5#include <initializer_list>
6#include <llvm/ADT/StringRef.h>
13 for (
const int i : {8, 16, 32, 64}) {
15 for (
const bool is_signed : {
true,
false}) {
16 const string type_name = (is_signed ?
"I"s :
"U"s) + std::to_string(i);
17 auto i_ty = std::make_unique<ty::Int>(type_name, i, is_signed);
18 (is_signed ? ints.s_ty : ints.u_ty) = i_ty.get();
19 known.insert({i_ty->name(), move(i_ty)});
24 auto bool_ty = std::make_unique<ty::Int>(
"Bool", 1,
false);
26 known.insert({bool_ty->name(), move(bool_ty)});
28 auto nil_ty = std::make_unique<ty::Nil>();
30 known.insert({nil_ty->name(), move(nil_ty)});
34 for (
const bool is_signed : {
true,
false}) {
36 const string type_name = (is_signed ?
"I"s :
"U"s) +
"Size";
37 auto i_ty = std::make_unique<ty::Int>(type_name, size_bits, is_signed);
39 known.insert({i_ty->name(), move(i_ty)});
45 for (
const auto& i : fn_types)
46 if (i->ret() == ret && i->args() == args && i->closure() == closure && !i->is_fn_ptr())
49 auto& new_fn = fn_types.emplace_back(std::make_unique<ty::Function>(
"", args, ret, closure,
false));
55 for (
const auto& i : fn_types) {
56 if (i->ret() == ret && i->args() == args && c_varargs == i->is_c_varargs() && i->closure().empty() &&
63 fn_types.emplace_back(std::make_unique<ty::Function>(
"", args, ret, vector<ty::Type>{},
true, c_varargs));
The Compiler the the primary top-level type during compilation. A single instance is created during t...
auto ptr_bitsize() -> unsigned int
void declare_size_type(Compiler &)
auto find_or_create_fn_ptr_type(const vector< ty::Type > &args, optional< ty::Type > ret, bool c_varargs=false) -> ty::Function *
llvm::StringMap< unique_ptr< ty::BaseType > > known
auto find_or_create_fn_type(const vector< ty::Type > &args, optional< ty::Type > ret, const vector< ty::Type > &closure) -> ty::Function *
array< IntTypePair, 4 > int_types