if (!isActive())
return true;
- auto It = Locals.find(I);
- assert(It != Locals.end() && "Missing local variable");
- Block *B = reinterpret_cast<Block *>(It->second.get());
+ Block *B = getLocal(I);
S.Stk.push<Pointer>(B, sizeof(InlineDescriptor));
return true;
}
using T = typename PrimConv<OpType>::T;
- auto It = Locals.find(I);
- assert(It != Locals.end() && "Missing local variable");
- auto *B = reinterpret_cast<Block *>(It->second.get());
+ Block *B = getLocal(I);
S.Stk.push<T>(*reinterpret_cast<T *>(B->data()));
return true;
}
using T = typename PrimConv<OpType>::T;
- auto It = Locals.find(I);
- assert(It != Locals.end() && "Missing local variable");
- auto *B = reinterpret_cast<Block *>(It->second.get());
+ Block *B = getLocal(I);
*reinterpret_cast<T *>(B->data()) = S.Stk.pop<T>();
InlineDescriptor &Desc = *reinterpret_cast<InlineDescriptor *>(B->rawData());
Desc.IsInitialized = true;
return true;
for (auto &Local : Descriptors[I]) {
- auto It = Locals.find(Local.Offset);
- assert(It != Locals.end() && "Missing local variable");
- S.deallocate(reinterpret_cast<Block *>(It->second.get()));
+ Block *B = getLocal(Local.Offset);
+ S.deallocate(B);
}
return true;
/// Temporaries which require storage.
llvm::DenseMap<unsigned, std::unique_ptr<char[]>> Locals;
+ Block *getLocal(unsigned Index) const {
+ auto It = Locals.find(Index);
+ assert(It != Locals.end() && "Missing local variable");
+ return reinterpret_cast<Block *>(It->second.get());
+ }
+
// The emitter always tracks the current instruction and sets OpPC to a token
// value which is mapped to the location of the opcode being evaluated.
CodePtr OpPC;