Go to the documentation of this file.
15 #ifndef LLVM_CLANG_AST_INTERP_FUNCTION_H
16 #define LLVM_CLANG_AST_INTERP_FUNCTION_H
21 #include "llvm/Support/raw_ostream.h"
26 class ByteCodeEmitter;
46 llvm::iterator_range<LocalVectorTy::iterator>
locals() {
47 return llvm::make_range(Descriptors.begin(), Descriptors.end());
83 bool hasRVO()
const {
return ParamTypes.size() != Params.size(); }
86 llvm::iterator_range<llvm::SmallVector<Scope, 2>::iterator>
scopes() {
87 return llvm::make_range(Scopes.begin(), Scopes.end());
93 return llvm::make_range(ParamTypes.rbegin(), ParamTypes.rend());
115 llvm::DenseMap<unsigned, ParamDescriptor> &&Params);
118 void setCode(
unsigned NewFrameSize, std::vector<char> &&NewCode,
SourceMap &&NewSrcMap,
120 FrameSize = NewFrameSize;
121 Code = std::move(NewCode);
122 SrcMap = std::move(NewSrcMap);
123 Scopes = std::move(NewScopes);
142 std::vector<char> Code;
150 llvm::DenseMap<unsigned, ParamDescriptor> Params;
152 bool IsValid =
false;
157 void dump(llvm::raw_ostream &OS)
const;
CodePtr getCodeBegin() const
Returns a pointer to the start of the code.
const FunctionDecl * getDecl() const
Returns the original FunctionDecl.
unsigned getArgSize() const
Returns the size of the argument stackx.
llvm::iterator_range< llvm::SmallVector< Scope, 2 >::iterator > scopes()
Range over the scope blocks.
Encodes a location in the source.
bool isConstexpr() const
Checks if the function is valid to call in constexpr.
CodePtr getCodeEnd() const
Returns a pointer to the end of the code.
bool hasRVO() const
Checks if the first argument is a RVO pointer.
SourceInfo getSource(CodePtr PC) const
Returns the source information at a given PC.
Information about a local's storage.
SourceLocation getLoc() const
Returns the location.
PrimType
Enumeration of the primitive types of the VM.
Describes the statement/declaration an opcode was generated from.
llvm::iterator_range< LocalVectorTy::iterator > locals()
unsigned Offset
Offset of the local in frame.
An emitter which links the program to bytecode for later use.
std::pair< PrimType, Descriptor * > ParamDescriptor
std::vector< std::pair< unsigned, SourceInfo > > SourceMap
ParamDescriptor getParamDescriptor(unsigned Offset) const
Returns a parameter descriptor.
Pointer into the code segment.
bool isConstructor() const
Checks if the function is a constructor.
Describes a memory block created by an allocation site.
llvm::iterator_range< arg_reverse_iterator > args_reverse()
Scope & getScope(unsigned Idx)
Returns a specific scope.
void dump() const
Dumps the disassembled bytecode to llvm::errs().
Scope(LocalVectorTy &&Descriptors)
Descriptor * Desc
Descriptor of the local.
bool isVirtual() const
Checks if the function is virtual.
The program contains and links the bytecode for all functions.
unsigned getFrameSize() const
Returns the size of the function's local stack.
SmallVectorImpl< PrimType >::reverse_iterator arg_reverse_iterator
Range over argument types.
Represents a function declaration or definition.
llvm::SmallVector< Local, 8 > LocalVectorTy