diff options
| author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-06-25 11:03:14 +0000 |
|---|---|---|
| committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-06-25 11:03:14 +0000 |
| commit | 1a20d2ab98c123aa000592f96aacaf3daf4b58d7 (patch) | |
| tree | 80e73436eebf37a231b35dcee5b70398300b9060 | |
| parent | 323fc2a2292f1d4f9f50f86815b5515660d49326 (diff) | |
| download | bcm5719-llvm-1a20d2ab98c123aa000592f96aacaf3daf4b58d7.tar.gz bcm5719-llvm-1a20d2ab98c123aa000592f96aacaf3daf4b58d7.zip | |
Identify unconditional gotos and generate a page sel instructions before them.
llvm-svn: 74172
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstrBuilder.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h index 4adb8460444..2705565a85b 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h @@ -133,6 +133,8 @@ public: if (MO.isGlobal()) return addGlobalAddress(MO.getGlobal(), MO.getOffset(), MO.getTargetFlags()); + if (MO.isMBB()) + return addMBB(MO.getMBB()); if (MO.isCPI()) return addConstantPoolIndex(MO.getIndex(), MO.getOffset(), MO.getTargetFlags()); diff --git a/llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp b/llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp index 20f926def39..43d47ae5292 100644 --- a/llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp +++ b/llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp @@ -109,7 +109,7 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) { // If this insn is not going to access any memory, return. 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; // Scan for the memory address operand. @@ -119,8 +119,9 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) { for (unsigned i = 0; i < NumOperands; i++) { MachineOperand Op = MI->getOperand(i); if (Op.getType() == MachineOperand::MO_GlobalAddress || - Op.getType() == MachineOperand::MO_ExternalSymbol) { - // We found one mem operand. Next one should be BS. + Op.getType() == MachineOperand::MO_ExternalSymbol || + Op.getType() == MachineOperand::MO_MachineBasicBlock) { + // We found one mem operand. Next one may be BS. MemOpPos = i; break; } @@ -133,7 +134,8 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) { MachineOperand &Op = MI->getOperand(MemOpPos); // 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(); BuildMI(*MBB, MI, dl, TII->get(PIC16::pagesel)). addOperand(Op); |

