clang
10.0.0svn
|
The program contains and links the bytecode for all functions. More...
#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/AST/Interp/Program.h"
Classes | |
class | DeclScope |
Context to manage declaration lifetimes. More... | |
Public Member Functions | |
Program (Context &Ctx) | |
unsigned | createGlobalString (const StringLiteral *S) |
Emits a string literal among global data. More... | |
Pointer | getPtrGlobal (unsigned Idx) |
Returns a pointer to a global. More... | |
Block * | getGlobal (unsigned Idx) |
Returns the value of a global. More... | |
llvm::Optional< unsigned > | getGlobal (const ValueDecl *VD) |
Finds a global's index. More... | |
llvm::Optional< unsigned > | getOrCreateGlobal (const ValueDecl *VD) |
Returns or creates a global an creates an index to it. More... | |
llvm::Optional< unsigned > | getOrCreateDummy (const ParmVarDecl *PD) |
Returns or creates a dummy value for parameters. More... | |
llvm::Optional< unsigned > | createGlobal (const ValueDecl *VD) |
Creates a global and returns its index. More... | |
llvm::Optional< unsigned > | createGlobal (const Expr *E) |
Creates a global from a lifetime-extended temporary. More... | |
template<typename... Ts> | |
Function * | createFunction (const FunctionDecl *Def, Ts &&... Args) |
Creates a new function from a code range. More... | |
template<typename... Ts> | |
Function * | createFunction (Ts &&... Args) |
Creates an anonymous function. More... | |
Function * | getFunction (const FunctionDecl *F) |
Returns a function. More... | |
llvm::Expected< Function * > | getOrCreateFunction (const FunctionDecl *F) |
Returns a pointer to a function if it exists and can be compiled. More... | |
Record * | getOrCreateRecord (const RecordDecl *RD) |
Returns a record or creates one if it does not exist. More... | |
Descriptor * | createDescriptor (const DeclTy &D, PrimType Type, bool IsConst=false, bool IsTemporary=false, bool IsMutable=false) |
Creates a descriptor for a primitive type. More... | |
Descriptor * | createDescriptor (const DeclTy &D, const Type *Ty, bool IsConst=false, bool IsTemporary=false, bool IsMutable=false) |
Creates a descriptor for a composite type. More... | |
llvm::Optional< unsigned > | getCurrentDecl () const |
Returns the current declaration ID. More... | |
void | dump () const |
Dumps the disassembled bytecode to llvm::errs() . More... | |
void | dump (llvm::raw_ostream &OS) const |
Friends | |
class | DeclScope |
The program contains and links the bytecode for all functions.
|
inline |
Definition at line 45 of file Program.h.
References createGlobalString().
|
inline |
Creates a descriptor for a primitive type.
Definition at line 101 of file Program.h.
Referenced by clang::interp::ByteCodeEmitter::compileFunc(), createDescriptor(), createGlobal(), and getOrCreateRecord().
Descriptor * Program::createDescriptor | ( | const DeclTy & | D, |
const Type * | Ty, | ||
bool | IsConst = false , |
||
bool | IsTemporary = false , |
||
bool | IsMutable = false |
||
) |
Creates a descriptor for a composite type.
Definition at line 296 of file Program.cpp.
References clang::interp::Context::classify(), createDescriptor(), clang::interp::Descriptor::getAllocSize(), clang::Type::getAs(), clang::Type::getAsArrayTypeUnsafe(), clang::ArrayType::getElementType(), getOrCreateRecord(), clang::QualType::getTypePtr(), max(), and clang::interp::primSize().
|
inline |
Creates a new function from a code range.
Definition at line 76 of file Program.h.
Referenced by clang::interp::ByteCodeEmitter::compileFunc().
|
inline |
Creates an anonymous function.
Definition at line 83 of file Program.h.
References getFunction(), getOrCreateFunction(), and getOrCreateRecord().
llvm::Optional< unsigned > Program::createGlobal | ( | const ValueDecl * | VD | ) |
Creates a global and returns its index.
Definition at line 141 of file Program.cpp.
References clang::ValueDecl::getType(), IsStatic, and P.
Referenced by createGlobal(), getGlobal(), getOrCreateDummy(), and getOrCreateGlobal().
llvm::Optional< unsigned > Program::createGlobal | ( | const Expr * | E | ) |
Creates a global from a lifetime-extended temporary.
Definition at line 158 of file Program.cpp.
References clang::interp::Context::classify(), createDescriptor(), createGlobal(), clang::interp::Descriptor::getAllocSize(), getCurrentDecl(), clang::Expr::getType(), clang::QualType::getTypePtr(), clang::QualType::isConstQualified(), and IsStatic.
unsigned Program::createGlobalString | ( | const StringLiteral * | S | ) |
Emits a string literal among global data.
Definition at line 21 of file Program.cpp.
Referenced by Program().
LLVM_DUMP_METHOD void Program::dump | ( | ) | const |
Dumps the disassembled bytecode to llvm::errs()
.
Definition at line 60 of file Disasm.cpp.
References clang::interp::Function::dump().
LLVM_DUMP_METHOD void Program::dump | ( | llvm::raw_ostream & | OS | ) | const |
Definition at line 62 of file Disasm.cpp.
|
inline |
Returns the current declaration ID.
Definition at line 124 of file Program.h.
Referenced by createGlobal().
Function * Program::getFunction | ( | const FunctionDecl * | F | ) |
Returns a function.
Definition at line 188 of file Program.cpp.
References clang::FunctionDecl::getDefinition().
Referenced by createFunction(), and getOrCreateFunction().
|
inline |
Returns the value of a global.
Definition at line 54 of file Program.h.
References createGlobal(), getOrCreateDummy(), and getOrCreateGlobal().
Referenced by clang::interp::GetGlobal(), getOrCreateGlobal(), and clang::interp::InitGlobal().
llvm::Optional< unsigned > Program::getGlobal | ( | const ValueDecl * | VD | ) |
Finds a global's index.
Definition at line 87 of file Program.cpp.
llvm::Optional< unsigned > Program::getOrCreateDummy | ( | const ParmVarDecl * | PD | ) |
Returns or creates a dummy value for parameters.
Definition at line 122 of file Program.cpp.
References clang::Type::castAs(), createGlobal(), clang::interp::Context::getASTContext(), clang::ValueDecl::getType(), clang::if(), and clang::ArrayType::Normal.
Referenced by getGlobal().
llvm::Expected< Function * > Program::getOrCreateFunction | ( | const FunctionDecl * | F | ) |
Returns a pointer to a function if it exists and can be compiled.
If a function couldn't be compiled, an error is returned. If a function was not yet defined, a null pointer is returned.
Definition at line 194 of file Program.cpp.
References clang::FunctionDecl::getDefinition(), and getFunction().
Referenced by createFunction().
llvm::Optional< unsigned > Program::getOrCreateGlobal | ( | const ValueDecl * | VD | ) |
Returns or creates a global an creates an index to it.
Definition at line 111 of file Program.cpp.
References createGlobal(), and getGlobal().
Referenced by getGlobal().
Record * Program::getOrCreateRecord | ( | const RecordDecl * | RD | ) |
Returns a record or creates one if it does not exist.
Definition at line 207 of file Program.cpp.
References clang::interp::align(), clang::interp::Context::classify(), createDescriptor(), clang::RecordDecl::fields(), clang::interp::Descriptor::getAllocSize(), clang::RecordDecl::getDefinition(), clang::interp::Record::getSize(), clang::QualType::getTypePtr(), and clang::QualType::isConstQualified().
Referenced by createDescriptor(), and createFunction().
Pointer Program::getPtrGlobal | ( | unsigned | Idx | ) |
Returns a pointer to a global.
Definition at line 82 of file Program.cpp.
Referenced by clang::interp::GetPtrGlobal().