32 Args(static_cast<char *>(S.Stk.top())), ArgSize(ArgSize) {
35 FrameOffset = S.Stk.size();
38 FuncFlags |= Func->hasRVO() * HasRVOFlag;
39 FuncFlags |= Func->hasThisPointer() * HasThisFlag;
42 for (
unsigned I = 0, N = Func->getNumWrittenParams(); I != N; ++I)
46 if (Func->getFrameSize() == 0)
49 for (
auto &
Scope : Func->scopes()) {
75 for (
unsigned I = 0, N = Func->getNumWrittenParams(); I != N; ++I)
76 S.deallocate(argBlock(I));
81 for (
auto &
Scope : Func->scopes()) {
96 for (
auto &
Local : Func->getScope(Idx).locals_reverse()) {
106 if constexpr (std::is_same_v<Pointer, T>) {
110 if (std::optional<APValue> RValue =
V.toRValue(Ctx, Ty))
121 if (F->isLambdaStaticInvoker())
129 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD);
130 MD && MD->getParent()->isAnonymousStructOrUnion())
148 bool IsMemberCall =
false;
149 bool ExplicitInstanceParam =
false;
150 if (
const auto *MD = dyn_cast<CXXMethodDecl>(F)) {
152 ExplicitInstanceParam = MD->isExplicitObjectMemberFunction();
155 if (Func->hasThisPointer() && IsMemberCall) {
156 if (
const auto *MCE = dyn_cast_if_present<CXXMemberCallExpr>(
CallExpr)) {
157 const Expr *
Object = MCE->getImplicitObjectArgument();
158 Object->printPretty(OS,
nullptr,
161 if (
Object->getType()->isPointerType())
165 }
else if (
const auto *OCE =
166 dyn_cast_if_present<CXXOperatorCallExpr>(
CallExpr)) {
167 OCE->getArg(0)->printPretty(OS,
nullptr,
171 }
else if (
const auto *M = dyn_cast<CXXMethodDecl>(F)) {
182 unsigned ParamIndex = ExplicitInstanceParam;
185 llvm::ListSeparator Comma;
187 F->
parameters().slice(ExplicitInstanceParam)) {
189 PrimType PrimT = Func->getParamDescriptor(ParamIndex).T;
191 print(OS, stackRef<T>(
Off), S.getContext(), Param->getType()));
203 return S.EvalLocation;
211 C->Caller->Func->getSource(
C->getRetOpPC()).getRange();
215 return S.EvalLocation;
221 return Func->getDecl();
227 Block *B = argBlock(Index);
231 unsigned ByteOffset = Func->getParamDescriptor(Index).Offset;
235 new (B->
data())
T(stackRef<T>(ByteOffset)));
245 if (F->isConstructor() || F->isDestructor())
248 return !F->getDecl()->isImplicit();
253 return S.getSource(PC);
262 if (Func && !Func->isValid())
278 if (DC->isStdNamespace())
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
static bool shouldSkipInBacktrace(const Function *F)
static void print(llvm::raw_ostream &OS, const T &V, const Context &Ctx, QualType Ty)
static bool funcHasUsableBody(const Function *F)
#define TYPE_SWITCH(Expr, B)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
const clang::PrintingPolicy & getPrintingPolicy() const
CanQualType getCanonicalTagType(const TagDecl *TD) const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
This represents one expression.
Represents a function declaration or definition.
ArrayRef< ParmVarDecl * > parameters() const
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a parameter to a function.
A (possibly-)qualified type.
A trivial tuple used to represent a source range.
bool isPointerOrReferenceType() const
A memory block, either on the stack or in the heap.
std::byte * data()
Returns a pointer to the stored data.
const Descriptor * getDescriptor() const
Returns the block's descriptor.
void invokeCtor()
Invokes the constructor.
bool isInitialized() const
Returns whether the data of this block has been initialized via invoking the Ctor func.
Pointer into the code segment.
Holds all information required to evaluate constexpr code in a module.
ASTContext & getASTContext() const
Returns the AST context.
CodePtr getRetOpPC() const
Returns the return address of the opcode in the caller frame.
InterpFrame(InterpState &S)
Bottom Frame.
InterpFrame * Caller
The frame of the previous function.
SourceInfo getSource(CodePtr PC) const
Map a location to a source.
~InterpFrame()
Destroys the frame, killing all live pointers to stack slots.
const Pointer & getThis() const
Returns the 'this' pointer.
bool isBottomFrame() const
unsigned getArgSize() const
Block * getLocalBlock(unsigned Offset) const
void destroy(unsigned Idx)
Invokes the destructors for a scope.
Pointer getParamPointer(unsigned Offset)
Returns a pointer to an argument - lazily creates a block.
const FunctionDecl * getCallee() const override
Returns the caller.
void enableLocal(unsigned Offset)
bool isStdFunction() const
SourceRange getCallRange() const override
Returns the location of the call to the frame.
void describe(llvm::raw_ostream &OS) const override
Describes the frame with arguments for diagnostic purposes.
A pointer to a memory block, live or dead.
llvm::iterator_range< LocalVectorTy::const_iterator > locals() const
Describes the statement/declaration an opcode was generated from.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
PrimType
Enumeration of the primitive types of the VM.
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Off
Never emit colors regardless of the output stream.
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressLambdaBody
Whether to suppress printing the body of a lambda.
bool isPrimitive() const
Checks if the descriptor is of a primitive.
PrimType getPrimType() const