[llvm-commits] [llvm-gcc-4.2] r73553 - in /llvm-gcc-4.2/trunk/gcc: config/alpha/alpha.h config/arm/arm.h config/i386/i386.h config/ia64/ia64.h config/mips/llvm-mips-target.h config/rs6000/rs6000.h llvm-backend.cpp
Chris Lattner
sabre at nondot.org
Tue Jun 16 14:16:30 PDT 2009
Author: lattner
Date: Tue Jun 16 16:16:30 2009
New Revision: 73553
URL: http://llvm.org/viewvc/llvm-project?rev=73553&view=rev
Log:
Initialize the target and asm printer for the currently configured code generator
before using it. This is a step towards switching from "targets in .o files" to
"targets in .a files".
Modified:
llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h
llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
llvm-gcc-4.2/trunk/gcc/config/ia64/ia64.h
llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h
llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h Tue Jun 16 16:16:30 2009
@@ -1600,6 +1600,12 @@
*/
#define LLVM_TARGET_INTRINSIC_PREFIX "alpha"
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME Alpha
+
+
/* LLVM_TARGET_INTRINSIC_LOWER - To handle builtins, we want to expand the
* invocation into normal LLVM code. If the target can handle the builtin, this
* macro should call the target TreeToLLVM::TargetIntrinsicLower method and
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Tue Jun 16 16:16:30 2009
@@ -2962,6 +2962,12 @@
#ifdef ENABLE_LLVM
#define LLVM_TARGET_INTRINSIC_PREFIX "arm"
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME ARM
+
+
/* Turn -march=xx into a CPU type.
*/
#define LLVM_SET_SUBTARGET_FEATURES(F) \
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Tue Jun 16 16:16:30 2009
@@ -3863,11 +3863,16 @@
};
#ifdef ENABLE_LLVM
+
/* LLVM_TARGET_INTRINSIC_PREFIX - Specify what prefix this target uses for its
* intrinsics.
*/
#define LLVM_TARGET_INTRINSIC_PREFIX "x86"
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME X86
/* Turn -march=xx into a CPU type.
*/
Modified: llvm-gcc-4.2/trunk/gcc/config/ia64/ia64.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/ia64/ia64.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/ia64/ia64.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/ia64/ia64.h Tue Jun 16 16:16:30 2009
@@ -2009,6 +2009,12 @@
/* LLVM LOCAL begin */
#define TARGET_UNWIND_TABLES_DEFAULT true
+
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME IA64
+
/* LLVM LOCAL end */
#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 15 : INVALID_REGNUM)
Modified: llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/mips/llvm-mips-target.h Tue Jun 16 16:16:30 2009
@@ -27,6 +27,11 @@
#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY) \
llvm_mips_should_pass_aggregate_in_memory(X, TY)
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME Mips
+
#endif /* LLVM_ABI_H */
/* LLVM LOCAL end (ENTIRE FILE!) */
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Tue Jun 16 16:16:30 2009
@@ -3452,6 +3452,11 @@
#ifdef ENABLE_LLVM
#define LLVM_TARGET_INTRINSIC_PREFIX "ppc"
+/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
+ * the llvm::InitializeXXXTarget() function.
+ */
+#define LLVM_TARGET_NAME PowerPC
+
/* Turn -march=xx into a CPU type.
*/
#define LLVM_SET_SUBTARGET_FEATURES(F) \
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=73553&r1=73552&r2=73553&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Jun 16 16:16:30 2009
@@ -51,6 +51,7 @@
#include "llvm/Support/Streams.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Program.h"
+
#include <cassert>
#undef VISIBILITY_HIDDEN
extern "C" {
@@ -326,7 +327,28 @@
}
}
+#ifndef LLVM_TARGET_NAME
+#error LLVM_TARGET_NAME macro not specified by GCC backend
+#endif
+
+namespace llvm {
+#define Declare2(TARG, MOD) void Initialize ## TARG ## MOD()
+#define Declare(T, M) Declare2(T, M)
+ Declare(LLVM_TARGET_NAME, Target);
+ Declare(LLVM_TARGET_NAME, AsmPrinter);
+#undef Declare
+#undef Declare2
+}
+
void llvm_initialize_backend(void) {
+ // Initialize the LLVM backend.
+#define DoInit2(TARG, MOD) llvm::Initialize ## TARG ## MOD()
+#define DoInit(T, M) DoInit2(T, M)
+ DoInit(LLVM_TARGET_NAME, Target);
+ DoInit(LLVM_TARGET_NAME, AsmPrinter);
+#undef DoInit
+#undef DoInit2
+
// Initialize LLVM options.
std::vector<const char*> Args;
Args.push_back(progname); // program name
More information about the llvm-commits
mailing list