15#ifndef LLVM_CLANG_AST_INTERP_FUNCTION_H
16#define LLVM_CLANG_AST_INTERP_FUNCTION_H
23#include "llvm/ADT/PointerUnion.h"
24#include "llvm/Support/raw_ostream.h"
51 llvm::iterator_range<LocalVectorTy::const_iterator>
locals()
const {
52 return llvm::make_range(Descriptors.begin(), Descriptors.end());
55 llvm::iterator_range<LocalVectorTy::const_reverse_iterator>
57 return llvm::reverse(Descriptors);
66 llvm::PointerUnion<const FunctionDecl *, const BlockExpr *>;
134 return dyn_cast<const FunctionDecl *>(Source);
137 return dyn_cast<const BlockExpr *>(Source);
141 return FD->getType();
156 return ParamDescriptors[Index];
165 llvm::iterator_range<llvm::SmallVector<Scope, 2>::const_iterator>
167 return llvm::make_range(Scopes.begin(), Scopes.end());
174 return llvm::reverse(ParamDescriptors);
221 if (
const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
222 dyn_cast<const FunctionDecl *>(Source)))
232 return HasThisPointer && ExplicitThisPointer;
235 return HasThisPointer && !ExplicitThisPointer;
255 return ParamDescriptors.size();
265 bool HasThisPointer,
bool HasRVO,
bool IsLambdaStaticInvoker);
272 this->Source = Source;
273 FrameSize = NewFrameSize;
274 Code = std::move(NewCode);
275 SrcMap = std::move(NewSrcMap);
276 Scopes = std::move(NewScopes);
277 IsValid = NewIsValid;
278 HasBody = NewHasBody;
281 void setIsFullyCompiled(
bool FC) { IsFullyCompiled = FC; }
282 void setDefined(
bool D) { Defined = D; }
300 unsigned FrameSize = 0;
306 LLVM_PREFERRED_TYPE(
bool)
307 unsigned IsValid : 1;
310 LLVM_PREFERRED_TYPE(
bool)
311 unsigned IsFullyCompiled : 1;
314 LLVM_PREFERRED_TYPE(
bool)
315 unsigned HasThisPointer : 1;
316 LLVM_PREFERRED_TYPE(
bool)
317 unsigned ExplicitThisPointer : 1;
321 LLVM_PREFERRED_TYPE(
bool)
324 LLVM_PREFERRED_TYPE(
bool)
325 unsigned HasBody : 1;
326 LLVM_PREFERRED_TYPE(
bool)
327 unsigned Defined : 1;
328 LLVM_PREFERRED_TYPE(
bool)
329 unsigned Variadic : 1;
330 LLVM_PREFERRED_TYPE(
bool)
331 unsigned Virtual : 1;
332 LLVM_PREFERRED_TYPE(
bool)
333 unsigned Immediate : 1;
334 LLVM_PREFERRED_TYPE(
bool)
335 unsigned Constexpr : 1;
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ struct/union/class.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Represents a function declaration or definition.
std::string getQualifiedNameAsString() const
A (possibly-)qualified type.
An emitter which links the program to bytecode for later use.
Pointer into the code segment.
bool hasExplicitThisPointer() const
Scope & getScope(unsigned Idx)
Returns a specific scope.
CodePtr getCodeBegin() const
Returns a pointer to the start of the code.
bool isDestructor() const
Checks if the function is a destructor.
CodePtr getCodeEnd() const
Returns a pointer to the end of the code.
friend class ByteCodeEmitter
std::string getName() const
Returns the name of the function decl this code was generated for.
bool isVirtual() const
Checks if the function is virtual.
unsigned getNumParams() const
Returs the full number of parameters, including implicit instance and RVO pointers.
bool isDefined() const
Checks if the function is defined.
bool hasNonNullAttr() const
const CXXRecordDecl * getParentDecl() const
Returns the parent record decl, if any.
unsigned getFrameSize() const
Returns the size of the function's local stack.
bool isLambdaCallOperator() const
Returns whether this function is the call operator of a lambda record decl.
const BlockExpr * getExpr() const
bool isFullyCompiled() const
Checks if the function is fully done compiling.
bool isConstructor() const
Checks if the function is a constructor.
bool hasImplicitThisPointer() const
const FunctionDecl * getDecl() const
Returns the original FunctionDecl.
bool hasBody() const
Checks if the function already has a body attached.
bool hasThisPointer() const
void dump(llvm::raw_ostream &OS, CodePtr PC={}) const
llvm::iterator_range< arg_reverse_iterator > args_reverse() const
const Scope & getScope(unsigned Idx) const
unsigned getNumWrittenParams() const
Returns the number of parameter this function takes when it's called, i.e excluding the instance poin...
unsigned getWrittenArgSize() const
unsigned getArgSize() const
Returns the size of the argument stack.
bool isLambdaStaticInvoker() const
Returns whether this function is a lambda static invoker, which we generate custom byte code for.
SourceInfo getSource(CodePtr PC) const
Returns the source information at a given PC.
bool isValid() const
Checks if the function is valid to call.
const ParamDescriptor & getParamDescriptor(unsigned Index) const
Returns a parameter descriptor.
void dump() const
Dumps the disassembled bytecode to llvm::errs().
bool isCopyOrMoveConstructor() const
bool isCopyOrMoveOperator() const
Checks if the function is copy or move operator.
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.
SmallVectorImpl< ParamDescriptor >::const_reverse_iterator arg_reverse_iterator
Range over argument types.
A pointer to a memory block, live or dead.
llvm::SmallVector< Local, 8 > LocalVectorTy
llvm::iterator_range< LocalVectorTy::const_iterator > locals() const
Scope(LocalVectorTy &&Descriptors)
llvm::iterator_range< LocalVectorTy::const_reverse_iterator > locals_reverse() const
Describes the statement/declaration an opcode was generated from.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
llvm::PointerUnion< const FunctionDecl *, const BlockExpr * > FunctionDeclTy
PrimType
Enumeration of the primitive types of the VM.
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
Top level wrappers for InstallAPI frontend operations.
__builtin_bitreverse32 uint32_t __builtin_riscv_aaddu_u32 __builtin_riscv_asubu_u32 __builtin_elementwise_add_sat __builtin_elementwise_sub_sat int32_t uint32_t uint32_t __builtin_riscv_mhacc_i32 __builtin_riscv_mhaccu_u32 __builtin_riscv_mhaccsu_i32 __builtin_riscv_mulq_i32 uint8_t
Describes a memory block created by an allocation site.
unsigned BlockOffset
Offset in the InterpFrame.
unsigned Offset
Offset on the stack.
ParamDescriptor(const Descriptor *Desc, unsigned Offset, unsigned BlockOffset, PrimType T)
Information about a local's storage.
unsigned Offset
Offset of the local in frame.
bool EnabledByDefault
If the cleanup for this local should be emitted.
const Descriptor * Desc
Descriptor of the local.