clang  19.0.0git
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::interp::EvalEmitter Class Referenceabstract

An emitter which evaluates opcodes as they are emitted. More...

#include "/home/runner/work/llvm/llvm/repo/clang/lib/AST/Interp/EvalEmitter.h"

Inheritance diagram for clang::interp::EvalEmitter:
Inheritance graph
[legend]

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)
 
InterpStategetState ()
 
- Public Member Functions inherited from clang::interp::SourceMapper
virtual ~SourceMapper ()
 
const ExprgetExpr (const Function *F, CodePtr PC) const
 Returns the expression if an opcode belongs to one, null otherwise. More...
 
SourceLocation getLocation (const Function *F, CodePtr PC) const
 Returns the location from which an opcode originates. More...
 
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. More...
 
LabelTy getLabel ()
 Create a label. More...
 
virtual bool visitExpr (const Expr *E)=0
 Methods implemented by the compiler. More...
 
virtual bool visitDecl (const VarDecl *VD)=0
 
bool jumpTrue (const LabelTy &Label)
 Emits jumps. More...
 
bool jumpFalse (const LabelTy &Label)
 
bool jump (const LabelTy &Label)
 
bool fallthrough (const LabelTy &Label)
 
Local createLocal (Descriptor *D)
 Callback for registering a local. More...
 
SourceInfo getSource (const Function *F, CodePtr PC) const override
 Returns the source location of the current opcode. More...
 

Protected Attributes

llvm::DenseMap< const ParmVarDecl *, ParamOffsetParams
 Parameter indices. More...
 
llvm::DenseMap< const ValueDecl *, ParamOffsetLambdaCaptures
 Lambda captures. More...
 
ParamOffset LambdaThisCapture {0, false}
 Offset of the This parameter in a lambda record. More...
 
llvm::SmallVector< SmallVector< Local, 8 >, 2 > Descriptors
 Local descriptors. More...
 

Detailed Description

An emitter which evaluates opcodes as they are emitted.

Definition at line 31 of file EvalEmitter.h.

Member Typedef Documentation

◆ AddrTy

Definition at line 34 of file EvalEmitter.h.

◆ LabelTy

Definition at line 33 of file EvalEmitter.h.

◆ Local

Definition at line 35 of file EvalEmitter.h.

Constructor & Destructor Documentation

◆ EvalEmitter()

EvalEmitter::EvalEmitter ( Context Ctx,
Program P,
State Parent,
InterpStack Stk 
)
protected

Definition at line 19 of file EvalEmitter.cpp.

◆ ~EvalEmitter()

EvalEmitter::~EvalEmitter ( )
protectedvirtual

Member Function Documentation

◆ createLocal()

Scope::Local EvalEmitter::createLocal ( Descriptor D)
protected

◆ emitLabel()

void EvalEmitter::emitLabel ( LabelTy  Label)
protected

Define a label.

Definition at line 65 of file EvalEmitter.cpp.

References Label.

◆ fallthrough()

bool EvalEmitter::fallthrough ( const LabelTy Label)
protected

Definition at line 115 of file EvalEmitter.cpp.

References Label.

◆ getLabel()

EvalEmitter::LabelTy EvalEmitter::getLabel ( )
protected

Create a label.

Definition at line 69 of file EvalEmitter.cpp.

◆ getSource()

SourceInfo clang::interp::EvalEmitter::getSource ( const Function F,
CodePtr  PC 
) const
inlineoverrideprotectedvirtual

Returns the source location of the current opcode.

Implements clang::interp::SourceMapper.

Definition at line 67 of file EvalEmitter.h.

References clang::interp::Function::getSource(), and clang::interp::Function::hasBody().

◆ getState()

InterpState& clang::interp::EvalEmitter::getState ( )
inline

Definition at line 41 of file EvalEmitter.h.

◆ interpretDecl()

EvaluationResult EvalEmitter::interpretDecl ( const VarDecl VD,
bool  CheckFullyInitialized 
)

◆ interpretExpr()

EvaluationResult EvalEmitter::interpretExpr ( const Expr E,
bool  ConvertResultToRValue = false 
)

◆ jump()

bool EvalEmitter::jump ( const LabelTy Label)
protected

Definition at line 109 of file EvalEmitter.cpp.

References Label.

◆ jumpFalse()

bool EvalEmitter::jumpFalse ( const LabelTy Label)
protected

◆ jumpTrue()

bool EvalEmitter::jumpTrue ( const LabelTy Label)
protected

Emits jumps.

Definition at line 93 of file EvalEmitter.cpp.

References Label, clang::interp::InterpStack::pop(), and clang::interp::InterpState::Stk.

◆ visitDecl()

virtual bool clang::interp::EvalEmitter::visitDecl ( const VarDecl VD)
protectedpure virtual

Referenced by interpretDecl().

◆ visitExpr()

virtual bool clang::interp::EvalEmitter::visitExpr ( const Expr E)
protectedpure virtual

Methods implemented by the compiler.

Referenced by interpretExpr().

Member Data Documentation

◆ Descriptors

llvm::SmallVector<SmallVector<Local, 8>, 2> clang::interp::EvalEmitter::Descriptors
protected

Local descriptors.

Definition at line 78 of file EvalEmitter.h.

◆ LambdaCaptures

llvm::DenseMap<const ValueDecl *, ParamOffset> clang::interp::EvalEmitter::LambdaCaptures
protected

Lambda captures.

Definition at line 74 of file EvalEmitter.h.

◆ LambdaThisCapture

ParamOffset clang::interp::EvalEmitter::LambdaThisCapture {0, false}
protected

Offset of the This parameter in a lambda record.

Definition at line 76 of file EvalEmitter.h.

◆ Params

llvm::DenseMap<const ParmVarDecl *, ParamOffset> clang::interp::EvalEmitter::Params
protected

Parameter indices.

Definition at line 72 of file EvalEmitter.h.


The documentation for this class was generated from the following files: