(
autoRecordPair :
Records) {
55 if(
Record*R = RecordPair.second)
75assert(Idx < Globals.size());
76 returnGlobals[Idx]->block();
97 template<
typename... Ts>
100 auto*
Func=
new Function(*
this, Def, std::forward<Ts>(Args)...);
101Funcs.insert({Def, std::unique_ptr<Function>(
Func)});
106 auto*
Func=
new Function(*
this, std::forward<Ts>(Args)...);
107AnonFuncs.emplace_back(
Func);
120 boolIsConst =
false,
boolIsTemporary =
false,
121 boolIsMutable =
false) {
122 returnallocateDescriptor(
D,
Type, MDSize, IsConst, IsTemporary, IsMutable);
128 boolIsConst =
false,
boolIsTemporary =
false,
129 boolIsMutable =
false,
136 P.startDeclaration(VD);
146 if(CurrentDeclaration == NoDeclaration)
147 returnstd::optional<unsigned>{};
148 returnLastDeclaration;
156 boolIsWeak,
const Expr*
Init=
nullptr);
161llvm::DenseMap<const FunctionDecl *, std::unique_ptr<Function>> Funcs;
163std::vector<std::unique_ptr<Function>> AnonFuncs;
166llvm::DenseMap<const FunctionDecl *, std::vector<unsigned>> Relocs;
169std::vector<const void *> NativePointers;
171llvm::DenseMap<const void *, unsigned> NativePointerIndices;
174 usingPoolAllocTy = llvm::BumpPtrAllocator;
182 template<
typename... Tys>
186 void*
operator new(
size_tMeta, PoolAllocTy &
Alloc,
size_t Data) {
187 return Alloc.Allocate(Meta +
Data,
alignof(
void*));
191std::byte *data() {
returnB.data(); }
193 Block*block() {
return&B; }
194 const Block*block()
const{
return&B; }
202PoolAllocTy Allocator;
205std::vector<Global *> Globals;
207llvm::DenseMap<const void *, unsigned> GlobalIndices;
210llvm::DenseMap<const RecordDecl *, Record *>
Records;
213llvm::DenseMap<const void *, unsigned> DummyVariables;
216 template<
typename... Ts> Descriptor *allocateDescriptor(Ts &&...Args) {
217 return new(Allocator) Descriptor(std::forward<Ts>(Args)...);
221 static constexpr unsignedNoDeclaration = (
unsigned)-1;
223 unsignedLastDeclaration = 0;
225 unsignedCurrentDeclaration = NoDeclaration;
228 voidstartDeclaration(
constValueDecl *Decl) {
229LastDeclaration += 1;
230CurrentDeclaration = LastDeclaration;
234 voidendDeclaration() { CurrentDeclaration = NoDeclaration; }
239 void dump(llvm::raw_ostream &OS)
const;
llvm::MachO::Records Records
This represents one expression.
Represents a function declaration or definition.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
A (possibly-)qualified type.
Represents a struct/union/class.
StringLiteral - This represents a string literal expression, e.g.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
A memory block, either on the stack or in the heap.
bool isInitialized() const
Returns whether the data of this block has been initialized via invoking the Ctor func.
Holds all information required to evaluate constexpr code in a module.
A pointer to a memory block, live or dead.
Context to manage declaration lifetimes.
DeclScope(Program &P, const ValueDecl *VD)
The program contains and links the bytecode for all functions.
std::optional< unsigned > getOrCreateGlobal(const ValueDecl *VD, const Expr *Init=nullptr)
Returns or creates a global an creates an index to it.
Function * getFunction(const FunctionDecl *F)
Returns a function.
Block * getGlobal(unsigned Idx)
Returns the value of a global.
std::optional< unsigned > createGlobal(const ValueDecl *VD, const Expr *Init)
Creates a global and returns its index.
const void * getNativePointer(unsigned Idx)
Returns the value of a marshalled native pointer.
Descriptor * createDescriptor(const DeclTy &D, PrimType Type, Descriptor::MetadataSize MDSize=std::nullopt, bool IsConst=false, bool IsTemporary=false, bool IsMutable=false)
Creates a descriptor for a primitive type.
unsigned getOrCreateNativePointer(const void *Ptr)
Marshals a native pointer to an ID for embedding in bytecode.
Function * createFunction(const FunctionDecl *Def, Ts &&...Args)
Creates a new function from a code range.
Pointer getPtrGlobal(unsigned Idx) const
Returns a pointer to a global.
unsigned getOrCreateDummy(const DeclTy &D)
Returns or creates a dummy value for unknown declarations.
void dump() const
Dumps the disassembled bytecode to llvm::errs().
std::optional< unsigned > getCurrentDecl() const
Returns the current declaration ID.
unsigned createGlobalString(const StringLiteral *S, const Expr *Base=nullptr)
Emits a string literal among global data.
Function * createFunction(Ts &&...Args)
Creates an anonymous function.
Record * getOrCreateRecord(const RecordDecl *RD)
Returns a record or creates one if it does not exist.
Structure/Class descriptor.
PrimType
Enumeration of the primitive types of the VM.
bool Alloc(InterpState &S, CodePtr OpPC, const Descriptor *Desc)
llvm::PointerUnion< const Decl *, const Expr * > DeclTy
The JSON file list parser is used to communicate input to InstallAPI.
Describes a memory block created by an allocation site.
std::optional< unsigned > MetadataSize
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4