mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
[mips][mips64r6] b(ge|lt)zal are not available on MIPS32r6/MIPS64r6 and bal is a normal instruction
Summary: b(ge|lt)zal have been removed in MIPS32r6/MIPS64r6. However, bal (an alias for 'bgezal $zero, $offset') still remains with the same encoding it had prior to MIPS32r6/MIPS64r6. Updated the MipsNaCLELFStreamer, and MipsLongBranch to correctly handle the MIPS32r6/MIPS64r6 BAL instruction in addition to the existing BAL_BR pseudo. No changes were required to the CodeGen test that looks for BAL (test/CodeGen/Mips/longbranch.ll) since the new instruction has the same syntax. Depends on D4113 Reviewers: jkolek, zoran.jovanovic, vmedic Reviewed By: vmedic Differential Revision: http://reviews.llvm.org/D4114 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210898 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -266,6 +266,13 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
LongBrMBB->addSuccessor(BalTgtMBB);
|
||||
BalTgtMBB->addSuccessor(TgtMBB);
|
||||
|
||||
// We must select between the MIPS32r6/MIPS64r6 BAL (which is a normal
|
||||
// instruction) and the pre-MIPS32r6/MIPS64r6 definition (which is an
|
||||
// pseudo-instruction wrapping BGEZAL).
|
||||
|
||||
const MipsSubtarget &Subtarget = TM.getSubtarget<MipsSubtarget>();
|
||||
unsigned BalOp = Subtarget.hasMips32r6() ? Mips::BAL : Mips::BAL_BR;
|
||||
|
||||
if (ABI != MipsSubtarget::N64) {
|
||||
// $longbr:
|
||||
// addiu $sp, $sp, -8
|
||||
@@ -307,9 +314,11 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
BuildMI(*LongBrMBB, Pos, DL, TII->get(Mips::LONG_BRANCH_LUi), Mips::AT)
|
||||
.addMBB(TgtMBB).addMBB(BalTgtMBB);
|
||||
MIBundleBuilder(*LongBrMBB, Pos)
|
||||
.append(BuildMI(*MF, DL, TII->get(Mips::BAL_BR)).addMBB(BalTgtMBB))
|
||||
.append(BuildMI(*MF, DL, TII->get(Mips::LONG_BRANCH_ADDiu), Mips::AT)
|
||||
.addReg(Mips::AT).addMBB(TgtMBB).addMBB(BalTgtMBB));
|
||||
.append(BuildMI(*MF, DL, TII->get(BalOp)).addMBB(BalTgtMBB))
|
||||
.append(BuildMI(*MF, DL, TII->get(Mips::LONG_BRANCH_ADDiu), Mips::AT)
|
||||
.addReg(Mips::AT)
|
||||
.addMBB(TgtMBB)
|
||||
.addMBB(BalTgtMBB));
|
||||
|
||||
Pos = BalTgtMBB->begin();
|
||||
|
||||
@@ -379,11 +388,12 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
.addReg(Mips::AT_64).addImm(16);
|
||||
|
||||
MIBundleBuilder(*LongBrMBB, Pos)
|
||||
.append(BuildMI(*MF, DL, TII->get(Mips::BAL_BR)).addMBB(BalTgtMBB))
|
||||
.append(BuildMI(*MF, DL, TII->get(Mips::LONG_BRANCH_DADDiu),
|
||||
Mips::AT_64).addReg(Mips::AT_64)
|
||||
.addMBB(TgtMBB, MipsII::MO_ABS_LO)
|
||||
.addMBB(BalTgtMBB));
|
||||
.append(BuildMI(*MF, DL, TII->get(BalOp)).addMBB(BalTgtMBB))
|
||||
.append(
|
||||
BuildMI(*MF, DL, TII->get(Mips::LONG_BRANCH_DADDiu), Mips::AT_64)
|
||||
.addReg(Mips::AT_64)
|
||||
.addMBB(TgtMBB, MipsII::MO_ABS_LO)
|
||||
.addMBB(BalTgtMBB));
|
||||
|
||||
Pos = BalTgtMBB->begin();
|
||||
|
||||
|
Reference in New Issue
Block a user