mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Add assertions in MipsLongBranch which check the size of basic blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1c1c49372c
commit
c984657c74
@ -258,7 +258,8 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
BalTgtMBB->addSuccessor(TgtMBB);
|
||||
|
||||
int64_t TgtAddress = MBBInfos[TgtMBB->getNumber()].Address;
|
||||
int64_t Offset = TgtAddress - (I.Address + I.Size - 20);
|
||||
unsigned BalTgtMBBSize = 5;
|
||||
int64_t Offset = TgtAddress - (I.Address + I.Size - BalTgtMBBSize * 4);
|
||||
int64_t Lo = SignExtend64<16>(Offset & 0xffff);
|
||||
int64_t Hi = SignExtend64<16>(((Offset + 0x8000) >> 16) & 0xffff);
|
||||
|
||||
@ -351,6 +352,9 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::DADDiu), Mips::SP_64)
|
||||
.addReg(Mips::SP_64).addImm(16)->setIsInsideBundle();
|
||||
}
|
||||
|
||||
assert(BalTgtMBBSize == BalTgtMBB->size());
|
||||
assert(LongBrMBB->size() + BalTgtMBBSize == LongBranchSeqSize);
|
||||
} else {
|
||||
// $longbr:
|
||||
// j $tgt
|
||||
@ -361,6 +365,8 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
|
||||
LongBrMBB->addSuccessor(TgtMBB);
|
||||
BuildMI(*LongBrMBB, Pos, DL, TII->get(Mips::J)).addMBB(TgtMBB);
|
||||
BuildMI(*LongBrMBB, Pos, DL, TII->get(Mips::NOP))->setIsInsideBundle();
|
||||
|
||||
assert(LongBrMBB->size() == LongBranchSeqSize);
|
||||
}
|
||||
|
||||
if (I.Br->isUnconditionalBranch()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user