[llvm-commits] [llvm] r56300 - /llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Thu Sep 18 00:27:23 PDT 2008


Author: evancheng
Date: Thu Sep 18 02:27:23 2008
New Revision: 56300

URL: http://llvm.org/viewvc/llvm-project?rev=56300&view=rev
Log:
Clean up.

Modified:
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=56300&r1=56299&r2=56300&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Thu Sep 18 02:27:23 2008
@@ -44,7 +44,7 @@
 namespace {
   struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter {
     ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
-      : AsmPrinter(O, TM, T), DW(O, this, T), MMI(NULL), AFI(NULL), 
+      : AsmPrinter(O, TM, T), DW(O, this, T), MMI(NULL), AFI(NULL), MCP(NULL),
         InCPMode(false) {
       Subtarget = &TM.getSubtarget<ARMSubtarget>();
     }
@@ -57,9 +57,13 @@
     const ARMSubtarget *Subtarget;
 
     /// AFI - Keep a pointer to ARMFunctionInfo for the current
-    /// MachineFunction
+    /// MachineFunction.
     ARMFunctionInfo *AFI;
 
+    /// MCP - Keep a pointer to constantpool entries of the current
+    /// MachineFunction.
+    const MachineConstantPool *MCP;
+
     /// We name each basic block in a Function with a unique number, so
     /// that we can consistently refer to them later. This is cleared
     /// at the beginning of each call to runOnMachineFunction().
@@ -185,6 +189,7 @@
 ///
 bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   AFI = MF.getInfo<ARMFunctionInfo>();
+  MCP = MF.getConstantPool();
 
   SetupMachineFunction(MF);
   O << "\n";
@@ -670,8 +675,7 @@
     assert(!strcmp(Modifier, "cpentry") && "Unknown modifier for CPE");
     unsigned CPI = MI->getOperand(OpNo).getIndex();
 
-    const MachineConstantPoolEntry &MCPE =  // Chasing pointers is fun?
-      MI->getParent()->getParent()->getConstantPool()->getConstants()[CPI];
+    const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPI];
     
     if (MCPE.isMachineConstantPoolEntry()) {
       EmitMachineConstantPoolValue(MCPE.Val.MachineCPVal);





More information about the llvm-commits mailing list