clang: lib/AST/ByteCode/ByteCodeEmitter.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_AST_INTERP_LINKEMITTER_H
14#define LLVM_CLANG_AST_INTERP_LINKEMITTER_H
15
20
22namespace interp {
24
25
27protected:
31
32public:
33
36
37protected:
39
41
42
44
46
47
49 virtual bool visitExpr(const Expr *E, bool DestroyToplevelScope) = 0;
51
52
57
58
59 bool isActive() const { return true; }
60
61
63
64
65 llvm::DenseMap<const ParmVarDecl *, ParamOffset> Params;
66
67 llvm::DenseMap<const ValueDecl *, ParamOffset> LambdaCaptures;
68
70
72
73private:
74
76
78
80
81 unsigned NextLocalOffset = 0;
82
83 llvm::DenseMap<LabelTy, unsigned> LabelOffsets;
84
85 llvm::DenseMap<LabelTy, llvm::SmallVector<unsigned, 5>> LabelRelocs;
86
87 std::vectorstd::byte Code;
88
90
91
93
94
95 template <typename... Tys>
96 bool emitOp(Opcode Op, const Tys &...Args, const SourceInfo &L);
97
98protected:
99#define GET_LINK_PROTO
100#include "Opcodes.inc"
101#undef GET_LINK_PROTO
102};
103
104}
105}
106
107#endif
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
This represents one expression.
Represents a function declaration or definition.
Represents a variable declaration or definition.
An emitter which links the program to bytecode for later use.
virtual bool visitExpr(const Expr *E, bool DestroyToplevelScope)=0
bool jump(const LabelTy &Label)
void emitLabel(LabelTy Label)
Define a label.
ParamOffset LambdaThisCapture
Offset of the This parameter in a lambda record.
ByteCodeEmitter(Context &Ctx, Program &P)
llvm::DenseMap< const ParmVarDecl *, ParamOffset > Params
Parameter indices.
llvm::DenseMap< const ValueDecl *, ParamOffset > LambdaCaptures
Lambda captures.
bool fallthrough(const LabelTy &Label)
Local createLocal(Descriptor *D)
Callback for local registration.
Function * compileFunc(const FunctionDecl *FuncDecl)
Compiles the function into the module.
Function * compileObjCBlock(const BlockExpr *BE)
Compile an ObjC block, i.e.
virtual bool visitFunc(const FunctionDecl *E)=0
Methods implemented by the compiler.
virtual ~ByteCodeEmitter()
bool jumpTrue(const LabelTy &Label)
Emits jumps.
virtual bool visitDeclAndReturn(const VarDecl *E, bool ConstantContext)=0
bool jumpFalse(const LabelTy &Label)
LabelTy getLabel()
Create a label.
bool isActive() const
We're always emitting bytecode.
llvm::SmallVector< SmallVector< Local, 8 >, 2 > Descriptors
Local descriptors.
Holds all information required to evaluate constexpr code in a module.
The program contains and links the bytecode for all functions.
Describes the statement/declaration an opcode was generated from.
std::vector< std::pair< unsigned, SourceInfo > > SourceMap
The JSON file list parser is used to communicate input to InstallAPI.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Describes a memory block created by an allocation site.
Information about a local's storage.