[llvm] r268830 - [X86] Register and initialize the FixupBW pass.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Fri May 6 18:11:11 PDT 2016
Author: ab
Date: Fri May 6 20:11:10 2016
New Revision: 268830
URL: http://llvm.org/viewvc/llvm-project?rev=268830&view=rev
Log:
[X86] Register and initialize the FixupBW pass.
That lets us use it in MIR tests.
Modified:
llvm/trunk/lib/Target/X86/X86.h
llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
Modified: llvm/trunk/lib/Target/X86/X86.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=268830&r1=268829&r2=268830&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86.h (original)
+++ llvm/trunk/lib/Target/X86/X86.h Fri May 6 20:11:10 2016
@@ -21,6 +21,7 @@ namespace llvm {
class FunctionPass;
class ImmutablePass;
+class PassRegistry;
class X86TargetMachine;
/// This pass converts a legalized DAG into a X86-specific DAG, ready for
@@ -78,6 +79,8 @@ FunctionPass *createX86ExpandPseudoPass(
/// in order to eliminate partial register usage, false dependences on
/// the upper portions of registers, and to save code size.
FunctionPass *createX86FixupBWInsts();
+
+void initializeFixupBWInstPassPass(PassRegistry &);
} // End llvm namespace
#endif
Modified: llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp?rev=268830&r1=268829&r2=268830&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FixupBWInsts.cpp Fri May 6 20:11:10 2016
@@ -60,7 +60,10 @@
#include "llvm/Target/TargetInstrInfo.h"
using namespace llvm;
-#define DEBUG_TYPE "x86-fixup-bw-insts"
+#define FIXUPBW_DESC "X86 Byte/Word Instruction Fixup"
+#define FIXUPBW_NAME "x86-fixup-bw-insts"
+
+#define DEBUG_TYPE FIXUPBW_NAME
// Option to allow this optimization pass to have fine-grained control.
// This is turned off by default so as not to affect a large number of
@@ -72,12 +75,6 @@ static cl::opt<bool>
namespace {
class FixupBWInstPass : public MachineFunctionPass {
- static char ID;
-
- const char *getPassName() const override {
- return "X86 Byte/Word Instruction Fixup";
- }
-
/// Loop over all of the instructions in the basic block replacing applicable
/// byte or word instructions with better alternatives.
void processBasicBlock(MachineFunction &MF, MachineBasicBlock &MBB);
@@ -94,7 +91,15 @@ class FixupBWInstPass : public MachineFu
MachineInstr *tryReplaceLoad(unsigned New32BitOpcode, MachineInstr *MI) const;
public:
- FixupBWInstPass() : MachineFunctionPass(ID) {}
+ static char ID;
+
+ const char *getPassName() const override {
+ return FIXUPBW_DESC;
+ }
+
+ FixupBWInstPass() : MachineFunctionPass(ID) {
+ initializeFixupBWInstPassPass(*PassRegistry::getPassRegistry());
+ }
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<MachineLoopInfo>(); // Machine loop info is used to
@@ -130,6 +135,8 @@ private:
char FixupBWInstPass::ID = 0;
}
+INITIALIZE_PASS(FixupBWInstPass, FIXUPBW_NAME, FIXUPBW_DESC, false, false)
+
FunctionPass *llvm::createX86FixupBWInsts() { return new FixupBWInstPass(); }
bool FixupBWInstPass::runOnMachineFunction(MachineFunction &MF) {
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=268830&r1=268829&r2=268830&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Fri May 6 20:11:10 2016
@@ -39,6 +39,7 @@ extern "C" void LLVMInitializeX86Target(
PassRegistry &PR = *PassRegistry::getPassRegistry();
initializeWinEHStatePassPass(PR);
+ initializeFixupBWInstPassPass(PR);
}
static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
More information about the llvm-commits
mailing list