mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
More bundle related API additions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -37,6 +37,10 @@ void finalizeBundle(MachineBasicBlock &MBB,
|
|||||||
MachineBasicBlock::instr_iterator finalizeBundle(MachineBasicBlock &MBB,
|
MachineBasicBlock::instr_iterator finalizeBundle(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::instr_iterator FirstMI);
|
MachineBasicBlock::instr_iterator FirstMI);
|
||||||
|
|
||||||
|
/// finalizeBundles - Finalize instruction bundles in the specified
|
||||||
|
/// MachineFunction. Return true if any bundles are finalized.
|
||||||
|
bool finalizeBundles(MachineFunction &MF);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -249,6 +249,11 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
FunctionPass *createUnpackMachineBundlesPass();
|
FunctionPass *createUnpackMachineBundlesPass();
|
||||||
|
|
||||||
|
/// createFinalizeMachineBundles - This pass finalize machine instruction
|
||||||
|
/// bundles (created earlier, e.g. during pre-RA scheduling).
|
||||||
|
///
|
||||||
|
FunctionPass *createFinalizeMachineBundlesPass();
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -235,6 +235,7 @@ void initializeVerifierPass(PassRegistry&);
|
|||||||
void initializeVirtRegMapPass(PassRegistry&);
|
void initializeVirtRegMapPass(PassRegistry&);
|
||||||
void initializeInstSimplifierPass(PassRegistry&);
|
void initializeInstSimplifierPass(PassRegistry&);
|
||||||
void initializeUnpackMachineBundlesPass(PassRegistry&);
|
void initializeUnpackMachineBundlesPass(PassRegistry&);
|
||||||
|
void initializeFinalizeMachineBundlesPass(PassRegistry&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ namespace {
|
|||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
char UnpackMachineBundles::ID = 0;
|
char UnpackMachineBundles::ID = 0;
|
||||||
INITIALIZE_PASS(UnpackMachineBundles, "unpack-mi-bundle",
|
INITIALIZE_PASS(UnpackMachineBundles, "unpack-mi-bundles",
|
||||||
"Unpack machine instruction bundles", false, false)
|
"Unpack machine instruction bundles", false, false)
|
||||||
|
|
||||||
FunctionPass *llvm::createUnpackMachineBundlesPass() {
|
FunctionPass *llvm::createUnpackMachineBundlesPass() {
|
||||||
@@ -71,6 +71,32 @@ bool UnpackMachineBundles::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
class FinalizeMachineBundles : public MachineFunctionPass {
|
||||||
|
public:
|
||||||
|
static char ID; // Pass identification
|
||||||
|
FinalizeMachineBundles() : MachineFunctionPass(ID) {
|
||||||
|
initializeFinalizeMachineBundlesPass(*PassRegistry::getPassRegistry());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||||
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
char FinalizeMachineBundles::ID = 0;
|
||||||
|
INITIALIZE_PASS(FinalizeMachineBundles, "finalize-mi-bundles",
|
||||||
|
"Finalize machine instruction bundles", false, false)
|
||||||
|
|
||||||
|
FunctionPass *llvm::createFinalizeMachineBundlesPass() {
|
||||||
|
return new FinalizeMachineBundles();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FinalizeMachineBundles::runOnMachineFunction(MachineFunction &MF) {
|
||||||
|
return llvm::finalizeBundles(MF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// finalizeBundle - Finalize a machine instruction bundle which includes
|
/// finalizeBundle - Finalize a machine instruction bundle which includes
|
||||||
/// a sequence of instructions starting from FirstMI to LastMI (exclusive).
|
/// a sequence of instructions starting from FirstMI to LastMI (exclusive).
|
||||||
/// This routine adds a BUNDLE instruction to represent the bundle, it adds
|
/// This routine adds a BUNDLE instruction to represent the bundle, it adds
|
||||||
@@ -196,3 +222,28 @@ llvm::finalizeBundle(MachineBasicBlock &MBB,
|
|||||||
finalizeBundle(MBB, FirstMI, LastMI);
|
finalizeBundle(MBB, FirstMI, LastMI);
|
||||||
return LastMI;
|
return LastMI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// finalizeBundles - Finalize instruction bundles in the specified
|
||||||
|
/// MachineFunction. Return true if any bundles are finalized.
|
||||||
|
bool llvm::finalizeBundles(MachineFunction &MF) {
|
||||||
|
bool Changed = false;
|
||||||
|
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
|
||||||
|
MachineBasicBlock &MBB = *I;
|
||||||
|
|
||||||
|
MachineBasicBlock::instr_iterator MII = MBB.instr_begin();
|
||||||
|
assert(!MII->isInsideBundle() &&
|
||||||
|
"First instr cannot be inside bundle before finalization!");
|
||||||
|
|
||||||
|
MachineBasicBlock::instr_iterator MIE = MBB.instr_end();
|
||||||
|
for (++MII; MII != MIE; ) {
|
||||||
|
if (!MII->isInsideBundle())
|
||||||
|
++MII;
|
||||||
|
else {
|
||||||
|
MII = finalizeBundle(MBB, llvm::prior(MII));
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user