aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h10
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h49
-rw-r--r--include/llvm/Intrinsics.td13
-rw-r--r--include/llvm/Target/TargetLowering.h2
4 files changed, 70 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 22487dd..70c7185 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -356,6 +356,16 @@ public:
SDOperand getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
SDOperand SV);
+ /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
+ // 3 operands
+ SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr,
+ SDOperand A2, SDOperand A3, MVT::ValueType VT);
+
+ /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
+ // 2 operands
+ SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr,
+ SDOperand A2, MVT::ValueType VT);
+
/// getLoad - Loads are not normal binary operators: their result type is not
/// determined by their operands, and they produce a value AND a token chain.
///
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index c1a50bb..293bb73 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -441,7 +441,7 @@ namespace ISD {
// is added / subtracted from the base pointer to form the address (for
// indexed memory ops).
LOAD, STORE,
-
+
// DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
// to a specified boundary. This node always has two return values: a new
// stack pointer value and a chain. The first operand is the token chain,
@@ -591,12 +591,30 @@ namespace ISD {
// OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load,
// store-store, device)
- // This corresponds to the atomic.barrier intrinsic.
+ // This corresponds to the memory.barrier intrinsic.
// it takes an input chain, 4 operands to specify the type of barrier, an
// operand specifying if the barrier applies to device and uncached memory
// and produces an output chain.
MEMBARRIER,
+ // Val, OUTCHAIN = ATOMIC_LCS(INCHAIN, ptr, cmp, swap)
+ // this corresponds to the atomic.lcs intrinsic.
+ // cmp is compared to *ptr, and if equal, swap is stored in *ptr.
+ // the return is always the original value in *ptr
+ ATOMIC_LCS,
+
+ // Val, OUTCHAIN = ATOMIC_LAS(INCHAIN, ptr, amt)
+ // this corresponds to the atomic.las intrinsic.
+ // *ptr + amt is stored to *ptr atomically.
+ // the return is always the original value in *ptr
+ ATOMIC_LAS,
+
+ // Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt)
+ // this corresponds to the atomic.swap intrinsic.
+ // amt is stored to *ptr atomically.
+ // the return is always the original value in *ptr
+ ATOMIC_SWAP,
+
// BUILTIN_OP_END - This must be the last enum value in this list.
BUILTIN_OP_END
};
@@ -1170,6 +1188,33 @@ public:
SDOperand getValue() const { return Op; }
};
+class AtomicSDNode : public SDNode {
+ virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
+ SDOperand Ops[4];
+ MVT::ValueType OrigVT;
+public:
+ AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand X,
+ SDOperand Y, SDOperand Z, MVT::ValueType VT)
+ : SDNode(Opc, VTL) {
+ Ops[0] = Chain;
+ Ops[1] = X;
+ Ops[2] = Y;
+ Ops[3] = Z;
+ InitOperands(Ops, 4);
+ OrigVT=VT;
+ }
+ AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand X,
+ SDOperand Y, MVT::ValueType VT)
+ : SDNode(Opc, VTL) {
+ Ops[0] = Chain;
+ Ops[1] = X;
+ Ops[2] = Y;
+ InitOperands(Ops, 3);
+ OrigVT=VT;
+ }
+ MVT::ValueType getVT() const { return OrigVT; }
+};
+
class StringSDNode : public SDNode {
std::string Value;
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 64b3abf..c29bd40 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -64,7 +64,7 @@ class LLVMPointerType<LLVMType elty>
class LLVMMatchType<int num>
: LLVMType<OtherVT>{
int Number = num;
-}
+}
def llvm_void_ty : LLVMType<isVoid>;
def llvm_anyint_ty : LLVMType<iAny>;
@@ -267,6 +267,17 @@ def int_init_trampoline : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty,
def int_memory_barrier : Intrinsic<[llvm_void_ty, llvm_i1_ty, llvm_i1_ty,
llvm_i1_ty, llvm_i1_ty, llvm_i1_ty], []>;
+def int_atomic_lcs : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+ LLVMMatchType<0>, LLVMMatchType<0>],
+ [IntrWriteArgMem]>, GCCBuiltin<"__sync_val_compare_and_swap">;
+def int_atomic_las : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+ LLVMMatchType<0>],
+ [IntrWriteArgMem]>, GCCBuiltin<"__sync_fetch_and_add">;
+def int_atomic_swap : Intrinsic<[llvm_anyint_ty, LLVMPointerType<LLVMMatchType<0>>,
+ LLVMMatchType<0>],
+ [IntrWriteArgMem]>, GCCBuiltin<"__sync_lock_test_and_set">;
+
+
//===-------------------------- Other Intrinsics --------------------------===//
//
def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 0d03cda..4515b90 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -1252,7 +1252,7 @@ private:
/// TargetDAGCombineArray - Targets can specify ISD nodes that they would
/// like PerformDAGCombine callbacks for by calling setTargetDAGCombine(),
/// which sets a bit in this array.
- unsigned char TargetDAGCombineArray[156/(sizeof(unsigned char)*8)];
+ unsigned char TargetDAGCombineArray[160/(sizeof(unsigned char)*8)];
/// PromoteToType - For operations that must be promoted to a specific type,
/// this holds the destination type. This map should be sparse, so don't hold