Targets should configure themselves based on a Module, not some wierd flags
authorChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 19:49:48 +0000 (19:49 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 19:49:48 +0000 (19:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8132 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9TargetMachine.cpp
lib/Target/X86/X86TargetMachine.cpp
lib/Target/X86/X86TargetMachine.h

index 83d156665f530328891bee2d8163e84ef2621159..e84a6eb2d9e985996fd1e71a1c76d8a5bc798254 100644 (file)
@@ -61,7 +61,7 @@ static cl::opt<bool> DumpInput("dump-input",
 // that implements the Sparc backend. (the llvm/CodeGen/Sparc.h interface)
 //----------------------------------------------------------------------------
 
-TargetMachine *allocateSparcTargetMachine(unsigned Configuration) {
+TargetMachine *allocateSparcTargetMachine(const Module &M) {
   return new UltraSparc();
 }
 
index 6a88390963c714fdd02727ecbd5b25238de5ead9..60f8bbca19b87b4021cd8bd82d69a787dc6861b3 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "X86TargetMachine.h"
 #include "X86.h"
+#include "llvm/Module.h"
 #include "llvm/PassManager.h"
 #include "llvm/Target/TargetMachineImpls.h"
 #include "llvm/CodeGen/MachineFunction.h"
@@ -13,7 +14,6 @@
 #include "llvm/Transforms/Scalar.h"
 #include "Support/CommandLine.h"
 #include "Support/Statistic.h"
-#include <iostream>
 
 namespace {
   cl::opt<bool> NoLocalRA("disable-local-ra",
@@ -27,21 +27,21 @@ namespace {
 // allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
 // that implements the X86 backend.
 //
-TargetMachine *allocateX86TargetMachine(unsigned Configuration) {
-  return new X86TargetMachine(Configuration);
+TargetMachine *allocateX86TargetMachine(const Module &M) {
+  return new X86TargetMachine(M);
 }
 
 
 /// X86TargetMachine ctor - Create an ILP32 architecture model
 ///
-X86TargetMachine::X86TargetMachine(unsigned Config)
+X86TargetMachine::X86TargetMachine(const Module &M)
   : TargetMachine("X86", 
-                 (Config & TM::EndianMask) == TM::LittleEndian,
-                 (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4,
-                 (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4,
-                 (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4,
-                  4, (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4),
-  FrameInfo(TargetFrameInfo::StackGrowsDown, 8/*16 for SSE*/, 4) {
+                 M.getEndianness() != Module::BigEndian,
+                  M.getPointerSize() != Module::Pointer64 ? 4 : 8,
+                  M.getPointerSize() != Module::Pointer64 ? 4 : 8,
+                  M.getPointerSize() != Module::Pointer64 ? 4 : 8,
+                  4, M.getPointerSize() != Module::Pointer64 ? 4 : 8),
+    FrameInfo(TargetFrameInfo::StackGrowsDown, 8/*16 for SSE*/, 4) {
 }
 
 
index 631b42ae86898cf24f75cf72b0e872b8e7d8799b..07c46089f2acbb28c0fddfe260dcdc21205b61b2 100644 (file)
@@ -16,7 +16,7 @@ class X86TargetMachine : public TargetMachine {
   X86InstrInfo InstrInfo;
   TargetFrameInfo FrameInfo;
 public:
-  X86TargetMachine(unsigned Configuration);
+  X86TargetMachine(const Module &M);
 
   virtual const X86InstrInfo     &getInstrInfo() const { return InstrInfo; }
   virtual const TargetFrameInfo  &getFrameInfo() const { return FrameInfo; }