mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
mcize jump table symbol manipulation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bfcb09688c
commit
0890cf124f
@ -167,8 +167,9 @@ namespace {
|
|||||||
void EmitStartOfAsmFile(Module &M);
|
void EmitStartOfAsmFile(Module &M);
|
||||||
void EmitEndOfAsmFile(Module &M);
|
void EmitEndOfAsmFile(Module &M);
|
||||||
|
|
||||||
virtual void printPICJumpTableSetLabel2(unsigned uid, unsigned uid2,
|
MCSymbol *GetARMSetPICJumpTableLabel2(unsigned uid, unsigned uid2,
|
||||||
const MachineBasicBlock *MBB) const;
|
const MachineBasicBlock *MBB) const;
|
||||||
|
MCSymbol *GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const;
|
||||||
|
|
||||||
/// EmitMachineConstantPoolValue - Print a machine constantpool value to
|
/// EmitMachineConstantPoolValue - Print a machine constantpool value to
|
||||||
/// the .s file.
|
/// the .s file.
|
||||||
@ -907,17 +908,22 @@ void ARMAsmPrinter::printCPInstOperand(const MachineInstr *MI, int OpNum,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMAsmPrinter::printPICJumpTableSetLabel2(unsigned uid, unsigned uid2,
|
MCSymbol *ARMAsmPrinter::
|
||||||
const MachineBasicBlock *MBB) const {
|
GetARMSetPICJumpTableLabel2(unsigned uid, unsigned uid2,
|
||||||
if (!MAI->getSetDirective())
|
const MachineBasicBlock *MBB) const {
|
||||||
return;
|
SmallString<60> Name;
|
||||||
|
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix()
|
||||||
O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
|
|
||||||
<< getFunctionNumber() << '_' << uid << '_' << uid2
|
<< getFunctionNumber() << '_' << uid << '_' << uid2
|
||||||
<< "_set_" << MBB->getNumber() << ','
|
<< "_set_" << MBB->getNumber();
|
||||||
<< *GetMBBSymbol(MBB->getNumber())
|
return OutContext.GetOrCreateSymbol(Name.str());
|
||||||
<< '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
}
|
||||||
<< '_' << uid << '_' << uid2 << '\n';
|
|
||||||
|
MCSymbol *ARMAsmPrinter::
|
||||||
|
GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const {
|
||||||
|
SmallString<60> Name;
|
||||||
|
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "JTI"
|
||||||
|
<< getFunctionNumber() << '_' << uid << '_' << uid2 << '\n';
|
||||||
|
return OutContext.GetOrCreateSymbol(Name.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
|
void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
|
||||||
@ -927,8 +933,8 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
|
|||||||
const MachineOperand &MO2 = MI->getOperand(OpNum+1); // Unique Id
|
const MachineOperand &MO2 = MI->getOperand(OpNum+1); // Unique Id
|
||||||
|
|
||||||
unsigned JTI = MO1.getIndex();
|
unsigned JTI = MO1.getIndex();
|
||||||
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel2(JTI, MO2.getImm());
|
||||||
<< '_' << JTI << '_' << MO2.getImm() << ":\n";
|
OutStreamer.EmitLabel(JTISymbol);
|
||||||
|
|
||||||
const char *JTEntryDirective = MAI->getData32bitsDirective();
|
const char *JTEntryDirective = MAI->getData32bitsDirective();
|
||||||
|
|
||||||
@ -942,21 +948,20 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
|
|||||||
MachineBasicBlock *MBB = JTBBs[i];
|
MachineBasicBlock *MBB = JTBBs[i];
|
||||||
bool isNew = JTSets.insert(MBB);
|
bool isNew = JTSets.insert(MBB);
|
||||||
|
|
||||||
if (UseSet && isNew)
|
if (UseSet && isNew) {
|
||||||
printPICJumpTableSetLabel2(JTI, MO2.getImm(), MBB);
|
O << MAI->getSetDirective() << ' '
|
||||||
|
<< *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << '-'
|
||||||
|
<< *JTISymbol << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
O << JTEntryDirective << ' ';
|
O << JTEntryDirective << ' ';
|
||||||
if (UseSet)
|
if (UseSet)
|
||||||
O << MAI->getPrivateGlobalPrefix() << getFunctionNumber()
|
O << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB);
|
||||||
<< '_' << JTI << '_' << MO2.getImm()
|
else if (TM.getRelocationModel() == Reloc::PIC_)
|
||||||
<< "_set_" << MBB->getNumber();
|
O << *GetMBBSymbol(MBB->getNumber()) << '-' << *JTISymbol;
|
||||||
else if (TM.getRelocationModel() == Reloc::PIC_) {
|
else
|
||||||
O << *GetMBBSymbol(MBB->getNumber())
|
|
||||||
<< '-' << MAI->getPrivateGlobalPrefix() << "JTI"
|
|
||||||
<< getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
|
|
||||||
} else {
|
|
||||||
O << *GetMBBSymbol(MBB->getNumber());
|
O << *GetMBBSymbol(MBB->getNumber());
|
||||||
}
|
|
||||||
if (i != e-1)
|
if (i != e-1)
|
||||||
O << '\n';
|
O << '\n';
|
||||||
}
|
}
|
||||||
@ -966,8 +971,9 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) {
|
|||||||
const MachineOperand &MO1 = MI->getOperand(OpNum);
|
const MachineOperand &MO1 = MI->getOperand(OpNum);
|
||||||
const MachineOperand &MO2 = MI->getOperand(OpNum+1); // Unique Id
|
const MachineOperand &MO2 = MI->getOperand(OpNum+1); // Unique Id
|
||||||
unsigned JTI = MO1.getIndex();
|
unsigned JTI = MO1.getIndex();
|
||||||
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
|
||||||
<< '_' << JTI << '_' << MO2.getImm() << ":\n";
|
MCSymbol *JTISymbol = GetARMJTIPICJumpTableLabel2(JTI, MO2.getImm());
|
||||||
|
OutStreamer.EmitLabel(JTISymbol);
|
||||||
|
|
||||||
const MachineFunction *MF = MI->getParent()->getParent();
|
const MachineFunction *MF = MI->getParent()->getParent();
|
||||||
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
|
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
|
||||||
@ -985,13 +991,12 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) {
|
|||||||
O << MAI->getData8bitsDirective();
|
O << MAI->getData8bitsDirective();
|
||||||
else if (HalfWordOffset)
|
else if (HalfWordOffset)
|
||||||
O << MAI->getData16bitsDirective();
|
O << MAI->getData16bitsDirective();
|
||||||
if (ByteOffset || HalfWordOffset) {
|
|
||||||
O << '(' << *GetMBBSymbol(MBB->getNumber());
|
if (ByteOffset || HalfWordOffset)
|
||||||
O << "-" << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
O << '(' << *GetMBBSymbol(MBB->getNumber()) << "-" << *JTISymbol << ")/2";
|
||||||
<< '_' << JTI << '_' << MO2.getImm() << ")/2";
|
else
|
||||||
} else {
|
|
||||||
O << "\tb.w " << *GetMBBSymbol(MBB->getNumber());
|
O << "\tb.w " << *GetMBBSymbol(MBB->getNumber());
|
||||||
}
|
|
||||||
if (i != e-1)
|
if (i != e-1)
|
||||||
O << '\n';
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user