Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
authorChris Lattner <sabre@nondot.org>
Sun, 28 Dec 2003 21:23:38 +0000 (21:23 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 28 Dec 2003 21:23:38 +0000 (21:23 +0000)
implementation from the TargetMachine directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8

21 files changed:
include/llvm/CodeGen/InstrSelection.h
include/llvm/CodeGen/IntrinsicLowering.h
include/llvm/IntrinsicLowering.h
include/llvm/Target/TargetMachine.h
lib/CodeGen/InstrSelection/InstrSelection.cpp
lib/CodeGen/IntrinsicLowering.cpp
lib/ExecutionEngine/Interpreter/Execution.cpp
lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
lib/Target/SparcV9/SparcV9JITInfo.h
lib/Target/SparcV9/SparcV9TargetMachine.cpp
lib/Target/SparcV9/SparcV9TargetMachine.h
lib/Target/TargetMachine.cpp
lib/Target/X86/InstSelectPattern.cpp
lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86.h
lib/Target/X86/X86ISelPattern.cpp
lib/Target/X86/X86ISelSimple.cpp
lib/Target/X86/X86JITInfo.h
lib/Target/X86/X86TargetMachine.cpp
lib/Target/X86/X86TargetMachine.h
lib/VMCore/IntrinsicLowering.cpp

index 294bd8eb1f5e5aa10744c07990fe5378484c5085..5fa1ab1782c1b53fdaeee2044f766edca3fd48bd 100644 (file)
@@ -22,7 +22,6 @@ class Function;
 class FunctionPass;
 class InstrForest;
 class InstructionNode;
-class IntrinsicLowering;
 class MachineCodeForInstruction;
 class MachineInstr;
 class TargetMachine;
@@ -40,8 +39,6 @@ extern void   GetInstructionsByRule   (InstructionNode* subtreeRoot,
 extern bool    ThisIsAChainRule        (int eruleno);
 
 
-//************************ Exported Functions ******************************/
-
 
 //---------------------------------------------------------------------------
 // Function: createInstructionSelectionPass
@@ -51,11 +48,8 @@ extern bool  ThisIsAChainRule        (int eruleno);
 //   Return a pass that performs machine dependent instruction selection.
 //---------------------------------------------------------------------------
 
-FunctionPass *createInstructionSelectionPass(TargetMachine &Target,
-                                             IntrinsicLowering &IL);
-
+FunctionPass *createInstructionSelectionPass(TargetMachine &Target);
 
-//************************ Exported Data Types *****************************/
 
 
 //---------------------------------------------------------------------------
index 7f0cd81ca6e7ff715bc1ac01f3d13e90ac01feb5..19ccb61b47d38fb5d11535eb786e22699388cb1e 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef LLVM_INTRINSICLOWERING_H
 #define LLVM_INTRINSICLOWERING_H
 
+#include "llvm/Intrinsics.h"
+
 namespace llvm {
   class CallInst;
   
index 7f0cd81ca6e7ff715bc1ac01f3d13e90ac01feb5..19ccb61b47d38fb5d11535eb786e22699388cb1e 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef LLVM_INTRINSICLOWERING_H
 #define LLVM_INTRINSICLOWERING_H
 
+#include "llvm/Intrinsics.h"
+
 namespace llvm {
   class CallInst;
   
index e326a2b68f512d823278a6c94efcd1763ecae77e..a653d6a47f2ca5b6578ade102239ef409dea47f9 100644 (file)
@@ -31,6 +31,7 @@ class MRegisterInfo;
 class FunctionPassManager;
 class PassManager;
 class Pass;
+class IntrinsicLowering;
 
 //===----------------------------------------------------------------------===//
 ///
@@ -40,24 +41,27 @@ class Pass;
 /// 
 class TargetMachine {
   const std::string Name;
-  const TargetData DataLayout;          // Calculates type size & alignment
+  const TargetData DataLayout;       // Calculates type size & alignment
+  IntrinsicLowering *IL;             // Specifies how to lower intrinsic calls
   
   TargetMachine(const TargetMachine&);   // DO NOT IMPLEMENT
   void operator=(const TargetMachine&);  // DO NOT IMPLEMENT
-protected:
-  TargetMachine(const std::string &name, // Can only create subclasses...
+protected: // Can only create subclasses...
+  TargetMachine(const std::string &name, IntrinsicLowering *IL,                
                bool LittleEndian = false,
                unsigned char PtrSize = 8, unsigned char PtrAl = 8,
                unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
                unsigned char LongAl = 8, unsigned char IntAl = 4,
-               unsigned char ShortAl = 2, unsigned char ByteAl = 1)
-    : Name(name), DataLayout(name, LittleEndian,
-                            PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
-                             IntAl, ShortAl, ByteAl) {}
+               unsigned char ShortAl = 2, unsigned char ByteAl = 1);
 public:
-  virtual ~TargetMachine() {}
+  virtual ~TargetMachine();
 
   const std::string &getName() const { return Name; }
+
+  // getIntrinsicLowering - This method returns a reference to an
+  // IntrinsicLowering instance which should be used by the code generator to
+  // lower unknown intrinsic functions to the equivalent LLVM expansion.
+  IntrinsicLowering &getIntrinsicLowering() const { return *IL; }
   
   // Interfaces to the major aspects of target machine information:
   // -- Instruction opcode and operand information
index f1fcc8fdc87a1b86233edf3392c041f7079dee1f..5d9d0a355b10fbd3eb281fc26b38c68c383380e5 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "llvm/CodeGen/InstrSelection.h"
 #include "llvm/Function.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
@@ -68,7 +67,6 @@ namespace {
   //
   class InstructionSelection : public FunctionPass {
     TargetMachine &Target;
-    IntrinsicLowering &IL;
     void InsertCodeForPhis(Function &F);
     void InsertPhiElimInstructions(BasicBlock *BB,
                                    const std::vector<MachineInstr*>& CpVec);
@@ -76,8 +74,7 @@ namespace {
     void PostprocessMachineCodeForTree(InstructionNode* instrNode,
                                        int ruleForNode, short* nts);
   public:
-    InstructionSelection(TargetMachine &TM, IntrinsicLowering &il)
-      : Target(TM), IL(il) {}
+    InstructionSelection(TargetMachine &TM) : Target(TM) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesCFG();
@@ -145,7 +142,7 @@ bool InstructionSelection::runOnFunction(Function &F) {
           default:
             // All other intrinsic calls we must lower.
             Instruction *Before = CI->getPrev();
-            IL.LowerIntrinsicCall(CI);
+            Target.getIntrinsicLowering().LowerIntrinsicCall(CI);
             if (Before) {        // Move iterator to instruction after call
               I = Before;  ++I;
             } else {
@@ -415,7 +412,6 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode,
 // createInstructionSelectionPass - Public entrypoint for instruction selection
 // and this file as a whole...
 //
-FunctionPass *llvm::createInstructionSelectionPass(TargetMachine &T,
-                                                   IntrinsicLowering &IL) {
-  return new InstructionSelection(T, IL);
+FunctionPass *llvm::createInstructionSelectionPass(TargetMachine &TM) {
+  return new InstructionSelection(TM);
 }
index 31a904351d2f71baef1b75ff7def649abcb9fc98..4815be9f28010f32625d67a92099690f844c4aa8 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/Constant.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/Module.h"
 #include "llvm/Type.h"
 #include "llvm/iOther.h"
index bec4b7b9056b8bb3afaf8ee436b826ad92523bb5..eec647a18498c49d90f07e152d7c050f94f73beb 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
 #include "llvm/IntrinsicLowering.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "Support/Statistic.h"
 #include "Support/Debug.h"
index f1fcc8fdc87a1b86233edf3392c041f7079dee1f..5d9d0a355b10fbd3eb281fc26b38c68c383380e5 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "llvm/CodeGen/InstrSelection.h"
 #include "llvm/Function.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
@@ -68,7 +67,6 @@ namespace {
   //
   class InstructionSelection : public FunctionPass {
     TargetMachine &Target;
-    IntrinsicLowering &IL;
     void InsertCodeForPhis(Function &F);
     void InsertPhiElimInstructions(BasicBlock *BB,
                                    const std::vector<MachineInstr*>& CpVec);
@@ -76,8 +74,7 @@ namespace {
     void PostprocessMachineCodeForTree(InstructionNode* instrNode,
                                        int ruleForNode, short* nts);
   public:
-    InstructionSelection(TargetMachine &TM, IntrinsicLowering &il)
-      : Target(TM), IL(il) {}
+    InstructionSelection(TargetMachine &TM) : Target(TM) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesCFG();
@@ -145,7 +142,7 @@ bool InstructionSelection::runOnFunction(Function &F) {
           default:
             // All other intrinsic calls we must lower.
             Instruction *Before = CI->getPrev();
-            IL.LowerIntrinsicCall(CI);
+            Target.getIntrinsicLowering().LowerIntrinsicCall(CI);
             if (Before) {        // Move iterator to instruction after call
               I = Before;  ++I;
             } else {
@@ -415,7 +412,6 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode,
 // createInstructionSelectionPass - Public entrypoint for instruction selection
 // and this file as a whole...
 //
-FunctionPass *llvm::createInstructionSelectionPass(TargetMachine &T,
-                                                   IntrinsicLowering &IL) {
-  return new InstructionSelection(T, IL);
+FunctionPass *llvm::createInstructionSelectionPass(TargetMachine &TM) {
+  return new InstructionSelection(TM);
 }
index d1000fe8da937e1fe211c6ce0904ecba9f583ea9..b667c5599e4ec7d2a1d17fa756030daa3b8a578a 100644 (file)
 
 namespace llvm {
   class TargetMachine;
-  class IntrinsicLowering;
 
   class SparcJITInfo : public TargetJITInfo {
     TargetMachine &TM;
-    IntrinsicLowering &IL;
   public:
-    SparcJITInfo(TargetMachine &tm, IntrinsicLowering &il) : TM(tm), IL(il) {}
+    SparcJITInfo(TargetMachine &tm) : TM(tm) {}
 
     /// addPassesToJITCompile - Add passes to the specified pass manager to
     /// implement a fast dynamic compiler for this target.  Return true if this
index f5ac9a5babb613fc0975e3819242b5c75246789c..03de7397c3a4e0f99de3ada55357222726a047f0 100644 (file)
@@ -116,17 +116,12 @@ FunctionPass *llvm::createSparcMachineCodeDestructionPass() {
 
 
 SparcTargetMachine::SparcTargetMachine(IntrinsicLowering *il)
-  : TargetMachine("UltraSparc-Native", false),
-    IL(il ? il : new DefaultIntrinsicLowering()),
+  : TargetMachine("UltraSparc-Native", il, false),
     schedInfo(*this),
     regInfo(*this),
     frameInfo(*this),
     cacheInfo(*this),
-    jitInfo(*this, *IL) {
-}
-
-SparcTargetMachine::~SparcTargetMachine() {
-  delete IL;
+    jitInfo(*this) {
 }
 
 // addPassesToEmitAssembly - This method controls the entire code generation
@@ -171,7 +166,7 @@ SparcTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
     PM.add(new PrintFunctionPass("Input code to instr. selection:\n",
                                  &std::cerr));
 
-  PM.add(createInstructionSelectionPass(*this, *IL));
+  PM.add(createInstructionSelectionPass(*this));
 
   if (!DisableSched)
     PM.add(createInstructionSchedulingWithSSAPass(*this));
@@ -238,7 +233,7 @@ void SparcJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
   //PM.add(createLICMPass());
   //PM.add(createGCSEPass());
 
-  PM.add(createInstructionSelectionPass(TM, IL));
+  PM.add(createInstructionSelectionPass(TM));
 
   PM.add(getRegisterAllocator(TM));
   PM.add(createPrologEpilogInsertionPass());
index 4ebd3dc16983fdf45dcae72038891cbfbbc09712..be50174de72d9671aaecf0cf1a0af7f2279b948d 100644 (file)
 
 namespace llvm {
   class PassManager;
-  class IntrinsicLowering;
 
 class SparcTargetMachine : public TargetMachine {
-  IntrinsicLowering *IL;
   SparcInstrInfo instrInfo;
   SparcSchedInfo schedInfo;
   SparcRegInfo   regInfo;
@@ -36,7 +34,6 @@ class SparcTargetMachine : public TargetMachine {
   SparcJITInfo   jitInfo;
 public:
   SparcTargetMachine(IntrinsicLowering *IL);
-  ~SparcTargetMachine();
   
   virtual const TargetInstrInfo  &getInstrInfo() const { return instrInfo; }
   virtual const TargetSchedInfo  &getSchedInfo() const { return schedInfo; }
index e7630b4ab34660320601ba92ad2a373c8f397730..51c1222ab68e69eb6a60af1339f6d130e088f190 100644 (file)
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetCacheInfo.h"
 #include "llvm/Type.h"
-
-namespace llvm {
+#include "llvm/IntrinsicLowering.h"
+using namespace llvm;
 
 //---------------------------------------------------------------------------
-// class TargetMachine
-// 
-// Purpose:
-//   Machine description.
-// 
-//---------------------------------------------------------------------------
+// TargetMachine Class
+//
+TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
+                             bool LittleEndian,
+                             unsigned char PtrSize, unsigned char PtrAl,
+                             unsigned char DoubleAl, unsigned char FloatAl,
+                             unsigned char LongAl, unsigned char IntAl,
+                             unsigned char ShortAl, unsigned char ByteAl)
+  : Name(name), DataLayout(name, LittleEndian,
+                           PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
+                           IntAl, ShortAl, ByteAl) {
+  IL = il ? il : new DefaultIntrinsicLowering();
+}
+
+
+
+TargetMachine::~TargetMachine() {
+  delete IL;
+}
+
+
 
 
-// function TargetMachine::findOptimalStorageSize 
-// 
 unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
   // All integer types smaller than ints promote to 4 byte integers.
   if (Ty->isIntegral() && Ty->getPrimitiveSize() < 4)
@@ -39,11 +52,8 @@ unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
 
 
 //---------------------------------------------------------------------------
-// class TargetCacheInfo 
-// 
-// Purpose:
-//   Describes properties of the target cache architecture.
-//---------------------------------------------------------------------------
+// TargetCacheInfo Class
+//
 
 void TargetCacheInfo::Initialize() {
   numLevels = 2;
@@ -51,5 +61,3 @@ void TargetCacheInfo::Initialize() {
   cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
   cacheAssoc.push_back(1);       cacheAssoc.push_back(4);
 }
-
-} // End llvm namespace
index a09d104d418b1ffa3e0ecc494914ef215abb1508..6b848b00ea2f8f558d8e371b2910fb43b3620fd0 100644 (file)
@@ -119,7 +119,6 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) {
 /// into a machine code representation using pattern matching and a machine
 /// description file.
 ///
-FunctionPass *llvm::createX86PatternInstructionSelector(TargetMachine &TM,
-                                                        IntrinsicLowering &IL) {
+FunctionPass *llvm::createX86PatternInstructionSelector(TargetMachine &TM) {
   return new ISel(TM);  
 }
index 1029fc669b9abf577d65b5ee7415bdf9da6cf6c7..0cd24813e95cd80b851c0cc85a3b52f46c473cbf 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/Pass.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
@@ -59,7 +58,6 @@ inline static MachineInstrBuilder BMI(MachineBasicBlock *MBB,
 namespace {
   struct ISel : public FunctionPass, InstVisitor<ISel> {
     TargetMachine &TM;
-    IntrinsicLowering &IL;
     MachineFunction *F;                 // The function we are compiling into
     MachineBasicBlock *BB;              // The current MBB we are compiling
     int VarArgsFrameIndex;              // FrameIndex for start of varargs area
@@ -69,8 +67,7 @@ namespace {
     // MBBMap - Mapping between LLVM BB -> Machine BB
     std::map<const BasicBlock*, MachineBasicBlock*> MBBMap;
 
-    ISel(TargetMachine &tm, IntrinsicLowering &il)
-      : TM(tm), IL(il), F(0), BB(0) {}
+    ISel(TargetMachine &tm) : TM(tm), F(0), BB(0) {}
 
     /// runOnFunction - Top level implementation of instruction selection for
     /// the entire function.
@@ -1116,7 +1113,7 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
           default:
             // All other intrinsic calls we must lower.
             Instruction *Before = CI->getPrev();
-            IL.LowerIntrinsicCall(CI);
+            TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
             if (Before) {        // Move iterator to instruction after call
               I = Before;  ++I;
             } else {
@@ -2196,7 +2193,6 @@ void ISel::visitFreeInst(FreeInst &I) {
 /// into a machine code representation is a very simple peep-hole fashion.  The
 /// generated code sucks but the implementation is nice and simple.
 ///
-FunctionPass *llvm::createX86SimpleInstructionSelector(TargetMachine &TM,
-                                                       IntrinsicLowering &IL) {
-  return new ISel(TM, IL);
+FunctionPass *llvm::createX86SimpleInstructionSelector(TargetMachine &TM) {
+  return new ISel(TM);
 }
index 65c13bf001f4043f207dc8c74a0ddebcdc68617c..54e2861a5f6e8d173029b5671d748f8bb7ba22c5 100644 (file)
@@ -27,15 +27,13 @@ class IntrinsicLowering;
 /// into a machine code representation in a very simple peep-hole fashion.  The
 /// generated code sucks but the implementation is nice and simple.
 ///
-FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM,
-                                                 IntrinsicLowering &IL);
+FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM);
 
 /// createX86PatternInstructionSelector - This pass converts an LLVM function
 /// into a machine code representation using pattern matching and a machine
 /// description file.
 ///
-FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM,
-                                                  IntrinsicLowering &IL);
+FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM);
 
 /// createX86SSAPeepholeOptimizerPass - Create a pass to perform SSA-based X86
 /// specific peephole optimizations.
index a09d104d418b1ffa3e0ecc494914ef215abb1508..6b848b00ea2f8f558d8e371b2910fb43b3620fd0 100644 (file)
@@ -119,7 +119,6 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) {
 /// into a machine code representation using pattern matching and a machine
 /// description file.
 ///
-FunctionPass *llvm::createX86PatternInstructionSelector(TargetMachine &TM,
-                                                        IntrinsicLowering &IL) {
+FunctionPass *llvm::createX86PatternInstructionSelector(TargetMachine &TM) {
   return new ISel(TM);  
 }
index 1029fc669b9abf577d65b5ee7415bdf9da6cf6c7..0cd24813e95cd80b851c0cc85a3b52f46c473cbf 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/Pass.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
@@ -59,7 +58,6 @@ inline static MachineInstrBuilder BMI(MachineBasicBlock *MBB,
 namespace {
   struct ISel : public FunctionPass, InstVisitor<ISel> {
     TargetMachine &TM;
-    IntrinsicLowering &IL;
     MachineFunction *F;                 // The function we are compiling into
     MachineBasicBlock *BB;              // The current MBB we are compiling
     int VarArgsFrameIndex;              // FrameIndex for start of varargs area
@@ -69,8 +67,7 @@ namespace {
     // MBBMap - Mapping between LLVM BB -> Machine BB
     std::map<const BasicBlock*, MachineBasicBlock*> MBBMap;
 
-    ISel(TargetMachine &tm, IntrinsicLowering &il)
-      : TM(tm), IL(il), F(0), BB(0) {}
+    ISel(TargetMachine &tm) : TM(tm), F(0), BB(0) {}
 
     /// runOnFunction - Top level implementation of instruction selection for
     /// the entire function.
@@ -1116,7 +1113,7 @@ void ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
           default:
             // All other intrinsic calls we must lower.
             Instruction *Before = CI->getPrev();
-            IL.LowerIntrinsicCall(CI);
+            TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
             if (Before) {        // Move iterator to instruction after call
               I = Before;  ++I;
             } else {
@@ -2196,7 +2193,6 @@ void ISel::visitFreeInst(FreeInst &I) {
 /// into a machine code representation is a very simple peep-hole fashion.  The
 /// generated code sucks but the implementation is nice and simple.
 ///
-FunctionPass *llvm::createX86SimpleInstructionSelector(TargetMachine &TM,
-                                                       IntrinsicLowering &IL) {
-  return new ISel(TM, IL);
+FunctionPass *llvm::createX86SimpleInstructionSelector(TargetMachine &TM) {
+  return new ISel(TM);
 }
index 0ebb4c5208e26b7abb2005f643ec05706abac6f3..75efb19a521e569fbe513fd4058cd24062871436 100644 (file)
@@ -22,9 +22,8 @@ namespace llvm {
 
   class X86JITInfo : public TargetJITInfo {
     TargetMachine &TM;
-    IntrinsicLowering &IL;
   public:
-    X86JITInfo(TargetMachine &tm, IntrinsicLowering &il) : TM(tm), IL(il) {}
+    X86JITInfo(TargetMachine &tm) : TM(tm) {}
 
     /// addPassesToJITCompile - Add passes to the specified pass manager to
     /// implement a fast dynamic compiler for this target.  Return true if this
@@ -37,7 +36,7 @@ namespace llvm {
     /// overwriting OLD with a branch to NEW.  This is used for self-modifying
     /// code.
     ///
-    virtual void replaceMachineCodeForFunction (void *Old, void *New);
+    virtual void replaceMachineCodeForFunction(void *Old, void *New);
     
     /// getJITStubForFunction - Create or return a stub for the specified
     /// function.  This stub acts just like the specified function, except that
index e4d1ecb9b14e8bd3b4952eb211e6369b99ea7826..879ad5031176a2d1f39bbb64b37efb02bacea06b 100644 (file)
@@ -45,15 +45,10 @@ TargetMachine *llvm::allocateX86TargetMachine(const Module &M,
 
 /// X86TargetMachine ctor - Create an ILP32 architecture model
 ///
-X86TargetMachine::X86TargetMachine(const Module &M, IntrinsicLowering *il)
-  : TargetMachine("X86", true, 4, 4, 4, 4, 4),
-    IL(il ? il : new DefaultIntrinsicLowering()),
+X86TargetMachine::X86TargetMachine(const Module &M, IntrinsicLowering *IL)
+  : TargetMachine("X86", IL, true, 4, 4, 4, 4, 4),
     FrameInfo(TargetFrameInfo::StackGrowsDown, 8/*16 for SSE*/, 4),
-    JITInfo(*this, *IL) {
-}
-
-X86TargetMachine::~X86TargetMachine() {
-  delete IL;
+    JITInfo(*this) {
 }
 
 
@@ -72,9 +67,9 @@ bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM,
   PM.add(createCFGSimplificationPass());
 
   if (NoPatternISel)
-    PM.add(createX86SimpleInstructionSelector(*this, *IL));
+    PM.add(createX86SimpleInstructionSelector(*this));
   else
-    PM.add(createX86PatternInstructionSelector(*this, *IL));
+    PM.add(createX86PatternInstructionSelector(*this));
 
   // Run optional SSA-based machine code optimizations next...
   if (!NoSSAPeephole)
@@ -127,9 +122,9 @@ void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
   PM.add(createCFGSimplificationPass());
 
   if (NoPatternISel)
-    PM.add(createX86SimpleInstructionSelector(TM, IL));
+    PM.add(createX86SimpleInstructionSelector(TM));
   else
-    PM.add(createX86PatternInstructionSelector(TM, IL));
+    PM.add(createX86PatternInstructionSelector(TM));
 
   // Run optional SSA-based machine code optimizations next...
   if (!NoSSAPeephole)
index 6cd8ac1ab3debd18e10ca686e7cac961446bb3c4..be8d8879a122409f496304111ede7414d61f4c9c 100644 (file)
@@ -24,13 +24,11 @@ namespace llvm {
 class IntrinsicLowering;
 
 class X86TargetMachine : public TargetMachine {
-  IntrinsicLowering *IL;
   X86InstrInfo    InstrInfo;
   TargetFrameInfo FrameInfo;
   X86JITInfo      JITInfo;
 public:
   X86TargetMachine(const Module &M, IntrinsicLowering *IL);
-  ~X86TargetMachine();
 
   virtual const X86InstrInfo     &getInstrInfo() const { return InstrInfo; }
   virtual const TargetFrameInfo  &getFrameInfo() const { return FrameInfo; }
index 31a904351d2f71baef1b75ff7def649abcb9fc98..4815be9f28010f32625d67a92099690f844c4aa8 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "llvm/IntrinsicLowering.h"
 #include "llvm/Constant.h"
-#include "llvm/Intrinsics.h"
 #include "llvm/Module.h"
 #include "llvm/Type.h"
 #include "llvm/iOther.h"