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
This commit is contained in:
Evan Cheng 2008-11-08 00:51:41 +00:00
parent 3dd42cfe12
commit f1bbb9577a
3 changed files with 28 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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