LLVM  13.0.0git
Namespaces | Macros | Functions | Variables
AttributorAttributes.cpp File Reference
#include "llvm/Transforms/IPO/Attributor.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumeBundleQueries.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/LazyValueInfo.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/NoFolder.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/IPO/ArgumentPromotion.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cassert>
Include dependency graph for AttributorAttributes.cpp:

Go to the source code of this file.

Namespaces

 llvm
 

Macros

#define DEBUG_TYPE   "attributor"
 
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)   ("Number of " #TYPE " marked '" #NAME "'")
 
#define BUILD_STAT_NAME(NAME, TYPE)   NumIR##TYPE##_##NAME
 
#define STATS_DECL_(NAME, MSG)   STATISTIC(NAME, MSG);
 
#define STATS_DECL(NAME, TYPE, MSG)   STATS_DECL_(BUILD_STAT_NAME(NAME, TYPE), MSG);
 
#define STATS_TRACK(NAME, TYPE)   ++(BUILD_STAT_NAME(NAME, TYPE));
 
#define STATS_DECLTRACK(NAME, TYPE, MSG)
 
#define STATS_DECLTRACK_ARG_ATTR(NAME)   STATS_DECLTRACK(NAME, Arguments, BUILD_STAT_MSG_IR_ATTR(arguments, NAME))
 
#define STATS_DECLTRACK_CSARG_ATTR(NAME)
 
#define STATS_DECLTRACK_FN_ATTR(NAME)   STATS_DECLTRACK(NAME, Function, BUILD_STAT_MSG_IR_ATTR(functions, NAME))
 
#define STATS_DECLTRACK_CS_ATTR(NAME)   STATS_DECLTRACK(NAME, CS, BUILD_STAT_MSG_IR_ATTR(call site, NAME))
 
#define STATS_DECLTRACK_FNRET_ATTR(NAME)
 
#define STATS_DECLTRACK_CSRET_ATTR(NAME)
 
#define STATS_DECLTRACK_FLOATING_ATTR(NAME)
 
#define PIPE_OPERATOR(CLASS)
 
#define SWITCH_PK_INV(CLASS, PK, POS_NAME)
 
#define SWITCH_PK_CREATE(CLASS, IRP, PK, SUFFIX)
 
#define CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 
#define CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 
#define CREATE_ALL_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 
#define CREATE_FUNCTION_ONLY_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 
#define CREATE_NON_RET_ABSTRACT_ATTRIBUTE_FOR_POSITION(CLASS)
 

Functions

 STATISTIC (NumAAs, "Number of abstract attributes created")
 

Variables

static cl::opt< bool > ManifestInternal ("attributor-manifest-internal", cl::Hidden, cl::desc("Manifest Attributor internal string attributes."), cl::init(false))
 
static cl::opt< intMaxHeapToStackSize ("max-heap-to-stack-size", cl::init(128), cl::Hidden)
 
static cl::opt< unsigned, trueMaxPotentialValues ("attributor-max-potential-values", cl::Hidden, cl::desc("Maximum number of potential values to be " "tracked for each position."), cl::location(llvm::PotentialConstantIntValuesState::MaxPotentialValues), cl::init(7))
 

Macro Definition Documentation

◆ BUILD_STAT_MSG_IR_ATTR

#define BUILD_STAT_MSG_IR_ATTR (   TYPE,
  NAME 
)    ("Number of " #TYPE " marked '" #NAME "'")

Definition at line 75 of file AttributorAttributes.cpp.

◆ BUILD_STAT_NAME

#define BUILD_STAT_NAME (   NAME,
  TYPE 
)    NumIR##TYPE##_##NAME

Definition at line 77 of file AttributorAttributes.cpp.

◆ CREATE_ALL_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_ALL_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FUNCTION, Function) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE, CallSite) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FLOAT, Floating) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_ARGUMENT, Argument) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_RETURNED, Returned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_RETURNED, CallSiteReturned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_ARGUMENT, CallSiteArgument) \
} \
return *AA; \
}

Definition at line 8189 of file AttributorAttributes.cpp.

◆ CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_FUNCTION_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_FLOAT, "floating") \
SWITCH_PK_INV(CLASS, IRP_ARGUMENT, "argument") \
SWITCH_PK_INV(CLASS, IRP_RETURNED, "returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_RETURNED, "call site returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_ARGUMENT, "call site argument") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FUNCTION, Function) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE, CallSite) \
} \
return *AA; \
}

Definition at line 8157 of file AttributorAttributes.cpp.

◆ CREATE_FUNCTION_ONLY_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_FUNCTION_ONLY_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_ARGUMENT, "argument") \
SWITCH_PK_INV(CLASS, IRP_FLOAT, "floating") \
SWITCH_PK_INV(CLASS, IRP_RETURNED, "returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_RETURNED, "call site returned") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE_ARGUMENT, "call site argument") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE, "call site") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FUNCTION, Function) \
} \
return *AA; \
}

Definition at line 8205 of file AttributorAttributes.cpp.

◆ CREATE_NON_RET_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_NON_RET_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_RETURNED, "returned") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FUNCTION, Function) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE, CallSite) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FLOAT, Floating) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_ARGUMENT, Argument) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_RETURNED, CallSiteReturned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_ARGUMENT, CallSiteArgument) \
} \
return *AA; \
}

Definition at line 8221 of file AttributorAttributes.cpp.

◆ CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION

#define CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION (   CLASS)
Value:
CLASS &CLASS::createForPosition(const IRPosition &IRP, Attributor &A) { \
CLASS *AA = nullptr; \
switch (IRP.getPositionKind()) { \
SWITCH_PK_INV(CLASS, IRP_INVALID, "invalid") \
SWITCH_PK_INV(CLASS, IRP_FUNCTION, "function") \
SWITCH_PK_INV(CLASS, IRP_CALL_SITE, "call site") \
SWITCH_PK_CREATE(CLASS, IRP, IRP_FLOAT, Floating) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_ARGUMENT, Argument) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_RETURNED, Returned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_RETURNED, CallSiteReturned) \
SWITCH_PK_CREATE(CLASS, IRP, IRP_CALL_SITE_ARGUMENT, CallSiteArgument) \
} \
return *AA; \
}

Definition at line 8173 of file AttributorAttributes.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "attributor"

Definition at line 40 of file AttributorAttributes.cpp.

◆ PIPE_OPERATOR

#define PIPE_OPERATOR (   CLASS)
Value:
raw_ostream &operator<<(raw_ostream &OS, const CLASS &AA) { \
return OS << static_cast<const AbstractAttribute &>(AA); \
}

Definition at line 109 of file AttributorAttributes.cpp.

◆ STATS_DECL

#define STATS_DECL (   NAME,
  TYPE,
  MSG 
)    STATS_DECL_(BUILD_STAT_NAME(NAME, TYPE), MSG);

Definition at line 79 of file AttributorAttributes.cpp.

◆ STATS_DECL_

#define STATS_DECL_ (   NAME,
  MSG 
)    STATISTIC(NAME, MSG);

Definition at line 78 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK

#define STATS_DECLTRACK (   NAME,
  TYPE,
  MSG 
)
Value:
{ \
STATS_DECL(NAME, TYPE, MSG) \
STATS_TRACK(NAME, TYPE) \
}

Definition at line 82 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_ARG_ATTR

#define STATS_DECLTRACK_ARG_ATTR (   NAME)    STATS_DECLTRACK(NAME, Arguments, BUILD_STAT_MSG_IR_ATTR(arguments, NAME))

Definition at line 87 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_CS_ATTR

#define STATS_DECLTRACK_CS_ATTR (   NAME)    STATS_DECLTRACK(NAME, CS, BUILD_STAT_MSG_IR_ATTR(call site, NAME))

Definition at line 94 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_CSARG_ATTR

#define STATS_DECLTRACK_CSARG_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, CSArguments, \

Definition at line 89 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_CSRET_ATTR

#define STATS_DECLTRACK_CSRET_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, CSReturn, \
BUILD_STAT_MSG_IR_ATTR(call site returns, NAME))

Definition at line 99 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_FLOATING_ATTR

#define STATS_DECLTRACK_FLOATING_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, Floating, \
("Number of floating values known to be '" #NAME "'"))

Definition at line 102 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_FN_ATTR

#define STATS_DECLTRACK_FN_ATTR (   NAME)    STATS_DECLTRACK(NAME, Function, BUILD_STAT_MSG_IR_ATTR(functions, NAME))

Definition at line 92 of file AttributorAttributes.cpp.

◆ STATS_DECLTRACK_FNRET_ATTR

#define STATS_DECLTRACK_FNRET_ATTR (   NAME)
Value:
STATS_DECLTRACK(NAME, FunctionReturn, \
BUILD_STAT_MSG_IR_ATTR(function returns, NAME))

Definition at line 96 of file AttributorAttributes.cpp.

◆ STATS_TRACK

#define STATS_TRACK (   NAME,
  TYPE 
)    ++(BUILD_STAT_NAME(NAME, TYPE));

Definition at line 81 of file AttributorAttributes.cpp.

◆ SWITCH_PK_CREATE

#define SWITCH_PK_CREATE (   CLASS,
  IRP,
  PK,
  SUFFIX 
)
Value:
case IRPosition::PK: \
AA = new (A.Allocator) CLASS##SUFFIX(IRP, A); \
++NumAAs; \
break;

Definition at line 8151 of file AttributorAttributes.cpp.

◆ SWITCH_PK_INV

#define SWITCH_PK_INV (   CLASS,
  PK,
  POS_NAME 
)
Value:
case IRPosition::PK: \
llvm_unreachable("Cannot create " #CLASS " for a " POS_NAME " position!");

Definition at line 8147 of file AttributorAttributes.cpp.

Function Documentation

◆ STATISTIC()

STATISTIC ( NumAAs  ,
"Number of abstract attributes created"   
)

Variable Documentation

◆ ManifestInternal

cl::opt<bool> ManifestInternal("attributor-manifest-internal", cl::Hidden, cl::desc("Manifest Attributor internal string attributes."), cl::init(false))
static

◆ MaxHeapToStackSize

cl::opt<int> MaxHeapToStackSize("max-heap-to-stack-size", cl::init(128), cl::Hidden)
static

◆ MaxPotentialValues

cl::opt<unsigned, true> MaxPotentialValues("attributor-max-potential-values", cl::Hidden, cl::desc("Maximum number of potential values to be " "tracked for each position."), cl::location(llvm::PotentialConstantIntValuesState::MaxPotentialValues), cl::init(7))
static
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
llvm::Function
Definition: Function.h:61
BUILD_STAT_MSG_IR_ATTR
#define BUILD_STAT_MSG_IR_ATTR(TYPE, NAME)
Definition: AttributorAttributes.cpp:75
llvm::IRPosition::getPositionKind
Kind getPositionKind() const
Return the associated position kind.
Definition: Attributor.h:463
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
call
S is passed via registers r2 But gcc stores them to the and then reload them to and r3 before issuing the call(r0 contains the address of the format string)
Definition: README.txt:190
llvm::IRPosition
Helper to describe and deal with positions in the LLVM-IR.
Definition: Attributor.h:231
STATS_DECLTRACK
#define STATS_DECLTRACK(NAME, TYPE, MSG)
Definition: AttributorAttributes.cpp:82
A
* A
Definition: README_ALTIVEC.txt:89
llvm::Attributor
The fixpoint analysis framework that orchestrates the attribute deduction.
Definition: Attributor.h:1054
arguments
we compile this esp call L1 $pb L1 esp je LBB1_2 esp ret but is currently always computed in the entry block It would be better to sink the picbase computation down into the block for the as it is the only one that uses it This happens for a lot of code with early outs Another example is loads of arguments
Definition: README.txt:425