namespace llvm {
-class Function;
class FunctionPass;
+class MachineFunction;
class MachineFunctionPass;
class ModulePass;
class Pass;
/// IfConverter - This pass performs machine code if conversion.
extern char &IfConverterID;
- FunctionPass *createIfConverter(std::function<bool(const Function &)> Ftor);
+ FunctionPass *createIfConverter(
+ std::function<bool(const MachineFunction &)> Ftor);
/// MachineBlockPlacement - This pass places basic blocks based on branch
/// probabilities.
extern char &UnpackMachineBundlesID;
FunctionPass *
- createUnpackMachineBundles(std::function<bool(const Function &)> Ftor);
+ createUnpackMachineBundles(std::function<bool(const MachineFunction &)> Ftor);
/// FinalizeMachineBundles - This pass finalize machine instruction
/// bundles (created earlier, e.g. during pre-RA scheduling).
bool PreRegAlloc;
bool MadeChange;
int FnNum;
- std::function<bool(const Function &)> PredicateFtor;
+ std::function<bool(const MachineFunction &)> PredicateFtor;
public:
static char ID;
- IfConverter(std::function<bool(const Function &)> Ftor = nullptr)
+ IfConverter(std::function<bool(const MachineFunction &)> Ftor = nullptr)
: MachineFunctionPass(ID), FnNum(-1), PredicateFtor(std::move(Ftor)) {
initializeIfConverterPass(*PassRegistry::getPassRegistry());
}
INITIALIZE_PASS_END(IfConverter, "if-converter", "If Converter", false, false)
bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
- if (skipFunction(*MF.getFunction()) ||
- (PredicateFtor && !PredicateFtor(*MF.getFunction())))
+ if (skipFunction(*MF.getFunction()) || (PredicateFtor && !PredicateFtor(MF)))
return false;
const TargetSubtargetInfo &ST = MF.getSubtarget();
}
FunctionPass *
-llvm::createIfConverter(std::function<bool(const Function &)> Ftor) {
+llvm::createIfConverter(std::function<bool(const MachineFunction &)> Ftor) {
return new IfConverter(std::move(Ftor));
}
class UnpackMachineBundles : public MachineFunctionPass {
public:
static char ID; // Pass identification
- UnpackMachineBundles(std::function<bool(const Function &)> Ftor = nullptr)
+ UnpackMachineBundles(
+ std::function<bool(const MachineFunction &)> Ftor = nullptr)
: MachineFunctionPass(ID), PredicateFtor(std::move(Ftor)) {
initializeUnpackMachineBundlesPass(*PassRegistry::getPassRegistry());
}
bool runOnMachineFunction(MachineFunction &MF) override;
private:
- std::function<bool(const Function &)> PredicateFtor;
+ std::function<bool(const MachineFunction &)> PredicateFtor;
};
} // end anonymous namespace
"Unpack machine instruction bundles", false, false)
bool UnpackMachineBundles::runOnMachineFunction(MachineFunction &MF) {
- if (PredicateFtor && !PredicateFtor(*MF.getFunction()))
+ if (PredicateFtor && !PredicateFtor(MF))
return false;
bool Changed = false;
}
FunctionPass *
-llvm::createUnpackMachineBundles(std::function<bool(const Function &)> Ftor) {
+llvm::createUnpackMachineBundles(
+ std::function<bool(const MachineFunction &)> Ftor) {
return new UnpackMachineBundles(std::move(Ftor));
}
return this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
}));
- addPass(createIfConverter([this](const Function &F) {
- return !this->TM->getSubtarget<ARMSubtarget>(F).isThumb1Only();
+ addPass(createIfConverter([](const MachineFunction &MF) {
+ return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
}));
}
addPass(createThumb2ITBlockPass());
addPass(createThumb2SizeReductionPass());
// Constant island pass work on unbundled instructions.
- addPass(createUnpackMachineBundles([this](const Function &F) {
- return this->TM->getSubtarget<ARMSubtarget>(F).isThumb2();
+ addPass(createUnpackMachineBundles([](const MachineFunction &MF) {
+ return MF.getSubtarget<ARMSubtarget>().isThumb2();
}));
// Don't optimize barriers at -O0.