[llvm-commits] [dragonegg] r92698 - in /dragonegg/trunk: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Mon Jan 4 23:01:18 PST 2010
Author: baldrick
Date: Tue Jan 5 01:01:18 2010
New Revision: 92698
URL: http://llvm.org/viewvc/llvm-project?rev=92698&view=rev
Log:
Port commit 91350 (grosbach) from llvm-gcc:
ARM Darwin doesn't require as strict a memory barrier
Modified:
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-internal.h
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=92698&r1=92697&r2=92698&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Jan 5 01:01:18 2010
@@ -4257,14 +4257,14 @@
/// builtin number.
static std::vector<Constant*> TargetBuiltinCache;
-void TreeToLLVM::EmitMemoryBarrier(bool ll, bool ls, bool sl, bool ss) {
+void TreeToLLVM::EmitMemoryBarrier(bool ll, bool ls, bool sl, bool ss,
+ bool device) {
Value* C[5];
C[0] = ConstantInt::get(Type::getInt1Ty(Context), ll);
C[1] = ConstantInt::get(Type::getInt1Ty(Context), ls);
C[2] = ConstantInt::get(Type::getInt1Ty(Context), sl);
C[3] = ConstantInt::get(Type::getInt1Ty(Context), ss);
- // Be conservatively safe.
- C[4] = ConstantInt::get(Type::getInt1Ty(Context), true);
+ C[4] = ConstantInt::get(Type::getInt1Ty(Context), device);
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::memory_barrier),
@@ -4288,7 +4288,11 @@
"cast");
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Value *Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, id,
Ty, 2),
@@ -4316,7 +4320,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Value *Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -4326,7 +4334,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
if (isBool)
Result = Builder.CreateIntCast(Builder.CreateICmpEQ(Result, C[1]),
@@ -4903,7 +4915,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -4913,7 +4929,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateAdd(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
@@ -4950,7 +4970,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -4960,7 +4984,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateSub(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
@@ -4997,7 +5025,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -5007,7 +5039,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateOr(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
@@ -5041,7 +5077,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -5051,7 +5091,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateAnd(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
@@ -5088,7 +5132,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -5098,7 +5146,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateXor(Result, C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
@@ -5135,7 +5187,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result =
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
@@ -5145,7 +5201,11 @@
// The gcc builtins are also full memory barriers.
// FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
- EmitMemoryBarrier(true, true, true, true);
+#if defined(TARGET_ARM) && defined(CONFIG_DARWIN_H)
+ EmitMemoryBarrier(true, true, true, true, false);
+#else
+ EmitMemoryBarrier(true, true, true, true, true);
+#endif
Result = Builder.CreateAnd(Builder.CreateNot(Result), C[1]);
Result = Builder.CreateIntToPtr(Result, ResultTy);
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=92698&r1=92697&r2=92698&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Tue Jan 5 01:01:18 2010
@@ -649,7 +649,7 @@
void EmitModifyOfRegisterVariable(tree_node *vardecl, Value *RHS);
// Helpers for Builtin Function Expansion.
- void EmitMemoryBarrier(bool ll, bool ls, bool sl, bool ss);
+ void EmitMemoryBarrier(bool ll, bool ls, bool sl, bool ss, bool device);
Value *BuildVector(const std::vector<Value*> &Elts);
Value *BuildVector(Value *Elt, ...);
Value *BuildVectorShuffle(Value *InVec1, Value *InVec2, ...);
More information about the llvm-commits
mailing list