1 #include "tir/Context.h"
5 #include "tir/Constant.h"
11 std::ostream& operator<<(std::ostream& os,
const Value& value) {
12 return value.print(os);
15 Context::Context(BumpAllocator& alloc) : alloc_{alloc}, pimpl_{
nullptr} {
16 void* buf1 = alloc.allocate_bytes(
sizeof(OpaquePointerType),
17 alignof(OpaquePointerType));
18 auto* pointerType =
new(buf1) OpaquePointerType{
this};
19 void* buf2 = alloc.allocate_bytes(
sizeof(
Type),
alignof(
Type));
20 auto* voidType =
new(buf2)
Type{
this};
21 void* buf3 = alloc.allocate_bytes(
sizeof(
Type),
alignof(
Type));
22 auto* labelType =
new(buf3)
Type{
this};
23 void* buf4 = alloc.allocate_bytes(
sizeof(ConstantNullPointer),
24 alignof(ConstantNullPointer));
25 auto* nullPointer =
new(buf4) ConstantNullPointer{*
this, pointerType};
29 ContextPImpl{alloc, pointerType, voidType, labelType, nullPointer};