mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Use bidirectional bundle flags to simplify important functions.
The bundle_iterator::operator++ function now doesn't need to dig out the basic block and check against end(). It can use the isBundledWithSucc() flag to find the last bundled instruction safely. Similarly, MachineInstr::isBundled() no longer needs to look at iterators etc. It only has to look at flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170473 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a3150098c
commit
2e4b639790
@ -146,11 +146,11 @@ public:
|
||||
bundle_iterator(IterTy mii) : MII(mii) {}
|
||||
|
||||
bundle_iterator(Ty &mi) : MII(mi) {
|
||||
assert(!mi.isInsideBundle() &&
|
||||
assert(!mi.isBundledWithPred() &&
|
||||
"It's not legal to initialize bundle_iterator with a bundled MI");
|
||||
}
|
||||
bundle_iterator(Ty *mi) : MII(mi) {
|
||||
assert((!mi || !mi->isInsideBundle()) &&
|
||||
assert((!mi || !mi->isBundledWithPred()) &&
|
||||
"It's not legal to initialize bundle_iterator with a bundled MI");
|
||||
}
|
||||
// Template allows conversion from const to nonconst.
|
||||
@ -174,13 +174,13 @@ public:
|
||||
// Increment and decrement operators...
|
||||
bundle_iterator &operator--() { // predecrement - Back up
|
||||
do --MII;
|
||||
while (MII->isInsideBundle());
|
||||
while (MII->isBundledWithPred());
|
||||
return *this;
|
||||
}
|
||||
bundle_iterator &operator++() { // preincrement - Advance
|
||||
IterTy E = MII->getParent()->instr_end();
|
||||
do ++MII;
|
||||
while (MII != E && MII->isInsideBundle());
|
||||
while (MII->isBundledWithSucc())
|
||||
++MII;
|
||||
++MII;
|
||||
return *this;
|
||||
}
|
||||
bundle_iterator operator--(int) { // postdecrement operators...
|
||||
|
@ -211,7 +211,9 @@ public:
|
||||
|
||||
/// isBundled - Return true if this instruction part of a bundle. This is true
|
||||
/// if either itself or its following instruction is marked "InsideBundle".
|
||||
bool isBundled() const;
|
||||
bool isBundled() const {
|
||||
return isBundledWithPred() || isBundledWithSucc();
|
||||
}
|
||||
|
||||
/// Return true if this instruction is part of a bundle, and it is not the
|
||||
/// first instruction in the bundle.
|
||||
|
@ -909,16 +909,6 @@ void MachineInstr::unbundleFromSucc() {
|
||||
Succ->clearFlag(BundledPred);
|
||||
}
|
||||
|
||||
/// isBundled - Return true if this instruction part of a bundle. This is true
|
||||
/// if either itself or its following instruction is marked "InsideBundle".
|
||||
bool MachineInstr::isBundled() const {
|
||||
if (isInsideBundle())
|
||||
return true;
|
||||
MachineBasicBlock::const_instr_iterator nextMI = this;
|
||||
++nextMI;
|
||||
return nextMI != Parent->instr_end() && nextMI->isInsideBundle();
|
||||
}
|
||||
|
||||
bool MachineInstr::isStackAligningInlineAsm() const {
|
||||
if (isInlineAsm()) {
|
||||
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
|
||||
|
Loading…
Reference in New Issue
Block a user