[llvm-commits] [dragonegg] r171632 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Convert.cpp test/validator/c/BuiltinAssumeAligned.c
Duncan Sands
baldrick at free.fr
Sat Jan 5 10:43:06 PST 2013
Author: baldrick
Date: Sat Jan 5 12:43:06 2013
New Revision: 171632
URL: http://llvm.org/viewvc/llvm-project?rev=171632&view=rev
Log:
Recognize and ignore builtin_assume_aligned.
Added:
dragonegg/trunk/test/validator/c/BuiltinAssumeAligned.c
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=171632&r1=171631&r2=171632&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Sat Jan 5 12:43:06 2013
@@ -629,6 +629,9 @@
bool EmitBuiltinAdjustTrampoline(gimple_statement_d *stmt, Value *&Result);
bool EmitBuiltinAlloca(gimple_statement_d *stmt, Value *&Result);
bool EmitBuiltinAllocaWithAlign(gimple_statement_d *stmt, Value *&Result);
+#if (GCC_MINOR > 6)
+ bool EmitBuiltinAssumeAligned(gimple_statement_d *stmt, Value *&Result);
+#endif
bool EmitBuiltinBZero(gimple_statement_d *stmt, Value *&Result);
bool EmitBuiltinConstantP(gimple_statement_d *stmt, Value *&Result);
bool EmitBuiltinExpect(gimple_statement_d *stmt, Value *&Result);
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=171632&r1=171631&r2=171632&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Sat Jan 5 12:43:06 2013
@@ -4288,6 +4288,10 @@
case BUILT_IN_ALLOCA_WITH_ALIGN:
return EmitBuiltinAllocaWithAlign(stmt, Result);
#endif
+#if (GCC_MINOR > 6)
+ case BUILT_IN_ASSUME_ALIGNED:
+ return EmitBuiltinAssumeAligned(stmt, Result);
+#endif
case BUILT_IN_BZERO: return EmitBuiltinBZero(stmt, Result);
case BUILT_IN_CONSTANT_P: return EmitBuiltinConstantP(stmt, Result);
case BUILT_IN_EXPECT: return EmitBuiltinExpect(stmt, Result);
@@ -5841,6 +5845,20 @@
return true;
}
+#if (GCC_MINOR > 6)
+bool TreeToLLVM::EmitBuiltinAssumeAligned(gimple stmt, Value *&Result) {
+ if (!validate_gimple_arglist(stmt, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
+ return false;
+ // Return the pointer argument. TODO: Pass the alignment information on to
+ // the optimizers.
+ Value *Ptr = EmitRegister(gimple_call_arg(stmt, 0));
+ // Bitcast it to the return type.
+ Ptr = TriviallyTypeConvert(Ptr, getRegType(gimple_call_return_type(stmt)));
+ Result = Reg2Mem(Ptr, gimple_call_return_type(stmt), Builder);
+ return true;
+}
+#endif
+
bool TreeToLLVM::EmitBuiltinExpect(gimple stmt, Value *&Result) {
tree type = gimple_call_return_type(stmt);
if (gimple_call_num_args(stmt) < 2) {
Added: dragonegg/trunk/test/validator/c/BuiltinAssumeAligned.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/BuiltinAssumeAligned.c?rev=171632&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/BuiltinAssumeAligned.c (added)
+++ dragonegg/trunk/test/validator/c/BuiltinAssumeAligned.c Sat Jan 5 12:43:06 2013
@@ -0,0 +1,6 @@
+// RUN: %dragonegg -S %s -o - | FileCheck %s
+// CHECK-NOT: assume_aligned
+// XFAIL: gcc-4.5, gcc-4.6
+int *foo(int *p) {
+ return __builtin_assume_aligned(p, 16);
+}
More information about the llvm-commits
mailing list