[llvm-commits] [llvm] r58896 - in /llvm/trunk/lib/Target/ARM: ARMCodeEmitter.cpp ARMJITInfo.h ARMTargetMachine.cpp

Evan Cheng evan.cheng at apple.com
Fri Nov 7 23:38:22 PST 2008


Author: evancheng
Date: Sat Nov  8 01:38:22 2008
New Revision: 58896

URL: http://llvm.org/viewvc/llvm-project?rev=58896&view=rev
Log:
Tell ARMJITInfo if codegen relocation is PIC. It changes how function stubs are generated.

Modified:
    llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
    llvm/trunk/lib/Target/ARM/ARMJITInfo.h
    llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=58896&r1=58895&r2=58896&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Sat Nov  8 01:38:22 2008
@@ -167,7 +167,7 @@
   MCPEs = &MF.getConstantPool()->getConstants();
   MJTEs = &MF.getJumpTableInfo()->getJumpTables();
   IsPIC = TM.getRelocationModel() == Reloc::PIC_;
-  JTI->Initialize(MF);
+  JTI->Initialize(MF, IsPIC);
 
   do {
     DOUT << "JITTing function '" << MF.getFunction()->getName() << "'\n";

Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58896&r1=58895&r2=58896&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Sat Nov  8 01:38:22 2008
@@ -26,8 +26,6 @@
   class ARMTargetMachine;
 
   class ARMJITInfo : public TargetJITInfo {
-    ARMTargetMachine &TM;
-
     // ConstPoolId2AddrMap - A map from constant pool ids to the corresponding
     // CONSTPOOL_ENTRY addresses.
     SmallVector<intptr_t, 16> ConstPoolId2AddrMap;
@@ -39,8 +37,12 @@
     // PCLabelMap - A map from PC labels to addresses.
     DenseMap<unsigned, intptr_t> PCLabelMap;
 
+    // IsPIC - True if the relocation model is PIC. This is used to determine
+    // how to codegen function stubs.
+    bool IsPIC;
+
   public:
-    explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) { useGOT = false; }
+    explicit ARMJITInfo() : IsPIC(false) { useGOT = false; }
 
     /// replaceMachineCodeForFunction - Make it so that calling the function
     /// whose machine code is at OLD turns into a call to NEW, perhaps by
@@ -89,12 +91,15 @@
 #endif
     }
 
-    /// Initialize - Initialize internal stage. Get the list of constant pool
-    /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map.
-    void Initialize(const MachineFunction &MF) {
+    /// Initialize - Initialize internal stage for the function being JITted.
+    /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map; resize
+    /// jump table ids to jump table bases map; remember if codegen relocation
+    /// model is PIC.
+    void Initialize(const MachineFunction &MF, bool isPIC) {
       const ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
       ConstPoolId2AddrMap.resize(AFI->getNumConstPoolEntries());
       JumpTableId2AddrMap.resize(AFI->getNumJumpTables());
+      IsPIC = isPIC;
     }
 
     /// getConstantPoolEntryAddr - The ARM target puts all constant

Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=58896&r1=58895&r2=58896&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Sat Nov  8 01:38:22 2008
@@ -84,7 +84,7 @@
            std::string("e-p:32:32-f64:64:64-i64:64:64"))),
     InstrInfo(Subtarget),
     FrameInfo(Subtarget),
-    JITInfo(*this),
+    JITInfo(),
     TLInfo(*this) {
   DefRelocModel = getRelocationModel();
 }





More information about the llvm-commits mailing list