mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-17 00:27:31 +00:00
Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in getInstructionIndex(). Also provide a const version. C++ is great for touch typing practice. llvm-svn: 151782
This commit is contained in:
parent
14d729cf6a
commit
1885bf0ac7
@ -234,11 +234,6 @@ public:
|
||||
/// if either itself or its following instruction is marked "InsideBundle".
|
||||
bool isBundled() const;
|
||||
|
||||
/// getBundleStart - If this instruction is inside a bundle return the
|
||||
/// instruction at the start of the bundle. Otherwise just returns the
|
||||
/// instruction itself.
|
||||
MachineInstr* getBundleStart();
|
||||
|
||||
/// getDebugLoc - Returns the debug location id of this MachineInstr.
|
||||
///
|
||||
DebugLoc getDebugLoc() const { return debugLoc; }
|
||||
|
@ -41,6 +41,22 @@ MachineBasicBlock::instr_iterator finalizeBundle(MachineBasicBlock &MBB,
|
||||
/// MachineFunction. Return true if any bundles are finalized.
|
||||
bool finalizeBundles(MachineFunction &MF);
|
||||
|
||||
/// getBundleStart - Returns the first instruction in the bundle containing MI.
|
||||
///
|
||||
static inline MachineInstr *getBundleStart(MachineInstr *MI) {
|
||||
MachineBasicBlock::instr_iterator I = MI;
|
||||
while (I->isInsideBundle())
|
||||
--I;
|
||||
return I;
|
||||
}
|
||||
|
||||
static inline const MachineInstr *getBundleStart(const MachineInstr *MI) {
|
||||
MachineBasicBlock::const_instr_iterator I = MI;
|
||||
while (I->isInsideBundle())
|
||||
--I;
|
||||
return I;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MachineOperand iterator
|
||||
//
|
||||
@ -82,7 +98,7 @@ protected:
|
||||
///
|
||||
explicit MachineOperandIteratorBase(MachineInstr *MI, bool WholeBundle) {
|
||||
if (WholeBundle) {
|
||||
InstrI = MI->getBundleStart();
|
||||
InstrI = getBundleStart(MI);
|
||||
InstrE = MI->getParent()->instr_end();
|
||||
} else {
|
||||
InstrI = InstrE = MI;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef LLVM_CODEGEN_SLOTINDEXES_H
|
||||
#define LLVM_CODEGEN_SLOTINDEXES_H
|
||||
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineInstrBundle.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
@ -495,10 +495,7 @@ namespace llvm {
|
||||
/// Returns the base index for the given instruction.
|
||||
SlotIndex getInstructionIndex(const MachineInstr *MI) const {
|
||||
// Instructions inside a bundle have the same number as the bundle itself.
|
||||
MachineBasicBlock::const_instr_iterator I = MI;
|
||||
while (I->isInsideBundle())
|
||||
--I;
|
||||
Mi2IndexMap::const_iterator itr = mi2iMap.find(I);
|
||||
Mi2IndexMap::const_iterator itr = mi2iMap.find(getBundleStart(MI));
|
||||
assert(itr != mi2iMap.end() && "Instruction not found in maps.");
|
||||
return itr->second;
|
||||
}
|
||||
|
@ -1522,7 +1522,7 @@ void LiveIntervals::handleMove(MachineInstr* MI) {
|
||||
SlotIndex OldIndex = indexes_->getInstructionIndex(MI);
|
||||
indexes_->removeMachineInstrFromMaps(MI);
|
||||
SlotIndex NewIndex = MI->isInsideBundle() ?
|
||||
indexes_->getInstructionIndex(MI->getBundleStart()) :
|
||||
indexes_->getInstructionIndex(MI) :
|
||||
indexes_->insertMachineInstrInMaps(MI);
|
||||
assert(getMBBStartIdx(MI->getParent()) <= OldIndex &&
|
||||
OldIndex < getMBBEndIdx(MI->getParent()) &&
|
||||
|
@ -900,16 +900,6 @@ bool MachineInstr::isBundled() const {
|
||||
return nextMI != Parent->instr_end() && nextMI->isInsideBundle();
|
||||
}
|
||||
|
||||
MachineInstr* MachineInstr::getBundleStart() {
|
||||
if (!isInsideBundle())
|
||||
return this;
|
||||
MachineBasicBlock::reverse_instr_iterator MII(this);
|
||||
++MII;
|
||||
while (MII->isInsideBundle())
|
||||
++MII;
|
||||
return &*MII;
|
||||
}
|
||||
|
||||
bool MachineInstr::isStackAligningInlineAsm() const {
|
||||
if (isInlineAsm()) {
|
||||
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
|
||||
|
Loading…
Reference in New Issue
Block a user