From f1bbb9577a42cf7dc3079412f1dd7683e3a03665 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sat, 8 Nov 2008 00:51:41 +0000 Subject: [PATCH] Use ARMFunctionInfo to track number of constpool entries and jumptables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58877 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMConstantIslandPass.cpp | 7 ++----- lib/Target/ARM/ARMJITInfo.h | 8 +++++--- lib/Target/ARM/ARMMachineFunctionInfo.h | 24 +++++++++++++++++++++--- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index 5d1384763bd..16de61524df 100644 --- a/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -47,9 +47,6 @@ namespace { /// CPE - A constant pool entry that has been placed somewhere, which /// tracks a list of users. class VISIBILITY_HIDDEN ARMConstantIslands : public MachineFunctionPass { - /// NextUID - Assign unique ID's to CPE's. - unsigned NextUID; - /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed /// by MBB Number. The two-byte pads required for Thumb alignment are /// counted as part of the following block (i.e., the offset and size for @@ -237,7 +234,7 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) { } /// The next UID to take is the first unused one. - NextUID = CPEMIs.size(); + AFI->initConstPoolEntryUId(CPEMIs.size()); // Do the initial scan of the function, building up information about the // sizes of each block, the location of all the water, and finding all of the @@ -1019,7 +1016,7 @@ bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &Fn, // No existing clone of this CPE is within range. // We will be generating a new clone. Get a UID for it. - unsigned ID = NextUID++; + unsigned ID = AFI->createConstPoolEntryUId(); // Look for water where we can place this CPE. We look for the farthest one // away that will work. Forward references only for now (although later diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h index feb7eea6aab..3610a6e479f 100644 --- a/lib/Target/ARM/ARMJITInfo.h +++ b/lib/Target/ARM/ARMJITInfo.h @@ -14,10 +14,11 @@ #ifndef ARMJITINFO_H #define ARMJITINFO_H -#include "llvm/Target/TargetJITInfo.h" +#include "ARMMachineFunctionInfo.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" +#include "llvm/Target/TargetJITInfo.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" @@ -85,8 +86,9 @@ namespace llvm { /// Initialize - Initialize internal stage. Get the list of constant pool /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map. void Initialize(const MachineFunction &MF) { - ConstPoolId2AddrMap.resize(MF.getConstantPool()->getConstants().size()); - JumpTableId2AddrMap.resize(MF.getJumpTableInfo()->getJumpTables().size()); + const ARMFunctionInfo *AFI = MF.getInfo(); + ConstPoolId2AddrMap.resize(AFI->getNumConstPoolEntries()); + JumpTableId2AddrMap.resize(AFI->getNumJumpTables()); } /// getConstantPoolEntryAddr - The ARM target puts all constant diff --git a/lib/Target/ARM/ARMMachineFunctionInfo.h b/lib/Target/ARM/ARMMachineFunctionInfo.h index eeb61d76860..6662be12a57 100644 --- a/lib/Target/ARM/ARMMachineFunctionInfo.h +++ b/lib/Target/ARM/ARMMachineFunctionInfo.h @@ -87,6 +87,8 @@ class ARMFunctionInfo : public MachineFunctionInfo { /// unsigned JumpTableUId; + unsigned ConstPoolEntryUId; + public: ARMFunctionInfo() : isThumb(false), @@ -96,7 +98,7 @@ public: FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0), GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), GPRCS1Frames(0), GPRCS2Frames(0), DPRCSFrames(0), - JumpTableUId(0) {} + JumpTableUId(0), ConstPoolEntryUId(0) {} ARMFunctionInfo(MachineFunction &MF) : isThumb(MF.getTarget().getSubtarget().isThumb()), @@ -107,7 +109,7 @@ public: GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), GPRCS1Frames(32), GPRCS2Frames(32), DPRCSFrames(32), SpilledCSRegs(MF.getTarget().getRegisterInfo()->getNumRegs()), - JumpTableUId(0) {} + JumpTableUId(0), ConstPoolEntryUId(0) {} bool isThumbFunction() const { return isThumb; } @@ -203,7 +205,7 @@ public: SpilledCSRegs.set(Reg); } - bool isCSRegisterSpilled(unsigned Reg) { + bool isCSRegisterSpilled(unsigned Reg) const { return SpilledCSRegs[Reg]; } @@ -214,6 +216,22 @@ public: unsigned createJumpTableUId() { return JumpTableUId++; } + + unsigned getNumJumpTables() const { + return JumpTableUId; + } + + void initConstPoolEntryUId(unsigned UId) { + ConstPoolEntryUId = UId; + } + + unsigned getNumConstPoolEntries() const { + return ConstPoolEntryUId; + } + + unsigned createConstPoolEntryUId() { + return ConstPoolEntryUId++; + } }; } // End llvm namespace -- 2.34.1