blob: 21e5173aba642319a9036f0c8c1ce009f830cc5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <willow/IR/TypeContext.h>
namespace willow {
Type TypeContext::IntType(std::size_t width) {
auto [it, _] = icache.try_emplace(IntTypeImpl::Key{width},
std::make_unique<IntTypeImpl>(width));
return Type(it->second.get());
}
Type TypeContext::PtrType(Type pointee) {
auto [it, _] = pcache.try_emplace(
PtrTypeImpl::Key{pointee}, std::make_unique<PtrTypeImpl>(pointee));
return Type(it->second.get());
}
Type TypeContext::VoidType() { return Type(voidty.get()); }
Type TypeContext::BasicBlockType() { return Type{labelty.get()}; }
Type TypeContext::FunctionType(Type ret, std::initializer_list<Type> params) {
auto [it, _] =
fncache.try_emplace(FunctionTypeImpl::Key{ret, params},
std::make_unique<FunctionTypeImpl>(ret, params));
return Type(it->second.get());
};
};
|