13#ifndef LLVM_CLANG_AST_INTERP_INTERPFRAME_H
14#define LLVM_CLANG_AST_INTERP_INTERPFRAME_H
33 CodePtr RetPC,
unsigned ArgSize);
40 unsigned VarArgSize = 0);
53 void describe(llvm::raw_ostream &OS)
const override;
71 template <
typename T>
const T &
getLocal(
unsigned Offset)
const {
72 return localRef<T>(Offset);
77 localRef<T>(Offset) =
Value;
85 template <
typename T>
const T &
getParam(
unsigned Offset)
const {
86 auto Pt = Params.find(Offset);
87 if (Pt == Params.end())
88 return stackRef<T>(Offset);
124 void dump(llvm::raw_ostream &OS,
unsigned Indent = 0)
const;
128 template <
typename T>
const T &stackRef(
unsigned Offset)
const {
130 return *
reinterpret_cast<const T *
>(Args - ArgSize + Offset);
134 template <
typename T>
T &localRef(
unsigned Offset)
const {
139 Block *localBlock(
unsigned Offset)
const {
140 return reinterpret_cast<Block *
>(Locals.get() + Offset -
sizeof(
Block));
144 InlineDescriptor *localInlineDesc(
unsigned Offset)
const {
145 return reinterpret_cast<InlineDescriptor *
>(Locals.get() + Offset);
162 const unsigned ArgSize;
164 char *Args =
nullptr;
166 std::unique_ptr<char[]> Locals;
168 const size_t FrameOffset;
170 llvm::DenseMap<unsigned, std::unique_ptr<char[]>> Params;
This represents one expression.
Represents a function declaration or definition.
Encodes a location in the source.
A trivial tuple used to represent a source range.
A memory block, either on the stack or in the heap.
Pointer into the code segment.
Base class for stack frames, shared between VM and walker.
CodePtr getCodeBegin() const
Returns a pointer to the start of the code.
Frame storing local variables.
void popArgs()
Pops the arguments off the stack.
const Expr * getExpr(CodePtr PC) const
InterpFrame * Caller
The frame of the previous function.
virtual SourceInfo getSource(CodePtr PC) const
Map a location to a source.
CodePtr getRetPC() const
Returns the return address of the frame.
CodePtr getPC() const
Returns the PC of the frame's code start.
SourceLocation getLocation(CodePtr PC) const
~InterpFrame()
Destroys the frame, killing all live pointers to stack slots.
const Pointer & getThis() const
Returns the 'this' pointer.
const Function * getFunction() const
Returns the current function.
size_t getFrameOffset() const
Returns the offset on the stack at which the frame starts.
SourceRange getRange(CodePtr PC) const
void setLocal(unsigned Offset, const T &Value)
Mutates a local variable.
const T & getParam(unsigned Offset) const
Returns the value of an argument.
bool isRoot() const
Checks if the frame is a root frame - return should quit the interpreter.
Pointer getLocalPointer(unsigned Offset) const
Returns a pointer to a local variables.
unsigned getDepth() const
Frame * getCaller() const override
Returns the parent frame object.
void setParam(unsigned Offset, const T &Value)
Mutates a local copy of a parameter.
void destroy(unsigned Idx)
Invokes the destructors for a scope.
const Pointer & getRVOPtr() const
Returns the RVO pointer, if the Function has one.
Pointer getParamPointer(unsigned Offset)
Returns a pointer to an argument - lazily creates a block.
const FunctionDecl * getCallee() const override
Returns the caller.
void initScope(unsigned Idx)
const T & getLocal(unsigned Offset) const
Returns the value of a local variable.
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.
T & deref() const
Dereferences the pointer, if it's live.
Describes the statement/declaration an opcode was generated from.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
unsigned IsInitialized
For primitive fields, it indicates if the field was initialized.