2003-08-21 22:14:26 +00:00
|
|
|
//===-- Passes.h - Target independent code generation passes ----*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-01-13 01:01:31 +00:00
|
|
|
//
|
2003-08-21 22:14:26 +00:00
|
|
|
// This file defines interfaces to access the target independent code generation
|
2003-01-13 01:01:31 +00:00
|
|
|
// passes provided by the LLVM backend.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_PASSES_H
|
|
|
|
#define LLVM_CODEGEN_PASSES_H
|
|
|
|
|
2012-02-04 02:56:45 +00:00
|
|
|
#include "llvm/Pass.h"
|
2009-10-16 21:06:15 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2004-02-04 21:41:10 +00:00
|
|
|
#include <string>
|
2004-01-30 21:53:46 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2013-10-15 02:03:44 +00:00
|
|
|
class FunctionPass;
|
|
|
|
class MachineFunctionPass;
|
2012-02-15 03:21:47 +00:00
|
|
|
class PassConfigImpl;
|
2013-10-15 02:03:44 +00:00
|
|
|
class PassInfo;
|
|
|
|
class ScheduleDAGInstrs;
|
|
|
|
class TargetLowering;
|
|
|
|
class TargetLoweringBase;
|
|
|
|
class TargetRegisterClass;
|
|
|
|
class raw_ostream;
|
|
|
|
struct MachineSchedContext;
|
2012-02-15 03:21:47 +00:00
|
|
|
|
2013-11-09 12:26:54 +00:00
|
|
|
// The old pass manager infrastructure is hidden in a legacy namespace now.
|
|
|
|
namespace legacy {
|
|
|
|
class PassManagerBase;
|
|
|
|
}
|
|
|
|
using legacy::PassManagerBase;
|
|
|
|
|
2013-04-10 01:06:56 +00:00
|
|
|
/// Discriminated union of Pass ID types.
|
|
|
|
///
|
|
|
|
/// The PassConfig API prefers dealing with IDs because they are safer and more
|
|
|
|
/// efficient. IDs decouple configuration from instantiation. This way, when a
|
|
|
|
/// pass is overriden, it isn't unnecessarily instantiated. It is also unsafe to
|
|
|
|
/// refer to a Pass pointer after adding it to a pass manager, which deletes
|
|
|
|
/// redundant pass instances.
|
|
|
|
///
|
|
|
|
/// However, it is convient to directly instantiate target passes with
|
|
|
|
/// non-default ctors. These often don't have a registered PassInfo. Rather than
|
|
|
|
/// force all target passes to implement the pass registry boilerplate, allow
|
|
|
|
/// the PassConfig API to handle either type.
|
|
|
|
///
|
|
|
|
/// AnalysisID is sadly char*, so PointerIntPair won't work.
|
|
|
|
class IdentifyingPassPtr {
|
2013-04-10 20:50:44 +00:00
|
|
|
union {
|
|
|
|
AnalysisID ID;
|
|
|
|
Pass *P;
|
|
|
|
};
|
2013-04-10 01:06:56 +00:00
|
|
|
bool IsInstance;
|
|
|
|
public:
|
2014-04-14 00:51:57 +00:00
|
|
|
IdentifyingPassPtr() : P(nullptr), IsInstance(false) {}
|
2013-04-10 20:50:44 +00:00
|
|
|
IdentifyingPassPtr(AnalysisID IDPtr) : ID(IDPtr), IsInstance(false) {}
|
|
|
|
IdentifyingPassPtr(Pass *InstancePtr) : P(InstancePtr), IsInstance(true) {}
|
2013-04-10 01:06:56 +00:00
|
|
|
|
|
|
|
bool isValid() const { return P; }
|
|
|
|
bool isInstance() const { return IsInstance; }
|
|
|
|
|
|
|
|
AnalysisID getID() const {
|
|
|
|
assert(!IsInstance && "Not a Pass ID");
|
2013-04-10 20:50:44 +00:00
|
|
|
return ID;
|
2013-04-10 01:06:56 +00:00
|
|
|
}
|
|
|
|
Pass *getInstance() const {
|
|
|
|
assert(IsInstance && "Not a Pass Instance");
|
2013-04-10 20:50:44 +00:00
|
|
|
return P;
|
2013-04-10 01:06:56 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct isPodLike<IdentifyingPassPtr> {
|
|
|
|
static const bool value = true;
|
|
|
|
};
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
/// Target-Independent Code Generator Pass Configuration Options.
|
|
|
|
///
|
2012-02-04 02:56:45 +00:00
|
|
|
/// This is an ImmutablePass solely for the purpose of exposing CodeGen options
|
|
|
|
/// to the internals of other CodeGen passes.
|
|
|
|
class TargetPassConfig : public ImmutablePass {
|
2012-02-15 03:21:51 +00:00
|
|
|
public:
|
|
|
|
/// Pseudo Pass IDs. These are defined within TargetPassConfig because they
|
|
|
|
/// are unregistered pass IDs. They are only useful for use with
|
|
|
|
/// TargetPassConfig APIs to identify multiple occurrences of the same pass.
|
|
|
|
///
|
|
|
|
|
|
|
|
/// EarlyTailDuplicate - A clone of the TailDuplicate pass that runs early
|
|
|
|
/// during codegen, on SSA form.
|
|
|
|
static char EarlyTailDuplicateID;
|
|
|
|
|
|
|
|
/// PostRAMachineLICM - A clone of the LICM pass that runs during late machine
|
|
|
|
/// optimization after regalloc.
|
|
|
|
static char PostRAMachineLICMID;
|
|
|
|
|
2012-07-02 19:48:31 +00:00
|
|
|
private:
|
|
|
|
PassManagerBase *PM;
|
2012-07-02 19:48:45 +00:00
|
|
|
AnalysisID StartAfter;
|
|
|
|
AnalysisID StopAfter;
|
|
|
|
bool Started;
|
|
|
|
bool Stopped;
|
2014-12-11 21:26:47 +00:00
|
|
|
bool AddingMachinePasses;
|
2012-07-02 19:48:31 +00:00
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
protected:
|
|
|
|
TargetMachine *TM;
|
2012-02-15 03:21:47 +00:00
|
|
|
PassConfigImpl *Impl; // Internal data structures
|
|
|
|
bool Initialized; // Flagged after all passes are configured.
|
2012-02-04 02:56:59 +00:00
|
|
|
|
|
|
|
// Target Pass Options
|
2012-02-08 21:22:48 +00:00
|
|
|
// Targets provide a default setting, user flags override.
|
2012-02-04 02:56:59 +00:00
|
|
|
//
|
2012-02-03 05:12:41 +00:00
|
|
|
bool DisableVerify;
|
|
|
|
|
2012-02-08 21:22:48 +00:00
|
|
|
/// Default setting for -enable-tail-merge on this target.
|
|
|
|
bool EnableTailMerge;
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
public:
|
2012-02-04 02:56:59 +00:00
|
|
|
TargetPassConfig(TargetMachine *tm, PassManagerBase &pm);
|
2012-02-04 02:56:45 +00:00
|
|
|
// Dummy constructor.
|
|
|
|
TargetPassConfig();
|
|
|
|
|
|
|
|
virtual ~TargetPassConfig();
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2012-02-04 02:56:45 +00:00
|
|
|
static char ID;
|
2012-02-03 05:12:41 +00:00
|
|
|
|
|
|
|
/// Get the right type of TargetMachine for this target.
|
|
|
|
template<typename TMC> TMC &getTM() const {
|
|
|
|
return *static_cast<TMC*>(TM);
|
|
|
|
}
|
|
|
|
|
2012-02-15 03:21:47 +00:00
|
|
|
//
|
2012-02-08 21:22:39 +00:00
|
|
|
void setInitialized() { Initialized = true; }
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
|
|
|
|
|
2012-07-02 19:48:45 +00:00
|
|
|
/// setStartStopPasses - Set the StartAfter and StopAfter passes to allow
|
|
|
|
/// running only a portion of the normal code-gen pass sequence. If the
|
|
|
|
/// Start pass ID is zero, then compilation will begin at the normal point;
|
|
|
|
/// otherwise, clear the Started flag to indicate that passes should not be
|
|
|
|
/// added until the starting pass is seen. If the Stop pass ID is zero,
|
|
|
|
/// then compilation will continue to the end.
|
|
|
|
void setStartStopPasses(AnalysisID Start, AnalysisID Stop) {
|
|
|
|
StartAfter = Start;
|
|
|
|
StopAfter = Stop;
|
2014-04-14 00:51:57 +00:00
|
|
|
Started = (StartAfter == nullptr);
|
2012-07-02 19:48:45 +00:00
|
|
|
}
|
|
|
|
|
2012-02-08 21:22:48 +00:00
|
|
|
void setDisableVerify(bool Disable) { setOpt(DisableVerify, Disable); }
|
|
|
|
|
|
|
|
bool getEnableTailMerge() const { return EnableTailMerge; }
|
|
|
|
void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
|
2012-02-04 02:56:59 +00:00
|
|
|
|
2012-02-15 03:21:47 +00:00
|
|
|
/// Allow the target to override a specific pass without overriding the pass
|
|
|
|
/// pipeline. When passes are added to the standard pipeline at the
|
2012-07-02 19:48:37 +00:00
|
|
|
/// point where StandardID is expected, add TargetID in its place.
|
2013-04-10 01:06:56 +00:00
|
|
|
void substitutePass(AnalysisID StandardID, IdentifyingPassPtr TargetID);
|
2012-02-15 03:21:47 +00:00
|
|
|
|
2012-05-30 00:17:12 +00:00
|
|
|
/// Insert InsertedPassID pass after TargetPassID pass.
|
2013-04-10 01:06:56 +00:00
|
|
|
void insertPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID);
|
2012-05-30 00:17:12 +00:00
|
|
|
|
2012-03-09 00:52:17 +00:00
|
|
|
/// Allow the target to enable a specific standard pass by default.
|
2012-07-02 19:48:37 +00:00
|
|
|
void enablePass(AnalysisID PassID) { substitutePass(PassID, PassID); }
|
2012-03-09 00:52:17 +00:00
|
|
|
|
|
|
|
/// Allow the target to disable a specific standard pass by default.
|
2013-04-10 01:06:56 +00:00
|
|
|
void disablePass(AnalysisID PassID) {
|
|
|
|
substitutePass(PassID, IdentifyingPassPtr());
|
|
|
|
}
|
2012-02-15 03:21:47 +00:00
|
|
|
|
2012-07-02 19:48:37 +00:00
|
|
|
/// Return the pass substituted for StandardID by the target.
|
2012-02-15 03:21:47 +00:00
|
|
|
/// If no substitution exists, return StandardID.
|
2013-04-10 01:06:56 +00:00
|
|
|
IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const;
|
2012-02-15 03:21:47 +00:00
|
|
|
|
2012-02-15 03:21:43 +00:00
|
|
|
/// Return true if the optimized regalloc pipeline is enabled.
|
2012-02-10 04:10:36 +00:00
|
|
|
bool getOptimizeRegAlloc() const;
|
|
|
|
|
2014-10-21 20:47:22 +00:00
|
|
|
/// Return true if the default global register allocator is in use and
|
|
|
|
/// has not be overriden on the command line with '-regalloc=...'
|
|
|
|
bool usingDefaultRegAlloc() const;
|
|
|
|
|
2012-02-04 02:56:59 +00:00
|
|
|
/// Add common target configurable passes that perform LLVM IR to IR
|
|
|
|
/// transforms following machine independent optimization.
|
|
|
|
virtual void addIRPasses();
|
|
|
|
|
2012-07-02 19:48:31 +00:00
|
|
|
/// Add passes to lower exception handling for the code generator.
|
|
|
|
void addPassesToHandleExceptions();
|
|
|
|
|
2012-11-30 22:08:55 +00:00
|
|
|
/// Add pass to prepare the LLVM IR for code generation. This should be done
|
|
|
|
/// before exception handling preparation passes.
|
|
|
|
virtual void addCodeGenPrepare();
|
|
|
|
|
2012-02-04 02:56:59 +00:00
|
|
|
/// Add common passes that perform LLVM IR to IR transforms in preparation for
|
|
|
|
/// instruction selection.
|
|
|
|
virtual void addISelPrepare();
|
|
|
|
|
|
|
|
/// addInstSelector - This method should install an instruction selector pass,
|
|
|
|
/// which converts from LLVM code to machine instructions.
|
|
|
|
virtual bool addInstSelector() {
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-03 05:12:41 +00:00
|
|
|
|
|
|
|
/// Add the complete, standard set of LLVM CodeGen passes.
|
|
|
|
/// Fully developed targets will not generally override this.
|
2012-02-04 02:56:59 +00:00
|
|
|
virtual void addMachinePasses();
|
2012-02-08 21:23:03 +00:00
|
|
|
|
2013-12-28 21:56:51 +00:00
|
|
|
/// Create an instance of ScheduleDAGInstrs to be run within the standard
|
|
|
|
/// MachineScheduler pass for this function and target at the current
|
|
|
|
/// optimization level.
|
2013-09-20 05:14:41 +00:00
|
|
|
///
|
|
|
|
/// This can also be used to plug a new MachineSchedStrategy into an instance
|
|
|
|
/// of the standard ScheduleDAGMI:
|
2015-01-19 12:02:25 +00:00
|
|
|
/// return new ScheduleDAGMI(C, make_unique<MyStrategy>(C), /* IsPostRA= */false)
|
2013-09-20 05:14:41 +00:00
|
|
|
///
|
|
|
|
/// Return NULL to select the default (generic) machine scheduler.
|
|
|
|
virtual ScheduleDAGInstrs *
|
|
|
|
createMachineScheduler(MachineSchedContext *C) const {
|
2014-04-14 00:51:57 +00:00
|
|
|
return nullptr;
|
2013-09-20 05:14:41 +00:00
|
|
|
}
|
|
|
|
|
2013-12-28 21:56:51 +00:00
|
|
|
/// Similar to createMachineScheduler but used when postRA machine scheduling
|
|
|
|
/// is enabled.
|
|
|
|
virtual ScheduleDAGInstrs *
|
|
|
|
createPostMachineScheduler(MachineSchedContext *C) const {
|
2014-04-14 00:51:57 +00:00
|
|
|
return nullptr;
|
2013-12-28 21:56:51 +00:00
|
|
|
}
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
protected:
|
2012-02-08 21:22:39 +00:00
|
|
|
// Helper to verify the analysis is really immutable.
|
|
|
|
void setOpt(bool &Opt, bool Val);
|
|
|
|
|
2012-02-04 02:56:59 +00:00
|
|
|
/// Methods with trivial inline returns are convenient points in the common
|
|
|
|
/// codegen pass pipeline where targets may insert passes. Methods with
|
|
|
|
/// out-of-line standard implementations are major CodeGen stages called by
|
|
|
|
/// addMachinePasses. Some targets may override major stages when inserting
|
|
|
|
/// passes is insufficient, but maintaining overriden stages is more work.
|
2012-02-03 05:12:41 +00:00
|
|
|
///
|
|
|
|
|
|
|
|
/// addPreISelPasses - This method should add any "last minute" LLVM->LLVM
|
|
|
|
/// passes (which are run just before instruction selector).
|
|
|
|
virtual bool addPreISel() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-02-09 00:40:55 +00:00
|
|
|
/// addMachineSSAOptimization - Add standard passes that optimize machine
|
|
|
|
/// instructions in SSA form.
|
|
|
|
virtual void addMachineSSAOptimization();
|
|
|
|
|
2013-01-17 00:58:38 +00:00
|
|
|
/// Add passes that optimize instruction level parallelism for out-of-order
|
|
|
|
/// targets. These passes are run while the machine code is still in SSA
|
|
|
|
/// form, so they can use MachineTraceMetrics to control their heuristics.
|
|
|
|
///
|
|
|
|
/// All passes added here should preserve the MachineDominatorTree,
|
|
|
|
/// MachineLoopInfo, and MachineTraceMetrics analyses.
|
|
|
|
virtual bool addILPOpts() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:26:47 +00:00
|
|
|
/// This method may be implemented by targets that want to run passes
|
|
|
|
/// immediately before register allocation.
|
|
|
|
virtual void addPreRegAlloc() { }
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2012-02-10 04:10:36 +00:00
|
|
|
/// createTargetRegisterAllocator - Create the register allocator pass for
|
|
|
|
/// this target at the current optimization level.
|
|
|
|
virtual FunctionPass *createTargetRegisterAllocator(bool Optimized);
|
|
|
|
|
|
|
|
/// addFastRegAlloc - Add the minimum set of target-independent passes that
|
|
|
|
/// are required for fast register allocation.
|
|
|
|
virtual void addFastRegAlloc(FunctionPass *RegAllocPass);
|
|
|
|
|
2012-02-11 07:11:29 +00:00
|
|
|
/// addOptimizedRegAlloc - Add passes related to register allocation.
|
|
|
|
/// LLVMTargetMachine provides standard regalloc passes for most targets.
|
2012-02-10 04:10:36 +00:00
|
|
|
virtual void addOptimizedRegAlloc(FunctionPass *RegAllocPass);
|
2012-02-09 00:40:55 +00:00
|
|
|
|
2012-06-26 17:09:29 +00:00
|
|
|
/// addPreRewrite - Add passes to the optimized register allocation pipeline
|
|
|
|
/// after register allocation is complete, but before virtual registers are
|
|
|
|
/// rewritten to physical registers.
|
|
|
|
///
|
|
|
|
/// These passes must preserve VirtRegMap and LiveIntervals, and when running
|
|
|
|
/// after RABasic or RAGreedy, they should take advantage of LiveRegMatrix.
|
|
|
|
/// When these passes run, VirtRegMap contains legal physreg assignments for
|
|
|
|
/// all virtual registers.
|
|
|
|
virtual bool addPreRewrite() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:26:47 +00:00
|
|
|
/// This method may be implemented by targets that want to run passes after
|
|
|
|
/// register allocation pass pipeline but before prolog-epilog insertion.
|
|
|
|
virtual void addPostRegAlloc() { }
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2012-02-09 00:40:55 +00:00
|
|
|
/// Add passes that optimize machine instructions after register allocation.
|
|
|
|
virtual void addMachineLateOptimization();
|
|
|
|
|
2014-12-11 21:26:47 +00:00
|
|
|
/// This method may be implemented by targets that want to run passes after
|
|
|
|
/// prolog-epilog insertion and before the second instruction scheduling pass.
|
|
|
|
virtual void addPreSched2() { }
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2012-12-21 02:57:04 +00:00
|
|
|
/// addGCPasses - Add late codegen passes that analyze code for garbage
|
|
|
|
/// collection. This should return true if GC info should be printed after
|
|
|
|
/// these passes.
|
|
|
|
virtual bool addGCPasses();
|
|
|
|
|
2012-02-09 00:40:55 +00:00
|
|
|
/// Add standard basic block placement passes.
|
|
|
|
virtual void addBlockPlacement();
|
|
|
|
|
2014-12-11 21:26:47 +00:00
|
|
|
/// This pass may be implemented by targets that want to run passes
|
|
|
|
/// immediately before machine code is emitted.
|
|
|
|
virtual void addPreEmitPass() { }
|
2012-02-03 05:12:41 +00:00
|
|
|
|
|
|
|
/// Utilities for targets to add passes to the pass manager.
|
|
|
|
///
|
|
|
|
|
2012-02-15 03:21:47 +00:00
|
|
|
/// Add a CodeGen pass at this point in the pipeline after checking overrides.
|
2012-07-02 19:48:37 +00:00
|
|
|
/// Return the pass that was added, or zero if no pass was added.
|
2014-12-11 21:26:47 +00:00
|
|
|
/// @p printAfter if true and adding a machine function pass add an extra
|
|
|
|
/// machine printer pass afterwards
|
|
|
|
/// @p verifyAfter if true and adding a machine function pass add an extra
|
|
|
|
/// machine verification pass afterwards.
|
|
|
|
AnalysisID addPass(AnalysisID PassID, bool verifyAfter = true,
|
|
|
|
bool printAfter = true);
|
2012-02-03 05:12:41 +00:00
|
|
|
|
2012-07-02 19:48:45 +00:00
|
|
|
/// Add a pass to the PassManager if that pass is supposed to be run, as
|
2013-08-05 11:11:11 +00:00
|
|
|
/// determined by the StartAfter and StopAfter options. Takes ownership of the
|
|
|
|
/// pass.
|
2014-12-11 21:26:47 +00:00
|
|
|
/// @p printAfter if true and adding a machine function pass add an extra
|
|
|
|
/// machine printer pass afterwards
|
|
|
|
/// @p verifyAfter if true and adding a machine function pass add an extra
|
|
|
|
/// machine verification pass afterwards.
|
|
|
|
void addPass(Pass *P, bool verifyAfter = true, bool printAfter = true);
|
2012-07-02 19:48:31 +00:00
|
|
|
|
2012-02-10 04:10:36 +00:00
|
|
|
/// addMachinePasses helper to create the target-selected or overriden
|
|
|
|
/// regalloc pass.
|
|
|
|
FunctionPass *createRegAllocPass(bool Optimized);
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
/// printAndVerify - Add a pass to dump then verify the machine function, if
|
|
|
|
/// those steps are enabled.
|
|
|
|
///
|
2014-12-11 21:26:47 +00:00
|
|
|
void printAndVerify(const std::string &Banner);
|
|
|
|
|
|
|
|
/// Add a pass to print the machine function if printing is enabled.
|
|
|
|
void addPrintPass(const std::string &Banner);
|
|
|
|
|
|
|
|
/// Add a pass to perform basic verification of the machine function if
|
|
|
|
/// verification is enabled.
|
|
|
|
void addVerifyPass(const std::string &Banner);
|
2012-02-03 05:12:41 +00:00
|
|
|
};
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
/// List of target independent CodeGen pass IDs.
|
|
|
|
namespace llvm {
|
2014-08-21 21:50:01 +00:00
|
|
|
FunctionPass *createAtomicExpandPass(const TargetMachine *TM);
|
2014-04-17 18:22:47 +00:00
|
|
|
|
2004-07-02 05:44:13 +00:00
|
|
|
/// createUnreachableBlockEliminationPass - The LLVM code generator does not
|
|
|
|
/// work well with unreachable basic blocks (what live ranges make sense for a
|
|
|
|
/// block that cannot be reached?). As such, a code generator should either
|
2010-08-06 21:31:35 +00:00
|
|
|
/// not instruction select unreachable blocks, or run this pass as its
|
2004-07-02 05:44:13 +00:00
|
|
|
/// last LLVM modifying pass to clean up blocks that are not reachable from
|
|
|
|
/// the entry block.
|
|
|
|
FunctionPass *createUnreachableBlockEliminationPass();
|
2005-04-21 20:39:54 +00:00
|
|
|
|
2003-12-20 10:18:58 +00:00
|
|
|
/// MachineFunctionPrinter pass - This pass prints out the machine function to
|
2010-08-06 21:31:35 +00:00
|
|
|
/// the given stream as a debugging tool.
|
2010-04-02 23:17:14 +00:00
|
|
|
MachineFunctionPass *
|
|
|
|
createMachineFunctionPrinterPass(raw_ostream &OS,
|
|
|
|
const std::string &Banner ="");
|
2004-01-30 21:53:46 +00:00
|
|
|
|
2014-02-22 00:07:45 +00:00
|
|
|
/// createCodeGenPreparePass - Transform the code to expose more pattern
|
|
|
|
/// matching during instruction selection.
|
2014-04-14 00:51:57 +00:00
|
|
|
FunctionPass *createCodeGenPreparePass(const TargetMachine *TM = nullptr);
|
2014-02-22 00:07:45 +00:00
|
|
|
|
2014-08-21 21:50:01 +00:00
|
|
|
/// AtomicExpandID -- Lowers atomic operations in terms of either cmpxchg
|
|
|
|
/// load-linked/store-conditional loops.
|
|
|
|
extern char &AtomicExpandID;
|
2014-04-17 18:22:47 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineLoopInfo - This pass is a loop analysis pass.
|
2010-08-06 18:33:48 +00:00
|
|
|
extern char &MachineLoopInfoID;
|
2008-01-04 20:54:55 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineDominators - This pass is a machine dominators analysis pass.
|
2010-08-06 18:33:48 +00:00
|
|
|
extern char &MachineDominatorsID;
|
2008-01-04 20:54:55 +00:00
|
|
|
|
2014-07-12 21:59:52 +00:00
|
|
|
/// MachineDominanaceFrontier - This pass is a machine dominators analysis pass.
|
|
|
|
extern char &MachineDominanceFrontierID;
|
|
|
|
|
2011-01-04 21:10:05 +00:00
|
|
|
/// EdgeBundles analysis - Bundle machine CFG edges.
|
|
|
|
extern char &EdgeBundlesID;
|
|
|
|
|
2012-02-10 04:10:36 +00:00
|
|
|
/// LiveVariables pass - This pass computes the set of blocks in which each
|
|
|
|
/// variable is life and sets machine operand kill flags.
|
|
|
|
extern char &LiveVariablesID;
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// PHIElimination - This pass eliminates machine instruction PHI nodes
|
2003-12-20 10:18:58 +00:00
|
|
|
/// by inserting copy instructions. This destroys SSA information, but is the
|
|
|
|
/// desired input for some register allocators. This pass is "required" by
|
|
|
|
/// these register allocator like this: AU.addRequiredID(PHIEliminationID);
|
2010-08-06 18:33:48 +00:00
|
|
|
extern char &PHIEliminationID;
|
2010-08-06 21:31:35 +00:00
|
|
|
|
2012-08-03 22:12:54 +00:00
|
|
|
/// LiveIntervals - This analysis keeps track of the live ranges of virtual
|
|
|
|
/// and physical registers.
|
|
|
|
extern char &LiveIntervalsID;
|
|
|
|
|
2010-10-26 00:11:33 +00:00
|
|
|
/// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
|
|
|
|
extern char &LiveStacksID;
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// TwoAddressInstruction - This pass reduces two-address instructions to
|
2003-12-20 10:18:58 +00:00
|
|
|
/// use two operands. This destroys SSA information but it is desired by
|
|
|
|
/// register allocators.
|
2010-08-06 18:33:48 +00:00
|
|
|
extern char &TwoAddressInstructionPassID;
|
2003-01-13 01:01:31 +00:00
|
|
|
|
2012-02-10 04:10:36 +00:00
|
|
|
/// ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
|
|
|
|
extern char &ProcessImplicitDefsID;
|
|
|
|
|
|
|
|
/// RegisterCoalescer - This pass merges live ranges to eliminate copies.
|
|
|
|
extern char &RegisterCoalescerID;
|
2011-08-09 00:29:53 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineScheduler - This pass schedules machine instructions.
|
2012-01-17 06:55:03 +00:00
|
|
|
extern char &MachineSchedulerID;
|
2012-01-13 06:30:30 +00:00
|
|
|
|
2013-12-28 21:56:51 +00:00
|
|
|
/// PostMachineScheduler - This pass schedules machine instructions postRA.
|
|
|
|
extern char &PostMachineSchedulerID;
|
|
|
|
|
2011-01-06 01:21:53 +00:00
|
|
|
/// SpillPlacement analysis. Suggest optimal placement of spill code between
|
|
|
|
/// basic blocks.
|
|
|
|
extern char &SpillPlacementID;
|
|
|
|
|
2012-06-08 23:44:45 +00:00
|
|
|
/// VirtRegRewriter pass. Rewrite virtual registers to physical registers as
|
|
|
|
/// assigned in VirtRegMap.
|
|
|
|
extern char &VirtRegRewriterID;
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// UnreachableMachineBlockElimination - This pass removes unreachable
|
2008-08-04 23:54:43 +00:00
|
|
|
/// machine basic blocks.
|
2010-08-06 18:33:48 +00:00
|
|
|
extern char &UnreachableMachineBlockElimID;
|
2008-08-04 23:54:43 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// DeadMachineInstructionElim - This pass removes dead machine instructions.
|
|
|
|
extern char &DeadMachineInstructionElimID;
|
2008-09-17 00:43:24 +00:00
|
|
|
|
2010-04-21 18:02:42 +00:00
|
|
|
/// FastRegisterAllocation Pass - This pass register allocates as fast as
|
|
|
|
/// possible. It is best suited for debug code where live ranges are short.
|
|
|
|
///
|
|
|
|
FunctionPass *createFastRegisterAllocator();
|
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
/// BasicRegisterAllocation Pass - This pass implements a degenerate global
|
|
|
|
/// register allocator using the basic regalloc framework.
|
|
|
|
///
|
|
|
|
FunctionPass *createBasicRegisterAllocator();
|
|
|
|
|
2010-12-08 03:26:16 +00:00
|
|
|
/// Greedy register allocation pass - This pass implements a global register
|
|
|
|
/// allocator for optimized builds.
|
|
|
|
///
|
|
|
|
FunctionPass *createGreedyRegisterAllocator();
|
|
|
|
|
2008-10-02 18:29:27 +00:00
|
|
|
/// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean
|
|
|
|
/// Quadratic Prograaming (PBQP) based register allocator.
|
|
|
|
///
|
2010-09-23 04:28:54 +00:00
|
|
|
FunctionPass *createDefaultPBQPRegisterAllocator();
|
2003-01-13 01:01:31 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// PrologEpilogCodeInserter - This pass inserts prolog and epilog code,
|
2003-12-20 10:18:58 +00:00
|
|
|
/// and eliminates abstract frame references.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &PrologEpilogCodeInserterID;
|
2010-08-06 21:31:35 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// ExpandPostRAPseudos - This pass expands pseudo instructions after
|
2011-09-25 16:46:08 +00:00
|
|
|
/// register allocation.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &ExpandPostRAPseudosID;
|
2003-09-30 20:14:43 +00:00
|
|
|
|
2009-10-16 21:06:15 +00:00
|
|
|
/// createPostRAScheduler - This pass performs post register allocation
|
|
|
|
/// scheduling.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &PostRASchedulerID;
|
2007-07-13 17:13:54 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// BranchFolding - This pass performs machine code CFG based
|
2004-07-31 09:59:14 +00:00
|
|
|
/// optimizations to delete branches to branches, eliminate branches to
|
|
|
|
/// successor blocks (creating fall throughs), and eliminating branches over
|
|
|
|
/// branches.
|
2012-02-08 21:22:48 +00:00
|
|
|
extern char &BranchFolderPassID;
|
2004-07-31 09:59:14 +00:00
|
|
|
|
2012-05-30 00:17:12 +00:00
|
|
|
/// MachineFunctionPrinterPass - This pass prints out MachineInstr's.
|
|
|
|
extern char &MachineFunctionPrinterPassID;
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// TailDuplicate - Duplicate blocks with unconditional branches
|
2009-11-26 00:32:21 +00:00
|
|
|
/// into tails of their predecessors.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &TailDuplicateID;
|
2009-11-26 00:32:21 +00:00
|
|
|
|
2012-07-26 18:38:11 +00:00
|
|
|
/// MachineTraceMetrics - This pass computes critical path and CPU resource
|
|
|
|
/// usage in an ensemble of traces.
|
|
|
|
extern char &MachineTraceMetricsID;
|
|
|
|
|
2012-07-04 00:09:54 +00:00
|
|
|
/// EarlyIfConverter - This pass performs if-conversion on SSA form by
|
|
|
|
/// inserting cmov instructions.
|
|
|
|
extern char &EarlyIfConverterID;
|
|
|
|
|
2014-08-03 21:35:39 +00:00
|
|
|
/// This pass performs instruction combining using trace metrics to estimate
|
|
|
|
/// critical-path and resource depth.
|
|
|
|
extern char &MachineCombinerID;
|
|
|
|
|
2012-09-06 09:17:37 +00:00
|
|
|
/// StackSlotColoring - This pass performs stack coloring and merging.
|
|
|
|
/// It merges disjoint allocas to reduce the stack size.
|
|
|
|
extern char &StackColoringID;
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// IfConverter - This pass performs machine code if conversion.
|
|
|
|
extern char &IfConverterID;
|
2007-05-16 02:00:57 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineBlockPlacement - This pass places basic blocks based on branch
|
Implement a block placement pass based on the branch probability and
block frequency analyses. This differs substantially from the existing
block-placement pass in LLVM:
1) It operates on the Machine-IR in the CodeGen layer. This exposes much
more (and more precise) information and opportunities. Also, the
results are more stable due to fewer transforms ocurring after the
pass runs.
2) It uses the generalized probability and frequency analyses. These can
model static heuristics, code annotation derived heuristics as well
as eventual profile loading. By basing the optimization on the
analysis interface it can work from any (or a combination) of these
inputs.
3) It uses a more aggressive algorithm, both building chains from tho
bottom up to maximize benefit, and using an SCC-based walk to layout
chains of blocks in a profitable ordering without O(N^2) iterations
which the old pass involves.
The pass is currently gated behind a flag, and not enabled by default
because it still needs to grow some important features. Most notably, it
needs to support loop aligning and careful layout of loop structures
much as done by hand currently in CodePlacementOpt. Once it supports
these, and has sufficient testing and quality tuning, it should replace
both of these passes.
Thanks to Nick Lewycky and Richard Smith for help authoring & debugging
this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm
forgetting for reviewing and answering all my questions. Writing
a backend pass is *sooo* much better now than it used to be. =D
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 06:46:38 +00:00
|
|
|
/// probabilities.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &MachineBlockPlacementID;
|
Implement a block placement pass based on the branch probability and
block frequency analyses. This differs substantially from the existing
block-placement pass in LLVM:
1) It operates on the Machine-IR in the CodeGen layer. This exposes much
more (and more precise) information and opportunities. Also, the
results are more stable due to fewer transforms ocurring after the
pass runs.
2) It uses the generalized probability and frequency analyses. These can
model static heuristics, code annotation derived heuristics as well
as eventual profile loading. By basing the optimization on the
analysis interface it can work from any (or a combination) of these
inputs.
3) It uses a more aggressive algorithm, both building chains from tho
bottom up to maximize benefit, and using an SCC-based walk to layout
chains of blocks in a profitable ordering without O(N^2) iterations
which the old pass involves.
The pass is currently gated behind a flag, and not enabled by default
because it still needs to grow some important features. Most notably, it
needs to support loop aligning and careful layout of loop structures
much as done by hand currently in CodePlacementOpt. Once it supports
these, and has sufficient testing and quality tuning, it should replace
both of these passes.
Thanks to Nick Lewycky and Richard Smith for help authoring & debugging
this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm
forgetting for reviewing and answering all my questions. Writing
a backend pass is *sooo* much better now than it used to be. =D
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 06:46:38 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineBlockPlacementStats - This pass collects statistics about the
|
2011-11-02 07:17:12 +00:00
|
|
|
/// basic block placement using branch probabilities and block frequency
|
|
|
|
/// information.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &MachineBlockPlacementStatsID;
|
2011-11-02 07:17:12 +00:00
|
|
|
|
2015-01-28 19:28:03 +00:00
|
|
|
/// GCLowering Pass - Used by gc.root to perform its default lowering
|
|
|
|
/// operations.
|
2007-12-11 00:30:17 +00:00
|
|
|
FunctionPass *createGCLoweringPass();
|
2010-08-06 21:31:35 +00:00
|
|
|
|
2015-01-28 19:28:03 +00:00
|
|
|
/// ShadowStackGCLowering - Implements the custom lowering mechanism
|
|
|
|
/// used by the shadow stack GC. Only runs on functions which opt in to
|
|
|
|
/// the shadow stack collector.
|
|
|
|
FunctionPass *createShadowStackGCLoweringPass();
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// GCMachineCodeAnalysis - Target-independent pass to mark safe points
|
|
|
|
/// in machine code. Must be added very late during code generation, just
|
|
|
|
/// prior to output, and importantly after all CFG transformations (such as
|
|
|
|
/// branch folding).
|
|
|
|
extern char &GCMachineCodeAnalysisID;
|
2010-08-06 21:31:35 +00:00
|
|
|
|
2008-08-17 18:44:35 +00:00
|
|
|
/// Creates a pass to print GC metadata.
|
2010-08-06 21:31:35 +00:00
|
|
|
///
|
2009-08-23 03:13:20 +00:00
|
|
|
FunctionPass *createGCInfoPrinter(raw_ostream &OS);
|
2010-08-06 21:31:35 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineCSE - This pass performs global CSE on machine instructions.
|
|
|
|
extern char &MachineCSEID;
|
2010-03-02 02:38:24 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineLICM - This pass performs LICM on machine instructions.
|
|
|
|
extern char &MachineLICMID;
|
Initial commit of the machine code LICM pass. It successfully hoists this:
_foo:
li r2, 0
LBB1_1: ; bb
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
addi r3, r3, 4
cmplw cr0, r2, r4
bne cr0, LBB1_1 ; bb
LBB1_2: ; return
blr
to:
_foo:
li r2, 0
li r5, 0
LBB1_1: ; bb
stw r5, 0(r3)
addi r2, r2, 1
addi r3, r3, 4
cmplw cr0, r2, r4
bne cr0, LBB1_1 ; bb
LBB1_2: ; return
blr
ZOMG!! :-)
Moar to come...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44687 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 21:42:31 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineSinking - This pass performs sinking on machine instructions.
|
|
|
|
extern char &MachineSinkingID;
|
2008-06-04 09:18:41 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// MachineCopyPropagation - This pass performs copy propagation on
|
2012-01-07 03:02:36 +00:00
|
|
|
/// machine instructions.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &MachineCopyPropagationID;
|
2012-01-07 03:02:36 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// PeepholeOptimizer - This pass performs peephole optimizations -
|
2010-08-09 23:59:04 +00:00
|
|
|
/// like extension and comparison eliminations.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &PeepholeOptimizerID;
|
2010-01-13 00:30:23 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// OptimizePHIs - This pass optimizes machine instruction PHIs
|
2010-02-12 01:30:21 +00:00
|
|
|
/// to take advantage of opportunities created during DAG legalization.
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &OptimizePHIsID;
|
2010-02-12 01:30:21 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// StackSlotColoring - This pass performs stack slot coloring.
|
|
|
|
extern char &StackSlotColoringID;
|
2008-11-04 02:10:20 +00:00
|
|
|
|
|
|
|
/// createStackProtectorPass - This pass adds stack protectors to functions.
|
2012-02-08 21:23:13 +00:00
|
|
|
///
|
2013-06-19 20:51:24 +00:00
|
|
|
FunctionPass *createStackProtectorPass(const TargetMachine *TM);
|
2008-11-04 02:10:20 +00:00
|
|
|
|
2009-05-16 00:33:53 +00:00
|
|
|
/// createMachineVerifierPass - This pass verifies cenerated machine code
|
|
|
|
/// instructions for correctness.
|
2012-02-08 21:23:13 +00:00
|
|
|
///
|
2014-12-11 19:41:51 +00:00
|
|
|
FunctionPass *createMachineVerifierPass(const std::string& Banner);
|
2009-05-16 00:33:53 +00:00
|
|
|
|
2009-05-22 20:36:31 +00:00
|
|
|
/// createDwarfEHPass - This pass mulches exception handling code into a form
|
|
|
|
/// adapted to code generation. Required if using dwarf exception handling.
|
2013-06-19 20:51:24 +00:00
|
|
|
FunctionPass *createDwarfEHPass(const TargetMachine *TM);
|
2009-05-22 20:36:31 +00:00
|
|
|
|
2015-01-29 00:41:44 +00:00
|
|
|
/// createWinEHPass - Prepares personality functions used by MSVC on Windows,
|
|
|
|
/// in addition to the Itanium LSDA based personalities.
|
|
|
|
FunctionPass *createWinEHPass(const TargetMachine *TM);
|
|
|
|
|
2012-03-13 20:04:21 +00:00
|
|
|
/// createSjLjEHPreparePass - This pass adapts exception handling code to use
|
2009-08-17 16:41:22 +00:00
|
|
|
/// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
|
2012-02-08 21:23:13 +00:00
|
|
|
///
|
2013-06-19 20:51:24 +00:00
|
|
|
FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM);
|
2009-08-17 16:41:22 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// LocalStackSlotAllocation - This pass assigns local frame indices to stack
|
|
|
|
/// slots relative to one another and allocates base registers to access them
|
|
|
|
/// when it is estimated by the target to be out of range of normal frame
|
|
|
|
/// pointer or stack pointer index addressing.
|
|
|
|
extern char &LocalStackSlotAllocationID;
|
2010-08-14 00:15:52 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// ExpandISelPseudos - This pass expands pseudo-instructions.
|
|
|
|
extern char &ExpandISelPseudosID;
|
2010-11-16 21:02:37 +00:00
|
|
|
|
2011-09-27 23:50:46 +00:00
|
|
|
/// createExecutionDependencyFixPass - This pass fixes execution time
|
|
|
|
/// problems with dependent instructions, such as switching execution
|
|
|
|
/// domains to match.
|
|
|
|
///
|
|
|
|
/// The pass will examine instructions using and defining registers in RC.
|
|
|
|
///
|
|
|
|
FunctionPass *createExecutionDependencyFixPass(const TargetRegisterClass *RC);
|
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// UnpackMachineBundles - This pass unpack machine instruction bundles.
|
|
|
|
extern char &UnpackMachineBundlesID;
|
2011-12-14 02:11:42 +00:00
|
|
|
|
2012-02-08 21:23:13 +00:00
|
|
|
/// FinalizeMachineBundles - This pass finalize machine instruction
|
2012-01-19 07:47:03 +00:00
|
|
|
/// bundles (created earlier, e.g. during pre-RA scheduling).
|
2012-02-08 21:23:13 +00:00
|
|
|
extern char &FinalizeMachineBundlesID;
|
2012-01-19 07:47:03 +00:00
|
|
|
|
2013-12-14 06:53:06 +00:00
|
|
|
/// StackMapLiveness - This pass analyses the register live-out set of
|
|
|
|
/// stackmap/patchpoint intrinsics and attaches the calculated information to
|
|
|
|
/// the intrinsic for later emission to the StackMap.
|
|
|
|
extern char &StackMapLivenessID;
|
|
|
|
|
2014-06-05 19:29:43 +00:00
|
|
|
/// createJumpInstrTables - This pass creates jump-instruction tables.
|
|
|
|
ModulePass *createJumpInstrTablesPass();
|
2014-11-11 21:08:02 +00:00
|
|
|
|
|
|
|
/// createForwardControlFlowIntegrityPass - This pass adds control-flow
|
|
|
|
/// integrity.
|
|
|
|
ModulePass *createForwardControlFlowIntegrityPass();
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2015-03-09 22:45:16 +00:00
|
|
|
/// Target machine pass initializer for passes with dependencies. Use with
|
|
|
|
/// INITIALIZE_TM_PASS_END.
|
|
|
|
#define INITIALIZE_TM_PASS_BEGIN INITIALIZE_PASS_BEGIN
|
|
|
|
|
|
|
|
/// Target machine pass initializer for passes with dependencies. Use with
|
|
|
|
/// INITIALIZE_TM_PASS_BEGIN.
|
|
|
|
#define INITIALIZE_TM_PASS_END(passName, arg, name, cfg, analysis) \
|
2014-06-13 22:57:59 +00:00
|
|
|
PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
|
|
|
|
PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis, \
|
|
|
|
PassInfo::TargetMachineCtor_t(callTargetMachineCtor< passName >)); \
|
|
|
|
Registry.registerPass(*PI, true); \
|
|
|
|
return PI; \
|
|
|
|
} \
|
|
|
|
void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
|
|
|
|
CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
|
|
|
|
}
|
|
|
|
|
2015-03-09 22:45:16 +00:00
|
|
|
/// This initializer registers TargetMachine constructor, so the pass being
|
|
|
|
/// initialized can use target dependent interfaces. Please do not move this
|
|
|
|
/// macro to be together with INITIALIZE_PASS, which is a complete target
|
|
|
|
/// independent initializer, and we don't want to make libScalarOpts depend
|
|
|
|
/// on libCodeGen.
|
|
|
|
#define INITIALIZE_TM_PASS(passName, arg, name, cfg, analysis) \
|
|
|
|
INITIALIZE_TM_PASS_BEGIN(passName, arg, name, cfg, analysis) \
|
|
|
|
INITIALIZE_TM_PASS_END(passName, arg, name, cfg, analysis)
|
|
|
|
|
2003-01-13 01:01:31 +00:00
|
|
|
#endif
|