|
clang 23.0.0git
|
Bytecode function. More...
#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/Function.h"
Classes | |
| struct | ParamDescriptor |
Public Types | |
| enum class | FunctionKind { Normal , Ctor , CopyOrMoveCtor , Dtor , LambdaStaticInvoker , LambdaCallOperator , CopyOrMoveOperator } |
| using | arg_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 |
| std::string | getName () const |
| Returns the name of the function decl this code was generated for. | |
| ParamDescriptor | getParamDescriptor (unsigned Index) 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 | isValid () const |
| Checks if the function is valid to call. | |
| bool | isVirtual () const |
| Checks if the function is virtual. | |
| bool | isImmediate () const |
| bool | isConstexpr () const |
| bool | isConstructor () const |
| Checks if the function is a constructor. | |
| bool | isCopyOrMoveConstructor () const |
| bool | isDestructor () const |
| Checks if the function is a destructor. | |
| bool | isCopyOrMoveOperator () const |
| Checks if the function is copy or move operator. | |
| 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. | |
| const CXXRecordDecl * | getParentDecl () const |
| Returns the parent record decl, if any. | |
| 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 | 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 |
| void | dump () const |
Dumps the disassembled bytecode to llvm::errs(). | |
| void | dump (CodePtr PC) const |
| void | dump (llvm::raw_ostream &OS, CodePtr PC={}) const |
Friends | |
| class | Program |
| class | ByteCodeEmitter |
| class | Context |
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.
The parameters saved in a clang::intepr::Function include both the instance pointer as well as the RVO pointer.
/// Stack position when calling ─────┐ /// this Function │ /// ▼ /// ┌─────┬──────┬────────┬────────┬─────┬────────────────────┐ /// │ RVO │ This │ Param1 │ Param2 │ ... │ │ /// └─────┴──────┴────────┴────────┴─────┴────────────────────┘ ///
Definition at line 99 of file Function.h.
Range over argument types.
Definition at line 167 of file Function.h.
|
strong |
| Enumerator | |
|---|---|
| Normal | |
| Ctor | |
| CopyOrMoveCtor | |
| Dtor | |
| LambdaStaticInvoker | |
| LambdaCallOperator | |
| CopyOrMoveOperator | |
Definition at line 101 of file Function.h.
|
inline |
Definition at line 169 of file Function.h.
|
inline |
Dumps the disassembled bytecode to llvm::errs().
Definition at line 335 of file Function.h.
References dump().
| LLVM_DUMP_METHOD void Function::dump | ( | CodePtr | PC | ) | const |
Definition at line 142 of file Disasm.cpp.
| void clang::interp::Function::dump | ( | llvm::raw_ostream & | OS, |
| CodePtr | PC = {} ) const |
|
inline |
Returns the size of the argument stack.
Definition at line 126 of file Function.h.
Referenced by clang::interp::InterpFrame::allocSize().
|
inline |
Returns a pointer to the start of the code.
Definition at line 129 of file Function.h.
Referenced by getSource().
|
inline |
Returns a pointer to the end of the code.
Definition at line 131 of file Function.h.
Referenced by getSource().
|
inline |
Returns the original FunctionDecl.
Definition at line 134 of file Function.h.
Referenced by clang::interp::CallPtr(), clang::interp::CastPointerIntegral(), clang::interp::CheckCallable(), clang::interp::CheckNonNullArgs(), getName(), clang::interp::Pointer::getSource(), hasNonNullAttr(), clang::interp::This(), and clang::interp::Pointer::toAPValue().
|
inline |
Definition at line 137 of file Function.h.
Referenced by clang::interp::Pointer::toAPValue().
|
inline |
Returns the size of the function's local stack.
Definition at line 124 of file Function.h.
Referenced by clang::interp::InterpFrame::allocSize().
|
inline |
Returns the name of the function decl this code was generated for.
Definition at line 143 of file Function.h.
References getDecl(), and clang::NamedDecl::getQualifiedNameAsString().
|
inline |
Definition at line 236 of file Function.h.
References hasRVO(), and hasThisPointer().
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 242 of file Function.h.
References getNumParams(), hasRVO(), and hasThisPointer().
Referenced by clang::interp::InterpFrame::allocSize().
|
inline |
Returns a parameter descriptor.
Definition at line 151 of file Function.h.
|
inline |
Returns the parent record decl, if any.
Definition at line 216 of file Function.h.
References clang::DeclContext::getParent().
Returns a specific scope.
Definition at line 174 of file Function.h.
Referenced by clang::interp::Destroy().
Definition at line 175 of file Function.h.
| SourceInfo Function::getSource | ( | CodePtr | PC | ) | const |
Returns the source information at a given PC.
Definition at line 56 of file Function.cpp.
References getCodeBegin(), getCodeEnd(), getSource(), and hasBody().
Referenced by clang::interp::EvalEmitter::getSource(), getSource(), and clang::interp::InterpState::getSource().
|
inline |
Definition at line 246 of file Function.h.
References clang::interp::align(), hasRVO(), hasThisPointer(), clang::interp::primSize(), and clang::interp::PT_Ptr.
Referenced by clang::interp::CallPtr().
|
inline |
Checks if the function already has a body attached.
Definition at line 229 of file Function.h.
Referenced by clang::interp::CheckCallable(), clang::interp::EvalEmitter::getSource(), and getSource().
|
inline |
Definition at line 158 of file Function.h.
References getDecl(), and clang::Decl::hasAttr().
Referenced by clang::interp::CallPtr().
|
inline |
Checks if the first argument is a RVO pointer.
Definition at line 156 of file Function.h.
Referenced by getNumParams(), getNumWrittenParams(), getWrittenArgSize(), clang::interp::RVOPtr(), and clang::interp::Compiler< Emitter >::VisitCXXInheritedCtorInitExpr().
|
inline |
Definition at line 226 of file Function.h.
Referenced by getNumParams(), getNumWrittenParams(), getWrittenArgSize(), and clang::interp::Compiler< Emitter >::VisitCXXInheritedCtorInitExpr().
|
inline |
Definition at line 186 of file Function.h.
Referenced by clang::interp::CheckCallable().
|
inline |
Checks if the function is a constructor.
Definition at line 189 of file Function.h.
References CopyOrMoveCtor, and Ctor.
Referenced by clang::interp::CheckLiteralType().
|
inline |
Definition at line 192 of file Function.h.
References CopyOrMoveCtor.
|
inline |
Checks if the function is copy or move operator.
Definition at line 199 of file Function.h.
References CopyOrMoveOperator.
|
inline |
Checks if the function is defined.
Definition at line 232 of file Function.h.
|
inline |
Checks if the function is a destructor.
Definition at line 197 of file Function.h.
References Dtor.
Referenced by clang::interp::runRecordDestructor().
|
inline |
Checks if the function is fully done compiling.
Definition at line 224 of file Function.h.
Referenced by clang::interp::CallPtr().
|
inline |
Definition at line 185 of file Function.h.
|
inline |
Returns whether this function is the call operator of a lambda record decl.
Definition at line 211 of file Function.h.
References LambdaCallOperator.
|
inline |
Returns whether this function is a lambda static invoker, which we generate custom byte code for.
Definition at line 205 of file Function.h.
References LambdaStaticInvoker.
Referenced by clang::interp::Call(), clang::interp::CallVar(), clang::interp::CheckCallable(), and isValid().
|
inline |
Definition at line 250 of file Function.h.
Referenced by clang::interp::CallPtr().
|
inline |
Checks if the function is valid to call.
Definition at line 181 of file Function.h.
References isLambdaStaticInvoker().
Referenced by clang::interp::CheckCallable().
|
inline |
Definition at line 234 of file Function.h.
|
inline |
Checks if the function is virtual.
Definition at line 184 of file Function.h.
Referenced by clang::interp::CallPtr(), and clang::interp::CheckCallable().
|
inline |
Range over the scope blocks.
Definition at line 162 of file Function.h.
|
friend |
Definition at line 282 of file Function.h.
References ByteCodeEmitter.
Referenced by ByteCodeEmitter.
|
friend |
|
friend |