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());
106 bool isVirtual()
const;
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;
llvm::iterator_range< llvm::SmallVector< Scope, 2 >::iterator > scopes()
Range over the scope blocks.
Represents a function declaration or definition.
Descriptor * Desc
Descriptor of the local.
Scope(LocalVectorTy &&Descriptors)
Pointer into the code segment.
std::pair< PrimType, Descriptor * > ParamDescriptor
const FunctionDecl * getDecl() const
Returns the original FunctionDecl.
bool hasRVO() const
Checks if the first argument is a RVO pointer.
Describes the statement/declaration an opcode was generated from.
Scope & getScope(unsigned Idx)
Returns a specific scope.
bool isConstructor() const
Checks if the function is a constructor.
PrimType
Enumeration of the primitive types of the VM.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Describes a memory block created by an allocation site.
Information about a local's storage.
unsigned Offset
Offset of the local in frame.
The program contains and links the bytecode for all functions.
SmallVectorImpl< PrimType >::reverse_iterator arg_reverse_iterator
Range over argument types.
Encodes a location in the source.
unsigned getFrameSize() const
Returns the size of the function's local stack.
Dataflow Directional Tag Classes.
std::vector< std::pair< unsigned, SourceInfo > > SourceMap
llvm::iterator_range< LocalVectorTy::iterator > locals()
An emitter which links the program to bytecode for later use.
bool isConstexpr() const
Checks if the function is valid to call in constexpr.
unsigned getArgSize() const
Returns the size of the argument stackx.
llvm::iterator_range< arg_reverse_iterator > args_reverse()
SourceLocation getLoc() const
Returns the lcoation.