Print IR from Hexagon MI passes with -print-before/after-all.

llvm-svn: 181255
This commit is contained in:
Krzysztof Parzyszek 2013-05-06 21:58:00 +00:00
parent 7cb710d58c
commit 18ee1193bf
6 changed files with 79 additions and 17 deletions

View File

@ -26,6 +26,11 @@
using namespace llvm;
namespace llvm {
void initializeHexagonCFGOptimizerPass(PassRegistry&);
}
namespace {
class HexagonCFGOptimizer : public MachineFunctionPass {
@ -39,7 +44,9 @@ private:
public:
static char ID;
HexagonCFGOptimizer(const HexagonTargetMachine& TM)
: MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {}
: MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {
initializeHexagonCFGOptimizerPass(*PassRegistry::getPassRegistry());
}
const char *getPassName() const {
return "Hexagon CFG Optimizer";
@ -230,6 +237,16 @@ bool HexagonCFGOptimizer::runOnMachineFunction(MachineFunction &Fn) {
// Public Constructor Functions
//===----------------------------------------------------------------------===//
static void initializePassOnce(PassRegistry &Registry) {
PassInfo *PI = new PassInfo("Hexagon CFG Optimizer", "hexagon-cfg",
&HexagonCFGOptimizer::ID, 0, false, false);
Registry.registerPass(*PI, true);
}
void llvm::initializeHexagonCFGOptimizerPass(PassRegistry &Registry) {
CALL_ONCE_INITIALIZATION(initializePassOnce)
}
FunctionPass *llvm::createHexagonCFGOptimizer(const HexagonTargetMachine &TM) {
return new HexagonCFGOptimizer(TM);
}

View File

@ -41,6 +41,11 @@
using namespace llvm;
namespace llvm {
void initializeHexagonExpandPredSpillCodePass(PassRegistry&);
}
namespace {
class HexagonExpandPredSpillCode : public MachineFunctionPass {
@ -50,7 +55,10 @@ class HexagonExpandPredSpillCode : public MachineFunctionPass {
public:
static char ID;
HexagonExpandPredSpillCode(const HexagonTargetMachine& TM) :
MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {}
MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeHexagonExpandPredSpillCodePass(Registry);
}
const char *getPassName() const {
return "Hexagon Expand Predicate Spill Code";
@ -175,6 +183,18 @@ bool HexagonExpandPredSpillCode::runOnMachineFunction(MachineFunction &Fn) {
// Public Constructor Functions
//===----------------------------------------------------------------------===//
static void initializePassOnce(PassRegistry &Registry) {
const char *Name = "Hexagon Expand Predicate Spill Code";
PassInfo *PI = new PassInfo(Name, "hexagon-spill-pred",
&HexagonExpandPredSpillCode::ID,
0, false, false);
Registry.registerPass(*PI, true);
}
void llvm::initializeHexagonExpandPredSpillCodePass(PassRegistry &Registry) {
CALL_ONCE_INITIALIZATION(initializePassOnce)
}
FunctionPass*
llvm::createHexagonExpandPredSpillCode(const HexagonTargetMachine &TM) {
return new HexagonExpandPredSpillCode(TM);

View File

@ -61,10 +61,6 @@ static cl::opt<bool> DisableHexagonPeephole("disable-hexagon-peephole",
cl::Hidden, cl::ZeroOrMore, cl::init(false),
cl::desc("Disable Peephole Optimization"));
static cl::opt<int>
DbgPNPCount("pnp-count", cl::init(-1), cl::Hidden,
cl::desc("Maximum number of P=NOT(P) to be optimized"));
static cl::opt<bool> DisablePNotP("disable-hexagon-pnotp",
cl::Hidden, cl::ZeroOrMore, cl::init(false),
cl::desc("Disable Optimization of PNotP"));
@ -77,6 +73,10 @@ static cl::opt<bool> DisableOptExtTo64("disable-hexagon-opt-ext-to-64",
cl::Hidden, cl::ZeroOrMore, cl::init(false),
cl::desc("Disable Optimization of extensions to i64."));
namespace llvm {
void initializeHexagonPeepholePass(PassRegistry&);
}
namespace {
struct HexagonPeephole : public MachineFunctionPass {
const HexagonInstrInfo *QII;
@ -85,7 +85,9 @@ namespace {
public:
static char ID;
HexagonPeephole() : MachineFunctionPass(ID) { }
HexagonPeephole() : MachineFunctionPass(ID) {
initializeHexagonPeepholePass(*PassRegistry::getPassRegistry());
}
bool runOnMachineFunction(MachineFunction &MF);
@ -104,8 +106,10 @@ namespace {
char HexagonPeephole::ID = 0;
bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) {
INITIALIZE_PASS(HexagonPeephole, "hexagon-peephole", "Hexagon Peephole",
false, false)
bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) {
QII = static_cast<const HexagonInstrInfo *>(MF.getTarget().
getInstrInfo());
QRI = static_cast<const HexagonRegisterInfo *>(MF.getTarget().

View File

@ -21,11 +21,18 @@
#include "llvm/Transforms/Scalar.h"
using namespace llvm;
namespace llvm {
void initializeHexagonRemoveExtendArgsPass(PassRegistry&);
}
namespace {
struct HexagonRemoveExtendArgs : public FunctionPass {
public:
static char ID;
HexagonRemoveExtendArgs() : FunctionPass(ID) {}
HexagonRemoveExtendArgs() : FunctionPass(ID) {
initializeHexagonRemoveExtendArgsPass(*PassRegistry::getPassRegistry());
}
virtual bool runOnFunction(Function &F);
const char *getPassName() const {
@ -41,11 +48,9 @@ namespace {
}
char HexagonRemoveExtendArgs::ID = 0;
RegisterPass<HexagonRemoveExtendArgs> X("reargs",
"Remove Sign and Zero Extends for Args"
);
INITIALIZE_PASS(HexagonRemoveExtendArgs, "reargs",
"Remove Sign and Zero Extends for Args", false, false)
bool HexagonRemoveExtendArgs::runOnFunction(Function &F) {
unsigned Idx = 1;

View File

@ -49,6 +49,11 @@
using namespace llvm;
namespace llvm {
void initializeHexagonSplitTFRCondSetsPass(PassRegistry&);
}
namespace {
class HexagonSplitTFRCondSets : public MachineFunctionPass {
@ -58,7 +63,9 @@ class HexagonSplitTFRCondSets : public MachineFunctionPass {
public:
static char ID;
HexagonSplitTFRCondSets(const HexagonTargetMachine& TM) :
MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {}
MachineFunctionPass(ID), QTM(TM), QST(*TM.getSubtargetImpl()) {
initializeHexagonSplitTFRCondSetsPass(*PassRegistry::getPassRegistry());
}
const char *getPassName() const {
return "Hexagon Split TFRCondSets";
@ -211,6 +218,17 @@ bool HexagonSplitTFRCondSets::runOnMachineFunction(MachineFunction &Fn) {
// Public Constructor Functions
//===----------------------------------------------------------------------===//
static void initializePassOnce(PassRegistry &Registry) {
const char *Name = "Hexagon Split TFRCondSets";
PassInfo *PI = new PassInfo(Name, "hexagon-split-tfr",
&HexagonSplitTFRCondSets::ID, 0, false, false);
Registry.registerPass(*PI, true);
}
void llvm::initializeHexagonSplitTFRCondSetsPass(PassRegistry &Registry) {
CALL_ONCE_INITIALIZATION(initializePassOnce)
}
FunctionPass*
llvm::createHexagonSplitTFRCondSets(const HexagonTargetMachine &TM) {
return new HexagonSplitTFRCondSets(TM);

View File

@ -56,9 +56,6 @@ static cl::opt<bool> PacketizeVolatiles("hexagon-packetize-volatiles",
cl::ZeroOrMore, cl::Hidden, cl::init(true),
cl::desc("Allow non-solo packetization of volatile memory references"));
extern cl::opt<bool> ScheduleInlineAsm;
extern cl::opt<bool> CountDeadOutput;
namespace llvm {
void initializeHexagonPacketizerPass(PassRegistry&);
}
@ -180,6 +177,7 @@ INITIALIZE_PASS_BEGIN(HexagonPacketizer, "packets", "Hexagon Packetizer",
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
INITIALIZE_PASS_END(HexagonPacketizer, "packets", "Hexagon Packetizer",
false, false)