15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGCALL_H 16 #define LLVM_CLANG_LIB_CODEGEN_CGCALL_H 22 #include "llvm/IR/Value.h" 48 const Decl *CalleeDecl;
51 explicit CGCalleeInfo() : CalleeProtoTy(nullptr), CalleeDecl(nullptr) {}
53 : CalleeProtoTy(calleeProtoTy), CalleeDecl(calleeDecl) {}
55 : CalleeProtoTy(calleeProtoTy), CalleeDecl(nullptr) {}
57 : CalleeProtoTy(nullptr), CalleeDecl(calleeDecl) {}
72 Last = PseudoDestructor
75 struct BuiltinInfoStorage {
79 struct PseudoDestructorInfoStorage {
83 SpecialKind KindOrFunctionPointer;
90 explicit CGCallee(SpecialKind
kind) : KindOrFunctionPointer(kind) {}
93 : KindOrFunctionPointer(SpecialKind::Builtin) {
99 CGCallee() : KindOrFunctionPointer(SpecialKind::Invalid) {}
104 : KindOrFunctionPointer(SpecialKind(
uintptr_t(functionPtr))) {
105 AbstractInfo = abstractInfo;
106 assert(functionPtr &&
"configuring callee without function pointer");
107 assert(functionPtr->getType()->isPointerTy());
108 assert(functionPtr->getType()->getPointerElementType()->isFunctionTy());
113 CGCallee result(SpecialKind::Builtin);
120 CGCallee result(SpecialKind::PseudoDestructor);
127 return CGCallee(abstractInfo, functionPtr);
131 return KindOrFunctionPointer == SpecialKind::Builtin;
143 return KindOrFunctionPointer == SpecialKind::PseudoDestructor;
146 assert(isPseudoDestructor());
147 return PseudoDestructorInfo.Expr;
154 assert(isOrdinary());
158 assert(isOrdinary());
162 return cast<llvm::FunctionType>(
163 getFunctionPointer()->getType()->getPointerElementType());
166 assert(isOrdinary());
167 KindOrFunctionPointer = SpecialKind(
uintptr_t(functionPtr));
176 : RV(rv), Ty(ty), NeedsCopy(needscopy)
208 push_back(
CallArg(rvalue, type, needscopy));
215 insert(end(), other.begin(), other.end());
216 Writebacks.insert(Writebacks.end(),
217 other.Writebacks.begin(), other.Writebacks.end());
218 CleanupsToDeactivate.insert(CleanupsToDeactivate.end(),
219 other.CleanupsToDeactivate.begin(),
220 other.CleanupsToDeactivate.end());
221 assert(!(StackBase && other.StackBase) &&
"can't merge stackbases");
223 StackBase = other.StackBase;
228 Writeback writeback = { srcLV, temporary, toUse };
229 Writebacks.push_back(writeback);
234 typedef llvm::iterator_range<SmallVectorImpl<Writeback>::const_iterator>
242 llvm::Instruction *IsActiveIP) {
246 CleanupsToDeactivate.push_back(ArgCleanup);
250 return CleanupsToDeactivate;
270 llvm::CallInst *StackBase;
282 llvm::PointerIntPair<llvm::Value *, 2, unsigned int>
Value;
294 : Value(Addr.isValid() ? Addr.getPointer() : nullptr,
295 (IsVolatile ? IS_VOLATILE : 0) | (IsUnused ? IS_UNUSED : 0)),
296 Alignment(Addr.isValid() ? Addr.getAlignment() :
CharUnits::Zero()) {}
300 bool isVolatile()
const {
return Value.getInt() & IS_VOLATILE; }
302 bool isUnused()
const {
return Value.getInt() & IS_UNUSED; }
ReturnValueSlot - Contains the address where the return value of a function can be stored...
An instance of this class is created to represent a function declaration or definition.
A (possibly-)qualified type.
CGCallee(const CGCalleeInfo &abstractInfo, llvm::Value *functionPtr)
Construct a callee.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
const Decl * getCalleeDecl() const
C Language Family Type Representation.
static const Builtin::Info BuiltinInfo[]
Decl - This represents one declaration (or definition), e.g.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
bool hasWritebacks() const
llvm::Instruction * getStackBase() const
llvm::Value * getFunctionPointer() const
CGCalleeInfo(const Decl *calleeDecl)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
EHScopeStack::stable_iterator Cleanup
bool isUsingInAlloca() const
Returns if we're using an inalloca struct to pass arguments in memory.
void addArgCleanupDeactivation(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *IsActiveIP)
llvm::FunctionType * getFunctionType() const
const CXXPseudoDestructorExpr * getPseudoDestructorExpr() const
CharUnits - This is an opaque type for sizes expressed in character units.
const FunctionDecl * getBuiltinDecl() const
CallArg(RValue rv, QualType ty, bool needscopy)
void setFunctionPointer(llvm::Value *functionPtr)
llvm::iterator_range< SmallVectorImpl< Writeback >::const_iterator > writeback_const_range
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
void addFrom(const CallArgList &other)
Add all the arguments from another CallArgList to this one.
Represents a prototype with parameter type info, e.g.
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
bool isPseudoDestructor() const
writeback_const_range writebacks() const
void addWriteback(LValue srcLV, Address temporary, llvm::Value *toUse)
PseudoDestructorInfoStorage PseudoDestructorInfo
Address Temporary
The temporary alloca.
llvm::Value * ToUse
A value to "use" after the writeback, or null.
Expr - This represents one expression.
CGCalleeInfo(const FunctionProtoType *calleeProtoTy)
static CGCallee forDirect(llvm::Constant *functionPtr, const CGCalleeInfo &abstractInfo=CGCalleeInfo())
void add(RValue rvalue, QualType type, bool needscopy=false)
static SVal getValue(SVal val, SValBuilder &svalBuilder)
BuiltinInfoStorage BuiltinInfo
CGCalleeInfo AbstractInfo
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
The l-value was considered opaque, so the alignment was determined from a type.
A saved depth on the scope stack.
All available information about a concrete callee.
CGCalleeInfo(const FunctionProtoType *calleeProtoTy, const Decl *calleeDecl)
FunctionArgList - Type for representing both the decl and type of parameters to a function...
const CGCalleeInfo & getAbstractInfo() const
llvm::Instruction * IsActiveIP
The "is active" insertion point.
Dataflow Directional Tag Classes.
LValue Source
The original argument.
static CGCallee forBuiltin(unsigned builtinID, const FunctionDecl *builtinDecl)
unsigned getBuiltinID() const
static CGCallee forPseudoDestructor(const CXXPseudoDestructorExpr *E)
ReturnValueSlot(Address Addr, bool IsVolatile, bool IsUnused=false)
unsigned kind
All of the diagnostics that can be emitted by the frontend.
const FunctionProtoType * getCalleeFunctionProtoType() const
LValue - This represents an lvalue references.
CallArgList - Type for representing both the value and type of arguments in a call.
Abstract information about a function or function prototype.
ArrayRef< CallArgCleanup > getCleanupsToDeactivate() const