tan  0.0.1
tanlang::PrimitiveType Class Reference
Inheritance diagram for tanlang::PrimitiveType:
Collaboration diagram for tanlang::PrimitiveType:

Public Types

enum  Kind {
  VOID , BOOL , I8 , I16 ,
  I32 , I64 , CHAR , U8 ,
  U16 , U32 , U64 , F32 ,
  F64
}
 

Public Member Functions

bool is_primitive () const override
 
bool is_float () const override
 
bool is_int () const override
 
bool is_num () const override
 
bool is_unsigned () const override
 
bool is_bool () const override
 
bool is_void () const override
 
bool is_char () const override
 
vector< Type * > children () const override
 
int get_align_bits () override
 
int get_size_bits () override
 
- Public Member Functions inherited from tanlang::Type
virtual bool is_pointer () const
 
virtual bool is_array () const
 
virtual bool is_string () const
 
virtual bool is_struct () const
 
virtual bool is_function () const
 
virtual bool is_ref () const
 
bool is_canonical () const
 
const str & get_typename () const
 

Static Public Member Functions

static PrimitiveTypeCreate (Kind kind)
 
- Static Public Member Functions inherited from tanlang::Type
static PrimitiveTypeGetVoidType ()
 
static PrimitiveTypeGetBoolType ()
 
static PrimitiveTypeGetCharType ()
 
static PrimitiveTypeGetIntegerType (size_t bit_size, bool is_unsigned)
 
static PrimitiveTypeGetFloatType (size_t bit_size)
 
static StringTypeGetStringType ()
 
static PointerTypeGetPointerType (Type *pointee)
 
static ArrayTypeGetArrayType (Type *element_type, int size)
 
static FunctionTypeGetFunctionType (Type *ret_type, const vector< Type * > &arg_types)
 
static StructTypeGetStructType (StructDecl *decl)
 
static TypeRefGetTypeRef (const str &name)
 
static bool IsCanonical (const Type &type)
 A composite type is canonical only if its subtype(s) are also canonical. A non-composite type is canonical only if it's not a type reference. More...
 

Static Public Attributes

static umap< Kind, int > SIZE_BITS
 
static umap< Kind, str > TYPE_NAMES
 
static const umap< str, Kind > TYPENAME_TO_KIND
 
- Static Public Attributes inherited from tanlang::Type
static vector< str > ALL_TYPE_NAMES
 

Additional Inherited Members

- Protected Attributes inherited from tanlang::Type
str _type_name {}
 
- Static Protected Attributes inherited from tanlang::Type
static StringTypeSTRING_TYPE = new StringType()
 
static umap< Type *, PointerType * > POINTER_TYPE_CACHE {}
 
static umap< pair< Type *, int >, ArrayType *, PairHashARRAY_TYPE_CACHE {}
 
static umap< str, Type * > NAMED_TYPE_CACHE {}
 

Detailed Description

Definition at line 86 of file type.h.

Member Data Documentation

◆ SIZE_BITS

umap<Kind, int> tanlang::PrimitiveType::SIZE_BITS
inlinestatic
Initial value:
{
{VOID, 0 },
{CHAR, 8 },
{I8, 8 },
{I16, 16},
{I32, 32},
{I64, 64},
{U8, 8 },
{U16, 16},
{U32, 32},
{U64, 64},
{F32, 32},
{F64, 64}
}

Definition at line 103 of file type.h.

◆ TYPE_NAMES

umap<Kind, str> tanlang::PrimitiveType::TYPE_NAMES
inlinestatic
Initial value:
{
{VOID, "void"},
{CHAR, "char"},
{I8, "i8" },
{I16, "i16" },
{I32, "i32" },
{I64, "i64" },
{U8, "u8" },
{U16, "u16" },
{U32, "u32" },
{U64, "u64" },
{F32, "f32" },
{F64, "f64" }
}

Definition at line 117 of file type.h.

◆ TYPENAME_TO_KIND

const umap<str, Kind> tanlang::PrimitiveType::TYPENAME_TO_KIND
inlinestatic
Initial value:
= {
{"int", I32 },
{"i8", I8 },
{"u8", U8 },
{"i16", I16 },
{"u16", U16 },
{"i32", I32 },
{"u32", U32 },
{"i64", I64 },
{"u64", U64 },
{"float", F32 },
{"f32", F32 },
{"f64", F64 },
{"void", VOID},
{"char", CHAR},
{"bool", BOOL}
}

Definition at line 131 of file type.h.


The documentation for this class was generated from the following files: