mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-25 16:31:33 +00:00
Switch over Transforms/Scalar to use the STATISTIC macro. For each statistic
converted, we lose a static initializer. This also allows GCC to emit warnings about unused statistics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
193c88cb56
commit
0e5f499638
@ -13,6 +13,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "adce"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Instructions.h"
|
||||
@ -29,11 +30,11 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumBlockRemoved("adce", "Number of basic blocks removed");
|
||||
Statistic NumInstRemoved ("adce", "Number of instructions removed");
|
||||
Statistic NumCallRemoved ("adce", "Number of calls and invokes removed");
|
||||
STATISTIC(NumBlockRemoved, "Number of basic blocks removed");
|
||||
STATISTIC(NumInstRemoved , "Number of instructions removed");
|
||||
STATISTIC(NumCallRemoved , "Number of calls and invokes removed");
|
||||
|
||||
namespace {
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ADCE Class
|
||||
//
|
||||
|
@ -26,6 +26,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "block-placement"
|
||||
#include "llvm/Analysis/ProfileInfo.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Pass.h"
|
||||
@ -35,9 +36,9 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumMoved("block-placement", "Number of basic blocks moved");
|
||||
STATISTIC(NumMoved, "Number of basic blocks moved");
|
||||
|
||||
namespace {
|
||||
struct BlockPlacement : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -25,12 +25,10 @@
|
||||
#include "llvm/Support/Streams.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic
|
||||
NumBrThread("condprop", "Number of CFG edges threaded through branches");
|
||||
Statistic
|
||||
NumSwThread("condprop", "Number of CFG edges threaded through switches");
|
||||
STATISTIC(NumBrThread, "Number of CFG edges threaded through branches");
|
||||
STATISTIC(NumSwThread, "Number of CFG edges threaded through switches");
|
||||
|
||||
namespace {
|
||||
struct CondProp : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "constprop"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Constant.h"
|
||||
@ -28,9 +29,9 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumInstKilled("constprop", "Number of instructions killed");
|
||||
STATISTIC(NumInstKilled, "Number of instructions killed");
|
||||
|
||||
namespace {
|
||||
struct ConstantPropagation : public FunctionPass {
|
||||
bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "cee"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Pass.h"
|
||||
@ -44,11 +45,11 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
|
||||
Statistic NumOperandsCann("cee", "Number of operands canonicalized");
|
||||
Statistic BranchRevectors("cee", "Number of branches revectored");
|
||||
STATISTIC(NumSetCCRemoved, "Number of setcc instruction eliminated");
|
||||
STATISTIC(NumOperandsCann, "Number of operands canonicalized");
|
||||
STATISTIC(BranchRevectors, "Number of branches revectored");
|
||||
|
||||
namespace {
|
||||
class ValueInfo;
|
||||
class Relation {
|
||||
Value *Val; // Relation to what value?
|
||||
|
@ -16,6 +16,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "dce"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Instruction.h"
|
||||
@ -25,14 +26,13 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic DIEEliminated("die", "Number of insts removed");
|
||||
Statistic DCEEliminated("dce", "Number of insts removed");
|
||||
STATISTIC(DIEEliminated, "Number of insts removed by DIE pass");
|
||||
STATISTIC(DCEEliminated, "Number of insts removed");
|
||||
|
||||
namespace {
|
||||
//===--------------------------------------------------------------------===//
|
||||
// DeadInstElimination pass implementation
|
||||
//
|
||||
|
||||
struct DeadInstElimination : public BasicBlockPass {
|
||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||
bool Changed = false;
|
||||
@ -58,11 +58,10 @@ FunctionPass *llvm::createDeadInstEliminationPass() {
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DeadCodeElimination pass implementation
|
||||
//
|
||||
|
||||
namespace {
|
||||
//===--------------------------------------------------------------------===//
|
||||
// DeadCodeElimination pass implementation
|
||||
//
|
||||
struct DCE : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "dse"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Function.h"
|
||||
@ -27,10 +28,10 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumStores("dse", "Number of stores deleted");
|
||||
Statistic NumOther ("dse", "Number of other instrs removed");
|
||||
STATISTIC(NumStores, "Number of stores deleted");
|
||||
STATISTIC(NumOther , "Number of other instrs removed");
|
||||
|
||||
namespace {
|
||||
struct DSE : public FunctionPass {
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "gcse"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Constant.h"
|
||||
@ -27,15 +28,14 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumInstRemoved, "Number of instructions removed");
|
||||
STATISTIC(NumLoadRemoved, "Number of loads removed");
|
||||
STATISTIC(NumCallRemoved, "Number of calls removed");
|
||||
STATISTIC(NumNonInsts , "Number of instructions removed due "
|
||||
"to non-instruction values");
|
||||
STATISTIC(NumArgsRepl , "Number of function arguments replaced "
|
||||
"with constant values");
|
||||
namespace {
|
||||
Statistic NumInstRemoved("gcse", "Number of instructions removed");
|
||||
Statistic NumLoadRemoved("gcse", "Number of loads removed");
|
||||
Statistic NumCallRemoved("gcse", "Number of calls removed");
|
||||
Statistic NumNonInsts ("gcse", "Number of instructions removed due "
|
||||
"to non-instruction values");
|
||||
Statistic NumArgsRepl ("gcse", "Number of function arguments replaced "
|
||||
"with constant values");
|
||||
|
||||
struct GCSE : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "indvars"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Constants.h"
|
||||
@ -51,13 +52,13 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumRemoved ("indvars", "Number of aux indvars removed");
|
||||
Statistic NumPointer ("indvars", "Number of pointer indvars promoted");
|
||||
Statistic NumInserted("indvars", "Number of canonical indvars added");
|
||||
Statistic NumReplaced("indvars", "Number of exit values replaced");
|
||||
Statistic NumLFTR ("indvars", "Number of loop exit tests replaced");
|
||||
STATISTIC(NumRemoved , "Number of aux indvars removed");
|
||||
STATISTIC(NumPointer , "Number of pointer indvars promoted");
|
||||
STATISTIC(NumInserted, "Number of canonical indvars added");
|
||||
STATISTIC(NumReplaced, "Number of exit values replaced");
|
||||
STATISTIC(NumLFTR , "Number of loop exit tests replaced");
|
||||
|
||||
namespace {
|
||||
class IndVarSimplify : public FunctionPass {
|
||||
LoopInfo *LI;
|
||||
ScalarEvolution *SE;
|
||||
|
@ -55,13 +55,13 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::PatternMatch;
|
||||
|
||||
namespace {
|
||||
Statistic NumCombined ("instcombine", "Number of insts combined");
|
||||
Statistic NumConstProp("instcombine", "Number of constant folds");
|
||||
Statistic NumDeadInst ("instcombine", "Number of dead inst eliminated");
|
||||
Statistic NumDeadStore("instcombine", "Number of dead stores eliminated");
|
||||
Statistic NumSunkInst ("instcombine", "Number of instructions sunk");
|
||||
STATISTIC(NumCombined , "Number of insts combined");
|
||||
STATISTIC(NumConstProp, "Number of constant folds");
|
||||
STATISTIC(NumDeadInst , "Number of dead inst eliminated");
|
||||
STATISTIC(NumDeadStore, "Number of dead stores eliminated");
|
||||
STATISTIC(NumSunkInst , "Number of instructions sunk");
|
||||
|
||||
namespace {
|
||||
class VISIBILITY_HIDDEN InstCombiner
|
||||
: public FunctionPass,
|
||||
public InstVisitor<InstCombiner, Instruction*> {
|
||||
|
@ -49,18 +49,17 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumSunk , "Number of instructions sunk out of loop");
|
||||
STATISTIC(NumHoisted , "Number of instructions hoisted out of loop");
|
||||
STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk");
|
||||
STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk");
|
||||
STATISTIC(NumPromoted , "Number of memory locations promoted to registers");
|
||||
|
||||
namespace {
|
||||
cl::opt<bool>
|
||||
DisablePromotion("disable-licm-promotion", cl::Hidden,
|
||||
cl::desc("Disable memory promotion in LICM pass"));
|
||||
|
||||
Statistic NumSunk("licm", "Number of instructions sunk out of loop");
|
||||
Statistic NumHoisted("licm", "Number of instructions hoisted out of loop");
|
||||
Statistic NumMovedLoads("licm", "Number of load insts hoisted or sunk");
|
||||
Statistic NumMovedCalls("licm", "Number of call insts hoisted or sunk");
|
||||
Statistic NumPromoted("licm",
|
||||
"Number of memory locations promoted to registers");
|
||||
|
||||
struct LICM : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -37,11 +37,11 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumReduced ("loop-reduce", "Number of GEPs strength reduced");
|
||||
Statistic NumInserted("loop-reduce", "Number of PHIs inserted");
|
||||
Statistic NumVariable("loop-reduce","Number of PHIs with variable strides");
|
||||
STATISTIC(NumReduced , "Number of GEPs strength reduced");
|
||||
STATISTIC(NumInserted, "Number of PHIs inserted");
|
||||
STATISTIC(NumVariable, "Number of PHIs with variable strides");
|
||||
|
||||
namespace {
|
||||
/// IVStrideUse - Keep track of one use of a strided induction variable, where
|
||||
/// 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'
|
||||
|
@ -36,9 +36,9 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumUnrolled("loop-unroll", "Number of loops completely unrolled");
|
||||
STATISTIC(NumUnrolled, "Number of loops completely unrolled");
|
||||
|
||||
namespace {
|
||||
cl::opt<unsigned>
|
||||
UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
|
||||
cl::desc("The cut-off point for loop unrolling"));
|
||||
|
@ -43,14 +43,13 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumBranches, "Number of branches unswitched");
|
||||
STATISTIC(NumSwitches, "Number of switches unswitched");
|
||||
STATISTIC(NumSelects , "Number of selects unswitched");
|
||||
STATISTIC(NumTrivial , "Number of unswitches that are trivial");
|
||||
STATISTIC(NumSimplify, "Number of simplifications of unswitched code");
|
||||
|
||||
namespace {
|
||||
Statistic NumBranches("loop-unswitch", "Number of branches unswitched");
|
||||
Statistic NumSwitches("loop-unswitch", "Number of switches unswitched");
|
||||
Statistic NumSelects ("loop-unswitch", "Number of selects unswitched");
|
||||
Statistic NumTrivial ("loop-unswitch",
|
||||
"Number of unswitches that are trivial");
|
||||
Statistic NumSimplify("loop-unswitch",
|
||||
"Number of simplifications of unswitched code");
|
||||
cl::opt<unsigned>
|
||||
Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
|
||||
cl::init(10), cl::Hidden);
|
||||
|
@ -35,13 +35,12 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumLinear ("reassociate","Number of insts linearized");
|
||||
Statistic NumChanged("reassociate","Number of insts reassociated");
|
||||
Statistic NumSwapped("reassociate","Number of insts with operands swapped");
|
||||
Statistic NumAnnihil("reassociate","Number of expr tree annihilated");
|
||||
Statistic NumFactor ("reassociate","Number of multiplies factored");
|
||||
STATISTIC(NumLinear , "Number of insts linearized");
|
||||
STATISTIC(NumChanged, "Number of insts reassociated");
|
||||
STATISTIC(NumAnnihil, "Number of expr tree annihilated");
|
||||
STATISTIC(NumFactor , "Number of multiplies factored");
|
||||
|
||||
namespace {
|
||||
struct ValueEntry {
|
||||
unsigned Rank;
|
||||
Value *Op;
|
||||
|
@ -16,6 +16,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "reg2mem"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Pass.h"
|
||||
@ -24,14 +25,12 @@
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumDemoted, "Number of registers demoted");
|
||||
|
||||
namespace {
|
||||
Statistic NumDemoted("reg2mem", "Number of registers demoted");
|
||||
|
||||
struct RegToMem : public FunctionPass {
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
@ -39,6 +39,16 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumInstRemoved, "Number of instructions removed");
|
||||
STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable");
|
||||
|
||||
STATISTIC(IPNumInstRemoved, "Number ofinstructions removed by IPSCCP");
|
||||
STATISTIC(IPNumDeadBlocks , "Number of basic blocks unreachable by IPSCCP");
|
||||
STATISTIC(IPNumArgsElimed ,"Number of arguments constant propagated by IPSCCP");
|
||||
STATISTIC(IPNumGlobalConst, "Number of globals found to be constant by IPSCCP");
|
||||
|
||||
|
||||
|
||||
// LatticeVal class - This class represents the different lattice values that an
|
||||
// instruction may occupy. It is a simple class with value semantics.
|
||||
//
|
||||
@ -1081,9 +1091,6 @@ bool SCCPSolver::ResolveBranchesIn(Function &F) {
|
||||
|
||||
|
||||
namespace {
|
||||
Statistic NumInstRemoved("sccp", "Number of instructions removed");
|
||||
Statistic NumDeadBlocks ("sccp", "Number of basic blocks unreachable");
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
/// SCCP Class - This class uses the SCCPSolver to implement a per-function
|
||||
@ -1192,13 +1199,6 @@ bool SCCP::runOnFunction(Function &F) {
|
||||
}
|
||||
|
||||
namespace {
|
||||
Statistic IPNumInstRemoved("ipsccp", "Number of instructions removed");
|
||||
Statistic IPNumDeadBlocks ("ipsccp", "Number of basic blocks unreachable");
|
||||
Statistic IPNumArgsElimed ("ipsccp",
|
||||
"Number of arguments constant propagated");
|
||||
Statistic IPNumGlobalConst("ipsccp",
|
||||
"Number of globals found to be constant");
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
/// IPSCCP Class - This class implements interprocedural Sparse Conditional
|
||||
|
@ -19,6 +19,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "scalarrepl"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
@ -36,12 +37,11 @@
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumReplaced("scalarrepl", "Number of allocas broken up");
|
||||
Statistic NumPromoted("scalarrepl", "Number of allocas promoted");
|
||||
Statistic NumConverted("scalarrepl",
|
||||
"Number of aggregates converted to scalar");
|
||||
STATISTIC(NumReplaced, "Number of allocas broken up");
|
||||
STATISTIC(NumPromoted, "Number of allocas promoted");
|
||||
STATISTIC(NumConverted, "Number of aggregates converted to scalar");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN SROA : public FunctionPass {
|
||||
bool runOnFunction(Function &F);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "simplifycfg"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "llvm/Constants.h"
|
||||
@ -29,9 +30,9 @@
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumSimpl("cfgsimplify", "Number of blocks simplified");
|
||||
STATISTIC(NumSimpl, "Number of blocks simplified");
|
||||
|
||||
namespace {
|
||||
struct CFGSimplifyPass : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
};
|
||||
|
@ -33,14 +33,12 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumEliminated, "Number of unconditional branches eliminated");
|
||||
|
||||
namespace {
|
||||
cl::opt<unsigned>
|
||||
Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
|
||||
cl::init(6), cl::Hidden);
|
||||
Statistic NumEliminated("tailduplicate",
|
||||
"Number of unconditional branches eliminated");
|
||||
Statistic NumPHINodes("tailduplicate", "Number of phi nodes inserted");
|
||||
|
||||
class TailDup : public FunctionPass {
|
||||
bool runOnFunction(Function &F);
|
||||
private:
|
||||
|
@ -50,6 +50,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "tailcallelim"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
@ -60,10 +61,10 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
Statistic NumEliminated("tailcallelim", "Number of tail calls removed");
|
||||
Statistic NumAccumAdded("tailcallelim","Number of accumulators introduced");
|
||||
STATISTIC(NumEliminated, "Number of tail calls removed");
|
||||
STATISTIC(NumAccumAdded, "Number of accumulators introduced");
|
||||
|
||||
namespace {
|
||||
struct TailCallElim : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user