15#ifndef LLVM_CLANG_AST_INTERP_FUNCTION_H
16#define LLVM_CLANG_AST_INTERP_FUNCTION_H
21#include "llvm/Support/raw_ostream.h"
46 llvm::iterator_range<LocalVectorTy::const_iterator>
locals()
const {
47 return llvm::make_range(Descriptors.begin(), Descriptors.end());
110 llvm::iterator_range<llvm::SmallVector<Scope, 2>::const_iterator>
112 return llvm::make_range(Scopes.begin(), Scopes.end());
119 return llvm::reverse(ParamTypes);
156 llvm::DenseMap<unsigned, ParamDescriptor> &&Params,
157 bool HasThisPointer,
bool HasRVO);
160 void setCode(
unsigned NewFrameSize, std::vector<char> &&NewCode,
SourceMap &&NewSrcMap,
162 FrameSize = NewFrameSize;
163 Code = std::move(NewCode);
164 SrcMap = std::move(NewSrcMap);
165 Scopes = std::move(NewScopes);
170 void setIsFullyCompiled(
bool FC) { IsFullyCompiled = FC; }
183 unsigned FrameSize = 0;
187 std::vector<char> Code;
195 llvm::DenseMap<unsigned, ParamDescriptor> Params;
197 bool IsValid =
false;
200 bool IsFullyCompiled =
false;
203 bool HasThisPointer =
false;
209 bool HasBody =
false;
214 void dump(llvm::raw_ostream &
OS)
const;
Represents a function declaration or definition.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
std::string getQualifiedNameAsString() const
Encodes a location in the source.
An emitter which links the program to bytecode for later use.
Pointer into the code segment.
Scope & getScope(unsigned Idx)
Returns a specific scope.
CodePtr getCodeBegin() const
Returns a pointer to the start of the code.
SourceLocation getLoc() const
Returns the location.
bool isDestructor() const
Checks if the function is a destructor.
CodePtr getCodeEnd() const
Returns a pointer to the end of the code.
const std::string getName() const
Returns the name of the function decl this code was generated for.
unsigned getNumParams() const
std::pair< PrimType, Descriptor * > ParamDescriptor
unsigned getFrameSize() const
Returns the size of the function's local stack.
bool isFullyCompiled() const
Checks if the function is fully done compiling.
bool isConstructor() const
Checks if the function is a constructor.
const FunctionDecl * getDecl() const
Returns the original FunctionDecl.
bool hasThisPointer() const
bool isVirtual() const
Checks if the function is virtual.
unsigned getBuiltinID() const
void dump() const
Dumps the disassembled bytecode to llvm::errs().
llvm::iterator_range< arg_reverse_iterator > args_reverse() const
bool isConstexpr() const
Checks if the function is valid to call in constexpr.
const Scope & getScope(unsigned Idx) const
unsigned getArgSize() const
Returns the size of the argument stack.
SmallVectorImpl< PrimType >::const_reverse_iterator arg_reverse_iterator
Range over argument types.
SourceInfo getSource(CodePtr PC) const
Returns the source information at a given PC.
ParamDescriptor getParamDescriptor(unsigned Offset) const
Returns a parameter descriptor.
llvm::iterator_range< llvm::SmallVector< Scope, 2 >::const_iterator > scopes() const
Range over the scope blocks.
bool hasRVO() const
Checks if the first argument is a RVO pointer.
The program contains and links the bytecode for all functions.
llvm::SmallVector< Local, 8 > LocalVectorTy
llvm::iterator_range< LocalVectorTy::const_iterator > locals() const
Scope(LocalVectorTy &&Descriptors)
Describes the statement/declaration an opcode was generated from.
std::vector< std::pair< unsigned, SourceInfo > > SourceMap
PrimType
Enumeration of the primitive types of the VM.
Describes a memory block created by an allocation site.
Information about a local's storage.
unsigned Offset
Offset of the local in frame.
Descriptor * Desc
Descriptor of the local.