23 if (Chunk && Chunk->Next)
24 std::free(Chunk->Next);
31 for (
PrimType Item : llvm::reverse(ItemTypes)) {
34 assert(ItemTypes.empty());
41 if (NewSize ==
size())
44 assert(NewSize <=
size());
45 for (
PrimType Item : llvm::reverse(ItemTypes)) {
48 if (
size() == NewSize)
53 assert(
size() == NewSize);
56void *InterpStack::peekData(
size_t Size)
const {
57 assert(Chunk &&
"Stack is empty!");
59 if (LLVM_LIKELY(Size <= Chunk->
size()))
60 return reinterpret_cast<void *
>(Chunk->start() + Chunk->Size - Size);
62 StackChunk *Ptr = Chunk;
63 while (Size > Ptr->size()) {
66 assert(Ptr &&
"Offset too large");
69 return reinterpret_cast<void *
>(Ptr->start() + Ptr->Size - Size);
72void InterpStack::shrink(
size_t Size) {
73 assert(Chunk &&
"Chunk is empty!");
76 if (LLVM_LIKELY(Size <= Chunk->
size())) {
82 while (Size > Chunk->size()) {
83 Size -= Chunk->size();
85 std::free(Chunk->Next);
86 Chunk->Next =
nullptr;
90 assert(Chunk &&
"Offset too large");
98 llvm::errs() <<
"Items: " << ItemTypes.size() <<
". Size: " <<
size() <<
'\n';
99 if (ItemTypes.empty())
107 for (
PrimType Item : llvm::reverse(ItemTypes)) {
110 llvm::errs() << Index <<
'/' << Offset <<
": ";
115 llvm::errs() <<
'\n';
#define TYPE_SWITCH(Expr, B)
void clearTo(size_t NewSize)
void dump() const
dump the stack contents to stderr.
void clear()
Clears the stack.
size_t size() const
Returns the size of the stack in bytes.
bool empty() const
Returns whether the stack is empty.
void discard()
Discards the top value from the stack.
~InterpStack()
Destroys the stack, freeing up storage.
T & peek() const
Returns a reference to the value on the top of the stack.
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
PrimType
Enumeration of the primitive types of the VM.
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T