mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151782 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -234,11 +234,6 @@ public:
|
|||||||
/// if either itself or its following instruction is marked "InsideBundle".
|
/// if either itself or its following instruction is marked "InsideBundle".
|
||||||
bool isBundled() const;
|
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.
|
/// getDebugLoc - Returns the debug location id of this MachineInstr.
|
||||||
///
|
///
|
||||||
DebugLoc getDebugLoc() const { return debugLoc; }
|
DebugLoc getDebugLoc() const { return debugLoc; }
|
||||||
|
|||||||
@@ -41,6 +41,22 @@ MachineBasicBlock::instr_iterator finalizeBundle(MachineBasicBlock &MBB,
|
|||||||
/// MachineFunction. Return true if any bundles are finalized.
|
/// MachineFunction. Return true if any bundles are finalized.
|
||||||
bool finalizeBundles(MachineFunction &MF);
|
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
|
// MachineOperand iterator
|
||||||
//
|
//
|
||||||
@@ -82,7 +98,7 @@ protected:
|
|||||||
///
|
///
|
||||||
explicit MachineOperandIteratorBase(MachineInstr *MI, bool WholeBundle) {
|
explicit MachineOperandIteratorBase(MachineInstr *MI, bool WholeBundle) {
|
||||||
if (WholeBundle) {
|
if (WholeBundle) {
|
||||||
InstrI = MI->getBundleStart();
|
InstrI = getBundleStart(MI);
|
||||||
InstrE = MI->getParent()->instr_end();
|
InstrE = MI->getParent()->instr_end();
|
||||||
} else {
|
} else {
|
||||||
InstrI = InstrE = MI;
|
InstrI = InstrE = MI;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef LLVM_CODEGEN_SLOTINDEXES_H
|
#ifndef LLVM_CODEGEN_SLOTINDEXES_H
|
||||||
#define 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/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/ADT/PointerIntPair.h"
|
#include "llvm/ADT/PointerIntPair.h"
|
||||||
@@ -495,10 +495,7 @@ namespace llvm {
|
|||||||
/// Returns the base index for the given instruction.
|
/// Returns the base index for the given instruction.
|
||||||
SlotIndex getInstructionIndex(const MachineInstr *MI) const {
|
SlotIndex getInstructionIndex(const MachineInstr *MI) const {
|
||||||
// Instructions inside a bundle have the same number as the bundle itself.
|
// Instructions inside a bundle have the same number as the bundle itself.
|
||||||
MachineBasicBlock::const_instr_iterator I = MI;
|
Mi2IndexMap::const_iterator itr = mi2iMap.find(getBundleStart(MI));
|
||||||
while (I->isInsideBundle())
|
|
||||||
--I;
|
|
||||||
Mi2IndexMap::const_iterator itr = mi2iMap.find(I);
|
|
||||||
assert(itr != mi2iMap.end() && "Instruction not found in maps.");
|
assert(itr != mi2iMap.end() && "Instruction not found in maps.");
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1522,7 +1522,7 @@ void LiveIntervals::handleMove(MachineInstr* MI) {
|
|||||||
SlotIndex OldIndex = indexes_->getInstructionIndex(MI);
|
SlotIndex OldIndex = indexes_->getInstructionIndex(MI);
|
||||||
indexes_->removeMachineInstrFromMaps(MI);
|
indexes_->removeMachineInstrFromMaps(MI);
|
||||||
SlotIndex NewIndex = MI->isInsideBundle() ?
|
SlotIndex NewIndex = MI->isInsideBundle() ?
|
||||||
indexes_->getInstructionIndex(MI->getBundleStart()) :
|
indexes_->getInstructionIndex(MI) :
|
||||||
indexes_->insertMachineInstrInMaps(MI);
|
indexes_->insertMachineInstrInMaps(MI);
|
||||||
assert(getMBBStartIdx(MI->getParent()) <= OldIndex &&
|
assert(getMBBStartIdx(MI->getParent()) <= OldIndex &&
|
||||||
OldIndex < getMBBEndIdx(MI->getParent()) &&
|
OldIndex < getMBBEndIdx(MI->getParent()) &&
|
||||||
|
|||||||
@@ -900,16 +900,6 @@ bool MachineInstr::isBundled() const {
|
|||||||
return nextMI != Parent->instr_end() && nextMI->isInsideBundle();
|
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 {
|
bool MachineInstr::isStackAligningInlineAsm() const {
|
||||||
if (isInlineAsm()) {
|
if (isInlineAsm()) {
|
||||||
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
|
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
|
||||||
|
|||||||
Reference in New Issue
Block a user