forked from OSchip/llvm-project
Use the ARMConstantPoolMBB class to handle the MBB values.
llvm-svn: 140943
This commit is contained in:
parent
6dbc9fe82b
commit
4a4772fae2
|
@ -856,7 +856,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
||||||
const GlobalValue *GV = cast<ARMConstantPoolConstant>(ACPV)->getGV();
|
const GlobalValue *GV = cast<ARMConstantPoolConstant>(ACPV)->getGV();
|
||||||
MCSym = GetARMGVSymbol(GV);
|
MCSym = GetARMGVSymbol(GV);
|
||||||
} else if (ACPV->isMachineBasicBlock()) {
|
} else if (ACPV->isMachineBasicBlock()) {
|
||||||
const MachineBasicBlock *MBB = ACPV->getMBB();
|
const MachineBasicBlock *MBB = cast<ARMConstantPoolMBB>(ACPV)->getMBB();
|
||||||
MCSym = MBB->getSymbol();
|
MCSym = MBB->getSymbol();
|
||||||
} else {
|
} else {
|
||||||
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
|
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
|
||||||
|
|
|
@ -1069,9 +1069,9 @@ static unsigned duplicateCPV(MachineFunction &MF, unsigned &CPI) {
|
||||||
NewCPV = ARMConstantPoolConstant::Create(MF.getFunction(), PCLabelId,
|
NewCPV = ARMConstantPoolConstant::Create(MF.getFunction(), PCLabelId,
|
||||||
ARMCP::CPLSDA, 4);
|
ARMCP::CPLSDA, 4);
|
||||||
else if (ACPV->isMachineBasicBlock())
|
else if (ACPV->isMachineBasicBlock())
|
||||||
NewCPV = new ARMConstantPoolValue(MF.getFunction()->getContext(),
|
NewCPV = ARMConstantPoolMBB::
|
||||||
ACPV->getMBB(), PCLabelId,
|
Create(MF.getFunction()->getContext(),
|
||||||
ARMCP::CPMachineBasicBlock, 4);
|
cast<ARMConstantPoolMBB>(ACPV)->getMBB(), PCLabelId, 4);
|
||||||
else
|
else
|
||||||
llvm_unreachable("Unexpected ARM constantpool value type!!");
|
llvm_unreachable("Unexpected ARM constantpool value type!!");
|
||||||
CPI = MCP->getConstantPoolIndex(NewCPV, MCPE.getAlignment());
|
CPI = MCP->getConstantPoolIndex(NewCPV, MCPE.getAlignment());
|
||||||
|
|
|
@ -31,7 +31,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(Type *Ty, unsigned id,
|
||||||
unsigned char PCAdj,
|
unsigned char PCAdj,
|
||||||
ARMCP::ARMCPModifier modifier,
|
ARMCP::ARMCPModifier modifier,
|
||||||
bool addCurrentAddress)
|
bool addCurrentAddress)
|
||||||
: MachineConstantPoolValue(Ty), MBB(NULL), LabelId(id), Kind(kind),
|
: MachineConstantPoolValue(Ty), LabelId(id), Kind(kind),
|
||||||
PCAdjust(PCAdj), Modifier(modifier),
|
PCAdjust(PCAdj), Modifier(modifier),
|
||||||
AddCurrentAddress(addCurrentAddress) {}
|
AddCurrentAddress(addCurrentAddress) {}
|
||||||
|
|
||||||
|
@ -44,23 +44,8 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id,
|
||||||
LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier),
|
LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier),
|
||||||
AddCurrentAddress(addCurrentAddress) {}
|
AddCurrentAddress(addCurrentAddress) {}
|
||||||
|
|
||||||
ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C,
|
|
||||||
const MachineBasicBlock *mbb,
|
|
||||||
unsigned id,
|
|
||||||
ARMCP::ARMCPKind K,
|
|
||||||
unsigned char PCAdj,
|
|
||||||
ARMCP::ARMCPModifier Modif,
|
|
||||||
bool AddCA)
|
|
||||||
: MachineConstantPoolValue((Type*)Type::getInt8PtrTy(C)),
|
|
||||||
MBB(mbb), LabelId(id), Kind(K), PCAdjust(PCAdj),
|
|
||||||
Modifier(Modif), AddCurrentAddress(AddCA) {}
|
|
||||||
|
|
||||||
ARMConstantPoolValue::~ARMConstantPoolValue() {}
|
ARMConstantPoolValue::~ARMConstantPoolValue() {}
|
||||||
|
|
||||||
const MachineBasicBlock *ARMConstantPoolValue::getMBB() const {
|
|
||||||
return MBB;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ARMConstantPoolValue::getModifierText() const {
|
const char *ARMConstantPoolValue::getModifierText() const {
|
||||||
switch (Modifier) {
|
switch (Modifier) {
|
||||||
default: llvm_unreachable("Unknown modifier!");
|
default: llvm_unreachable("Unknown modifier!");
|
||||||
|
@ -120,8 +105,6 @@ void ARMConstantPoolValue::dump() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMConstantPoolValue::print(raw_ostream &O) const {
|
void ARMConstantPoolValue::print(raw_ostream &O) const {
|
||||||
if (MBB)
|
|
||||||
O << "";
|
|
||||||
if (Modifier) O << "(" << getModifierText() << ")";
|
if (Modifier) O << "(" << getModifierText() << ")";
|
||||||
if (PCAdjust != 0) {
|
if (PCAdjust != 0) {
|
||||||
O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust;
|
O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust;
|
||||||
|
@ -304,16 +287,17 @@ void ARMConstantPoolSymbol::print(raw_ostream &O) const {
|
||||||
// ARMConstantPoolMBB
|
// ARMConstantPoolMBB
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C, MachineBasicBlock *mbb,
|
ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C,
|
||||||
|
const MachineBasicBlock *mbb,
|
||||||
unsigned id, unsigned char PCAdj,
|
unsigned id, unsigned char PCAdj,
|
||||||
ARMCP::ARMCPModifier Modifier,
|
ARMCP::ARMCPModifier Modifier,
|
||||||
bool AddCurrentAddress)
|
bool AddCurrentAddress)
|
||||||
: ARMConstantPoolValue(C, mbb, id, ARMCP::CPMachineBasicBlock, PCAdj,
|
: ARMConstantPoolValue(C, id, ARMCP::CPMachineBasicBlock, PCAdj,
|
||||||
Modifier, AddCurrentAddress),
|
Modifier, AddCurrentAddress),
|
||||||
MBB(mbb) {}
|
MBB(mbb) {}
|
||||||
|
|
||||||
ARMConstantPoolMBB *ARMConstantPoolMBB::Create(LLVMContext &C,
|
ARMConstantPoolMBB *ARMConstantPoolMBB::Create(LLVMContext &C,
|
||||||
MachineBasicBlock *mbb,
|
const MachineBasicBlock *mbb,
|
||||||
unsigned ID,
|
unsigned ID,
|
||||||
unsigned char PCAdj) {
|
unsigned char PCAdj) {
|
||||||
return new ARMConstantPoolMBB(C, mbb, ID, PCAdj, ARMCP::no_modifier, false);
|
return new ARMConstantPoolMBB(C, mbb, ID, PCAdj, ARMCP::no_modifier, false);
|
||||||
|
|
|
@ -49,7 +49,6 @@ namespace ARMCP {
|
||||||
/// represent PC-relative displacement between the address of the load
|
/// represent PC-relative displacement between the address of the load
|
||||||
/// instruction and the constant being loaded, i.e. (&GV-(LPIC+8)).
|
/// instruction and the constant being loaded, i.e. (&GV-(LPIC+8)).
|
||||||
class ARMConstantPoolValue : public MachineConstantPoolValue {
|
class ARMConstantPoolValue : public MachineConstantPoolValue {
|
||||||
const MachineBasicBlock *MBB; // MachineBasicBlock being loaded.
|
|
||||||
unsigned LabelId; // Label id of the load.
|
unsigned LabelId; // Label id of the load.
|
||||||
ARMCP::ARMCPKind Kind; // Kind of constant.
|
ARMCP::ARMCPKind Kind; // Kind of constant.
|
||||||
unsigned char PCAdjust; // Extra adjustment if constantpool is pc-relative.
|
unsigned char PCAdjust; // Extra adjustment if constantpool is pc-relative.
|
||||||
|
@ -66,15 +65,8 @@ protected:
|
||||||
unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
|
unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
|
||||||
bool AddCurrentAddress);
|
bool AddCurrentAddress);
|
||||||
public:
|
public:
|
||||||
ARMConstantPoolValue(LLVMContext &C, const MachineBasicBlock *mbb,unsigned id,
|
|
||||||
ARMCP::ARMCPKind Kind = ARMCP::CPValue,
|
|
||||||
unsigned char PCAdj = 0,
|
|
||||||
ARMCP::ARMCPModifier Modifier = ARMCP::no_modifier,
|
|
||||||
bool AddCurrentAddress = false);
|
|
||||||
virtual ~ARMConstantPoolValue();
|
virtual ~ARMConstantPoolValue();
|
||||||
|
|
||||||
const MachineBasicBlock *getMBB() const;
|
|
||||||
|
|
||||||
ARMCP::ARMCPModifier getModifier() const { return Modifier; }
|
ARMCP::ARMCPModifier getModifier() const { return Modifier; }
|
||||||
const char *getModifierText() const;
|
const char *getModifierText() const;
|
||||||
bool hasModifier() const { return Modifier != ARMCP::no_modifier; }
|
bool hasModifier() const { return Modifier != ARMCP::no_modifier; }
|
||||||
|
@ -200,14 +192,15 @@ public:
|
||||||
/// ARMConstantPoolMBB - ARM-specific constantpool value of a machine basic
|
/// ARMConstantPoolMBB - ARM-specific constantpool value of a machine basic
|
||||||
/// block.
|
/// block.
|
||||||
class ARMConstantPoolMBB : public ARMConstantPoolValue {
|
class ARMConstantPoolMBB : public ARMConstantPoolValue {
|
||||||
MachineBasicBlock *MBB; // Machine basic block.
|
const MachineBasicBlock *MBB; // Machine basic block.
|
||||||
|
|
||||||
ARMConstantPoolMBB(LLVMContext &C, MachineBasicBlock *mbb, unsigned id,
|
ARMConstantPoolMBB(LLVMContext &C, const MachineBasicBlock *mbb, unsigned id,
|
||||||
unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
|
unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
|
||||||
bool AddCurrentAddress);
|
bool AddCurrentAddress);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ARMConstantPoolMBB *Create(LLVMContext &C, MachineBasicBlock *mbb,
|
static ARMConstantPoolMBB *Create(LLVMContext &C,
|
||||||
|
const MachineBasicBlock *mbb,
|
||||||
unsigned ID, unsigned char PCAdj);
|
unsigned ID, unsigned char PCAdj);
|
||||||
|
|
||||||
const MachineBasicBlock *getMBB() const { return MBB; }
|
const MachineBasicBlock *getMBB() const { return MBB; }
|
||||||
|
|
Loading…
Reference in New Issue