clang  10.0.0svn
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 "/opt/doxygen-docs/src/llvm/tools/clang/lib/AST/Interp/ByteCodeEmitter.h"

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

Public Member Functions

llvm::Expected< Function * > compileFunc (const FunctionDecl *F)
 Compiles the function into the module. More...
 

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. More...
 
LabelTy getLabel ()
 Create a label. More...
 
virtual bool visitFunc (const FunctionDecl *E)=0
 Methods implemented by the compiler. More...
 
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. More...
 
bool bail (const Decl *D)
 
bool bail (const SourceLocation &Loc)
 
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 local registration. More...
 

Protected Attributes

llvm::DenseMap< const ParmVarDecl *, unsigned > Params
 Parameter indices. More...
 
llvm::SmallVector< SmallVector< Local, 8 >, 2 > Descriptors
 Local descriptors. More...
 

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.

◆ ~ByteCodeEmitter()

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

Definition at line 45 of file ByteCodeEmitter.h.

References emitLabel(), and Label.

Member Function Documentation

◆ bail() [1/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.

Referenced by bail().

◆ bail() [2/3]

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

Definition at line 59 of file ByteCodeEmitter.h.

References bail(), createLocal(), fallthrough(), clang::Decl::getBeginLoc(), jump(), jumpFalse(), and jumpTrue().

Referenced by bail().

◆ bail() [3/3]

bool ByteCodeEmitter::bail ( const SourceLocation Loc)
protected

Definition at line 119 of file ByteCodeEmitter.cpp.

References max(), and clang::interp::Success.

◆ compileFunc()

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

◆ createLocal()

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

Callback for local registration.

Definition at line 80 of file ByteCodeEmitter.cpp.

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

Referenced by bail().

◆ emitLabel()

void ByteCodeEmitter::emitLabel ( LabelTy  Label)
protected

Define a label.

Rewrite the operand of all jumps to this label.

Definition at line 87 of file ByteCodeEmitter.cpp.

References Label, Offset, and clang::Target.

Referenced by fallthrough(), and ~ByteCodeEmitter().

◆ fallthrough()

bool ByteCodeEmitter::fallthrough ( const LabelTy Label)
protected

Definition at line 164 of file ByteCodeEmitter.cpp.

References emitLabel().

Referenced by bail().

◆ getLabel()

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

Create a label.

Definition at line 50 of file ByteCodeEmitter.h.

References visitDecl(), visitExpr(), and visitFunc().

◆ jump()

bool ByteCodeEmitter::jump ( const LabelTy Label)
protected

Definition at line 160 of file ByteCodeEmitter.cpp.

Referenced by bail().

◆ jumpFalse()

bool ByteCodeEmitter::jumpFalse ( const LabelTy Label)
protected

Definition at line 156 of file ByteCodeEmitter.cpp.

Referenced by bail().

◆ jumpTrue()

bool ByteCodeEmitter::jumpTrue ( const LabelTy Label)
protected

Emits jumps.

Definition at line 152 of file ByteCodeEmitter.cpp.

Referenced by bail().

◆ visitDecl()

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

Referenced by getLabel().

◆ visitExpr()

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

Referenced by getLabel().

◆ visitFunc()

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

Methods implemented by the compiler.

Referenced by compileFunc(), and getLabel().

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: