mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug binary size by 376 KB, and reduces link time for llvm tools slightly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -44,6 +44,7 @@
|
|||||||
#include "llvm/ADT/DepthFirstIterator.h"
|
#include "llvm/ADT/DepthFirstIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ STATISTIC(NumArgumentsDead , "Number of dead pointer args eliminated");
|
|||||||
namespace {
|
namespace {
|
||||||
/// ArgPromotion - The 'by reference' to 'by value' argument promotion pass.
|
/// ArgPromotion - The 'by reference' to 'by value' argument promotion pass.
|
||||||
///
|
///
|
||||||
struct ArgPromotion : public CallGraphSCCPass {
|
struct VISIBILITY_HIDDEN ArgPromotion : public CallGraphSCCPass {
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequired<AliasAnalysis>();
|
AU.addRequired<AliasAnalysis>();
|
||||||
AU.addRequired<TargetData>();
|
AU.addRequired<TargetData>();
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumMerged, "Number of global constants merged");
|
STATISTIC(NumMerged, "Number of global constants merged");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct ConstantMerge : public ModulePass {
|
struct VISIBILITY_HIDDEN ConstantMerge : public ModulePass {
|
||||||
// run - For this pass, process all of the globals in the module,
|
// run - For this pass, process all of the globals in the module,
|
||||||
// eliminating duplicate constants.
|
// eliminating duplicate constants.
|
||||||
//
|
//
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ STATISTIC(NumRetValsEliminated , "Number of unused return values removed");
|
|||||||
namespace {
|
namespace {
|
||||||
/// DAE - The dead argument elimination pass.
|
/// DAE - The dead argument elimination pass.
|
||||||
///
|
///
|
||||||
class DAE : public ModulePass {
|
class VISIBILITY_HIDDEN DAE : public ModulePass {
|
||||||
/// Liveness enum - During our initial pass over the program, we determine
|
/// Liveness enum - During our initial pass over the program, we determine
|
||||||
/// that things are either definately alive, definately dead, or in need of
|
/// that things are either definately alive, definately dead, or in need of
|
||||||
/// interprocedural analysis (MaybeLive).
|
/// interprocedural analysis (MaybeLive).
|
||||||
|
@ -19,12 +19,13 @@
|
|||||||
#include "llvm/TypeSymbolTable.h"
|
#include "llvm/TypeSymbolTable.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
|
STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct DTE : public ModulePass {
|
struct VISIBILITY_HIDDEN DTE : public ModulePass {
|
||||||
// doPassInitialization - For this pass, it removes global symbol table
|
// doPassInitialization - For this pass, it removes global symbol table
|
||||||
// entries for primitive types. These are never used for linking in GCC and
|
// entries for primitive types. These are never used for linking in GCC and
|
||||||
// they make the output uglier to look at, so we nuke them.
|
// they make the output uglier to look at, so we nuke them.
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class FunctionExtractorPass : public ModulePass {
|
/// @brief A pass to extract specific functions and their dependencies.
|
||||||
|
class VISIBILITY_HIDDEN FunctionExtractorPass : public ModulePass {
|
||||||
Function *Named;
|
Function *Named;
|
||||||
bool deleteFunc;
|
bool deleteFunc;
|
||||||
bool reLink;
|
bool reLink;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ STATISTIC(NumFunctions, "Number of functions removed");
|
|||||||
STATISTIC(NumVariables, "Number of global variables removed");
|
STATISTIC(NumVariables, "Number of global variables removed");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct GlobalDCE : public ModulePass {
|
struct VISIBILITY_HIDDEN GlobalDCE : public ModulePass {
|
||||||
// run - Do the GlobalDCE pass on the specified module, optionally updating
|
// run - Do the GlobalDCE pass on the specified module, optionally updating
|
||||||
// the specified callgraph to reflect the changes.
|
// the specified callgraph to reflect the changes.
|
||||||
//
|
//
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Analysis/ConstantFolding.h"
|
#include "llvm/Analysis/ConstantFolding.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -45,7 +46,7 @@ STATISTIC(NumFastCallFns , "Number of functions converted to fastcc");
|
|||||||
STATISTIC(NumCtorsEvaluated, "Number of static ctors evaluated");
|
STATISTIC(NumCtorsEvaluated, "Number of static ctors evaluated");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct GlobalOpt : public ModulePass {
|
struct VISIBILITY_HIDDEN GlobalOpt : public ModulePass {
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequired<TargetData>();
|
AU.addRequired<TargetData>();
|
||||||
}
|
}
|
||||||
@ -68,7 +69,7 @@ ModulePass *llvm::createGlobalOptimizerPass() { return new GlobalOpt(); }
|
|||||||
/// GlobalStatus - As we analyze each global, keep track of some information
|
/// GlobalStatus - As we analyze each global, keep track of some information
|
||||||
/// about it. If we find out that the address of the global is taken, none of
|
/// about it. If we find out that the address of the global is taken, none of
|
||||||
/// this info will be accurate.
|
/// this info will be accurate.
|
||||||
struct GlobalStatus {
|
struct VISIBILITY_HIDDEN GlobalStatus {
|
||||||
/// isLoaded - True if the global is ever loaded. If the global isn't ever
|
/// isLoaded - True if the global is ever loaded. If the global isn't ever
|
||||||
/// loaded it can be deleted.
|
/// loaded it can be deleted.
|
||||||
bool isLoaded;
|
bool isLoaded;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ STATISTIC(NumReturnValProped, "Number of return values turned into constants");
|
|||||||
namespace {
|
namespace {
|
||||||
/// IPCP - The interprocedural constant propagation pass
|
/// IPCP - The interprocedural constant propagation pass
|
||||||
///
|
///
|
||||||
struct IPCP : public ModulePass {
|
struct VISIBILITY_HIDDEN IPCP : public ModulePass {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
private:
|
private:
|
||||||
bool PropagateConstantsIntoArguments(Function &F);
|
bool PropagateConstantsIntoArguments(Function &F);
|
||||||
|
@ -23,13 +23,14 @@
|
|||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumBounceSites, "Number of sites modified");
|
STATISTIC(NumBounceSites, "Number of sites modified");
|
||||||
STATISTIC(NumBounce , "Number of bounce functions created");
|
STATISTIC(NumBounce , "Number of bounce functions created");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class IndMemRemPass : public ModulePass {
|
class VISIBILITY_HIDDEN IndMemRemPass : public ModulePass {
|
||||||
public:
|
public:
|
||||||
virtual bool runOnModule(Module &M);
|
virtual bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
@ -18,11 +18,12 @@
|
|||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct ArgInfo {
|
struct VISIBILITY_HIDDEN ArgInfo {
|
||||||
unsigned ConstantWeight;
|
unsigned ConstantWeight;
|
||||||
unsigned AllocaWeight;
|
unsigned AllocaWeight;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ namespace {
|
|||||||
|
|
||||||
// FunctionInfo - For each function, calculate the size of it in blocks and
|
// FunctionInfo - For each function, calculate the size of it in blocks and
|
||||||
// instructions.
|
// instructions.
|
||||||
struct FunctionInfo {
|
struct VISIBILITY_HIDDEN FunctionInfo {
|
||||||
// NumInsts, NumBlocks - Keep track of how large each function is, which is
|
// NumInsts, NumBlocks - Keep track of how large each function is, which is
|
||||||
// used to estimate the code size cost of inlining it.
|
// used to estimate the code size cost of inlining it.
|
||||||
unsigned NumInsts, NumBlocks;
|
unsigned NumInsts, NumBlocks;
|
||||||
@ -50,7 +51,7 @@ namespace {
|
|||||||
void analyzeFunction(Function *F);
|
void analyzeFunction(Function *F);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SimpleInliner : public Inliner {
|
class VISIBILITY_HIDDEN SimpleInliner : public Inliner {
|
||||||
std::map<const Function*, FunctionInfo> CachedFunctionInfo;
|
std::map<const Function*, FunctionInfo> CachedFunctionInfo;
|
||||||
public:
|
public:
|
||||||
int getInlineCost(CallSite CS);
|
int getInlineCost(CallSite CS);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -41,7 +42,7 @@ namespace {
|
|||||||
cl::desc("A list of symbol names to preserve"),
|
cl::desc("A list of symbol names to preserve"),
|
||||||
cl::CommaSeparated);
|
cl::CommaSeparated);
|
||||||
|
|
||||||
class InternalizePass : public ModulePass {
|
class VISIBILITY_HIDDEN InternalizePass : public ModulePass {
|
||||||
std::set<std::string> ExternalNames;
|
std::set<std::string> ExternalNames;
|
||||||
bool DontInternalize;
|
bool DontInternalize;
|
||||||
public:
|
public:
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/FunctionUtils.h"
|
#include "llvm/Transforms/Utils/FunctionUtils.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -32,7 +33,7 @@ namespace {
|
|||||||
// FIXME: This is not a function pass, but the PassManager doesn't allow
|
// FIXME: This is not a function pass, but the PassManager doesn't allow
|
||||||
// Module passes to require FunctionPasses, so we can't get loop info if we're
|
// Module passes to require FunctionPasses, so we can't get loop info if we're
|
||||||
// not a function pass.
|
// not a function pass.
|
||||||
struct LoopExtractor : public FunctionPass {
|
struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
|
||||||
unsigned NumLoops;
|
unsigned NumLoops;
|
||||||
|
|
||||||
LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}
|
LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/ADT/DepthFirstIterator.h"
|
#include "llvm/ADT/DepthFirstIterator.h"
|
||||||
@ -58,7 +59,7 @@ STATISTIC(InvokesTransformed , "Number of invokes modified");
|
|||||||
namespace {
|
namespace {
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// LowerSetJmp pass implementation.
|
// LowerSetJmp pass implementation.
|
||||||
class LowerSetJmp : public ModulePass,
|
class VISIBILITY_HIDDEN LowerSetJmp : public ModulePass,
|
||||||
public InstVisitor<LowerSetJmp> {
|
public InstVisitor<LowerSetJmp> {
|
||||||
// LLVM library functions...
|
// LLVM library functions...
|
||||||
Constant *InitSJMap; // __llvm_sjljeh_init_setjmpmap
|
Constant *InitSJMap; // __llvm_sjljeh_init_setjmpmap
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/Analysis/CallGraph.h"
|
#include "llvm/Analysis/CallGraph.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -32,7 +33,7 @@ STATISTIC(NumRemoved, "Number of invokes removed");
|
|||||||
STATISTIC(NumUnreach, "Number of noreturn calls optimized");
|
STATISTIC(NumUnreach, "Number of noreturn calls optimized");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct PruneEH : public CallGraphSCCPass {
|
struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass {
|
||||||
/// DoesNotUnwind - This set contains all of the functions which we have
|
/// DoesNotUnwind - This set contains all of the functions which we have
|
||||||
/// determined cannot unwind.
|
/// determined cannot unwind.
|
||||||
std::set<CallGraphNode*> DoesNotUnwind;
|
std::set<CallGraphNode*> DoesNotUnwind;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ namespace {
|
|||||||
// RaiseAllocations - Turn %malloc and %free calls into the appropriate
|
// RaiseAllocations - Turn %malloc and %free calls into the appropriate
|
||||||
// instruction.
|
// instruction.
|
||||||
//
|
//
|
||||||
class RaiseAllocations : public ModulePass {
|
class VISIBILITY_HIDDEN RaiseAllocations : public ModulePass {
|
||||||
Function *MallocFunc; // Functions in the module we are processing
|
Function *MallocFunc; // Functions in the module we are processing
|
||||||
Function *FreeFunc; // Initialized by doPassInitializationVirt
|
Function *FreeFunc; // Initialized by doPassInitializationVirt
|
||||||
public:
|
public:
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "llvm/ADT/hash_map"
|
#include "llvm/ADT/hash_map"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Config/config.h"
|
#include "llvm/Config/config.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
@ -62,7 +63,7 @@ static LibCallOptimization *OptList = 0;
|
|||||||
/// generally short-circuit actually calling the function if there's a simpler
|
/// generally short-circuit actually calling the function if there's a simpler
|
||||||
/// way (e.g. strlen(X) can be reduced to a constant if X is a constant global).
|
/// way (e.g. strlen(X) can be reduced to a constant if X is a constant global).
|
||||||
/// @brief Base class for library call optimizations
|
/// @brief Base class for library call optimizations
|
||||||
class LibCallOptimization {
|
class VISIBILITY_HIDDEN LibCallOptimization {
|
||||||
LibCallOptimization **Prev, *Next;
|
LibCallOptimization **Prev, *Next;
|
||||||
const char *FunctionName; ///< Name of the library call we optimize
|
const char *FunctionName; ///< Name of the library call we optimize
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -142,7 +143,7 @@ public:
|
|||||||
/// validate the call (ValidateLibraryCall). If it is validated, then
|
/// validate the call (ValidateLibraryCall). If it is validated, then
|
||||||
/// the OptimizeCall method is also called.
|
/// the OptimizeCall method is also called.
|
||||||
/// @brief A ModulePass for optimizing well-known function calls.
|
/// @brief A ModulePass for optimizing well-known function calls.
|
||||||
class SimplifyLibCalls : public ModulePass {
|
class VISIBILITY_HIDDEN SimplifyLibCalls : public ModulePass {
|
||||||
public:
|
public:
|
||||||
/// We need some target data for accurate signature details that are
|
/// We need some target data for accurate signature details that are
|
||||||
/// target dependent. So we require target data in our AnalysisUsage.
|
/// target dependent. So we require target data in our AnalysisUsage.
|
||||||
@ -383,15 +384,16 @@ ModulePass *llvm::createSimplifyLibCallsPass() {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Forward declare utility functions.
|
// Forward declare utility functions.
|
||||||
bool getConstantStringLength(Value* V, uint64_t& len, ConstantArray** A = 0 );
|
static bool getConstantStringLength(Value* V, uint64_t& len,
|
||||||
Value *CastToCStr(Value *V, Instruction &IP);
|
ConstantArray** A = 0 );
|
||||||
|
static Value *CastToCStr(Value *V, Instruction &IP);
|
||||||
|
|
||||||
/// This LibCallOptimization will find instances of a call to "exit" that occurs
|
/// This LibCallOptimization will find instances of a call to "exit" that occurs
|
||||||
/// within the "main" function and change it to a simple "ret" instruction with
|
/// within the "main" function and change it to a simple "ret" instruction with
|
||||||
/// the same value passed to the exit function. When this is done, it splits the
|
/// the same value passed to the exit function. When this is done, it splits the
|
||||||
/// basic block at the exit(3) call and deletes the call instruction.
|
/// basic block at the exit(3) call and deletes the call instruction.
|
||||||
/// @brief Replace calls to exit in main with a simple return
|
/// @brief Replace calls to exit in main with a simple return
|
||||||
struct ExitInMainOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN ExitInMainOptimization : public LibCallOptimization {
|
||||||
ExitInMainOptimization() : LibCallOptimization("exit",
|
ExitInMainOptimization() : LibCallOptimization("exit",
|
||||||
"Number of 'exit' calls simplified") {}
|
"Number of 'exit' calls simplified") {}
|
||||||
|
|
||||||
@ -447,7 +449,7 @@ struct ExitInMainOptimization : public LibCallOptimization {
|
|||||||
/// of the constant string. Both of these calls are further reduced, if possible
|
/// of the constant string. Both of these calls are further reduced, if possible
|
||||||
/// on subsequent passes.
|
/// on subsequent passes.
|
||||||
/// @brief Simplify the strcat library function.
|
/// @brief Simplify the strcat library function.
|
||||||
struct StrCatOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrCatOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default constructor
|
/// @brief Default constructor
|
||||||
StrCatOptimization() : LibCallOptimization("strcat",
|
StrCatOptimization() : LibCallOptimization("strcat",
|
||||||
@ -530,7 +532,7 @@ public:
|
|||||||
/// function. It optimizes out cases where the arguments are both constant
|
/// function. It optimizes out cases where the arguments are both constant
|
||||||
/// and the result can be determined statically.
|
/// and the result can be determined statically.
|
||||||
/// @brief Simplify the strcmp library function.
|
/// @brief Simplify the strcmp library function.
|
||||||
struct StrChrOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrChrOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
StrChrOptimization() : LibCallOptimization("strchr",
|
StrChrOptimization() : LibCallOptimization("strchr",
|
||||||
"Number of 'strchr' calls simplified") {}
|
"Number of 'strchr' calls simplified") {}
|
||||||
@ -611,7 +613,7 @@ public:
|
|||||||
/// function. It optimizes out cases where one or both arguments are constant
|
/// function. It optimizes out cases where one or both arguments are constant
|
||||||
/// and the result can be determined statically.
|
/// and the result can be determined statically.
|
||||||
/// @brief Simplify the strcmp library function.
|
/// @brief Simplify the strcmp library function.
|
||||||
struct StrCmpOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrCmpOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
StrCmpOptimization() : LibCallOptimization("strcmp",
|
StrCmpOptimization() : LibCallOptimization("strcmp",
|
||||||
"Number of 'strcmp' calls simplified") {}
|
"Number of 'strcmp' calls simplified") {}
|
||||||
@ -688,7 +690,7 @@ public:
|
|||||||
/// function. It optimizes out cases where one or both arguments are constant
|
/// function. It optimizes out cases where one or both arguments are constant
|
||||||
/// and the result can be determined statically.
|
/// and the result can be determined statically.
|
||||||
/// @brief Simplify the strncmp library function.
|
/// @brief Simplify the strncmp library function.
|
||||||
struct StrNCmpOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrNCmpOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
StrNCmpOptimization() : LibCallOptimization("strncmp",
|
StrNCmpOptimization() : LibCallOptimization("strncmp",
|
||||||
"Number of 'strncmp' calls simplified") {}
|
"Number of 'strncmp' calls simplified") {}
|
||||||
@ -781,7 +783,7 @@ public:
|
|||||||
/// (1) If src and dest are the same and not volatile, just return dest
|
/// (1) If src and dest are the same and not volatile, just return dest
|
||||||
/// (2) If the src is a constant then we can convert to llvm.memmove
|
/// (2) If the src is a constant then we can convert to llvm.memmove
|
||||||
/// @brief Simplify the strcpy library function.
|
/// @brief Simplify the strcpy library function.
|
||||||
struct StrCpyOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrCpyOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
StrCpyOptimization() : LibCallOptimization("strcpy",
|
StrCpyOptimization() : LibCallOptimization("strcpy",
|
||||||
"Number of 'strcpy' calls simplified") {}
|
"Number of 'strcpy' calls simplified") {}
|
||||||
@ -859,7 +861,7 @@ public:
|
|||||||
/// function by replacing it with a constant value if the string provided to
|
/// function by replacing it with a constant value if the string provided to
|
||||||
/// it is a constant array.
|
/// it is a constant array.
|
||||||
/// @brief Simplify the strlen library function.
|
/// @brief Simplify the strlen library function.
|
||||||
struct StrLenOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN StrLenOptimization : public LibCallOptimization {
|
||||||
StrLenOptimization() : LibCallOptimization("strlen",
|
StrLenOptimization() : LibCallOptimization("strlen",
|
||||||
"Number of 'strlen' calls simplified") {}
|
"Number of 'strlen' calls simplified") {}
|
||||||
|
|
||||||
@ -947,7 +949,7 @@ static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) {
|
|||||||
|
|
||||||
/// This memcmpOptimization will simplify a call to the memcmp library
|
/// This memcmpOptimization will simplify a call to the memcmp library
|
||||||
/// function.
|
/// function.
|
||||||
struct memcmpOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN memcmpOptimization : public LibCallOptimization {
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
memcmpOptimization()
|
memcmpOptimization()
|
||||||
: LibCallOptimization("memcmp", "Number of 'memcmp' calls simplified") {}
|
: LibCallOptimization("memcmp", "Number of 'memcmp' calls simplified") {}
|
||||||
@ -1052,7 +1054,7 @@ struct memcmpOptimization : public LibCallOptimization {
|
|||||||
/// bytes depending on the length of the string and the alignment. Additional
|
/// bytes depending on the length of the string and the alignment. Additional
|
||||||
/// optimizations are possible in code generation (sequence of immediate store)
|
/// optimizations are possible in code generation (sequence of immediate store)
|
||||||
/// @brief Simplify the memcpy library function.
|
/// @brief Simplify the memcpy library function.
|
||||||
struct LLVMMemCpyMoveOptzn : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN LLVMMemCpyMoveOptzn : public LibCallOptimization {
|
||||||
LLVMMemCpyMoveOptzn(const char* fname, const char* desc)
|
LLVMMemCpyMoveOptzn(const char* fname, const char* desc)
|
||||||
: LibCallOptimization(fname, desc) {}
|
: LibCallOptimization(fname, desc) {}
|
||||||
|
|
||||||
@ -1129,7 +1131,7 @@ LLVMMemCpyMoveOptzn LLVMMemMoveOptimizer64("llvm.memmove.i64",
|
|||||||
/// This LibCallOptimization will simplify a call to the memset library
|
/// This LibCallOptimization will simplify a call to the memset library
|
||||||
/// function by expanding it out to a single store of size 0, 1, 2, 4, or 8
|
/// function by expanding it out to a single store of size 0, 1, 2, 4, or 8
|
||||||
/// bytes depending on the length argument.
|
/// bytes depending on the length argument.
|
||||||
struct LLVMMemSetOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN LLVMMemSetOptimization : public LibCallOptimization {
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
LLVMMemSetOptimization(const char *Name) : LibCallOptimization(Name,
|
LLVMMemSetOptimization(const char *Name) : LibCallOptimization(Name,
|
||||||
"Number of 'llvm.memset' calls simplified") {}
|
"Number of 'llvm.memset' calls simplified") {}
|
||||||
@ -1232,7 +1234,7 @@ LLVMMemSetOptimization MemSet64Optimizer("llvm.memset.i64");
|
|||||||
/// function. It looks for cases where the result of pow is well known and
|
/// function. It looks for cases where the result of pow is well known and
|
||||||
/// substitutes the appropriate value.
|
/// substitutes the appropriate value.
|
||||||
/// @brief Simplify the pow library function.
|
/// @brief Simplify the pow library function.
|
||||||
struct PowOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN PowOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
PowOptimization() : LibCallOptimization("pow",
|
PowOptimization() : LibCallOptimization("pow",
|
||||||
@ -1293,7 +1295,7 @@ public:
|
|||||||
/// function. It looks for cases where the result of printf is not used and the
|
/// function. It looks for cases where the result of printf is not used and the
|
||||||
/// operation can be reduced to something simpler.
|
/// operation can be reduced to something simpler.
|
||||||
/// @brief Simplify the printf library function.
|
/// @brief Simplify the printf library function.
|
||||||
struct PrintfOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN PrintfOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
PrintfOptimization() : LibCallOptimization("printf",
|
PrintfOptimization() : LibCallOptimization("printf",
|
||||||
@ -1371,7 +1373,7 @@ public:
|
|||||||
/// function. It looks for cases where the result of fprintf is not used and the
|
/// function. It looks for cases where the result of fprintf is not used and the
|
||||||
/// operation can be reduced to something simpler.
|
/// operation can be reduced to something simpler.
|
||||||
/// @brief Simplify the fprintf library function.
|
/// @brief Simplify the fprintf library function.
|
||||||
struct FPrintFOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN FPrintFOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
FPrintFOptimization() : LibCallOptimization("fprintf",
|
FPrintFOptimization() : LibCallOptimization("fprintf",
|
||||||
@ -1491,7 +1493,7 @@ public:
|
|||||||
/// function. It looks for cases where the result of sprintf is not used and the
|
/// function. It looks for cases where the result of sprintf is not used and the
|
||||||
/// operation can be reduced to something simpler.
|
/// operation can be reduced to something simpler.
|
||||||
/// @brief Simplify the sprintf library function.
|
/// @brief Simplify the sprintf library function.
|
||||||
struct SPrintFOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN SPrintFOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
SPrintFOptimization() : LibCallOptimization("sprintf",
|
SPrintFOptimization() : LibCallOptimization("sprintf",
|
||||||
@ -1614,7 +1616,7 @@ public:
|
|||||||
/// function. It looks for cases where the result of fputs is not used and the
|
/// function. It looks for cases where the result of fputs is not used and the
|
||||||
/// operation can be reduced to something simpler.
|
/// operation can be reduced to something simpler.
|
||||||
/// @brief Simplify the puts library function.
|
/// @brief Simplify the puts library function.
|
||||||
struct PutsOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN PutsOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
PutsOptimization() : LibCallOptimization("fputs",
|
PutsOptimization() : LibCallOptimization("fputs",
|
||||||
@ -1675,7 +1677,7 @@ public:
|
|||||||
/// This LibCallOptimization will simplify calls to the "isdigit" library
|
/// This LibCallOptimization will simplify calls to the "isdigit" library
|
||||||
/// function. It simply does range checks the parameter explicitly.
|
/// function. It simply does range checks the parameter explicitly.
|
||||||
/// @brief Simplify the isdigit library function.
|
/// @brief Simplify the isdigit library function.
|
||||||
struct isdigitOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN isdigitOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
isdigitOptimization() : LibCallOptimization("isdigit",
|
isdigitOptimization() : LibCallOptimization("isdigit",
|
||||||
"Number of 'isdigit' calls simplified") {}
|
"Number of 'isdigit' calls simplified") {}
|
||||||
@ -1716,7 +1718,7 @@ public:
|
|||||||
}
|
}
|
||||||
} isdigitOptimizer;
|
} isdigitOptimizer;
|
||||||
|
|
||||||
struct isasciiOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN isasciiOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
isasciiOptimization()
|
isasciiOptimization()
|
||||||
: LibCallOptimization("isascii", "Number of 'isascii' calls simplified") {}
|
: LibCallOptimization("isascii", "Number of 'isascii' calls simplified") {}
|
||||||
@ -1746,7 +1748,7 @@ public:
|
|||||||
/// function. It simply does the corresponding and operation to restrict the
|
/// function. It simply does the corresponding and operation to restrict the
|
||||||
/// range of values to the ASCII character set (0-127).
|
/// range of values to the ASCII character set (0-127).
|
||||||
/// @brief Simplify the toascii library function.
|
/// @brief Simplify the toascii library function.
|
||||||
struct ToAsciiOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN ToAsciiOptimization : public LibCallOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
ToAsciiOptimization() : LibCallOptimization("toascii",
|
ToAsciiOptimization() : LibCallOptimization("toascii",
|
||||||
@ -1775,7 +1777,7 @@ public:
|
|||||||
/// optimization is to compute the result at compile time if the argument is
|
/// optimization is to compute the result at compile time if the argument is
|
||||||
/// a constant.
|
/// a constant.
|
||||||
/// @brief Simplify the ffs library function.
|
/// @brief Simplify the ffs library function.
|
||||||
struct FFSOptimization : public LibCallOptimization {
|
struct VISIBILITY_HIDDEN FFSOptimization : public LibCallOptimization {
|
||||||
protected:
|
protected:
|
||||||
/// @brief Subclass Constructor
|
/// @brief Subclass Constructor
|
||||||
FFSOptimization(const char* funcName, const char* description)
|
FFSOptimization(const char* funcName, const char* description)
|
||||||
@ -1855,7 +1857,7 @@ public:
|
|||||||
/// calls. It simply uses FFSOptimization for which the transformation is
|
/// calls. It simply uses FFSOptimization for which the transformation is
|
||||||
/// identical.
|
/// identical.
|
||||||
/// @brief Simplify the ffsl library function.
|
/// @brief Simplify the ffsl library function.
|
||||||
struct FFSLOptimization : public FFSOptimization {
|
struct VISIBILITY_HIDDEN FFSLOptimization : public FFSOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
FFSLOptimization() : FFSOptimization("ffsl",
|
FFSLOptimization() : FFSOptimization("ffsl",
|
||||||
@ -1867,7 +1869,7 @@ public:
|
|||||||
/// calls. It simply uses FFSOptimization for which the transformation is
|
/// calls. It simply uses FFSOptimization for which the transformation is
|
||||||
/// identical.
|
/// identical.
|
||||||
/// @brief Simplify the ffsl library function.
|
/// @brief Simplify the ffsl library function.
|
||||||
struct FFSLLOptimization : public FFSOptimization {
|
struct VISIBILITY_HIDDEN FFSLLOptimization : public FFSOptimization {
|
||||||
public:
|
public:
|
||||||
/// @brief Default Constructor
|
/// @brief Default Constructor
|
||||||
FFSLLOptimization() : FFSOptimization("ffsll",
|
FFSLLOptimization() : FFSOptimization("ffsll",
|
||||||
@ -1909,7 +1911,7 @@ struct UnaryDoubleFPOptimizer : public LibCallOptimization {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct FloorOptimization : public UnaryDoubleFPOptimizer {
|
struct VISIBILITY_HIDDEN FloorOptimization : public UnaryDoubleFPOptimizer {
|
||||||
FloorOptimization()
|
FloorOptimization()
|
||||||
: UnaryDoubleFPOptimizer("floor", "Number of 'floor' calls simplified") {}
|
: UnaryDoubleFPOptimizer("floor", "Number of 'floor' calls simplified") {}
|
||||||
|
|
||||||
@ -1923,7 +1925,7 @@ struct FloorOptimization : public UnaryDoubleFPOptimizer {
|
|||||||
}
|
}
|
||||||
} FloorOptimizer;
|
} FloorOptimizer;
|
||||||
|
|
||||||
struct CeilOptimization : public UnaryDoubleFPOptimizer {
|
struct VISIBILITY_HIDDEN CeilOptimization : public UnaryDoubleFPOptimizer {
|
||||||
CeilOptimization()
|
CeilOptimization()
|
||||||
: UnaryDoubleFPOptimizer("ceil", "Number of 'ceil' calls simplified") {}
|
: UnaryDoubleFPOptimizer("ceil", "Number of 'ceil' calls simplified") {}
|
||||||
|
|
||||||
@ -1937,7 +1939,7 @@ struct CeilOptimization : public UnaryDoubleFPOptimizer {
|
|||||||
}
|
}
|
||||||
} CeilOptimizer;
|
} CeilOptimizer;
|
||||||
|
|
||||||
struct RoundOptimization : public UnaryDoubleFPOptimizer {
|
struct VISIBILITY_HIDDEN RoundOptimization : public UnaryDoubleFPOptimizer {
|
||||||
RoundOptimization()
|
RoundOptimization()
|
||||||
: UnaryDoubleFPOptimizer("round", "Number of 'round' calls simplified") {}
|
: UnaryDoubleFPOptimizer("round", "Number of 'round' calls simplified") {}
|
||||||
|
|
||||||
@ -1951,7 +1953,7 @@ struct RoundOptimization : public UnaryDoubleFPOptimizer {
|
|||||||
}
|
}
|
||||||
} RoundOptimizer;
|
} RoundOptimizer;
|
||||||
|
|
||||||
struct RintOptimization : public UnaryDoubleFPOptimizer {
|
struct VISIBILITY_HIDDEN RintOptimization : public UnaryDoubleFPOptimizer {
|
||||||
RintOptimization()
|
RintOptimization()
|
||||||
: UnaryDoubleFPOptimizer("rint", "Number of 'rint' calls simplified") {}
|
: UnaryDoubleFPOptimizer("rint", "Number of 'rint' calls simplified") {}
|
||||||
|
|
||||||
@ -1965,7 +1967,7 @@ struct RintOptimization : public UnaryDoubleFPOptimizer {
|
|||||||
}
|
}
|
||||||
} RintOptimizer;
|
} RintOptimizer;
|
||||||
|
|
||||||
struct NearByIntOptimization : public UnaryDoubleFPOptimizer {
|
struct VISIBILITY_HIDDEN NearByIntOptimization : public UnaryDoubleFPOptimizer {
|
||||||
NearByIntOptimization()
|
NearByIntOptimization()
|
||||||
: UnaryDoubleFPOptimizer("nearbyint",
|
: UnaryDoubleFPOptimizer("nearbyint",
|
||||||
"Number of 'nearbyint' calls simplified") {}
|
"Number of 'nearbyint' calls simplified") {}
|
||||||
@ -1990,7 +1992,8 @@ struct NearByIntOptimization : public UnaryDoubleFPOptimizer {
|
|||||||
/// of the null-terminated string. If false is returned, the conditions were
|
/// of the null-terminated string. If false is returned, the conditions were
|
||||||
/// not met and len is set to 0.
|
/// not met and len is set to 0.
|
||||||
/// @brief Get the length of a constant string (null-terminated array).
|
/// @brief Get the length of a constant string (null-terminated array).
|
||||||
bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) {
|
static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
|
||||||
|
{
|
||||||
assert(V != 0 && "Invalid args to getConstantStringLength");
|
assert(V != 0 && "Invalid args to getConstantStringLength");
|
||||||
len = 0; // make sure we initialize this
|
len = 0; // make sure we initialize this
|
||||||
User* GEP = 0;
|
User* GEP = 0;
|
||||||
@ -2079,7 +2082,7 @@ bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) {
|
|||||||
/// CastToCStr - Return V if it is an sbyte*, otherwise cast it to sbyte*,
|
/// CastToCStr - Return V if it is an sbyte*, otherwise cast it to sbyte*,
|
||||||
/// inserting the cast before IP, and return the cast.
|
/// inserting the cast before IP, and return the cast.
|
||||||
/// @brief Cast a value to a "C" string.
|
/// @brief Cast a value to a "C" string.
|
||||||
Value *CastToCStr(Value *V, Instruction &IP) {
|
static Value *CastToCStr(Value *V, Instruction &IP) {
|
||||||
assert(isa<PointerType>(V->getType()) &&
|
assert(isa<PointerType>(V->getType()) &&
|
||||||
"Can't cast non-pointer type to C string type");
|
"Can't cast non-pointer type to C string type");
|
||||||
const Type *SBPTy = PointerType::get(Type::Int8Ty);
|
const Type *SBPTy = PointerType::get(Type::Int8Ty);
|
||||||
|
@ -30,10 +30,11 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/ValueSymbolTable.h"
|
#include "llvm/ValueSymbolTable.h"
|
||||||
#include "llvm/TypeSymbolTable.h"
|
#include "llvm/TypeSymbolTable.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class StripSymbols : public ModulePass {
|
class VISIBILITY_HIDDEN StripSymbols : public ModulePass {
|
||||||
bool OnlyDebugInfo;
|
bool OnlyDebugInfo;
|
||||||
public:
|
public:
|
||||||
StripSymbols(bool ODI = false) : OnlyDebugInfo(ODI) {}
|
StripSymbols(bool ODI = false) : OnlyDebugInfo(ODI) {}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
#include "RSProfiling.h"
|
#include "RSProfiling.h"
|
||||||
@ -30,7 +31,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class FunctionProfiler : public RSProfilers_std {
|
class VISIBILITY_HIDDEN FunctionProfiler : public RSProfilers_std {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
@ -29,7 +30,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class EdgeProfiler : public ModulePass {
|
class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ namespace {
|
|||||||
BLACK
|
BLACK
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EmitFunctionTable : public ModulePass {
|
struct VISIBILITY_HIDDEN EmitFunctionTable : public ModulePass {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
#include "RSProfiling.h"
|
#include "RSProfiling.h"
|
||||||
@ -66,7 +67,7 @@ namespace {
|
|||||||
/// NullProfilerRS - The basic profiler that does nothing. It is the default
|
/// NullProfilerRS - The basic profiler that does nothing. It is the default
|
||||||
/// profiler and thus terminates RSProfiler chains. It is useful for
|
/// profiler and thus terminates RSProfiler chains. It is useful for
|
||||||
/// measuring framework overhead
|
/// measuring framework overhead
|
||||||
class NullProfilerRS : public RSProfilers {
|
class VISIBILITY_HIDDEN NullProfilerRS : public RSProfilers {
|
||||||
public:
|
public:
|
||||||
bool isProfiling(Value* v) {
|
bool isProfiling(Value* v) {
|
||||||
return false;
|
return false;
|
||||||
@ -85,7 +86,7 @@ namespace {
|
|||||||
static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
|
static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
|
||||||
|
|
||||||
/// Chooser - Something that chooses when to make a sample of the profiled code
|
/// Chooser - Something that chooses when to make a sample of the profiled code
|
||||||
class Chooser {
|
class VISIBILITY_HIDDEN Chooser {
|
||||||
public:
|
public:
|
||||||
/// ProcessChoicePoint - is called for each basic block inserted to choose
|
/// ProcessChoicePoint - is called for each basic block inserted to choose
|
||||||
/// between normal and sample code
|
/// between normal and sample code
|
||||||
@ -99,7 +100,7 @@ namespace {
|
|||||||
//Things that implement sampling policies
|
//Things that implement sampling policies
|
||||||
//A global value that is read-mod-stored to choose when to sample.
|
//A global value that is read-mod-stored to choose when to sample.
|
||||||
//A sample is taken when the global counter hits 0
|
//A sample is taken when the global counter hits 0
|
||||||
class GlobalRandomCounter : public Chooser {
|
class VISIBILITY_HIDDEN GlobalRandomCounter : public Chooser {
|
||||||
GlobalVariable* Counter;
|
GlobalVariable* Counter;
|
||||||
Value* ResetValue;
|
Value* ResetValue;
|
||||||
const Type* T;
|
const Type* T;
|
||||||
@ -111,7 +112,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Same is GRC, but allow register allocation of the global counter
|
//Same is GRC, but allow register allocation of the global counter
|
||||||
class GlobalRandomCounterOpt : public Chooser {
|
class VISIBILITY_HIDDEN GlobalRandomCounterOpt : public Chooser {
|
||||||
GlobalVariable* Counter;
|
GlobalVariable* Counter;
|
||||||
Value* ResetValue;
|
Value* ResetValue;
|
||||||
AllocaInst* AI;
|
AllocaInst* AI;
|
||||||
@ -125,7 +126,7 @@ namespace {
|
|||||||
|
|
||||||
//Use the cycle counter intrinsic as a source of pseudo randomness when
|
//Use the cycle counter intrinsic as a source of pseudo randomness when
|
||||||
//deciding when to sample.
|
//deciding when to sample.
|
||||||
class CycleCounter : public Chooser {
|
class VISIBILITY_HIDDEN CycleCounter : public Chooser {
|
||||||
uint64_t rm;
|
uint64_t rm;
|
||||||
Constant *F;
|
Constant *F;
|
||||||
public:
|
public:
|
||||||
@ -136,7 +137,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// ProfilerRS - Insert the random sampling framework
|
/// ProfilerRS - Insert the random sampling framework
|
||||||
struct ProfilerRS : public FunctionPass {
|
struct VISIBILITY_HIDDEN ProfilerRS : public FunctionPass {
|
||||||
std::map<Value*, Value*> TransCache;
|
std::map<Value*, Value*> TransCache;
|
||||||
std::set<BasicBlock*> ChoicePoints;
|
std::set<BasicBlock*> ChoicePoints;
|
||||||
Chooser* c;
|
Chooser* c;
|
||||||
|
@ -21,12 +21,13 @@
|
|||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Transforms/Instrumentation.h"
|
#include "llvm/Transforms/Instrumentation.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class TraceBasicBlocks : public ModulePass {
|
class VISIBILITY_HIDDEN TraceBasicBlocks : public ModulePass {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "llvm/ADT/DepthFirstIterator.h"
|
#include "llvm/ADT/DepthFirstIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ namespace {
|
|||||||
// This class does all of the work of Aggressive Dead Code Elimination.
|
// This class does all of the work of Aggressive Dead Code Elimination.
|
||||||
// It's public interface consists of a constructor and a doADCE() method.
|
// It's public interface consists of a constructor and a doADCE() method.
|
||||||
//
|
//
|
||||||
class ADCE : public FunctionPass {
|
class VISIBILITY_HIDDEN ADCE : public FunctionPass {
|
||||||
Function *Func; // The function that we are working on
|
Function *Func; // The function that we are working on
|
||||||
std::vector<Instruction*> WorkList; // Instructions that just became live
|
std::vector<Instruction*> WorkList; // Instructions that just became live
|
||||||
std::set<Instruction*> LiveSet; // The set of live instructions
|
std::set<Instruction*> LiveSet; // The set of live instructions
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -39,7 +40,7 @@ using namespace llvm;
|
|||||||
STATISTIC(NumMoved, "Number of basic blocks moved");
|
STATISTIC(NumMoved, "Number of basic blocks moved");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct BlockPlacement : public FunctionPass {
|
struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ STATISTIC(NumBrThread, "Number of CFG edges threaded through branches");
|
|||||||
STATISTIC(NumSwThread, "Number of CFG edges threaded through switches");
|
STATISTIC(NumSwThread, "Number of CFG edges threaded through switches");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct CondProp : public FunctionPass {
|
struct VISIBILITY_HIDDEN CondProp : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/Constant.h"
|
#include "llvm/Constant.h"
|
||||||
#include "llvm/Instruction.h"
|
#include "llvm/Instruction.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -32,7 +33,7 @@ using namespace llvm;
|
|||||||
STATISTIC(NumInstKilled, "Number of instructions killed");
|
STATISTIC(NumInstKilled, "Number of instructions killed");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct ConstantPropagation : public FunctionPass {
|
struct VISIBILITY_HIDDEN ConstantPropagation : public FunctionPass {
|
||||||
bool runOnFunction(Function &F);
|
bool runOnFunction(Function &F);
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Support/ConstantRange.h"
|
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
|
#include "llvm/Support/ConstantRange.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/PostOrderIterator.h"
|
#include "llvm/ADT/PostOrderIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -52,7 +53,7 @@ STATISTIC(BranchRevectors, "Number of branches revectored");
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class ValueInfo;
|
class ValueInfo;
|
||||||
class Relation {
|
class VISIBILITY_HIDDEN Relation {
|
||||||
Value *Val; // Relation to what value?
|
Value *Val; // Relation to what value?
|
||||||
unsigned Rel; // SetCC or ICmp relation, or Add if no information
|
unsigned Rel; // SetCC or ICmp relation, or Add if no information
|
||||||
public:
|
public:
|
||||||
@ -96,7 +97,7 @@ namespace {
|
|||||||
// relationships to other values in the program (specified with Relation) that
|
// relationships to other values in the program (specified with Relation) that
|
||||||
// are known to be valid in a region.
|
// are known to be valid in a region.
|
||||||
//
|
//
|
||||||
class ValueInfo {
|
class VISIBILITY_HIDDEN ValueInfo {
|
||||||
// RelationShips - this value is know to have the specified relationships to
|
// RelationShips - this value is know to have the specified relationships to
|
||||||
// other values. There can only be one entry per value, and this list is
|
// other values. There can only be one entry per value, and this list is
|
||||||
// kept sorted by the Val field.
|
// kept sorted by the Val field.
|
||||||
@ -167,7 +168,7 @@ namespace {
|
|||||||
// the RegionInfo for their dominator, because anything known in a dominator
|
// the RegionInfo for their dominator, because anything known in a dominator
|
||||||
// is known to be true in a dominated block as well.
|
// is known to be true in a dominated block as well.
|
||||||
//
|
//
|
||||||
class RegionInfo {
|
class VISIBILITY_HIDDEN RegionInfo {
|
||||||
BasicBlock *BB;
|
BasicBlock *BB;
|
||||||
|
|
||||||
// ValueMap - Tracks the ValueInformation known for this region
|
// ValueMap - Tracks the ValueInformation known for this region
|
||||||
@ -218,7 +219,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// CEE - Correlated Expression Elimination
|
/// CEE - Correlated Expression Elimination
|
||||||
class CEE : public FunctionPass {
|
class VISIBILITY_HIDDEN CEE : public FunctionPass {
|
||||||
std::map<Value*, unsigned> RankMap;
|
std::map<Value*, unsigned> RankMap;
|
||||||
std::map<BasicBlock*, RegionInfo> RegionInfoMap;
|
std::map<BasicBlock*, RegionInfo> RegionInfoMap;
|
||||||
ETForest *EF;
|
ETForest *EF;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Instruction.h"
|
#include "llvm/Instruction.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -33,7 +34,7 @@ namespace {
|
|||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// DeadInstElimination pass implementation
|
// DeadInstElimination pass implementation
|
||||||
//
|
//
|
||||||
struct DeadInstElimination : public BasicBlockPass {
|
struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass {
|
||||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
|
for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
|
||||||
|
@ -26,13 +26,14 @@
|
|||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/ADT/SetVector.h"
|
#include "llvm/ADT/SetVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumStores, "Number of stores deleted");
|
STATISTIC(NumStores, "Number of stores deleted");
|
||||||
STATISTIC(NumOther , "Number of other instrs removed");
|
STATISTIC(NumOther , "Number of other instrs removed");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct DSE : public FunctionPass {
|
struct VISIBILITY_HIDDEN DSE : public FunctionPass {
|
||||||
|
|
||||||
virtual bool runOnFunction(Function &F) {
|
virtual bool runOnFunction(Function &F) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/Analysis/ValueNumbering.h"
|
#include "llvm/Analysis/ValueNumbering.h"
|
||||||
#include "llvm/ADT/DepthFirstIterator.h"
|
#include "llvm/ADT/DepthFirstIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ STATISTIC(NumNonInsts , "Number of instructions removed due "
|
|||||||
STATISTIC(NumArgsRepl , "Number of function arguments replaced "
|
STATISTIC(NumArgsRepl , "Number of function arguments replaced "
|
||||||
"with constant values");
|
"with constant values");
|
||||||
namespace {
|
namespace {
|
||||||
struct GCSE : public FunctionPass {
|
struct VISIBILITY_HIDDEN GCSE : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "llvm/Analysis/ScalarEvolutionExpander.h"
|
#include "llvm/Analysis/ScalarEvolutionExpander.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
@ -61,7 +62,7 @@ STATISTIC(NumReplaced, "Number of exit values replaced");
|
|||||||
STATISTIC(NumLFTR , "Number of loop exit tests replaced");
|
STATISTIC(NumLFTR , "Number of loop exit tests replaced");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class IndVarSimplify : public FunctionPass {
|
class VISIBILITY_HIDDEN IndVarSimplify : public FunctionPass {
|
||||||
LoopInfo *LI;
|
LoopInfo *LI;
|
||||||
ScalarEvolution *SE;
|
ScalarEvolution *SE;
|
||||||
bool Changed;
|
bool Changed;
|
||||||
|
@ -41,8 +41,9 @@
|
|||||||
#include "llvm/Analysis/AliasAnalysis.h"
|
#include "llvm/Analysis/AliasAnalysis.h"
|
||||||
#include "llvm/Analysis/AliasSetTracker.h"
|
#include "llvm/Analysis/AliasSetTracker.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Support/CFG.h"
|
|
||||||
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
||||||
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -60,7 +61,7 @@ namespace {
|
|||||||
DisablePromotion("disable-licm-promotion", cl::Hidden,
|
DisablePromotion("disable-licm-promotion", cl::Hidden,
|
||||||
cl::desc("Disable memory promotion in LICM pass"));
|
cl::desc("Disable memory promotion in LICM pass"));
|
||||||
|
|
||||||
struct LICM : public FunctionPass {
|
struct VISIBILITY_HIDDEN LICM : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
/// This transformation requires natural loop information & requires that
|
/// This transformation requires natural loop information & requires that
|
||||||
|
@ -46,7 +46,7 @@ namespace {
|
|||||||
/// the stride is stored externally. The Offset member keeps track of the
|
/// the stride is stored externally. The Offset member keeps track of the
|
||||||
/// offset from the IV, User is the actual user of the operand, and 'Operand'
|
/// offset from the IV, User is the actual user of the operand, and 'Operand'
|
||||||
/// is the operand # of the User that is the use.
|
/// is the operand # of the User that is the use.
|
||||||
struct IVStrideUse {
|
struct VISIBILITY_HIDDEN IVStrideUse {
|
||||||
SCEVHandle Offset;
|
SCEVHandle Offset;
|
||||||
Instruction *User;
|
Instruction *User;
|
||||||
Value *OperandValToReplace;
|
Value *OperandValToReplace;
|
||||||
@ -66,7 +66,7 @@ namespace {
|
|||||||
/// have an operand that is based on the trip count multiplied by some stride.
|
/// have an operand that is based on the trip count multiplied by some stride.
|
||||||
/// The stride for all of these users is common and kept external to this
|
/// The stride for all of these users is common and kept external to this
|
||||||
/// structure.
|
/// structure.
|
||||||
struct IVUsersOfOneStride {
|
struct VISIBILITY_HIDDEN IVUsersOfOneStride {
|
||||||
/// Users - Keep track of all of the users of this stride as well as the
|
/// Users - Keep track of all of the users of this stride as well as the
|
||||||
/// initial value and the operand that uses the IV.
|
/// initial value and the operand that uses the IV.
|
||||||
std::vector<IVStrideUse> Users;
|
std::vector<IVStrideUse> Users;
|
||||||
@ -79,7 +79,7 @@ namespace {
|
|||||||
/// IVInfo - This structure keeps track of one IV expression inserted during
|
/// IVInfo - This structure keeps track of one IV expression inserted during
|
||||||
/// StrengthReduceStridedIVUsers. It contains the stride, the common base, as
|
/// StrengthReduceStridedIVUsers. It contains the stride, the common base, as
|
||||||
/// well as the PHI node and increment value created for rewrite.
|
/// well as the PHI node and increment value created for rewrite.
|
||||||
struct IVExpr {
|
struct VISIBILITY_HIDDEN IVExpr {
|
||||||
SCEVHandle Stride;
|
SCEVHandle Stride;
|
||||||
SCEVHandle Base;
|
SCEVHandle Base;
|
||||||
PHINode *PHI;
|
PHINode *PHI;
|
||||||
@ -95,7 +95,7 @@ namespace {
|
|||||||
|
|
||||||
/// IVsOfOneStride - This structure keeps track of all IV expression inserted
|
/// IVsOfOneStride - This structure keeps track of all IV expression inserted
|
||||||
/// during StrengthReduceStridedIVUsers for a particular stride of the IV.
|
/// during StrengthReduceStridedIVUsers for a particular stride of the IV.
|
||||||
struct IVsOfOneStride {
|
struct VISIBILITY_HIDDEN IVsOfOneStride {
|
||||||
std::vector<IVExpr> IVs;
|
std::vector<IVExpr> IVs;
|
||||||
|
|
||||||
void addIV(const SCEVHandle &Stride, const SCEVHandle &Base, PHINode *PHI,
|
void addIV(const SCEVHandle &Stride, const SCEVHandle &Base, PHINode *PHI,
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -44,7 +45,7 @@ namespace {
|
|||||||
UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
|
UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
|
||||||
cl::desc("The cut-off point for loop unrolling"));
|
cl::desc("The cut-off point for loop unrolling"));
|
||||||
|
|
||||||
class LoopUnroll : public FunctionPass {
|
class VISIBILITY_HIDDEN LoopUnroll : public FunctionPass {
|
||||||
LoopInfo *LI; // The current loop information
|
LoopInfo *LI; // The current loop information
|
||||||
public:
|
public:
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
@ -39,8 +39,9 @@
|
|||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/PostOrderIterator.h"
|
#include "llvm/ADT/PostOrderIterator.h"
|
||||||
#include "llvm/Support/Debug.h"
|
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -56,7 +57,7 @@ namespace {
|
|||||||
Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
|
Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
|
||||||
cl::init(10), cl::Hidden);
|
cl::init(10), cl::Hidden);
|
||||||
|
|
||||||
class LoopUnswitch : public FunctionPass {
|
class VISIBILITY_HIDDEN LoopUnswitch : public FunctionPass {
|
||||||
LoopInfo *LI; // Loop information
|
LoopInfo *LI; // Loop information
|
||||||
|
|
||||||
// LoopProcessWorklist - List of loops we need to process.
|
// LoopProcessWorklist - List of loops we need to process.
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
@ -36,7 +37,8 @@ namespace {
|
|||||||
///
|
///
|
||||||
/// @brief Transforms packed instructions to simpler instructions.
|
/// @brief Transforms packed instructions to simpler instructions.
|
||||||
///
|
///
|
||||||
class LowerPacked : public FunctionPass, public InstVisitor<LowerPacked> {
|
class VISIBILITY_HIDDEN LowerPacked
|
||||||
|
: public FunctionPass, public InstVisitor<LowerPacked> {
|
||||||
public:
|
public:
|
||||||
/// @brief Lowers packed operations to scalar operations.
|
/// @brief Lowers packed operations to scalar operations.
|
||||||
/// @param F The fuction to process
|
/// @param F The fuction to process
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/PostOrderIterator.h"
|
#include "llvm/ADT/PostOrderIterator.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -41,7 +42,7 @@ STATISTIC(NumAnnihil, "Number of expr tree annihilated");
|
|||||||
STATISTIC(NumFactor , "Number of multiplies factored");
|
STATISTIC(NumFactor , "Number of multiplies factored");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct ValueEntry {
|
struct VISIBILITY_HIDDEN ValueEntry {
|
||||||
unsigned Rank;
|
unsigned Rank;
|
||||||
Value *Op;
|
Value *Op;
|
||||||
ValueEntry(unsigned R, Value *O) : Rank(R), Op(O) {}
|
ValueEntry(unsigned R, Value *O) : Rank(R), Op(O) {}
|
||||||
@ -63,7 +64,7 @@ static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class Reassociate : public FunctionPass {
|
class VISIBILITY_HIDDEN Reassociate : public FunctionPass {
|
||||||
std::map<BasicBlock*, unsigned> RankMap;
|
std::map<BasicBlock*, unsigned> RankMap;
|
||||||
std::map<Value*, unsigned> ValueRankMap;
|
std::map<Value*, unsigned> ValueRankMap;
|
||||||
bool MadeChange;
|
bool MadeChange;
|
||||||
|
@ -25,13 +25,14 @@
|
|||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumDemoted, "Number of registers demoted");
|
STATISTIC(NumDemoted, "Number of registers demoted");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct RegToMem : public FunctionPass {
|
struct VISIBILITY_HIDDEN RegToMem : public FunctionPass {
|
||||||
|
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequiredID(BreakCriticalEdgesID);
|
AU.addRequiredID(BreakCriticalEdgesID);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "llvm/Analysis/ConstantFolding.h"
|
#include "llvm/Analysis/ConstantFolding.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "llvm/ADT/DenseMap.h"
|
#include "llvm/ADT/DenseMap.h"
|
||||||
@ -53,7 +54,7 @@ namespace {
|
|||||||
/// LatticeVal class - This class represents the different lattice values that
|
/// LatticeVal class - This class represents the different lattice values that
|
||||||
/// an LLVM value may occupy. It is a simple class with value semantics.
|
/// an LLVM value may occupy. It is a simple class with value semantics.
|
||||||
///
|
///
|
||||||
class LatticeVal {
|
class VISIBILITY_HIDDEN LatticeVal {
|
||||||
enum {
|
enum {
|
||||||
/// undefined - This LLVM Value has no known value yet.
|
/// undefined - This LLVM Value has no known value yet.
|
||||||
undefined,
|
undefined,
|
||||||
@ -1332,7 +1333,7 @@ namespace {
|
|||||||
/// SCCP Class - This class uses the SCCPSolver to implement a per-function
|
/// SCCP Class - This class uses the SCCPSolver to implement a per-function
|
||||||
/// Sparse Conditional Constant Propagator.
|
/// Sparse Conditional Constant Propagator.
|
||||||
///
|
///
|
||||||
struct SCCP : public FunctionPass {
|
struct VISIBILITY_HIDDEN SCCP : public FunctionPass {
|
||||||
// runOnFunction - Run the Sparse Conditional Constant Propagation
|
// runOnFunction - Run the Sparse Conditional Constant Propagation
|
||||||
// algorithm, and return true if the function was modified.
|
// algorithm, and return true if the function was modified.
|
||||||
//
|
//
|
||||||
@ -1440,7 +1441,7 @@ namespace {
|
|||||||
/// IPSCCP Class - This class implements interprocedural Sparse Conditional
|
/// IPSCCP Class - This class implements interprocedural Sparse Conditional
|
||||||
/// Constant Propagation.
|
/// Constant Propagation.
|
||||||
///
|
///
|
||||||
struct IPSCCP : public ModulePass {
|
struct VISIBILITY_HIDDEN IPSCCP : public ModulePass {
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -33,7 +34,7 @@ using namespace llvm;
|
|||||||
STATISTIC(NumSimpl, "Number of blocks simplified");
|
STATISTIC(NumSimpl, "Number of blocks simplified");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct CFGSimplifyPass : public FunctionPass {
|
struct VISIBILITY_HIDDEN CFGSimplifyPass : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
};
|
};
|
||||||
RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
|
RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -39,7 +40,7 @@ namespace {
|
|||||||
cl::opt<unsigned>
|
cl::opt<unsigned>
|
||||||
Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
|
Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
|
||||||
cl::init(6), cl::Hidden);
|
cl::init(6), cl::Hidden);
|
||||||
class TailDup : public FunctionPass {
|
class VISIBILITY_HIDDEN TailDup : public FunctionPass {
|
||||||
bool runOnFunction(Function &F);
|
bool runOnFunction(Function &F);
|
||||||
private:
|
private:
|
||||||
inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI);
|
inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI);
|
||||||
|
@ -59,13 +59,14 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumEliminated, "Number of tail calls removed");
|
STATISTIC(NumEliminated, "Number of tail calls removed");
|
||||||
STATISTIC(NumAccumAdded, "Number of accumulators introduced");
|
STATISTIC(NumAccumAdded, "Number of accumulators introduced");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct TailCallElim : public FunctionPass {
|
struct VISIBILITY_HIDDEN TailCallElim : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "ValueMapper.h"
|
#include "ValueMapper.h"
|
||||||
#include "llvm/Analysis/ConstantFolding.h"
|
#include "llvm/Analysis/ConstantFolding.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
@ -152,7 +153,7 @@ Function *llvm::CloneFunction(const Function *F,
|
|||||||
namespace {
|
namespace {
|
||||||
/// PruningFunctionCloner - This class is a private class used to implement
|
/// PruningFunctionCloner - This class is a private class used to implement
|
||||||
/// the CloneAndPruneFunctionInto method.
|
/// the CloneAndPruneFunctionInto method.
|
||||||
struct PruningFunctionCloner {
|
struct VISIBILITY_HIDDEN PruningFunctionCloner {
|
||||||
Function *NewFunc;
|
Function *NewFunc;
|
||||||
const Function *OldFunc;
|
const Function *OldFunc;
|
||||||
DenseMap<const Value*, Value*> &ValueMap;
|
DenseMap<const Value*, Value*> &ValueMap;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -40,7 +41,7 @@ AggregateArgsOpt("aggregate-extracted-args", cl::Hidden,
|
|||||||
cl::desc("Aggregate arguments to code-extracted functions"));
|
cl::desc("Aggregate arguments to code-extracted functions"));
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class CodeExtractor {
|
class VISIBILITY_HIDDEN CodeExtractor {
|
||||||
typedef std::vector<Value*> Values;
|
typedef std::vector<Value*> Values;
|
||||||
std::set<BasicBlock*> BlocksToExtract;
|
std::set<BasicBlock*> BlocksToExtract;
|
||||||
DominatorSet *DS;
|
DominatorSet *DS;
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -45,7 +46,7 @@ using namespace llvm;
|
|||||||
STATISTIC(NumLCSSA, "Number of live out of a loop variables");
|
STATISTIC(NumLCSSA, "Number of live out of a loop variables");
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct LCSSA : public FunctionPass {
|
struct VISIBILITY_HIDDEN LCSSA : public FunctionPass {
|
||||||
// Cached analysis information for the current function.
|
// Cached analysis information for the current function.
|
||||||
LoopInfo *LI;
|
LoopInfo *LI;
|
||||||
DominatorTree *DT;
|
DominatorTree *DT;
|
||||||
|
@ -24,12 +24,13 @@
|
|||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
|
#include "llvm/Support/Compiler.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
/// LowerSelect - Turn select instructions into conditional branches.
|
/// LowerSelect - Turn select instructions into conditional branches.
|
||||||
///
|
///
|
||||||
class LowerSelect : public FunctionPass {
|
class VISIBILITY_HIDDEN LowerSelect : public FunctionPass {
|
||||||
bool OnlyFP; // Only lower FP select instructions?
|
bool OnlyFP; // Only lower FP select instructions?
|
||||||
public:
|
public:
|
||||||
LowerSelect(bool onlyfp = false) : OnlyFP(onlyfp) {}
|
LowerSelect(bool onlyfp = false) : OnlyFP(onlyfp) {}
|
||||||
|
Reference in New Issue
Block a user