[llvm-commits] [llvm] r53692 - in /llvm/trunk: include/llvm/Support/Compiler.h lib/Target/X86/X86JITInfo.cpp

Devang Patel dpatel at apple.com
Wed Jul 16 10:54:35 PDT 2008


Author: dpatel
Date: Wed Jul 16 12:54:34 2008
New Revision: 53692

URL: http://llvm.org/viewvc/llvm-project?rev=53692&view=rev
Log:
Mark function used by asm block as used, otherwise optimizer may not see the use and may delete the function.


Modified:
    llvm/trunk/include/llvm/Support/Compiler.h
    llvm/trunk/lib/Target/X86/X86JITInfo.cpp

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=53692&r1=53691&r2=53692&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Wed Jul 16 12:54:34 2008
@@ -23,6 +23,11 @@
 #define VISIBILITY_HIDDEN
 #endif
 
+#if (__GNUC__ >= 4)
+#define ATTRIBUTE_USED __attribute__((__used__))
+#else
+#define ATTRIBUTE_USED
+#endif
 
 // C++ doesn't support 'extern template' of template specializations.  GCC does,
 // but requires __extension__ before it.  In the header, use this:

Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=53692&r1=53691&r2=53692&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Wed Jul 16 12:54:34 2008
@@ -18,6 +18,7 @@
 #include "llvm/Function.h"
 #include "llvm/CodeGen/MachineCodeEmitter.h"
 #include "llvm/Config/alloca.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdlib>
 #include <cstring>
 using namespace llvm;
@@ -315,7 +316,8 @@
 /// function stub when we did not know the real target of a call.  This function
 /// must locate the start of the stub or call site and pass it into the JIT
 /// compiler function.
-extern "C" void X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
+extern "C" void ATTRIBUTE_USED
+X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
   intptr_t *RetAddrLoc = &StackPtr[1];
   assert(*RetAddrLoc == RetAddr &&
          "Could not find return address on the stack!");





More information about the llvm-commits mailing list