Changeset View
Changeset View
Standalone View
Standalone View
cfe/trunk/lib/CodeGen/CGCall.h
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
/// If this is a delayed callee computation of some sort, prepare | /// If this is a delayed callee computation of some sort, prepare | ||||
/// a concrete callee. | /// a concrete callee. | ||||
CGCallee prepareConcreteCallee(CodeGenFunction &CGF) const; | CGCallee prepareConcreteCallee(CodeGenFunction &CGF) const; | ||||
}; | }; | ||||
struct CallArg { | struct CallArg { | ||||
private: | |||||
union { | |||||
RValue RV; | RValue RV; | ||||
LValue LV; /// The argument is semantically a load from this l-value. | |||||
}; | |||||
bool HasLV; | |||||
/// A data-flow flag to make sure getRValue and/or copyInto are not | |||||
/// called twice for duplicated IR emission. | |||||
mutable bool IsUsed; | |||||
public: | |||||
QualType Ty; | QualType Ty; | ||||
bool NeedsCopy; | CallArg(RValue rv, QualType ty) | ||||
CallArg(RValue rv, QualType ty, bool needscopy) | : RV(rv), HasLV(false), IsUsed(false), Ty(ty) {} | ||||
: RV(rv), Ty(ty), NeedsCopy(needscopy) | CallArg(LValue lv, QualType ty) | ||||
{ } | : LV(lv), HasLV(true), IsUsed(false), Ty(ty) {} | ||||
bool hasLValue() const { return HasLV; } | |||||
QualType getType() const { return Ty; } | |||||
/// \returns an independent RValue. If the CallArg contains an LValue, | |||||
/// a temporary copy is returned. | |||||
RValue getRValue(CodeGenFunction &CGF) const; | |||||
LValue getKnownLValue() const { | |||||
assert(HasLV && !IsUsed); | |||||
return LV; | |||||
} | |||||
RValue getKnownRValue() const { | |||||
assert(!HasLV && !IsUsed); | |||||
return RV; | |||||
} | |||||
void setRValue(RValue _RV) { | |||||
assert(!HasLV); | |||||
RV = _RV; | |||||
} | |||||
bool isAggregate() const { return HasLV || RV.isAggregate(); } | |||||
void copyInto(CodeGenFunction &CGF, Address A) const; | |||||
}; | }; | ||||
/// CallArgList - Type for representing both the value and type of | /// CallArgList - Type for representing both the value and type of | ||||
/// arguments in a call. | /// arguments in a call. | ||||
class CallArgList : | class CallArgList : | ||||
public SmallVector<CallArg, 16> { | public SmallVector<CallArg, 16> { | ||||
public: | public: | ||||
CallArgList() : StackBase(nullptr) {} | CallArgList() : StackBase(nullptr) {} | ||||
Show All 13 Lines | public: | ||||
struct CallArgCleanup { | struct CallArgCleanup { | ||||
EHScopeStack::stable_iterator Cleanup; | EHScopeStack::stable_iterator Cleanup; | ||||
/// The "is active" insertion point. This instruction is temporary and | /// The "is active" insertion point. This instruction is temporary and | ||||
/// will be removed after insertion. | /// will be removed after insertion. | ||||
llvm::Instruction *IsActiveIP; | llvm::Instruction *IsActiveIP; | ||||
}; | }; | ||||
void add(RValue rvalue, QualType type, bool needscopy = false) { | void add(RValue rvalue, QualType type) { push_back(CallArg(rvalue, type)); } | ||||
push_back(CallArg(rvalue, type, needscopy)); | |||||
void addUncopiedAggregate(LValue LV, QualType type) { | |||||
push_back(CallArg(LV, type)); | |||||
} | } | ||||
/// Add all the arguments from another CallArgList to this one. After doing | /// Add all the arguments from another CallArgList to this one. After doing | ||||
/// this, the old CallArgList retains its list of arguments, but must not | /// this, the old CallArgList retains its list of arguments, but must not | ||||
/// be used to emit a call. | /// be used to emit a call. | ||||
void addFrom(const CallArgList &other) { | void addFrom(const CallArgList &other) { | ||||
insert(end(), other.begin(), other.end()); | insert(end(), other.begin(), other.end()); | ||||
Writebacks.insert(Writebacks.end(), | Writebacks.insert(Writebacks.end(), | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |