[llvm-commits] [dragonegg] r135901 - in /dragonegg/trunk: include/darwin/dragonegg/OS.h include/freebsd/dragonegg/OS.h include/linux/dragonegg/OS.h include/openbsd/dragonegg/OS.h src/Backend.cpp

Duncan Sands baldrick at free.fr
Mon Jul 25 01:25:12 PDT 2011


Author: baldrick
Date: Mon Jul 25 03:25:11 2011
New Revision: 135901

URL: http://llvm.org/viewvc/llvm-project?rev=135901&view=rev
Log:
Port commit 135470 (evancheng) from llvm-gcc.  Original changelog entry:
Match createTargetMachine API change.

Modified:
    dragonegg/trunk/include/darwin/dragonegg/OS.h
    dragonegg/trunk/include/freebsd/dragonegg/OS.h
    dragonegg/trunk/include/linux/dragonegg/OS.h
    dragonegg/trunk/include/openbsd/dragonegg/OS.h
    dragonegg/trunk/src/Backend.cpp

Modified: dragonegg/trunk/include/darwin/dragonegg/OS.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/darwin/dragonegg/OS.h?rev=135901&r1=135900&r2=135901&view=diff
==============================================================================
--- dragonegg/trunk/include/darwin/dragonegg/OS.h (original)
+++ dragonegg/trunk/include/darwin/dragonegg/OS.h Mon Jul 25 03:25:11 2011
@@ -25,23 +25,23 @@
 
 /* Darwin X86-64 only supports PIC code generation. */
 #if defined (TARGET_386)
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if ((TARGET_64BIT) || flag_pic)                    \
-    argvec.push_back ("--relocation-model=pic");     \
-  else if (!MACHO_DYNAMIC_NO_PIC_P)                  \
-    argvec.push_back ("--relocation-model=static")
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if ((TARGET_64BIT) || flag_pic)		\
+    RelocModel = Reloc::PIC_;			\
+  else if (!MACHO_DYNAMIC_NO_PIC_P)		\
+    RelocModel = Reloc::Static;
 #elif defined (TARGET_ARM)
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if (flag_pic)                                      \
-    argvec.push_back ("--relocation-model=pic");     \
-  else if (!MACHO_DYNAMIC_NO_PIC_P)                  \
-    argvec.push_back ("--relocation-model=static");  \
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if (flag_pic)					\
+    RelocModel = Reloc::PIC_;			\
+  else if (!MACHO_DYNAMIC_NO_PIC_P)		\
+    RelocModel = Reloc::Static;			\
 #else /* !TARGET_386 && !TARGET_ARM */
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if (flag_pic)                                      \
-    argvec.push_back ("--relocation-model=pic");     \
-  else if (!MACHO_DYNAMIC_NO_PIC_P)                  \
-    argvec.push_back ("--relocation-model=static")
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if (flag_pic)					\
+    RelocModel = Reloc::PIC_;			\
+  else if (!MACHO_DYNAMIC_NO_PIC_P)		\
+    RelocModel = Reloc::Static;
 #endif /* !TARGET_386 && !TARGET_ARM */
 
 /* Give a constant string a sufficient alignment for the platform.  */

Modified: dragonegg/trunk/include/freebsd/dragonegg/OS.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/freebsd/dragonegg/OS.h?rev=135901&r1=135900&r2=135901&view=diff
==============================================================================
--- dragonegg/trunk/include/freebsd/dragonegg/OS.h (original)
+++ dragonegg/trunk/include/freebsd/dragonegg/OS.h Mon Jul 25 03:25:11 2011
@@ -24,10 +24,10 @@
 #define DRAGONEGG_OS_H
 
 /* Yes, we support PIC codegen for FreeBSD targets! */
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if (flag_pic)                                      \
-    argvec.push_back ("--relocation-model=pic");     \
-  else                                               \
-    argvec.push_back ("--relocation-model=static");
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if (flag_pic)					\
+    RelocModel = Reloc::PIC_;			\
+  else						\
+    RelocModel = Reloc::Static;
 
 #endif /* DRAGONEGG_OS_H */

Modified: dragonegg/trunk/include/linux/dragonegg/OS.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/linux/dragonegg/OS.h?rev=135901&r1=135900&r2=135901&view=diff
==============================================================================
--- dragonegg/trunk/include/linux/dragonegg/OS.h (original)
+++ dragonegg/trunk/include/linux/dragonegg/OS.h Mon Jul 25 03:25:11 2011
@@ -24,10 +24,10 @@
 #define DRAGONEGG_OS_H
 
 /* Yes, we support PIC codegen for linux targets! */
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if (flag_pic)                                      \
-    argvec.push_back ("--relocation-model=pic");     \
-  else                                               \
-    argvec.push_back ("--relocation-model=static");
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if (flag_pic)					\
+    RelocModel = Reloc::PIC_;			\
+  else						\
+    RelocModel = Reloc::Static;
 
 #endif /* DRAGONEGG_OS_H */

Modified: dragonegg/trunk/include/openbsd/dragonegg/OS.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/openbsd/dragonegg/OS.h?rev=135901&r1=135900&r2=135901&view=diff
==============================================================================
--- dragonegg/trunk/include/openbsd/dragonegg/OS.h (original)
+++ dragonegg/trunk/include/openbsd/dragonegg/OS.h Mon Jul 25 03:25:11 2011
@@ -24,10 +24,10 @@
 #define DRAGONEGG_OS_H
 
 /* Yes, we support PIC codegen for OpenBSD targets! */
-#define LLVM_SET_TARGET_OPTIONS(argvec)              \
-  if (flag_pic)                                      \
-    argvec.push_back ("--relocation-model=pic");     \
-  else                                               \
-    argvec.push_back ("--relocation-model=static");
+#define LLVM_SET_RELOC_MODEL(RelocModel)	\
+  if (flag_pic)					\
+    RelocModel = Reloc::PIC_;			\
+  else						\
+    RelocModel = Reloc::Static;
 
 #endif /* DRAGONEGG_OS_H */

Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=135901&r1=135900&r2=135901&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Mon Jul 25 03:25:11 2011
@@ -39,6 +39,7 @@
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/CodeGen/RegAllocRegistry.h"
+#include "llvm/MC/MCCodeGenInfo.h"
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PassManagerBuilder.h"
@@ -413,7 +414,15 @@
   LLVM_SET_SUBTARGET_FEATURES(CPU, Features);
   FeatureStr = Features.getString();
 #endif
-  TheTarget = TME->createTargetMachine(TargetTriple, CPU, FeatureStr);
+
+  // The target can set LLVM_SET_RELOC_MODEL to configure the relocation
+  // model used by the LLVM backend.
+  Reloc::Model RelocModel = Reloc::Default;
+#ifdef LLVM_SET_RELOC_MODEL
+  LLVM_SET_RELOC_MODEL(RelocModel);
+#endif
+  TheTarget = TME->createTargetMachine(TargetTriple, CPU, FeatureStr,
+                                       RelocModel);
   TheTarget->setMCUseCFI(flag_dwarf2_cfi_asm);
   assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
 }





More information about the llvm-commits mailing list