mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Simple branch instruction support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112923 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3061c4442e
commit
e5734105da
@ -112,6 +112,7 @@ class ARMFastISel : public FastISel {
|
|||||||
// Instruction selection routines.
|
// Instruction selection routines.
|
||||||
virtual bool ARMSelectLoad(const Instruction *I);
|
virtual bool ARMSelectLoad(const Instruction *I);
|
||||||
virtual bool ARMSelectStore(const Instruction *I);
|
virtual bool ARMSelectStore(const Instruction *I);
|
||||||
|
virtual bool ARMSelectBranch(const Instruction *I);
|
||||||
|
|
||||||
// Utility routines.
|
// Utility routines.
|
||||||
private:
|
private:
|
||||||
@ -619,6 +620,26 @@ bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ARMFastISel::ARMSelectBranch(const Instruction *I) {
|
||||||
|
const BranchInst *BI = cast<BranchInst>(I);
|
||||||
|
MachineBasicBlock *TBB = FuncInfo.MBBMap[BI->getSuccessor(0)];
|
||||||
|
MachineBasicBlock *FBB = FuncInfo.MBBMap[BI->getSuccessor(1)];
|
||||||
|
|
||||||
|
// Simple branch support.
|
||||||
|
unsigned CondReg = getRegForValue(BI->getCondition());
|
||||||
|
if (CondReg == 0) return false;
|
||||||
|
|
||||||
|
unsigned CmpOpc = isThumb ? ARM::t2CMPrr : ARM::CMPrr;
|
||||||
|
unsigned BrOpc = isThumb ? ARM::t2Bcc : ARM::Bcc;
|
||||||
|
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(CmpOpc))
|
||||||
|
.addReg(CondReg).addReg(CondReg));
|
||||||
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(BrOpc))
|
||||||
|
.addMBB(TBB).addImm(ARMCC::NE).addReg(ARM::CPSR);
|
||||||
|
FastEmitBranch(FBB, DL);
|
||||||
|
FuncInfo.MBB->addSuccessor(TBB);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: SoftFP support.
|
// TODO: SoftFP support.
|
||||||
bool ARMFastISel::TargetSelectInstruction(const Instruction *I) {
|
bool ARMFastISel::TargetSelectInstruction(const Instruction *I) {
|
||||||
// No Thumb-1 for now.
|
// No Thumb-1 for now.
|
||||||
@ -629,6 +650,8 @@ bool ARMFastISel::TargetSelectInstruction(const Instruction *I) {
|
|||||||
return ARMSelectLoad(I);
|
return ARMSelectLoad(I);
|
||||||
case Instruction::Store:
|
case Instruction::Store:
|
||||||
return ARMSelectStore(I);
|
return ARMSelectStore(I);
|
||||||
|
case Instruction::Br:
|
||||||
|
return ARMSelectBranch(I);
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user