LLVM  5.0.0
Macros | Functions | Variables
Attributes.cpp File Reference
#include "llvm/IR/Attributes.h"
#include "AttributeImpl.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <map>
#include <string>
#include <tuple>
#include <utility>
#include "AttributesCompatFunc.inc"
Include dependency graph for Attributes.cpp:

Go to the source code of this file.

Macros

#define GET_ATTR_COMPAT_FUNC
 

Functions

static uint64_t packAllocSizeArgs (unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
 
static std::pair< unsigned,
Optional< unsigned > > 
unpackAllocSizeArgs (uint64_t Num)
 
static constexpr unsigned attrIdxToArrayIdx (unsigned Index)
 Map from AttributeList index to the internal array index. More...
 
template<typename AttrClass >
static bool isEqual (const Function &Caller, const Function &Callee)
 
template<typename AttrClass >
static void setAND (Function &Caller, const Function &Callee)
 Compute the logical AND of the attributes of the caller and the callee. More...
 
template<typename AttrClass >
static void setOR (Function &Caller, const Function &Callee)
 Compute the logical OR of the attributes of the caller and the callee. More...
 
static void adjustCallerSSPLevel (Function &Caller, const Function &Callee)
 If the inlined function had a higher stack protection level than the calling function, then bump up the caller's stack protection level. More...
 
static void adjustCallerStackProbes (Function &Caller, const Function &Callee)
 If the inlined function required stack probes, then ensure that the calling function has those too. More...
 
static void adjustCallerStackProbeSize (Function &Caller, const Function &Callee)
 If the inlined function defines the size of guard region on the stack, then ensure that the calling function defines a guard region that is no larger. More...
 

Variables

static const unsigned AllocSizeNumElemsNotPresent = -1
 

Macro Definition Documentation

#define GET_ATTR_COMPAT_FUNC

Definition at line 1674 of file Attributes.cpp.

Function Documentation

static void adjustCallerSSPLevel ( Function &  Caller,
const Function &  Callee 
)
static

If the inlined function had a higher stack protection level than the calling function, then bump up the caller's stack protection level.

Definition at line 1619 of file Attributes.cpp.

References llvm::AttrBuilder::addAttribute(), llvm::Function::addFnAttr(), llvm::AttributeList::FunctionIndex, llvm::Function::hasFnAttribute(), and llvm::Function::removeAttributes().

static void adjustCallerStackProbes ( Function &  Caller,
const Function &  Callee 
)
static

If the inlined function required stack probes, then ensure that the calling function has those too.

Definition at line 1643 of file Attributes.cpp.

References llvm::Function::addFnAttr(), llvm::Function::getFnAttribute(), and llvm::Function::hasFnAttribute().

static void adjustCallerStackProbeSize ( Function &  Caller,
const Function &  Callee 
)
static

If the inlined function defines the size of guard region on the stack, then ensure that the calling function defines a guard region that is no larger.

Definition at line 1654 of file Attributes.cpp.

References llvm::Function::addFnAttr(), llvm::StringRef::getAsInteger(), llvm::Function::getFnAttribute(), llvm::Attribute::getValueAsString(), and llvm::Function::hasFnAttribute().

static constexpr unsigned attrIdxToArrayIdx ( unsigned  Index)
static

Map from AttributeList index to the internal array index.

Adding one works: FunctionIndex: ~0U -> 0 ReturnIndex: 0 -> 1 FirstArgIndex: 1.. -> 2..

Definition at line 795 of file Attributes.cpp.

Referenced by llvm::AttributeList::addAttributes(), llvm::AttributeList::addParamAttribute(), llvm::AttributeListImpl::AttributeListImpl(), llvm::AttributeList::get(), llvm::AttributeList::getAttributes(), and llvm::AttributeList::removeAttributes().

template<typename AttrClass >
static bool isEqual ( const Function &  Caller,
const Function &  Callee 
)
static

Definition at line 1588 of file Attributes.cpp.

References llvm::Function::getFnAttribute().

Referenced by llvm::ImutAVLFactory< ImutInfo >::add_internal(), llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::clear(), llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::copyFrom(), llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::destroyAll(), llvm::EliminateDuplicatePHINodes(), llvm::ImutAVLTree< ImutInfo >::find(), llvm::DenseMapInfo< CachedHashStringRef >::getHashValue(), llvm::DenseMapInfo< CachedHashString >::getHashValue(), llvm::SmallDenseMap< const GlobalValue *, ModRefInfo, 16 >::grow(), llvm::ImutAVLTree< ImutInfo >::isElementEqual(), llvm::DenseMapInfo< CachedHashStringRef >::isEqual(), llvm::DenseMapInfo< BasicBlockEdge >::isEqual(), llvm::DenseMapInfo< std::pair< T, U > >::isEqual(), llvm::DenseMapInfo< AssertingVH< T > >::isEqual(), llvm::DenseMapInfo< FunctionSummary::ConstVCall >::isEqual(), llvm::DenseMapInfo< PointerUnion< T, U > >::isEqual(), llvm::DenseMapInfo< PoisoningVH< T > >::isEqual(), llvm::DenseMapInfo< TargetInstrInfo::RegSubRegPair >::isEqual(), markAliveBlocks(), llvm::DenseMapBase< SmallDenseMap< KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::moveFromOldBuckets(), llvm::ImutAVLFactory< ImutInfo >::remove_internal(), and llvm::SmallDenseMap< const GlobalValue *, ModRefInfo, 16 >::swap().

static uint64_t packAllocSizeArgs ( unsigned  ElemSizeArg,
const Optional< unsigned > &  NumElemsArg 
)
static
template<typename AttrClass >
static void setAND ( Function &  Caller,
const Function &  Callee 
)
static

Compute the logical AND of the attributes of the caller and the callee.

This function sets the caller's attribute to false if the callee's attribute is false.

Definition at line 1599 of file Attributes.cpp.

template<typename AttrClass >
static void setOR ( Function &  Caller,
const Function &  Callee 
)
static

Compute the logical OR of the attributes of the caller and the callee.

This function sets the caller's attribute to true if the callee's attribute is true.

Definition at line 1611 of file Attributes.cpp.

static std::pair<unsigned, Optional<unsigned> > unpackAllocSizeArgs ( uint64_t  Num)
static

Variable Documentation

const unsigned AllocSizeNumElemsNotPresent = -1
static

Definition at line 58 of file Attributes.cpp.

Referenced by packAllocSizeArgs(), and unpackAllocSizeArgs().