13#ifndef LLVM_CLANG_AST_INTERP_EVALEMITTER_H
14#define LLVM_CLANG_AST_INTERP_EVALEMITTER_H
20#include "llvm/Support/Error.h"
38 bool ConvertResultToRValue =
false);
69 bool isActive()
const {
return CurrentLabel == ActiveLabel; }
80 llvm::DenseMap<const ParmVarDecl *, ParamOffset>
Params;
98 bool ConvertResultToRValue =
false;
101 bool CheckFullyInitialized =
false;
104 llvm::DenseMap<unsigned, std::unique_ptr<char[]>> Locals;
106 Block *getLocal(
unsigned Index)
const {
107 auto It = Locals.find(Index);
108 assert(It != Locals.end() &&
"Missing local variable");
109 return reinterpret_cast<Block *
>(It->second.get());
112 void updateGlobalTemporaries();
128#define GET_EVAL_PROTO
129#include "Opcodes.inc"
This represents one expression.
Represents a function declaration or definition.
Represents a variable declaration or definition.
A memory block, either on the stack or in the heap.
Pointer into the code segment.
Holds all information required to evaluate constexpr code in a module.
An emitter which evaluates opcodes as they are emitted.
bool jump(const LabelTy &Label)
EvaluationResult interpretExpr(const Expr *E, bool ConvertResultToRValue=false)
EvaluationResult interpretDecl(const VarDecl *VD, bool CheckFullyInitialized)
virtual bool visitFunc(const FunctionDecl *F)=0
virtual bool visitExpr(const Expr *E)=0
Methods implemented by the compiler.
bool jumpFalse(const LabelTy &Label)
Local createLocal(Descriptor *D)
Callback for registering a local.
void emitLabel(LabelTy Label)
Define a label.
bool isActive() const
Since expressions can only jump forward, predicated execution is used to deal with if-else statements...
bool fallthrough(const LabelTy &Label)
void cleanup()
Clean up all resources.
LabelTy getLabel()
Create a label.
llvm::DenseMap< const ValueDecl *, ParamOffset > LambdaCaptures
Lambda captures.
virtual bool visitDeclAndReturn(const VarDecl *VD, bool ConstantContext)=0
llvm::DenseMap< const ParmVarDecl *, ParamOffset > Params
Parameter indices.
ParamOffset LambdaThisCapture
Offset of the This parameter in a lambda record.
SourceInfo getSource(const Function *F, CodePtr PC) const override
Returns the source location of the current opcode.
llvm::SmallVector< SmallVector< Local, 8 >, 2 > Descriptors
Local descriptors.
bool jumpTrue(const LabelTy &Label)
Emits jumps.
Defines the result of an evaluation.
bool hasBody() const
Checks if the function already has a body attached.
SourceInfo getSource(CodePtr PC) const
Returns the source information at a given PC.
Stack frame storing temporaries and parameters.
The program contains and links the bytecode for all functions.
Describes the statement/declaration an opcode was generated from.
Interface for classes which map locations to sources.
Interface for the VM to interact with the AST walker's context.
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.