mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Propagate cr# from COND_BRANCH to the actual branch instruction as appropriate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23111 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb150d7d1f
commit
f48e83ded0
@ -106,12 +106,13 @@ namespace {
|
|||||||
|
|
||||||
int Displacement = OffsetMap[trueMBB] - ByteCount;
|
int Displacement = OffsetMap[trueMBB] - ByteCount;
|
||||||
unsigned Opcode = MBBI->getOperand(1).getImmedValue();
|
unsigned Opcode = MBBI->getOperand(1).getImmedValue();
|
||||||
|
unsigned CRReg = MBBI->getOperand(0).getReg();
|
||||||
unsigned Inverted = PPC32InstrInfo::invertPPCBranchOpcode(Opcode);
|
unsigned Inverted = PPC32InstrInfo::invertPPCBranchOpcode(Opcode);
|
||||||
|
|
||||||
if (Displacement >= -32768 && Displacement <= 32767) {
|
if (Displacement >= -32768 && Displacement <= 32767) {
|
||||||
BuildMI(*MBB, MBBJ, Opcode, 2).addReg(PPC::CR0).addMBB(trueMBB);
|
BuildMI(*MBB, MBBJ, Opcode, 2).addReg(CRReg).addMBB(trueMBB);
|
||||||
} else {
|
} else {
|
||||||
BuildMI(*MBB, MBBJ, Inverted, 2).addReg(PPC::CR0).addSImm(8);
|
BuildMI(*MBB, MBBJ, Inverted, 2).addReg(CRReg).addSImm(8);
|
||||||
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(trueMBB);
|
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(trueMBB);
|
||||||
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(falseMBB);
|
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(falseMBB);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user