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

An emitter which links the program to bytecode for later use. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/Interp/ByteCodeEmitter.h"

Public Member Functions

FunctioncompileFunc (const FunctionDecl *FuncDecl)
 Compiles the function into the module.
 

Protected Types

using LabelTy = uint32_t
 
using AddrTy = uintptr_t
 
using Local = Scope::Local
 

Protected Member Functions

 ByteCodeEmitter (Context &Ctx, Program &P)
 
virtual ~ByteCodeEmitter ()
 
void emitLabel (LabelTy Label)
 Define a label.
 
LabelTy getLabel ()
 Create a label.
 
virtual bool visitFunc (const FunctionDecl *E)=0
 Methods implemented by the compiler.
 
virtual bool visitExpr (const Expr *E)=0
 
virtual bool visitDecl (const VarDecl *E)=0
 
bool jumpTrue (const LabelTy &Label)
 Emits jumps.
 
bool jumpFalse (const LabelTy &Label)
 
bool jump (const LabelTy &Label)
 
bool fallthrough (const LabelTy &Label)
 
Local createLocal (Descriptor *D)
 Callback for local registration.
 

Protected Attributes

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

Detailed Description

An emitter which links the program to bytecode for later use.

Definition at line 26 of file ByteCodeEmitter.h.

Member Typedef Documentation

◆ AddrTy

Definition at line 29 of file ByteCodeEmitter.h.

◆ LabelTy

using clang::interp::ByteCodeEmitter::LabelTy = uint32_t
protected

Definition at line 28 of file ByteCodeEmitter.h.

◆ Local

Definition at line 30 of file ByteCodeEmitter.h.

Constructor & Destructor Documentation

◆ ByteCodeEmitter()

clang::interp::ByteCodeEmitter::ByteCodeEmitter ( Context Ctx,
Program P 
)
inlineprotected

Definition at line 37 of file ByteCodeEmitter.h.

References P.

◆ ~ByteCodeEmitter()

virtual clang::interp::ByteCodeEmitter::~ByteCodeEmitter ( )
inlineprotectedvirtual

Definition at line 39 of file ByteCodeEmitter.h.

Member Function Documentation

◆ compileFunc()

Function * ByteCodeEmitter::compileFunc ( const FunctionDecl FuncDecl)

◆ createLocal()

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

Callback for local registration.

Definition at line 182 of file ByteCodeEmitter.cpp.

References clang::interp::align(), and clang::interp::Descriptor::getAllocSize().

◆ emitLabel()

void ByteCodeEmitter::emitLabel ( LabelTy  Label)
protected

Define a label.

Definition at line 189 of file ByteCodeEmitter.cpp.

References clang::interp::align(), clang::interp::aligned(), and Label.

Referenced by fallthrough().

◆ fallthrough()

bool ByteCodeEmitter::fallthrough ( const LabelTy Label)
protected

Definition at line 320 of file ByteCodeEmitter.cpp.

References emitLabel(), and Label.

◆ getLabel()

LabelTy clang::interp::ByteCodeEmitter::getLabel ( )
inlineprotected

Create a label.

Definition at line 44 of file ByteCodeEmitter.h.

◆ jump()

bool ByteCodeEmitter::jump ( const LabelTy Label)
protected

Definition at line 316 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpFalse()

bool ByteCodeEmitter::jumpFalse ( const LabelTy Label)
protected

Definition at line 312 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpTrue()

bool ByteCodeEmitter::jumpTrue ( const LabelTy Label)
protected

Emits jumps.

Definition at line 308 of file ByteCodeEmitter.cpp.

References Label.

◆ visitDecl()

virtual bool clang::interp::ByteCodeEmitter::visitDecl ( const VarDecl E)
protectedpure virtual

◆ visitExpr()

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

◆ visitFunc()

virtual bool clang::interp::ByteCodeEmitter::visitFunc ( const FunctionDecl E)
protectedpure virtual

Methods implemented by the compiler.

Referenced by compileFunc().

Member Data Documentation

◆ Descriptors

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

Local descriptors.

Definition at line 67 of file ByteCodeEmitter.h.

Referenced by compileFunc().

◆ LambdaCaptures

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

Lambda captures.

Definition at line 63 of file ByteCodeEmitter.h.

Referenced by compileFunc().

◆ LambdaThisCapture

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

Offset of the This parameter in a lambda record.

Definition at line 65 of file ByteCodeEmitter.h.

Referenced by compileFunc().

◆ Params

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

Parameter indices.

Definition at line 61 of file ByteCodeEmitter.h.

Referenced by compileFunc().


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