Hello,
This is the first of the memory synchronization and atomic operations
patches. Here we provide the memory.barrier intrinsic and a conservative
implementation in the CBE.
-Chandler
Index: include/llvm/Intrinsics.td
===================================================================
--- include/llvm/Intrinsics.td (revision 40873)
+++ include/llvm/Intrinsics.td (working copy)
@@ -244,6 +244,11 @@
def int_adjust_trampoline : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty], [IntrNoMem]>,
GCCBuiltin<"__builtin_adjust_trampoline">;
+//===------- Atomic Operation and Memory Synchronization Intrinsics
-------===//
+//
+def int_memory_barrier : Intrinsic<[llvm_void_ty, llvm_i1_ty, llvm_i1_ty,
+ llvm_i1_ty, llvm_i1_ty]>;
+
//===----------------------------------------------------------------------===//
// Target-specific intrinsics
//===----------------------------------------------------------------------===//
Index: lib/CodeGen/IntrinsicLowering.cpp
===================================================================
--- lib/CodeGen/IntrinsicLowering.cpp (revision 40873)
+++ lib/CodeGen/IntrinsicLowering.cpp (working copy)
@@ -791,6 +791,10 @@
Type::DoubleTy, sqrtFCache);
break;
}
+
+ case Intrinsic::memory_barrier:
+ break; // Strip this from unsupported targets.
+
}
assert(CI->use_empty() &&
Index: lib/Target/CBackend/CBackend.cpp
===================================================================
--- lib/Target/CBackend/CBackend.cpp (revision 40873)
+++ lib/Target/CBackend/CBackend.cpp (working copy)
@@ -2407,6 +2407,7 @@
case Intrinsic::dbg_stoppoint:
case Intrinsic::powi_f32:
case Intrinsic::powi_f64:
+ case Intrinsic::memory_barrier:
// We directly implement these intrinsics
break;
default:
@@ -2554,6 +2555,9 @@
writeOperand(I.getOperand(3));
Out << ")";
return;
+ case Intrinsic::memory_barrier:
+ Out << "__sync_synchronize()";
+ return;
case Intrinsic::dbg_stoppoint: {
// If we use writeOperand directly we get a "u" suffix which is
rejected
// by gcc.
_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits