mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-13 10:32:06 +00:00
Identify unconditional gotos and generate a page sel instructions before them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a5e0abd0d4
commit
8ebd4b6422
@ -133,6 +133,8 @@ public:
|
|||||||
if (MO.isGlobal())
|
if (MO.isGlobal())
|
||||||
return addGlobalAddress(MO.getGlobal(), MO.getOffset(),
|
return addGlobalAddress(MO.getGlobal(), MO.getOffset(),
|
||||||
MO.getTargetFlags());
|
MO.getTargetFlags());
|
||||||
|
if (MO.isMBB())
|
||||||
|
return addMBB(MO.getMBB());
|
||||||
if (MO.isCPI())
|
if (MO.isCPI())
|
||||||
return addConstantPoolIndex(MO.getIndex(), MO.getOffset(),
|
return addConstantPoolIndex(MO.getIndex(), MO.getOffset(),
|
||||||
MO.getTargetFlags());
|
MO.getTargetFlags());
|
||||||
|
@ -109,7 +109,7 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
|
|||||||
|
|
||||||
// If this insn is not going to access any memory, return.
|
// If this insn is not going to access any memory, return.
|
||||||
const TargetInstrDesc &TID = TII->get(MI->getOpcode());
|
const TargetInstrDesc &TID = TII->get(MI->getOpcode());
|
||||||
if (! (TID.isCall() || TID.mayLoad() || TID.mayStore()))
|
if (!(TID.isBranch() || TID.isCall() || TID.mayLoad() || TID.mayStore()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Scan for the memory address operand.
|
// Scan for the memory address operand.
|
||||||
@ -119,8 +119,9 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
|
|||||||
for (unsigned i = 0; i < NumOperands; i++) {
|
for (unsigned i = 0; i < NumOperands; i++) {
|
||||||
MachineOperand Op = MI->getOperand(i);
|
MachineOperand Op = MI->getOperand(i);
|
||||||
if (Op.getType() == MachineOperand::MO_GlobalAddress ||
|
if (Op.getType() == MachineOperand::MO_GlobalAddress ||
|
||||||
Op.getType() == MachineOperand::MO_ExternalSymbol) {
|
Op.getType() == MachineOperand::MO_ExternalSymbol ||
|
||||||
// We found one mem operand. Next one should be BS.
|
Op.getType() == MachineOperand::MO_MachineBasicBlock) {
|
||||||
|
// We found one mem operand. Next one may be BS.
|
||||||
MemOpPos = i;
|
MemOpPos = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -133,7 +134,8 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
|
|||||||
MachineOperand &Op = MI->getOperand(MemOpPos);
|
MachineOperand &Op = MI->getOperand(MemOpPos);
|
||||||
|
|
||||||
// If this is a pagesel material, handle it first.
|
// If this is a pagesel material, handle it first.
|
||||||
if (MI->getOpcode() == PIC16::CALL) {
|
if (MI->getOpcode() == PIC16::CALL ||
|
||||||
|
MI->getOpcode() == PIC16::br_uncond) {
|
||||||
DebugLoc dl = MI->getDebugLoc();
|
DebugLoc dl = MI->getDebugLoc();
|
||||||
BuildMI(*MBB, MI, dl, TII->get(PIC16::pagesel)).
|
BuildMI(*MBB, MI, dl, TII->get(PIC16::pagesel)).
|
||||||
addOperand(Op);
|
addOperand(Op);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user