mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Add comment, fix typo, reduce memory usage, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3df62bde9b
commit
c285414988
@ -79,14 +79,14 @@ namespace {
|
|||||||
/// opcode.
|
/// opcode.
|
||||||
struct ImmBranch {
|
struct ImmBranch {
|
||||||
MachineInstr *MI;
|
MachineInstr *MI;
|
||||||
bool isCond;
|
unsigned MaxDisp : 31;
|
||||||
|
bool isCond : 1;
|
||||||
int UncondBr;
|
int UncondBr;
|
||||||
unsigned MaxDisp;
|
ImmBranch(MachineInstr *mi, unsigned maxdisp, bool cond, int ubr)
|
||||||
ImmBranch(MachineInstr *mi, bool cond, int ubr, unsigned maxdisp)
|
: MI(mi), MaxDisp(maxdisp), isCond(cond), UncondBr(ubr) {}
|
||||||
: MI(mi), isCond(cond), UncondBr(ubr), MaxDisp(maxdisp) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Branches - Keep track of all the immediate branche instructions.
|
/// Branches - Keep track of all the immediate branch instructions.
|
||||||
///
|
///
|
||||||
std::vector<ImmBranch> ImmBranches;
|
std::vector<ImmBranch> ImmBranches;
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ namespace {
|
|||||||
void SplitBlockBeforeInstr(MachineInstr *MI);
|
void SplitBlockBeforeInstr(MachineInstr *MI);
|
||||||
void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB);
|
void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB);
|
||||||
bool HandleConstantPoolUser(MachineFunction &Fn, CPUser &U);
|
bool HandleConstantPoolUser(MachineFunction &Fn, CPUser &U);
|
||||||
bool ShortenImmediateBranch(MachineFunction &Fn, ImmBranch &Br);
|
bool FixUpImmediateBranch(MachineFunction &Fn, ImmBranch &Br);
|
||||||
|
|
||||||
unsigned GetInstSize(MachineInstr *MI) const;
|
unsigned GetInstSize(MachineInstr *MI) const;
|
||||||
unsigned GetOffsetOf(MachineInstr *MI) const;
|
unsigned GetOffsetOf(MachineInstr *MI) const;
|
||||||
@ -154,7 +154,7 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) {
|
|||||||
for (unsigned i = 0, e = CPUsers.size(); i != e; ++i)
|
for (unsigned i = 0, e = CPUsers.size(); i != e; ++i)
|
||||||
MadeChange |= HandleConstantPoolUser(Fn, CPUsers[i]);
|
MadeChange |= HandleConstantPoolUser(Fn, CPUsers[i]);
|
||||||
for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
|
for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
|
||||||
MadeChange |= ShortenImmediateBranch(Fn, ImmBranches[i]);
|
MadeChange |= FixUpImmediateBranch(Fn, ImmBranches[i]);
|
||||||
} while (MadeChange);
|
} while (MadeChange);
|
||||||
|
|
||||||
BBSizes.clear();
|
BBSizes.clear();
|
||||||
@ -260,7 +260,7 @@ void ARMConstantIslands::InitialFunctionScan(MachineFunction &Fn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
unsigned MaxDisp = (1 << (Bits-1)) * Scale;
|
unsigned MaxDisp = (1 << (Bits-1)) * Scale;
|
||||||
ImmBranches.push_back(ImmBranch(I, isCond, UOpc, MaxDisp));
|
ImmBranches.push_back(ImmBranch(I, MaxDisp, isCond, UOpc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan the instructions for constant pool operands.
|
// Scan the instructions for constant pool operands.
|
||||||
@ -560,8 +560,13 @@ bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &Fn, CPUser &U){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// FixUpImmediateBranch - Fix up immediate branches whose destination is too
|
||||||
|
/// far away to fit in its displacement field. If it is a conditional branch,
|
||||||
|
/// then it is converted to an inverse conditional branch + an unconditional
|
||||||
|
/// branch to the destination. If it is an unconditional branch, then it is
|
||||||
|
/// converted to a branch to a branch.
|
||||||
bool
|
bool
|
||||||
ARMConstantIslands::ShortenImmediateBranch(MachineFunction &Fn, ImmBranch &Br) {
|
ARMConstantIslands::FixUpImmediateBranch(MachineFunction &Fn, ImmBranch &Br) {
|
||||||
MachineInstr *MI = Br.MI;
|
MachineInstr *MI = Br.MI;
|
||||||
MachineBasicBlock *DestBB = MI->getOperand(0).getMachineBasicBlock();
|
MachineBasicBlock *DestBB = MI->getOperand(0).getMachineBasicBlock();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user