aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-11-08 00:51:41 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-11-08 00:51:41 +0000
commitf1bbb9577a42cf7dc3079412f1dd7683e3a03665 (patch)
tree8844f2df461f927b4e30cadafd83537a0029e2a6
parent3dd42cfe125d3ebc9e3551204bc3b89f06b2a3f3 (diff)
downloadexternal_llvm-f1bbb9577a42cf7dc3079412f1dd7683e3a03665.tar.gz
external_llvm-f1bbb9577a42cf7dc3079412f1dd7683e3a03665.tar.bz2
external_llvm-f1bbb9577a42cf7dc3079412f1dd7683e3a03665.zip
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
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp7
-rw-r--r--lib/Target/ARM/ARMJITInfo.h8
-rw-r--r--lib/Target/ARM/ARMMachineFunctionInfo.h24
3 files changed, 28 insertions, 11 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 5d1384763b..16de61524d 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 feb7eea6aa..3610a6e479 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<ARMFunctionInfo>();
+ 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 eeb61d7686..6662be12a5 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<ARMSubtarget>().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