1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[Modules] Fix potential ODR violations by sinking the DEBUG_TYPE

definition below all of the header #include lines, lib/Transforms/...
edition.

This one is tricky for two reasons. We again have a couple of passes
that define something else before the includes as well. I've sunk their
name macros with the DEBUG_TYPE.

Also, InstCombine contains headers that need DEBUG_TYPE, so now those
headers #define and #undef DEBUG_TYPE around their code, leaving them
well formed modular headers. Fixing these headers was a large motivation
for all of these changes, as "leaky" macros of this form are hard on the
modules implementation.

llvm-svn: 206844
This commit is contained in:
Chandler Carruth 2014-04-22 02:55:47 +00:00
parent 7b7b0c3523
commit 6f9ba6a633
98 changed files with 202 additions and 111 deletions

View File

@ -12,13 +12,14 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "hello"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "hello"
STATISTIC(HelloCounter, "Counts number of functions greeted"); STATISTIC(HelloCounter, "Counts number of functions greeted");
namespace { namespace {

View File

@ -29,7 +29,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "argpromotion"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -49,6 +48,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "argpromotion"
STATISTIC(NumArgumentsPromoted , "Number of pointer arguments promoted"); STATISTIC(NumArgumentsPromoted , "Number of pointer arguments promoted");
STATISTIC(NumAggregatesPromoted, "Number of aggregate arguments promoted"); STATISTIC(NumAggregatesPromoted, "Number of aggregate arguments promoted");
STATISTIC(NumByValArgsPromoted , "Number of byval arguments promoted"); STATISTIC(NumByValArgsPromoted , "Number of byval arguments promoted");

View File

@ -17,7 +17,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "constmerge"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerIntPair.h"
@ -31,6 +30,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "constmerge"
STATISTIC(NumMerged, "Number of global constants merged"); STATISTIC(NumMerged, "Number of global constants merged");
namespace { namespace {

View File

@ -17,7 +17,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "deadargelim"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -40,6 +39,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "deadargelim"
STATISTIC(NumArgumentsEliminated, "Number of unread args removed"); STATISTIC(NumArgumentsEliminated, "Number of unread args removed");
STATISTIC(NumRetValsEliminated , "Number of unused return values removed"); STATISTIC(NumRetValsEliminated , "Number of unused return values removed");
STATISTIC(NumArgumentsReplacedWithUndef, STATISTIC(NumArgumentsReplacedWithUndef,

View File

@ -18,7 +18,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "functionattrs"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
@ -35,6 +34,8 @@
#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetLibraryInfo.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "functionattrs"
STATISTIC(NumReadNone, "Number of functions marked readnone"); STATISTIC(NumReadNone, "Number of functions marked readnone");
STATISTIC(NumReadOnly, "Number of functions marked readonly"); STATISTIC(NumReadOnly, "Number of functions marked readonly");
STATISTIC(NumNoCapture, "Number of arguments marked nocapture"); STATISTIC(NumNoCapture, "Number of arguments marked nocapture");

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "globaldce"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -24,6 +23,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "globaldce"
STATISTIC(NumAliases , "Number of global aliases removed"); STATISTIC(NumAliases , "Number of global aliases removed");
STATISTIC(NumFunctions, "Number of functions removed"); STATISTIC(NumFunctions, "Number of functions removed");
STATISTIC(NumVariables, "Number of global variables removed"); STATISTIC(NumVariables, "Number of global variables removed");

View File

@ -13,7 +13,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "globalopt"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
@ -44,6 +43,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "globalopt"
STATISTIC(NumMarked , "Number of globals marked constant"); STATISTIC(NumMarked , "Number of globals marked constant");
STATISTIC(NumUnnamed , "Number of globals marked unnamed_addr"); STATISTIC(NumUnnamed , "Number of globals marked unnamed_addr");
STATISTIC(NumSRA , "Number of aggregate globals broken into scalars"); STATISTIC(NumSRA , "Number of aggregate globals broken into scalars");

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "ipconstprop"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -27,6 +26,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "ipconstprop"
STATISTIC(NumArgumentsProped, "Number of args turned into constants"); STATISTIC(NumArgumentsProped, "Number of args turned into constants");
STATISTIC(NumReturnValProped, "Number of return values turned into constants"); STATISTIC(NumReturnValProped, "Number of return values turned into constants");

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "inline"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CallGraph.h"
@ -28,6 +27,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "inline"
namespace { namespace {
/// \brief Inliner pass which only handles "always inline" functions. /// \brief Inliner pass which only handles "always inline" functions.

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "inline"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/InlineCost.h" #include "llvm/Analysis/InlineCost.h"
@ -26,6 +25,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "inline"
namespace { namespace {
/// \brief Actual inliner pass implementation. /// \brief Actual inliner pass implementation.

View File

@ -13,7 +13,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "inline"
#include "llvm/Transforms/IPO/InlinerPass.h" #include "llvm/Transforms/IPO/InlinerPass.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -33,6 +32,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "inline"
STATISTIC(NumInlined, "Number of functions inlined"); STATISTIC(NumInlined, "Number of functions inlined");
STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined"); STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
STATISTIC(NumDeleted, "Number of functions deleted because all callers found"); STATISTIC(NumDeleted, "Number of functions deleted because all callers found");

View File

@ -19,7 +19,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "internalize"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -35,6 +34,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "internalize"
STATISTIC(NumAliases , "Number of aliases internalized"); STATISTIC(NumAliases , "Number of aliases internalized");
STATISTIC(NumFunctions, "Number of functions internalized"); STATISTIC(NumFunctions, "Number of functions internalized");
STATISTIC(NumGlobals , "Number of global vars internalized"); STATISTIC(NumGlobals , "Number of global vars internalized");

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-extract"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/LoopPass.h"
@ -30,6 +29,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-extract"
STATISTIC(NumExtracted, "Number of loops extracted"); STATISTIC(NumExtracted, "Number of loops extracted");
namespace { namespace {

View File

@ -43,7 +43,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "mergefunc"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/FoldingSet.h"
@ -67,6 +66,8 @@
#include <vector> #include <vector>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "mergefunc"
STATISTIC(NumFunctionsMerged, "Number of functions merged"); STATISTIC(NumFunctionsMerged, "Number of functions merged");
STATISTIC(NumThunksWritten, "Number of thunks generated"); STATISTIC(NumThunksWritten, "Number of thunks generated");
STATISTIC(NumAliasesWritten, "Number of aliases generated"); STATISTIC(NumAliasesWritten, "Number of aliases generated");

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "partialinlining"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/CFG.h" #include "llvm/IR/CFG.h"
@ -24,6 +23,8 @@
#include "llvm/Transforms/Utils/CodeExtractor.h" #include "llvm/Transforms/Utils/CodeExtractor.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "partialinlining"
STATISTIC(NumPartialInlined, "Number of functions partially inlined"); STATISTIC(NumPartialInlined, "Number of functions partially inlined");
namespace { namespace {

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "prune-eh"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -30,6 +29,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "prune-eh"
STATISTIC(NumRemoved, "Number of invokes removed"); STATISTIC(NumRemoved, "Number of invokes removed");
STATISTIC(NumUnreach, "Number of noreturn calls optimized"); STATISTIC(NumUnreach, "Number of noreturn calls optimized");

View File

@ -14,13 +14,14 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "strip-dead-prototypes"
#include "llvm/Transforms/IPO.h" #include "llvm/Transforms/IPO.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "strip-dead-prototypes"
STATISTIC(NumDeadPrototypes, "Number of dead prototypes removed"); STATISTIC(NumDeadPrototypes, "Number of dead prototypes removed");
namespace { namespace {

View File

@ -20,6 +20,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/Transforms/Utils/SimplifyLibCalls.h" #include "llvm/Transforms/Utils/SimplifyLibCalls.h"
#define DEBUG_TYPE "instcombine"
namespace llvm { namespace llvm {
class CallSite; class CallSite;
class DataLayout; class DataLayout;
@ -394,8 +396,8 @@ private:
Value *Descale(Value *Val, APInt Scale, bool &NoSignedWrap); Value *Descale(Value *Val, APInt Scale, bool &NoSignedWrap);
}; };
} // end namespace llvm. } // end namespace llvm.
#undef DEBUG_TYPE
#endif #endif

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -21,6 +20,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
namespace { namespace {
/// Class representing coefficient of floating-point addend. /// Class representing coefficient of floating-point addend.

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/ConstantRange.h" #include "llvm/IR/ConstantRange.h"
@ -21,6 +20,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// isFreeToInvert - Return true if the specified value is free to invert (apply /// isFreeToInvert - Return true if the specified value is free to invert (apply
/// ~ to). This happens in cases where the ~ can be eliminated. /// ~ to). This happens in cases where the ~ can be eliminated.
static inline bool isFreeToInvert(Value *V) { static inline bool isFreeToInvert(Value *V) {

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/MemoryBuiltins.h"
@ -23,6 +22,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
STATISTIC(NumSimplified, "Number of library calls simplified"); STATISTIC(NumSimplified, "Number of library calls simplified");
/// getPromotedType - Return the specified type promoted as it would be to pass /// getPromotedType - Return the specified type promoted as it would be to pass

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
@ -20,6 +19,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// DecomposeSimpleLinearExpr - Analyze 'Val', seeing if it is a simple linear /// DecomposeSimpleLinearExpr - Analyze 'Val', seeing if it is a simple linear
/// expression. If so, decompose it, returning some value X, such that Val is /// expression. If so, decompose it, returning some value X, such that Val is
/// X*Scale+Offset. /// X*Scale+Offset.

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -25,6 +24,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
static ConstantInt *getOne(Constant *C) { static ConstantInt *getOne(Constant *C) {
return ConstantInt::get(cast<IntegerType>(C->getType()), 1); return ConstantInt::get(cast<IntegerType>(C->getType()), 1);
} }

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/Loads.h" #include "llvm/Analysis/Loads.h"
@ -21,6 +20,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "instcombine"
STATISTIC(NumDeadStore, "Number of dead stores eliminated"); STATISTIC(NumDeadStore, "Number of dead stores eliminated");
STATISTIC(NumGlobalCopies, "Number of allocas copied from constant global"); STATISTIC(NumGlobalCopies, "Number of allocas copied from constant global");

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
@ -20,6 +19,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// simplifyValueKnownNonZero - The specific integer value is used in a context /// simplifyValueKnownNonZero - The specific integer value is used in a context
/// where it is known to be non-zero. If this allows us to simplify the /// where it is known to be non-zero. If this allows us to simplify the

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -19,6 +18,8 @@
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "instcombine"
/// FoldPHIArgBinOpIntoPHI - If we have something like phi [add (a,b), add(a,c)] /// FoldPHIArgBinOpIntoPHI - If we have something like phi [add (a,b), add(a,c)]
/// and if a/b/c and the add's all have a single use, turn this into a phi /// and if a/b/c and the add's all have a single use, turn this into a phi
/// and a single binop. /// and a single binop.

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -19,6 +18,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// MatchSelectPattern - Pattern match integer [SU]MIN, [SU]MAX, and ABS idioms, /// MatchSelectPattern - Pattern match integer [SU]MIN, [SU]MAX, and ABS idioms,
/// returning the kind and providing the out parameter results if we /// returning the kind and providing the out parameter results if we
/// successfully match. /// successfully match.

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -20,6 +19,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) { Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) {
assert(I.getOperand(1)->getType() == I.getOperand(0)->getType()); assert(I.getOperand(1)->getType() == I.getOperand(0)->getType());
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
@ -21,6 +20,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::PatternMatch; using namespace llvm::PatternMatch;
#define DEBUG_TYPE "instcombine"
/// ShrinkDemandedConstant - Check to see if the specified operand of the /// ShrinkDemandedConstant - Check to see if the specified operand of the
/// specified instruction is a constant integer. If so, check to see if there /// specified instruction is a constant integer. If so, check to see if there
/// are any bits set in the constant that are not demanded. If so, shrink the /// are any bits set in the constant that are not demanded. If so, shrink the

View File

@ -12,12 +12,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm/IR/PatternMatch.h" #include "llvm/IR/PatternMatch.h"
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "instcombine"
/// CheapToScalarize - Return true if the value is cheaper to scalarize than it /// CheapToScalarize - Return true if the value is cheaper to scalarize than it
/// is to leave as a vector operation. isConstant indicates whether we're /// is to leave as a vector operation. isConstant indicates whether we're
/// extracting one known element. If false we're extracting a variable index. /// extracting one known element. If false we're extracting a variable index.

View File

@ -17,6 +17,8 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "instcombine"
namespace llvm { namespace llvm {
/// InstCombineWorklist - This is the worklist management logic for /// InstCombineWorklist - This is the worklist management logic for
@ -100,4 +102,6 @@ public:
} // end namespace llvm. } // end namespace llvm.
#undef DEBUG_TYPE
#endif #endif

View File

@ -33,7 +33,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instcombine"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "InstCombine.h" #include "InstCombine.h"
#include "llvm-c/Initialization.h" #include "llvm-c/Initialization.h"
@ -58,6 +57,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::PatternMatch; using namespace llvm::PatternMatch;
#define DEBUG_TYPE "instcombine"
STATISTIC(NumCombined , "Number of insts combined"); STATISTIC(NumCombined , "Number of insts combined");
STATISTIC(NumConstProp, "Number of constant folds"); STATISTIC(NumConstProp, "Number of constant folds");
STATISTIC(NumDeadInst , "Number of dead inst eliminated"); STATISTIC(NumDeadInst , "Number of dead inst eliminated");

View File

@ -13,8 +13,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "asan"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
@ -53,6 +51,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "asan"
static const uint64_t kDefaultShadowScale = 3; static const uint64_t kDefaultShadowScale = 3;
static const uint64_t kDefaultShadowOffset32 = 1ULL << 29; static const uint64_t kDefaultShadowOffset32 = 1ULL << 29;
static const uint64_t kDefaultShadowOffset64 = 1ULL << 44; static const uint64_t kDefaultShadowOffset64 = 1ULL << 44;

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "bounds-checking"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/MemoryBuiltins.h"
@ -28,6 +27,8 @@
#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetLibraryInfo.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "bounds-checking"
static cl::opt<bool> SingleTrapBB("bounds-checking-single-trap", static cl::opt<bool> SingleTrapBB("bounds-checking-single-trap",
cl::desc("Use one trap block per function")); cl::desc("Use one trap block per function"));

View File

@ -16,8 +16,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "debug-ir"
#include "llvm/IR/ValueMap.h" #include "llvm/IR/ValueMap.h"
#include "DebugIR.h" #include "DebugIR.h"
#include "llvm/IR/AssemblyAnnotationWriter.h" #include "llvm/IR/AssemblyAnnotationWriter.h"
@ -42,6 +40,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "debug-ir"
namespace { namespace {
/// Builds a map of Value* to line numbers on which the Value appears in a /// Builds a map of Value* to line numbers on which the Value appears in a

View File

@ -14,8 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "insert-gcov-profiling"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h" #include "llvm/ADT/Hashing.h"
@ -44,6 +42,8 @@
#include <utility> #include <utility>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "insert-gcov-profiling"
static cl::opt<std::string> static cl::opt<std::string>
DefaultGCOVVersion("default-gcov-version", cl::init("402*"), cl::Hidden, DefaultGCOVVersion("default-gcov-version", cl::init("402*"), cl::Hidden,
cl::ValueRequired); cl::ValueRequired);

View File

@ -93,8 +93,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "msan"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
@ -123,6 +121,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "msan"
static const uint64_t kShadowMask32 = 1ULL << 31; static const uint64_t kShadowMask32 = 1ULL << 31;
static const uint64_t kShadowMask64 = 1ULL << 46; static const uint64_t kShadowMask64 = 1ULL << 46;
static const uint64_t kOriginOffset32 = 1ULL << 30; static const uint64_t kOriginOffset32 = 1ULL << 30;

View File

@ -19,8 +19,6 @@
// The rest is handled by the run-time library. // The rest is handled by the run-time library.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "tsan"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
@ -46,6 +44,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "tsan"
static cl::opt<std::string> ClBlacklistFile("tsan-blacklist", static cl::opt<std::string> ClBlacklistFile("tsan-blacklist",
cl::desc("Blacklist file"), cl::Hidden); cl::desc("Blacklist file"), cl::Hidden);
static cl::opt<bool> ClInstrumentMemoryAccesses( static cl::opt<bool> ClInstrumentMemoryAccesses(

View File

@ -20,7 +20,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "objc-arc-dependency"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "DependencyAnalysis.h" #include "DependencyAnalysis.h"
#include "ProvenanceAnalysis.h" #include "ProvenanceAnalysis.h"
@ -29,6 +28,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::objcarc; using namespace llvm::objcarc;
#define DEBUG_TYPE "objc-arc-dependency"
/// Test whether the given instruction can result in a reference count /// Test whether the given instruction can result in a reference count
/// modification (positive or negative) for the pointer's object. /// modification (positive or negative) for the pointer's object.
bool bool

View File

@ -24,7 +24,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "objc-arc-ap-elim"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
@ -34,6 +33,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::objcarc; using namespace llvm::objcarc;
#define DEBUG_TYPE "objc-arc-ap-elim"
namespace { namespace {
/// \brief Autorelease pool elimination. /// \brief Autorelease pool elimination.
class ObjCARCAPElim : public ModulePass { class ObjCARCAPElim : public ModulePass {

View File

@ -20,7 +20,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "objc-arc-aa"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "ObjCARCAliasAnalysis.h" #include "ObjCARCAliasAnalysis.h"
#include "llvm/IR/Instruction.h" #include "llvm/IR/Instruction.h"
@ -28,6 +27,8 @@
#include "llvm/PassAnalysisSupport.h" #include "llvm/PassAnalysisSupport.h"
#include "llvm/PassSupport.h" #include "llvm/PassSupport.h"
#define DEBUG_TYPE "objc-arc-aa"
namespace llvm { namespace llvm {
class Function; class Function;
class Value; class Value;

View File

@ -26,7 +26,6 @@
// TODO: ObjCARCContract could insert PHI nodes when uses aren't // TODO: ObjCARCContract could insert PHI nodes when uses aren't
// dominated by single calls. // dominated by single calls.
#define DEBUG_TYPE "objc-arc-contract"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "ARCRuntimeEntryPoints.h" #include "ARCRuntimeEntryPoints.h"
#include "DependencyAnalysis.h" #include "DependencyAnalysis.h"
@ -40,6 +39,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::objcarc; using namespace llvm::objcarc;
#define DEBUG_TYPE "objc-arc-contract"
STATISTIC(NumPeeps, "Number of calls peephole-optimized"); STATISTIC(NumPeeps, "Number of calls peephole-optimized");
STATISTIC(NumStoreStrongs, "Number objc_storeStrong calls formed"); STATISTIC(NumStoreStrongs, "Number objc_storeStrong calls formed");

View File

@ -23,8 +23,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "objc-arc-expand"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
@ -40,6 +38,8 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "objc-arc-expand"
namespace llvm { namespace llvm {
class Module; class Module;
} }

View File

@ -24,7 +24,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "objc-arc-opts"
#include "ObjCARC.h" #include "ObjCARC.h"
#include "ARCRuntimeEntryPoints.h" #include "ARCRuntimeEntryPoints.h"
#include "DependencyAnalysis.h" #include "DependencyAnalysis.h"
@ -44,6 +43,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::objcarc; using namespace llvm::objcarc;
#define DEBUG_TYPE "objc-arc-opts"
/// \defgroup MiscUtils Miscellaneous utilities that are not ARC specific. /// \defgroup MiscUtils Miscellaneous utilities that are not ARC specific.
/// @{ /// @{

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "adce"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -28,6 +27,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "adce"
STATISTIC(NumRemoved, "Number of instructions removed"); STATISTIC(NumRemoved, "Number of instructions removed");
namespace { namespace {

View File

@ -33,7 +33,6 @@
// %0 = load i64* inttoptr (i64 big_constant to i64*) // %0 = load i64* inttoptr (i64 big_constant to i64*)
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "consthoist"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -47,6 +46,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "consthoist"
STATISTIC(NumConstantsHoisted, "Number of constants hoisted"); STATISTIC(NumConstantsHoisted, "Number of constants hoisted");
STATISTIC(NumConstantsRebased, "Number of constants rebased"); STATISTIC(NumConstantsRebased, "Number of constants rebased");

View File

@ -18,7 +18,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "constprop"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ConstantFolding.h"
@ -31,6 +30,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "constprop"
STATISTIC(NumInstKilled, "Number of instructions killed"); STATISTIC(NumInstKilled, "Number of instructions killed");
namespace { namespace {

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "correlated-value-propagation"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -26,6 +25,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "correlated-value-propagation"
STATISTIC(NumPhis, "Number of phis propagated"); STATISTIC(NumPhis, "Number of phis propagated");
STATISTIC(NumSelects, "Number of selects propagated"); STATISTIC(NumSelects, "Number of selects propagated");
STATISTIC(NumMemAccess, "Number of memory access targets propagated"); STATISTIC(NumMemAccess, "Number of memory access targets propagated");

View File

@ -16,7 +16,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "dce"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/InstIterator.h" #include "llvm/IR/InstIterator.h"
@ -26,6 +25,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "dce"
STATISTIC(DIEEliminated, "Number of insts removed by DIE pass"); STATISTIC(DIEEliminated, "Number of insts removed by DIE pass");
STATISTIC(DCEEliminated, "Number of insts removed"); STATISTIC(DCEEliminated, "Number of insts removed");

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "dse"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
@ -38,6 +37,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "dse"
STATISTIC(NumFastStores, "Number of stores deleted"); STATISTIC(NumFastStores, "Number of stores deleted");
STATISTIC(NumFastOther , "Number of other instrs removed"); STATISTIC(NumFastOther , "Number of other instrs removed");

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "early-cse"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Hashing.h" #include "llvm/ADT/Hashing.h"
#include "llvm/ADT/ScopedHashTable.h" #include "llvm/ADT/ScopedHashTable.h"
@ -29,6 +28,8 @@
#include <vector> #include <vector>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "early-cse"
STATISTIC(NumSimplify, "Number of instructions simplified or DCE'd"); STATISTIC(NumSimplify, "Number of instructions simplified or DCE'd");
STATISTIC(NumCSE, "Number of instructions CSE'd"); STATISTIC(NumCSE, "Number of instructions CSE'd");
STATISTIC(NumCSELoad, "Number of load instructions CSE'd"); STATISTIC(NumCSELoad, "Number of load instructions CSE'd");

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "flattencfg"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/IR/CFG.h" #include "llvm/IR/CFG.h"
@ -19,6 +18,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "flattencfg"
namespace { namespace {
struct FlattenCFGPass : public FunctionPass { struct FlattenCFGPass : public FunctionPass {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "gvn"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
@ -50,6 +49,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "gvn"
STATISTIC(NumGVNInstr, "Number of instructions deleted"); STATISTIC(NumGVNInstr, "Number of instructions deleted");
STATISTIC(NumGVNLoad, "Number of loads deleted"); STATISTIC(NumGVNLoad, "Number of loads deleted");
STATISTIC(NumGVNPRE, "Number of instructions PRE'd"); STATISTIC(NumGVNPRE, "Number of instructions PRE'd");

View File

@ -51,7 +51,6 @@
// note that we saved 2 registers here almostly "for free". // note that we saved 2 registers here almostly "for free".
// ===---------------------------------------------------------------------===// // ===---------------------------------------------------------------------===//
#define DEBUG_TYPE "global-merge"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -70,6 +69,8 @@
#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetLoweringObjectFile.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "global-merge"
static cl::opt<bool> static cl::opt<bool>
EnableGlobalMerge("global-merge", cl::Hidden, EnableGlobalMerge("global-merge", cl::Hidden,
cl::desc("Enable global merge pass"), cl::desc("Enable global merge pass"),

View File

@ -24,7 +24,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "indvars"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -50,6 +49,8 @@
#include "llvm/Transforms/Utils/SimplifyIndVar.h" #include "llvm/Transforms/Utils/SimplifyIndVar.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "indvars"
STATISTIC(NumWidened , "Number of indvars widened"); STATISTIC(NumWidened , "Number of indvars widened");
STATISTIC(NumReplaced , "Number of exit values replaced"); STATISTIC(NumReplaced , "Number of exit values replaced");
STATISTIC(NumLFTR , "Number of loop exit tests replaced"); STATISTIC(NumLFTR , "Number of loop exit tests replaced");

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "jump-threading"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseSet.h"
@ -38,6 +37,8 @@
#include "llvm/Transforms/Utils/SSAUpdater.h" #include "llvm/Transforms/Utils/SSAUpdater.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "jump-threading"
STATISTIC(NumThreads, "Number of jumps threaded"); STATISTIC(NumThreads, "Number of jumps threaded");
STATISTIC(NumFolds, "Number of terminators folded"); STATISTIC(NumFolds, "Number of terminators folded");
STATISTIC(NumDupes, "Number of branch blocks duplicated to eliminate phi"); STATISTIC(NumDupes, "Number of branch blocks duplicated to eliminate phi");

View File

@ -30,7 +30,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "licm"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
@ -60,6 +59,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "licm"
STATISTIC(NumSunk , "Number of instructions sunk out of loop"); STATISTIC(NumSunk , "Number of instructions sunk out of loop");
STATISTIC(NumHoisted , "Number of instructions hoisted out of loop"); STATISTIC(NumHoisted , "Number of instructions hoisted out of loop");
STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk"); STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk");

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-delete"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -23,6 +22,8 @@
#include "llvm/IR/Dominators.h" #include "llvm/IR/Dominators.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-delete"
STATISTIC(NumDeleted, "Number of loops deleted"); STATISTIC(NumDeleted, "Number of loops deleted");
namespace { namespace {

View File

@ -41,7 +41,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-idiom"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
@ -61,6 +60,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-idiom"
STATISTIC(NumMemSet, "Number of memset's formed from loop stores"); STATISTIC(NumMemSet, "Number of memset's formed from loop stores");
STATISTIC(NumMemCpy, "Number of memcpy's formed from loop load+stores"); STATISTIC(NumMemCpy, "Number of memcpy's formed from loop load+stores");

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-instsimplify"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -26,6 +25,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-instsimplify"
STATISTIC(NumSimplified, "Number of redundant instructions simplified"); STATISTIC(NumSimplified, "Number of redundant instructions simplified");
namespace { namespace {

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-reroll"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
@ -36,6 +35,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-reroll"
STATISTIC(NumRerolledLoops, "Number of rerolled loops"); STATISTIC(NumRerolledLoops, "Number of rerolled loops");
static cl::opt<unsigned> static cl::opt<unsigned>

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-rotate"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CodeMetrics.h" #include "llvm/Analysis/CodeMetrics.h"
@ -31,6 +30,8 @@
#include "llvm/Transforms/Utils/ValueMapper.h" #include "llvm/Transforms/Utils/ValueMapper.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-rotate"
#define MAX_HEADER_SIZE 16 #define MAX_HEADER_SIZE 16
STATISTIC(NumRotated, "Number of loops rotated"); STATISTIC(NumRotated, "Number of loops rotated");

View File

@ -53,7 +53,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-reduce"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Hashing.h" #include "llvm/ADT/Hashing.h"
@ -78,6 +77,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-reduce"
/// MaxIVUsers is an arbitrary threshold that provides an early opportunitiy for /// MaxIVUsers is an arbitrary threshold that provides an early opportunitiy for
/// bail out. This threshold is far beyond the number of users that LSR can /// bail out. This threshold is far beyond the number of users that LSR can
/// conceivably solve, so it should not affect generated code, but catches the /// conceivably solve, so it should not affect generated code, but catches the

View File

@ -12,7 +12,6 @@
// counts of loops easily. // counts of loops easily.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-unroll"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/Analysis/CodeMetrics.h" #include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/LoopPass.h"
@ -29,6 +28,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-unroll"
static cl::opt<unsigned> static cl::opt<unsigned>
UnrollThreshold("unroll-threshold", cl::init(150), cl::Hidden, UnrollThreshold("unroll-threshold", cl::init(150), cl::Hidden,
cl::desc("The cut-off point for automatic loop unrolling")); cl::desc("The cut-off point for automatic loop unrolling"));

View File

@ -26,7 +26,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-unswitch"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -53,6 +52,8 @@
#include <set> #include <set>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-unswitch"
STATISTIC(NumBranches, "Number of branches unswitched"); STATISTIC(NumBranches, "Number of branches unswitched");
STATISTIC(NumSwitches, "Number of switches unswitched"); STATISTIC(NumSwitches, "Number of switches unswitched");
STATISTIC(NumSelects , "Number of selects unswitched"); STATISTIC(NumSelects , "Number of selects unswitched");

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loweratomic"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
@ -20,6 +19,8 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loweratomic"
static bool LowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI) { static bool LowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI) {
IRBuilder<> Builder(CXI->getParent(), CXI); IRBuilder<> Builder(CXI->getParent(), CXI);
Value *Ptr = CXI->getPointerOperand(); Value *Ptr = CXI->getPointerOperand();

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "memcpyopt"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -33,6 +32,8 @@
#include <list> #include <list>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "memcpyopt"
STATISTIC(NumMemCpyInstr, "Number of memcpy instructions deleted"); STATISTIC(NumMemCpyInstr, "Number of memcpy instructions deleted");
STATISTIC(NumMemSetInfer, "Number of memsets inferred"); STATISTIC(NumMemSetInfer, "Number of memsets inferred");
STATISTIC(NumMoveToCpy, "Number of memmoves converted to memcpy"); STATISTIC(NumMoveToCpy, "Number of memmoves converted to memcpy");

View File

@ -13,7 +13,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "partially-inline-libcalls"
#include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Intrinsics.h" #include "llvm/IR/Intrinsics.h"
@ -25,6 +24,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "partially-inline-libcalls"
namespace { namespace {
class PartiallyInlineLibCalls : public FunctionPass { class PartiallyInlineLibCalls : public FunctionPass {
public: public:

View File

@ -20,7 +20,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "reassociate"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/PostOrderIterator.h"
@ -42,6 +41,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "reassociate"
STATISTIC(NumChanged, "Number of insts reassociated"); STATISTIC(NumChanged, "Number of insts reassociated");
STATISTIC(NumAnnihil, "Number of expr tree annihilated"); STATISTIC(NumAnnihil, "Number of expr tree annihilated");
STATISTIC(NumFactor , "Number of multiplies factored"); STATISTIC(NumFactor , "Number of multiplies factored");

View File

@ -16,7 +16,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "reg2mem"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/BasicBlock.h" #include "llvm/IR/BasicBlock.h"
@ -30,6 +29,8 @@
#include <list> #include <list>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "reg2mem"
STATISTIC(NumRegsDemoted, "Number of registers demoted"); STATISTIC(NumRegsDemoted, "Number of registers demoted");
STATISTIC(NumPhisDemoted, "Number of phi-nodes demoted"); STATISTIC(NumPhisDemoted, "Number of phi-nodes demoted");

View File

@ -17,7 +17,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "sccp"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseSet.h"
@ -42,6 +41,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "sccp"
STATISTIC(NumInstRemoved, "Number of instructions removed"); STATISTIC(NumInstRemoved, "Number of instructions removed");
STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable"); STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable");

View File

@ -23,7 +23,6 @@
/// ///
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "sroa"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
@ -64,6 +63,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "sroa"
STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for replacement"); STATISTIC(NumAllocasAnalyzed, "Number of allocas analyzed for replacement");
STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed"); STATISTIC(NumAllocaPartitions, "Number of alloca partitions formed");
STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per alloca"); STATISTIC(MaxPartitionsPerAlloca, "Maximum number of partitions per alloca");

View File

@ -22,8 +22,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "sample-profile"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -54,6 +52,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "sample-profile"
// Command line option to specify the file to read samples from. This is // Command line option to specify the file to read samples from. This is
// mainly used for debugging. // mainly used for debugging.
static cl::opt<std::string> SampleProfileFile( static cl::opt<std::string> SampleProfileFile(

View File

@ -19,7 +19,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "scalarrepl"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -52,6 +51,8 @@
#include "llvm/Transforms/Utils/SSAUpdater.h" #include "llvm/Transforms/Utils/SSAUpdater.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "scalarrepl"
STATISTIC(NumReplaced, "Number of allocas broken up"); STATISTIC(NumReplaced, "Number of allocas broken up");
STATISTIC(NumPromoted, "Number of allocas promoted"); STATISTIC(NumPromoted, "Number of allocas promoted");
STATISTIC(NumAdjusted, "Number of scalar allocas adjusted to allow promotion"); STATISTIC(NumAdjusted, "Number of scalar allocas adjusted to allow promotion");

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "scalarizer"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h" #include "llvm/IR/InstVisitor.h"
@ -25,6 +24,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "scalarizer"
namespace { namespace {
// Used to store the scattered form of a vector. // Used to store the scattered form of a vector.
typedef SmallVector<Value *, 8> ValueVector; typedef SmallVector<Value *, 8> ValueVector;

View File

@ -21,7 +21,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "simplifycfg"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -38,6 +37,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "simplifycfg"
STATISTIC(NumSimpl, "Number of blocks simplified"); STATISTIC(NumSimpl, "Number of blocks simplified");
namespace { namespace {

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "sink"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
@ -25,6 +24,8 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "sink"
STATISTIC(NumSunk, "Number of instructions sunk"); STATISTIC(NumSunk, "Number of instructions sunk");
STATISTIC(NumSinkIter, "Number of sinking iterations"); STATISTIC(NumSinkIter, "Number of sinking iterations");

View File

@ -7,7 +7,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "structurizecfg"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/MapVector.h" #include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/SCCIterator.h"
@ -21,6 +20,8 @@
using namespace llvm; using namespace llvm;
using namespace llvm::PatternMatch; using namespace llvm::PatternMatch;
#define DEBUG_TYPE "structurizecfg"
namespace { namespace {
// Definition of the complex types used in this pass. // Definition of the complex types used in this pass.

View File

@ -50,7 +50,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "tailcallelim"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -76,6 +75,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "tailcallelim"
STATISTIC(NumEliminated, "Number of tail calls removed"); STATISTIC(NumEliminated, "Number of tail calls removed");
STATISTIC(NumRetDuped, "Number of return duplicated"); STATISTIC(NumRetDuped, "Number of return duplicated");
STATISTIC(NumAccumAdded, "Number of accumulators introduced"); STATISTIC(NumAccumAdded, "Number of accumulators introduced");

View File

@ -52,8 +52,6 @@
// http://wiki.dwarfstd.org/index.php?title=Path_Discriminators // http://wiki.dwarfstd.org/index.php?title=Path_Discriminators
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "add-discriminators"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/IR/BasicBlock.h" #include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
@ -69,6 +67,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "add-discriminators"
namespace { namespace {
struct AddDiscriminators : public FunctionPass { struct AddDiscriminators : public FunctionPass {
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "break-crit-edges"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -30,6 +29,8 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "break-crit-edges"
STATISTIC(NumBroken, "Number of blocks inserted"); STATISTIC(NumBroken, "Number of blocks inserted");
namespace { namespace {

View File

@ -15,7 +15,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "bypass-slow-division"
#include "llvm/Transforms/Utils/BypassSlowDivision.h" #include "llvm/Transforms/Utils/BypassSlowDivision.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
@ -24,6 +23,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "bypass-slow-division"
namespace { namespace {
struct DivOpInfo { struct DivOpInfo {
bool SignedOp; bool SignedOp;

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "flattencfg"
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
@ -22,6 +21,8 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "flattencfg"
namespace { namespace {
class FlattenCFGOpt { class FlattenCFGOpt {
AliasAnalysis *AA; AliasAnalysis *AA;

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "integer-division"
#include "llvm/Transforms/Utils/IntegerDivision.h" #include "llvm/Transforms/Utils/IntegerDivision.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
@ -24,6 +23,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "integer-division"
/// Generate code to compute the remainder of two signed integers. Returns the /// Generate code to compute the remainder of two signed integers. Returns the
/// remainder, which will have the sign of the dividend. Builder's insert point /// remainder, which will have the sign of the dividend. Builder's insert point
/// should be pointing where the caller wants code generated, e.g. at the srem /// should be pointing where the caller wants code generated, e.g. at the srem

View File

@ -27,7 +27,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "lcssa"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -44,6 +43,8 @@
#include "llvm/Transforms/Utils/SSAUpdater.h" #include "llvm/Transforms/Utils/SSAUpdater.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "lcssa"
STATISTIC(NumLCSSA, "Number of live out of a loop variables"); STATISTIC(NumLCSSA, "Number of live out of a loop variables");
/// Return true if the specified block is in the list. /// Return true if the specified block is in the list.

View File

@ -37,7 +37,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-simplify"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SetOperations.h"
@ -63,6 +62,8 @@
#include "llvm/Transforms/Utils/LoopUtils.h" #include "llvm/Transforms/Utils/LoopUtils.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-simplify"
STATISTIC(NumInserted, "Number of pre-header or exit blocks inserted"); STATISTIC(NumInserted, "Number of pre-header or exit blocks inserted");
STATISTIC(NumNested , "Number of nested loops split out"); STATISTIC(NumNested , "Number of nested loops split out");

View File

@ -16,7 +16,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-unroll"
#include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/Transforms/Utils/UnrollLoop.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/InstructionSimplify.h"
@ -34,6 +33,8 @@
#include "llvm/Transforms/Utils/SimplifyIndVar.h" #include "llvm/Transforms/Utils/SimplifyIndVar.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-unroll"
// TODO: Should these be here or in LoopUnroll? // TODO: Should these be here or in LoopUnroll?
STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled"); STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)"); STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)");

View File

@ -21,7 +21,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-unroll"
#include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/Transforms/Utils/UnrollLoop.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopIterator.h" #include "llvm/Analysis/LoopIterator.h"
@ -37,6 +36,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "loop-unroll"
STATISTIC(NumRuntimeUnrolled, STATISTIC(NumRuntimeUnrolled,
"Number of loops unrolled with run-time trip counts"); "Number of loops unrolled with run-time trip counts");

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "lower-expect-intrinsic"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/BasicBlock.h" #include "llvm/IR/BasicBlock.h"
@ -29,6 +28,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "lower-expect-intrinsic"
STATISTIC(IfHandled, "Number of 'expect' intrinsic instructions handled"); STATISTIC(IfHandled, "Number of 'expect' intrinsic instructions handled");
static cl::opt<uint32_t> static cl::opt<uint32_t>

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "lowerinvoke"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
@ -25,6 +24,8 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "lowerinvoke"
STATISTIC(NumInvokes, "Number of invokes replaced"); STATISTIC(NumInvokes, "Number of invokes replaced");
namespace { namespace {

View File

@ -12,7 +12,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "mem2reg"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/IR/Dominators.h" #include "llvm/IR/Dominators.h"
@ -22,6 +21,8 @@
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "mem2reg"
STATISTIC(NumPromoted, "Number of alloca's promoted"); STATISTIC(NumPromoted, "Number of alloca's promoted");
namespace { namespace {

View File

@ -25,7 +25,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "mem2reg"
#include "llvm/Transforms/Utils/PromoteMemToReg.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
@ -51,6 +50,8 @@
#include <queue> #include <queue>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "mem2reg"
STATISTIC(NumLocalPromoted, "Number of alloca's promoted within one block"); STATISTIC(NumLocalPromoted, "Number of alloca's promoted within one block");
STATISTIC(NumSingleStore, "Number of alloca's promoted with a single store"); STATISTIC(NumSingleStore, "Number of alloca's promoted with a single store");
STATISTIC(NumDeadAlloca, "Number of dead alloca's removed"); STATISTIC(NumDeadAlloca, "Number of dead alloca's removed");

View File

@ -11,7 +11,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "simplifycfg"
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
@ -50,6 +49,8 @@
using namespace llvm; using namespace llvm;
using namespace PatternMatch; using namespace PatternMatch;
#define DEBUG_TYPE "simplifycfg"
static cl::opt<unsigned> static cl::opt<unsigned>
PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(1), PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(1),
cl::desc("Control the amount of phi node folding to perform (default = 1)")); cl::desc("Control the amount of phi node folding to perform (default = 1)"));

View File

@ -13,8 +13,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "indvars"
#include "llvm/Transforms/Utils/SimplifyIndVar.h" #include "llvm/Transforms/Utils/SimplifyIndVar.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
@ -34,6 +32,8 @@
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "indvars"
STATISTIC(NumElimIdentity, "Number of IV identities eliminated"); STATISTIC(NumElimIdentity, "Number of IV identities eliminated");
STATISTIC(NumElimOperand, "Number of IV operands folded into a use"); STATISTIC(NumElimOperand, "Number of IV operands folded into a use");
STATISTIC(NumElimRem , "Number of IV remainder operations eliminated"); STATISTIC(NumElimRem , "Number of IV remainder operations eliminated");

View File

@ -14,7 +14,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define DEBUG_TYPE "instsimplify"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
@ -29,6 +28,8 @@
#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/Local.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "instsimplify"
STATISTIC(NumSimplified, "Number of redundant instructions removed"); STATISTIC(NumSimplified, "Number of redundant instructions removed");
namespace { namespace {

View File

@ -15,7 +15,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define BBV_NAME "bb-vectorize" #define BBV_NAME "bb-vectorize"
#define DEBUG_TYPE BBV_NAME
#include "llvm/Transforms/Vectorize.h" #include "llvm/Transforms/Vectorize.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseSet.h"
@ -50,6 +49,8 @@
#include <algorithm> #include <algorithm>
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE BBV_NAME
static cl::opt<bool> static cl::opt<bool>
IgnoreTargetInfo("bb-vectorize-ignore-target-info", cl::init(false), IgnoreTargetInfo("bb-vectorize-ignore-target-info", cl::init(false),
cl::Hidden, cl::desc("Ignore target information")); cl::Hidden, cl::desc("Ignore target information"));

View File

@ -42,9 +42,6 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define LV_NAME "loop-vectorize"
#define DEBUG_TYPE LV_NAME
#include "llvm/Transforms/Vectorize.h" #include "llvm/Transforms/Vectorize.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/EquivalenceClasses.h"
@ -98,6 +95,9 @@
using namespace llvm; using namespace llvm;
using namespace llvm::PatternMatch; using namespace llvm::PatternMatch;
#define LV_NAME "loop-vectorize"
#define DEBUG_TYPE LV_NAME
static cl::opt<unsigned> static cl::opt<unsigned>
VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden, VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden,
cl::desc("Sets the SIMD width. Zero is autoselect.")); cl::desc("Sets the SIMD width. Zero is autoselect."));

View File

@ -15,9 +15,6 @@
// "Loop-Aware SLP in GCC" by Ira Rosen, Dorit Nuzman, Ayal Zaks. // "Loop-Aware SLP in GCC" by Ira Rosen, Dorit Nuzman, Ayal Zaks.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#define SV_NAME "slp-vectorizer"
#define DEBUG_TYPE "SLP"
#include "llvm/Transforms/Vectorize.h" #include "llvm/Transforms/Vectorize.h"
#include "llvm/ADT/MapVector.h" #include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PostOrderIterator.h" #include "llvm/ADT/PostOrderIterator.h"
@ -47,6 +44,9 @@
using namespace llvm; using namespace llvm;
#define SV_NAME "slp-vectorizer"
#define DEBUG_TYPE "SLP"
static cl::opt<int> static cl::opt<int>
SLPCostThreshold("slp-threshold", cl::init(0), cl::Hidden, SLPCostThreshold("slp-threshold", cl::init(0), cl::Hidden,
cl::desc("Only vectorize if you gain more than this " cl::desc("Only vectorize if you gain more than this "