clang 17.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"

Collaboration diagram for clang::interp::ByteCodeEmitter:
Collaboration graph
[legend]

Public Member Functions

llvm::Expected< Function * > compileFunc (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 bail (const Stmt *S)
 Bails out if a given node cannot be compiled.
 
bool bail (const Decl *D)
 
bool bail (const SourceLocation &Loc)
 
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 *, unsignedParams
 Parameter indices.
 
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 32 of file ByteCodeEmitter.h.

Member Typedef Documentation

◆ AddrTy

Definition at line 35 of file ByteCodeEmitter.h.

◆ LabelTy

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

Definition at line 34 of file ByteCodeEmitter.h.

◆ Local

Definition at line 36 of file ByteCodeEmitter.h.

Constructor & Destructor Documentation

◆ ByteCodeEmitter()

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

Definition at line 43 of file ByteCodeEmitter.h.

References P.

◆ ~ByteCodeEmitter()

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

Definition at line 45 of file ByteCodeEmitter.h.

Member Function Documentation

◆ bail() [1/3]

bool clang::interp::ByteCodeEmitter::bail ( const Decl D)
inlineprotected

Definition at line 59 of file ByteCodeEmitter.h.

References bail(), and clang::Decl::getBeginLoc().

Referenced by bail().

◆ bail() [2/3]

bool ByteCodeEmitter::bail ( const SourceLocation Loc)
protected

Definition at line 143 of file ByteCodeEmitter.cpp.

◆ bail() [3/3]

bool clang::interp::ByteCodeEmitter::bail ( const Stmt S)
inlineprotected

Bails out if a given node cannot be compiled.

Definition at line 58 of file ByteCodeEmitter.h.

References bail().

Referenced by bail().

◆ compileFunc()

Expected< Function * > ByteCodeEmitter::compileFunc ( const FunctionDecl FuncDecl)

◆ createLocal()

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

Callback for local registration.

Definition at line 101 of file ByteCodeEmitter.cpp.

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

◆ emitLabel()

void ByteCodeEmitter::emitLabel ( LabelTy  Label)
protected

Define a label.

Rewrite the operand of all jumps to this label.

Definition at line 108 of file ByteCodeEmitter.cpp.

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

Referenced by fallthrough().

◆ fallthrough()

bool ByteCodeEmitter::fallthrough ( const LabelTy Label)
protected

Definition at line 209 of file ByteCodeEmitter.cpp.

References emitLabel(), and Label.

◆ getLabel()

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

Create a label.

Definition at line 50 of file ByteCodeEmitter.h.

◆ jump()

bool ByteCodeEmitter::jump ( const LabelTy Label)
protected

Definition at line 205 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpFalse()

bool ByteCodeEmitter::jumpFalse ( const LabelTy Label)
protected

Definition at line 201 of file ByteCodeEmitter.cpp.

References Label.

◆ jumpTrue()

bool ByteCodeEmitter::jumpTrue ( const LabelTy Label)
protected

Emits jumps.

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

Referenced by compileFunc().

◆ Params

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

Parameter indices.

Definition at line 72 of file ByteCodeEmitter.h.

Referenced by compileFunc().


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