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 visitDeclAndReturn (const VarDecl *E, bool ConstantContext)=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
 We're always emitting bytecode.
 
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 184 of file ByteCodeEmitter.cpp.

References clang::interp::align(), and D.

◆ emitLabel()

void ByteCodeEmitter::emitLabel ( LabelTy  Label)
protected

Define a label.

Definition at line 191 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 322 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.

◆ isActive()

bool clang::interp::ByteCodeEmitter::isActive ( ) const
inlineprotected

We're always emitting bytecode.

Definition at line 58 of file ByteCodeEmitter.h.

◆ jump()

bool ByteCodeEmitter::jump ( const LabelTy Label)
protected

Definition at line 318 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpFalse()

bool ByteCodeEmitter::jumpFalse ( const LabelTy Label)
protected

Definition at line 314 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpTrue()

bool ByteCodeEmitter::jumpTrue ( const LabelTy Label)
protected

Emits jumps.

Definition at line 310 of file ByteCodeEmitter.cpp.

References Label.

◆ visitDeclAndReturn()

virtual bool clang::interp::ByteCodeEmitter::visitDeclAndReturn ( const VarDecl E,
bool  ConstantContext 
)
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 70 of file ByteCodeEmitter.h.

Referenced by compileFunc().

◆ LambdaCaptures

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

Lambda captures.

Definition at line 66 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 68 of file ByteCodeEmitter.h.

Referenced by compileFunc().

◆ Params

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

Parameter indices.

Definition at line 64 of file ByteCodeEmitter.h.

Referenced by compileFunc().


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