clang 20.0.0git
|
An emitter which evaluates opcodes as they are emitted. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/EvalEmitter.h"
Public Types | |
using | LabelTy = uint32_t |
using | AddrTy = uintptr_t |
using | Local = Scope::Local |
Public Member Functions | |
EvaluationResult | interpretExpr (const Expr *E, bool ConvertResultToRValue=false) |
EvaluationResult | interpretDecl (const VarDecl *VD, bool CheckFullyInitialized) |
void | cleanup () |
Clean up all resources. | |
InterpState & | getState () |
Public Member Functions inherited from clang::interp::SourceMapper | |
virtual | ~SourceMapper () |
virtual SourceInfo | getSource (const Function *F, CodePtr PC) const =0 |
Returns source information for a given PC in a function. | |
const Expr * | getExpr (const Function *F, CodePtr PC) const |
Returns the expression if an opcode belongs to one, null otherwise. | |
SourceLocation | getLocation (const Function *F, CodePtr PC) const |
Returns the location from which an opcode originates. | |
SourceRange | getRange (const Function *F, CodePtr PC) const |
Protected Member Functions | |
EvalEmitter (Context &Ctx, Program &P, State &Parent, InterpStack &Stk) | |
virtual | ~EvalEmitter () |
void | emitLabel (LabelTy Label) |
Define a label. | |
LabelTy | getLabel () |
Create a label. | |
virtual bool | visitExpr (const Expr *E)=0 |
Methods implemented by the compiler. | |
virtual bool | visitDeclAndReturn (const VarDecl *VD, bool ConstantContext)=0 |
virtual bool | visitFunc (const FunctionDecl *F)=0 |
bool | jumpTrue (const LabelTy &Label) |
Emits jumps. | |
bool | jumpFalse (const LabelTy &Label) |
bool | jump (const LabelTy &Label) |
bool | fallthrough (const LabelTy &Label) |
bool | isActive () const |
Since expressions can only jump forward, predicated execution is used to deal with if-else statements. | |
Local | createLocal (Descriptor *D) |
Callback for registering a local. | |
SourceInfo | getSource (const Function *F, CodePtr PC) const override |
Returns the source location of the current opcode. | |
Protected Attributes | |
llvm::DenseMap< const ParmVarDecl *, ParamOffset > | Params |
Parameter indices. | |
llvm::DenseMap< const ValueDecl *, ParamOffset > | LambdaCaptures |
Lambda captures. | |
ParamOffset | LambdaThisCapture {0, false} |
Offset of the This parameter in a lambda record. | |
llvm::SmallVector< SmallVector< Local, 8 >, 2 > | Descriptors |
Local descriptors. | |
An emitter which evaluates opcodes as they are emitted.
Definition at line 31 of file EvalEmitter.h.
Definition at line 34 of file EvalEmitter.h.
using clang::interp::EvalEmitter::LabelTy = uint32_t |
Definition at line 33 of file EvalEmitter.h.
Definition at line 35 of file EvalEmitter.h.
|
protected |
Definition at line 19 of file EvalEmitter.cpp.
References clang::interp::InterpState::Current.
|
protectedvirtual |
Definition at line 27 of file EvalEmitter.cpp.
References clang::interp::Block::invokeDtor(), clang::interp::Block::isInitialized(), and V.
void EvalEmitter::cleanup | ( | ) |
Clean up all resources.
Clean up all our resources.
This needs to done in failed evaluations before we call InterpStack::clear(), because there might be a Pointer on the stack pointing into a Block in the EvalEmitter.
Definition at line 38 of file EvalEmitter.cpp.
References clang::interp::InterpState::cleanup().
|
protected |
Callback for registering a local.
Definition at line 83 of file EvalEmitter.cpp.
References D, clang::interp::InlineDescriptor::Desc, clang::interp::Context::getEvalID(), clang::interp::Block::invokeCtor(), clang::interp::InlineDescriptor::IsActive, clang::interp::InlineDescriptor::IsBase, clang::interp::InlineDescriptor::IsConst, clang::interp::InlineDescriptor::IsFieldMutable, clang::interp::InlineDescriptor::IsInitialized, and clang::interp::InlineDescriptor::Offset.
|
protected |
Definition at line 127 of file EvalEmitter.cpp.
References isActive(), and Label.
|
protected |
Create a label.
Definition at line 81 of file EvalEmitter.cpp.
|
inlineoverrideprotectedvirtual |
Returns the source location of the current opcode.
Implements clang::interp::SourceMapper.
Definition at line 75 of file EvalEmitter.h.
References clang::interp::Function::getSource(), and clang::interp::Function::hasBody().
|
inline |
Definition at line 44 of file EvalEmitter.h.
EvaluationResult EvalEmitter::interpretDecl | ( | const VarDecl * | VD, |
bool | CheckFullyInitialized | ||
) |
Definition at line 56 of file EvalEmitter.cpp.
References clang::interp::InterpState::EvaluatingDecl, clang::VarDecl::getAnyInitializer(), clang::ValueDecl::getType(), clang::interp::InterpState::inConstantContext(), clang::Init, clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::T, and visitDeclAndReturn().
EvaluationResult EvalEmitter::interpretExpr | ( | const Expr * | E, |
bool | ConvertResultToRValue = false |
||
) |
Definition at line 40 of file EvalEmitter.cpp.
References E, clang::Expr::getExprLoc(), clang::interp::InterpState::setEvalLocation(), and visitExpr().
|
inlineprotected |
Since expressions can only jump forward, predicated execution is used to deal with if-else statements.
Definition at line 69 of file EvalEmitter.h.
Referenced by fallthrough(), jump(), jumpFalse(), and jumpTrue().
Definition at line 121 of file EvalEmitter.cpp.
References isActive(), and Label.
Definition at line 113 of file EvalEmitter.cpp.
References isActive(), Label, clang::interp::InterpStack::pop(), and clang::interp::InterpState::Stk.
Emits jumps.
Definition at line 105 of file EvalEmitter.cpp.
References isActive(), Label, clang::interp::InterpStack::pop(), and clang::interp::InterpState::Stk.
|
protectedpure virtual |
Referenced by interpretDecl().
Methods implemented by the compiler.
Referenced by interpretExpr().
|
protectedpure virtual |
|
protected |
Local descriptors.
Definition at line 86 of file EvalEmitter.h.
|
protected |
Lambda captures.
Definition at line 82 of file EvalEmitter.h.
|
protected |
Offset of the This parameter in a lambda record.
Definition at line 84 of file EvalEmitter.h.
|
protected |
Parameter indices.
Definition at line 80 of file EvalEmitter.h.