clang 20.0.0git
|
Bytecode function. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/Function.h"
Public Types | |
using | ParamDescriptor = std::pair< PrimType, Descriptor * > |
using | arg_reverse_iterator = SmallVectorImpl< PrimType >::const_reverse_iterator |
Range over argument types. | |
Public Member Functions | |
unsigned | getFrameSize () const |
Returns the size of the function's local stack. | |
unsigned | getArgSize () const |
Returns the size of the argument stack. | |
CodePtr | getCodeBegin () const |
Returns a pointer to the start of the code. | |
CodePtr | getCodeEnd () const |
Returns a pointer to the end of the code. | |
const FunctionDecl * | getDecl () const |
Returns the original FunctionDecl. | |
const BlockExpr * | getExpr () const |
const std::string | getName () const |
Returns the name of the function decl this code was generated for. | |
ParamDescriptor | getParamDescriptor (unsigned Offset) const |
Returns a parameter descriptor. | |
bool | hasRVO () const |
Checks if the first argument is a RVO pointer. | |
bool | hasNonNullAttr () const |
llvm::iterator_range< llvm::SmallVector< Scope, 2 >::const_iterator > | scopes () const |
Range over the scope blocks. | |
llvm::iterator_range< arg_reverse_iterator > | args_reverse () const |
Scope & | getScope (unsigned Idx) |
Returns a specific scope. | |
const Scope & | getScope (unsigned Idx) const |
SourceInfo | getSource (CodePtr PC) const |
Returns the source information at a given PC. | |
bool | isConstexpr () const |
Checks if the function is valid to call in constexpr. | |
bool | isVirtual () const |
Checks if the function is virtual. | |
bool | isConstructor () const |
Checks if the function is a constructor. | |
bool | isDestructor () const |
Checks if the function is a destructor. | |
const CXXRecordDecl * | getParentDecl () const |
Returns the parent record decl, if any. | |
bool | isLambdaStaticInvoker () const |
Returns whether this function is a lambda static invoker, which we generate custom byte code for. | |
bool | isLambdaCallOperator () const |
Returns whether this function is the call operator of a lambda record decl. | |
bool | isFullyCompiled () const |
Checks if the function is fully done compiling. | |
bool | hasThisPointer () const |
bool | hasBody () const |
Checks if the function already has a body attached. | |
bool | isDefined () const |
Checks if the function is defined. | |
bool | isVariadic () const |
unsigned | getBuiltinID () const |
bool | isBuiltin () const |
bool | isUnevaluatedBuiltin () const |
unsigned | getNumParams () const |
unsigned | getNumWrittenParams () const |
Returns the number of parameter this function takes when it's called, i.e excluding the instance pointer and the RVO pointer. | |
unsigned | getWrittenArgSize () const |
bool | isThisPointerExplicit () const |
unsigned | getParamOffset (unsigned ParamIndex) const |
void | dump () const |
Dumps the disassembled bytecode to llvm::errs() . | |
void | dump (llvm::raw_ostream &OS) const |
Friends | |
class | Program |
class | ByteCodeEmitter |
Bytecode function.
Contains links to the bytecode of the function, as well as metadata describing all arguments and stack-local variables.
When calling a function, all argument values must be on the stack.
If the function has a This pointer (i.e. hasThisPointer() returns true, the argument values need to be preceeded by a Pointer for the This object.
If the function uses Return Value Optimization, the arguments (and potentially the This pointer) need to be preceeded by a Pointer pointing to the location to construct the returned value.
After the function has been called, it will remove all arguments, including RVO and This pointer, from the stack.
Definition at line 81 of file Function.h.
using clang::interp::Function::arg_reverse_iterator = SmallVectorImpl<PrimType>::const_reverse_iterator |
Range over argument types.
Definition at line 127 of file Function.h.
using clang::interp::Function::ParamDescriptor = std::pair<PrimType, Descriptor *> |
Definition at line 83 of file Function.h.
|
inline |
Definition at line 129 of file Function.h.
Referenced by clang::interp::InterpFrame::popArgs().
LLVM_DUMP_METHOD void Function::dump | ( | ) | const |
Dumps the disassembled bytecode to llvm::errs()
.
Definition at line 64 of file Disasm.cpp.
References dump().
LLVM_DUMP_METHOD void Function::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 66 of file Disasm.cpp.
References getName().
|
inline |
Returns the size of the argument stack.
Definition at line 88 of file Function.h.
|
inline |
Definition at line 196 of file Function.h.
References getBuiltinID().
Referenced by getBuiltinID(), clang::interp::interp_floating_comparison(), clang::interp::InterpretBuiltin(), and isBuiltin().
|
inline |
Returns a pointer to the start of the code.
Definition at line 91 of file Function.h.
Referenced by clang::interp::InterpFrame::getPC().
|
inline |
Returns a pointer to the end of the code.
Definition at line 93 of file Function.h.
|
inline |
Returns the original FunctionDecl.
Definition at line 96 of file Function.h.
Referenced by clang::interp::CheckCallable(), clang::interp::CheckNonNullArgs(), clang::interp::InterpFrame::getCallee(), clang::interp::InterpFrame::getExpr(), clang::interp::InterpFrame::getLocation(), clang::interp::InterpFrame::getRange(), clang::interp::Pointer::getSource(), clang::interp::InterpFrame::getSource(), hasNonNullAttr(), clang::interp::interp__builtin_inf(), and clang::interp::interp__builtin_nan().
|
inline |
Definition at line 99 of file Function.h.
|
inline |
Returns the size of the function's local stack.
Definition at line 86 of file Function.h.
Referenced by clang::interp::InterpFrame::dump().
|
inline |
Returns the name of the function decl this code was generated for.
Definition at line 105 of file Function.h.
|
inline |
Definition at line 206 of file Function.h.
Referenced by getNumWrittenParams().
|
inline |
Returns the number of parameter this function takes when it's called, i.e excluding the instance pointer and the RVO pointer.
Definition at line 210 of file Function.h.
References getNumParams(), hasRVO(), and hasThisPointer().
Referenced by clang::interp::cleanupAfterFunctionCall().
Function::ParamDescriptor Function::getParamDescriptor | ( | unsigned | Offset | ) | const |
Returns a parameter descriptor.
Definition at line 32 of file Function.cpp.
Referenced by clang::interp::InterpFrame::getParamPointer().
Definition at line 225 of file Function.h.
|
inline |
Returns the parent record decl, if any.
Definition at line 158 of file Function.h.
References clang::DeclContext::getParent().
Returns a specific scope.
Definition at line 134 of file Function.h.
Referenced by clang::interp::InterpFrame::destroy(), and clang::interp::InterpFrame::initScope().
Definition at line 135 of file Function.h.
SourceInfo Function::getSource | ( | CodePtr | PC | ) | const |
Returns the source information at a given PC.
Definition at line 38 of file Function.cpp.
Referenced by clang::interp::EvalEmitter::getSource(), and clang::interp::InterpState::getSource().
|
inline |
Definition at line 214 of file Function.h.
References clang::interp::align(), hasRVO(), hasThisPointer(), clang::interp::primSize(), and clang::interp::PT_Ptr.
|
inline |
Checks if the function already has a body attached.
Definition at line 189 of file Function.h.
Referenced by clang::interp::CheckCallable(), clang::interp::InterpFrame::getExpr(), clang::interp::InterpFrame::getLocation(), clang::interp::InterpFrame::getRange(), clang::interp::InterpFrame::getSource(), and clang::interp::EvalEmitter::getSource().
|
inline |
Definition at line 118 of file Function.h.
References getDecl(), and clang::Decl::hasAttr().
|
inline |
Checks if the first argument is a RVO pointer.
Definition at line 116 of file Function.h.
Referenced by clang::interp::InterpFrame::describe(), getNumWrittenParams(), getWrittenArgSize(), and clang::interp::Compiler< Emitter >::VisitCXXInheritedCtorInitExpr().
|
inline |
Definition at line 186 of file Function.h.
Referenced by clang::interp::InterpFrame::describe(), getNumWrittenParams(), getWrittenArgSize(), and clang::interp::Compiler< Emitter >::VisitCXXInheritedCtorInitExpr().
|
inline |
Definition at line 200 of file Function.h.
References getBuiltinID().
Referenced by clang::interp::cleanupAfterFunctionCall().
|
inline |
Checks if the function is valid to call in constexpr.
Definition at line 141 of file Function.h.
References isLambdaStaticInvoker().
Referenced by clang::interp::CheckCallable().
|
inline |
Checks if the function is a constructor.
Definition at line 147 of file Function.h.
|
inline |
Checks if the function is defined.
Definition at line 192 of file Function.h.
|
inline |
Checks if the function is a destructor.
Definition at line 152 of file Function.h.
|
inline |
Checks if the function is fully done compiling.
Definition at line 184 of file Function.h.
|
inline |
Returns whether this function is the call operator of a lambda record decl.
Definition at line 176 of file Function.h.
References clang::isLambdaCallOperator().
|
inline |
Returns whether this function is a lambda static invoker, which we generate custom byte code for.
Definition at line 167 of file Function.h.
Referenced by clang::interp::CheckCallable(), and isConstexpr().
|
inline |
Definition at line 218 of file Function.h.
|
inline |
Definition at line 204 of file Function.h.
Referenced by clang::interp::cleanupAfterFunctionCall().
|
inline |
Definition at line 194 of file Function.h.
Referenced by clang::interp::cleanupAfterFunctionCall().
bool Function::isVirtual | ( | ) | const |
Checks if the function is virtual.
Definition at line 50 of file Function.cpp.
Referenced by clang::interp::CheckCallable().
|
inline |
Range over the scope blocks.
Definition at line 122 of file Function.h.
Referenced by clang::interp::InterpFrame::~InterpFrame().
|
friend |
Definition at line 254 of file Function.h.
|
friend |
Definition at line 253 of file Function.h.