27 ArgSize(0), Depth(0) {}
32 Args(static_cast<char *>(S.Stk.top())), ArgSize(ArgSize),
36 FrameOffset = S.Stk.size();
39 FuncFlags |= Func->hasRVO() * HasRVOFlag;
40 FuncFlags |= Func->hasThisPointer() * HasThisFlag;
43 for (
unsigned I = 0, N = Func->getNumWrittenParams(); I != N; ++I)
44 new (argBlock(I))
Block(S.EvalID, Func->getParamDescriptor(I).Desc);
46 if (Func->getFrameSize() == 0)
49 for (
auto &
Scope : Func->scopes()) {
51 new (localBlock(Local.Offset))
76 for (
unsigned I = 0, N = Func->getNumWrittenParams(); I != N; ++I)
77 S.deallocate(argBlock(I));
86 if (!Func || Func->getFrameSize() == 0)
88 for (
auto &
Scope : Func->scopes()) {
90 S.deallocate(localBlock(Local.Offset));
99 for (
auto &Local : Func->getScope(Idx).locals()) {
100 assert(!localBlock(Local.Offset)->isInitialized());
101 localBlock(Local.Offset)->invokeCtor();
113 localInlineDesc(Idx)->IsActive =
true;
117 for (
auto &Local : Func->getScope(Idx).locals_reverse()) {
118 S.deallocate(localBlock(Local.Offset));
125 if constexpr (std::is_same_v<Pointer, T>) {
129 if (std::optional<APValue> RValue =
V.toRValue(Ctx, Ty))
140 if (F->isLambdaStaticInvoker())
148 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD);
149 MD && MD->getParent()->isAnonymousStructOrUnion())
167 bool IsMemberCall =
false;
168 bool ExplicitInstanceParam =
false;
169 if (
const auto *MD = dyn_cast<CXXMethodDecl>(F)) {
171 ExplicitInstanceParam = MD->isExplicitObjectMemberFunction();
174 if (Func->hasThisPointer() && IsMemberCall) {
175 if (
const auto *MCE = dyn_cast_if_present<CXXMemberCallExpr>(
CallExpr)) {
176 const Expr *
Object = MCE->getImplicitObjectArgument();
177 Object->printPretty(OS,
nullptr,
180 if (
Object->getType()->isPointerType())
184 }
else if (
const auto *OCE =
185 dyn_cast_if_present<CXXOperatorCallExpr>(
CallExpr)) {
186 OCE->getArg(0)->printPretty(OS,
nullptr,
190 }
else if (
const auto *M = dyn_cast<CXXMethodDecl>(F)) {
201 unsigned ParamIndex = ExplicitInstanceParam;
204 llvm::ListSeparator Comma;
206 F->
parameters().slice(ExplicitInstanceParam)) {
208 PrimType PrimT = Func->getParamDescriptor(ParamIndex).T;
210 print(OS, stackRef<T>(
Off), S.getContext(), Param->getType()));
222 return S.EvalLocation;
230 C->Caller->Func->getSource(
C->getRetOpPC()).getRange();
234 return S.EvalLocation;
240 return Func->getDecl();
244 assert(Offset < Func->getFrameSize() &&
"Invalid local offset.");
245 return Pointer(localBlock(Offset));
249 return localBlock(Offset);
255 Block *B = argBlock(Index);
259 unsigned ByteOffset = Func->getParamDescriptor(Index).Offset;
263 new (B->
data())
T(stackRef<T>(ByteOffset)));
273 if (F->isConstructor() || F->isDestructor())
276 return !F->getDecl()->isImplicit();
281 return S.getSource(PC);
301 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.
static constexpr uint8_t InlineDescMD
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.
void enableLocal(unsigned Idx)
Block * getLocalBlock(unsigned Offset) const
~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
Pointer getLocalPointer(unsigned Offset) const
Returns a pointer to a local variables.
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.
bool isStdFunction() const
void initScope(unsigned Idx)
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
Inline descriptor embedded in structures and arrays.