[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectPattern.cpp InstSelectSimple.cpp X86.h X86JITInfo.h X86TargetMachine.cpp X86TargetMachine.h

Chris Lattner lattner at cs.uiuc.edu
Sun Dec 28 15:24:07 PST 2003


Changes in directory llvm/lib/Target/X86:

InstSelectPattern.cpp updated: 1.6 -> 1.7
InstSelectSimple.cpp updated: 1.147 -> 1.148
X86.h updated: 1.24 -> 1.25
X86JITInfo.h updated: 1.2 -> 1.3
X86TargetMachine.cpp updated: 1.43 -> 1.44
X86TargetMachine.h updated: 1.20 -> 1.21

---
Log message:

Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.



---
Diffs of the changes:  (+16 -31)

Index: llvm/lib/Target/X86/InstSelectPattern.cpp
diff -u llvm/lib/Target/X86/InstSelectPattern.cpp:1.6 llvm/lib/Target/X86/InstSelectPattern.cpp:1.7
--- llvm/lib/Target/X86/InstSelectPattern.cpp:1.6	Sun Dec 28 03:47:19 2003
+++ llvm/lib/Target/X86/InstSelectPattern.cpp	Sun Dec 28 15:23:38 2003
@@ -119,7 +119,6 @@
 /// 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: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.147 llvm/lib/Target/X86/InstSelectSimple.cpp:1.148
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.147	Sun Dec 28 03:53:23 2003
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Sun Dec 28 15:23:38 2003
@@ -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 @@
 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 @@
     // 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 @@
           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 @@
 /// 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: llvm/lib/Target/X86/X86.h
diff -u llvm/lib/Target/X86/X86.h:1.24 llvm/lib/Target/X86/X86.h:1.25
--- llvm/lib/Target/X86/X86.h:1.24	Sun Dec 28 03:47:19 2003
+++ llvm/lib/Target/X86/X86.h	Sun Dec 28 15:23:38 2003
@@ -27,15 +27,13 @@
 /// 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: llvm/lib/Target/X86/X86JITInfo.h
diff -u llvm/lib/Target/X86/X86JITInfo.h:1.2 llvm/lib/Target/X86/X86JITInfo.h:1.3
--- llvm/lib/Target/X86/X86JITInfo.h:1.2	Sun Dec 28 03:47:19 2003
+++ llvm/lib/Target/X86/X86JITInfo.h	Sun Dec 28 15:23:38 2003
@@ -22,9 +22,8 @@
 
   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 @@
     /// 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: llvm/lib/Target/X86/X86TargetMachine.cpp
diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.43 llvm/lib/Target/X86/X86TargetMachine.cpp:1.44
--- llvm/lib/Target/X86/X86TargetMachine.cpp:1.43	Sun Dec 28 03:47:19 2003
+++ llvm/lib/Target/X86/X86TargetMachine.cpp	Sun Dec 28 15:23:38 2003
@@ -45,15 +45,10 @@
 
 /// 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 @@
   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 @@
   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: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.20 llvm/lib/Target/X86/X86TargetMachine.h:1.21
--- llvm/lib/Target/X86/X86TargetMachine.h:1.20	Sun Dec 28 03:47:19 2003
+++ llvm/lib/Target/X86/X86TargetMachine.h	Sun Dec 28 15:23:38 2003
@@ -24,13 +24,11 @@
 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; }





More information about the llvm-commits mailing list