C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

basic_type Class Reference

#include <basic_type.h>

List of all members.

Public Member Functions

 basic_type ()
 basic_type (unsigned int sign, unsigned int length, unsigned int base_type, unsigned int parse_only=0)
bool operator== (const basic_type &bt2) const
bool operator!= (const basic_type &bt2) const
bool operator< (const basic_type &bt2) const
bool is_no_sign () const
void set_no_sign ()
bool is_signed () const
void set_signed ()
bool is_unsigned () const
void set_unsigned ()
bool parse_only () const
void parse_only (bool po)
bool is_no_type () const
void set_no_type ()
bool is_int () const
void set_int ()
bool is_char () const
void set_char ()
bool is_float () const
void set_float ()
bool is_void () const
void set_void ()
bool is_ellipsis () const
void set_ellipsis ()
bool is_no_length () const
void set_no_length ()
bool is_short () const
void set_short ()
bool is_long () const
void set_long ()
bool is_longlong () const
void set_longlong ()
bool is_integer () const
bool is_arithmetic () const
bool is_scalar () const
string to_string () const
string base_name () const
string length_name () const
string sign_name () const
int size ()
int alignment ()
void merge_in (basic_type &other, Coord coord=Coord::Unknown)
void finish ()
int to_num () const

Static Public Attributes

const basic_type Void
const basic_type Ellipsis
const basic_type SChar
const basic_type UChar
const basic_type SShort
const basic_type UShort
const basic_type SInt
const basic_type UInt
const basic_type SLong
const basic_type ULong
const basic_type SLongLong
const basic_type ULongLong
const basic_type Float
const basic_type Double
const basic_type LongDouble
const basic_type Char
const basic_type Int
const basic_type Signed
const basic_type Unsigned
const basic_type Short
const basic_type Long
const basic_type LongLong
const basic_type IntParseOnly
const unsigned int TARGET_MAX_UCHAR = 256
const unsigned int TARGET_MAX_INT = INT_MAX
const unsigned int TARGET_MAX_UINT = UINT_MAX
const unsigned int TARGET_MAX_LONG = LONG_MAX
const unsigned int TARGET_MAX_ULONG = ULONG_MAX
const unsigned int CHAR_SIZE = sizeof(char)
const unsigned int CHAR_ALIGN = CHAR_SIZE
const unsigned int SHORT_SIZE = sizeof(short)
const unsigned int SHORT_ALIGN = SHORT_SIZE
const unsigned int INT_SIZE = sizeof(int)
const unsigned int INT_ALIGN = INT_SIZE
const unsigned int FLOAT_SIZE = sizeof(float)
const unsigned int FLOAT_ALIGN = FLOAT_SIZE
const unsigned int DOUBLE_SIZE = sizeof(double)
const unsigned int DOUBLE_ALIGN = DOUBLE_SIZE
const unsigned int LONGDOUBLE_SIZE = sizeof(long double)
const unsigned int LONGDOUBLE_ALIGN = LONGDOUBLE_SIZE
const unsigned int LONG_SIZE = sizeof(long)
const unsigned int LONG_ALIGN = LONG_SIZE
const unsigned int POINTER_SIZE = sizeof(void *)
const unsigned int POINTER_ALIGN = POINTER_SIZE
const unsigned int BYTE_LENGTH = CHAR_BIT
const unsigned int WORD_LENGTH = (INT_SIZE * BYTE_LENGTH)

Private Member Functions

unsigned int base_type () const
void base_type (unsigned int bt)
unsigned int length () const
void length (unsigned int l)
unsigned int sign () const
void sign (unsigned int s)

Private Attributes

unsigned int _base_type:3
unsigned int _length:2
unsigned int _sign:2
unsigned int _parse_only:1

Static Private Attributes

const unsigned int NO_TYPE = 0x0
const unsigned int INT = 0x1
const unsigned int CHAR = 0x2
const unsigned int FLOAT = 0x3
const unsigned int VOID = 0x4
const unsigned int ELLIPSIS = 0x5
const unsigned int NO_LENGTH = 0x0
const unsigned int SHORT = 0x1
const unsigned int LONG = 0x2
const unsigned int LONGLONG = 0x3
const unsigned int NO_SIGN = 0x0
const unsigned int SIGNED = 0x1
const unsigned int UNSIGNED = 0x2
const unsigned int PARSE_ONLY = 0x1


Constructor & Destructor Documentation

basic_type::basic_type   [inline]
 

Definition at line 109 of file basic_type.h.

References _base_type, _length, _parse_only, and _sign.

basic_type::basic_type unsigned int    sign,
unsigned int    length,
unsigned int    base_type,
unsigned int    parse_only = 0
[inline]
 

Definition at line 113 of file basic_type.h.

References _base_type, _length, _parse_only, _sign, and parse_only().


Member Function Documentation

int basic_type::alignment  
 

Definition at line 282 of file basic_type.cc.

References base_type(), CHAR, CHAR_ALIGN, DOUBLE_ALIGN, FLOAT, FLOAT_ALIGN, INT, INT_ALIGN, length(), LONG, LONG_ALIGN, LONGDOUBLE_ALIGN, LONGLONG, SHORT, SHORT_ALIGN, CBZ::SyntaxError(), and VOID.

string basic_type::base_name   const
 

Definition at line 320 of file basic_type.cc.

References base_type(), CHAR, ELLIPSIS, FLOAT, INT, length(), LONG, LONGLONG, and VOID.

Referenced by merge_in(), and to_string().

void basic_type::base_type unsigned int    bt [inline, private]
 

Definition at line 99 of file basic_type.h.

References _base_type.

unsigned int basic_type::base_type   const [inline, private]
 

Definition at line 98 of file basic_type.h.

References _base_type.

Referenced by alignment(), base_name(), length_name(), operator<(), operator==(), size(), and to_string().

void basic_type::finish  
 

Definition at line 231 of file basic_type.cc.

References is_char(), is_int(), is_no_sign(), is_no_type(), parse_only(), set_int(), and set_signed().

Referenced by primNode::finish().

bool basic_type::is_arithmetic   const [inline]
 

Definition at line 197 of file basic_type.h.

References _base_type.

Referenced by primNode::is_arithmetic().

bool basic_type::is_char   const [inline]
 

Definition at line 168 of file basic_type.h.

References _base_type.

Referenced by finish(), lir_gen_walker::gen_global_decl(), LirUtil::getTypeString(), typeNode::integral_promotions(), primNode::is_char(), merge_in(), and constant::to_string().

bool basic_type::is_ellipsis   const [inline]
 

Definition at line 177 of file basic_type.h.

References _base_type.

Referenced by primNode::is_ellipsis().

bool basic_type::is_float   const [inline]
 

Definition at line 171 of file basic_type.h.

References _base_type.

Referenced by lir_gen_walker::gen_global_decl(), LirUtil::getTypeString(), typeNode::integral_promotions(), primNode::is_float(), and merge_in().

bool basic_type::is_int   const [inline]
 

Definition at line 165 of file basic_type.h.

References _base_type.

Referenced by finish(), lir_gen_walker::gen_global_decl(), typeNode::integral_promotions(), primNode::is_int(), and merge_in().

bool basic_type::is_integer   const [inline]
 

Definition at line 194 of file basic_type.h.

References _base_type.

Referenced by enum_value_walker::at_enum(), semcheck_walker::at_suespec(), LirUtil::getTypeString(), constant::is_equal_to(), and primNode::is_integer().

bool basic_type::is_long   const [inline]
 

Definition at line 186 of file basic_type.h.

References _length.

Referenced by lir_gen_walker::gen_global_decl(), arch_info::get_data_align(), arch_info::get_data_size(), LirUtil::getTypeString(), and merge_in().

bool basic_type::is_longlong   const [inline]
 

Definition at line 189 of file basic_type.h.

References _length.

Referenced by merge_in().

bool basic_type::is_no_length   const [inline]
 

Definition at line 180 of file basic_type.h.

References _length.

Referenced by merge_in().

bool basic_type::is_no_sign   const [inline]
 

Definition at line 150 of file basic_type.h.

References _sign.

Referenced by finish(), and merge_in().

bool basic_type::is_no_type   const [inline]
 

Definition at line 162 of file basic_type.h.

References _base_type.

Referenced by finish(), and merge_in().

bool basic_type::is_scalar   const [inline]
 

Definition at line 201 of file basic_type.h.

References _base_type.

Referenced by primNode::is_scalar().

bool basic_type::is_short   const [inline]
 

Definition at line 183 of file basic_type.h.

References _length.

Referenced by lir_gen_walker::gen_global_decl(), arch_info::get_data_align(), arch_info::get_data_size(), LirUtil::getTypeString(), and typeNode::integral_promotions().

bool basic_type::is_signed   const [inline]
 

Definition at line 153 of file basic_type.h.

References _sign.

bool basic_type::is_unsigned   const [inline]
 

Definition at line 156 of file basic_type.h.

References _sign.

Referenced by LirUtil::getTypeString(), typeNode::integral_promotions(), and to_string().

bool basic_type::is_void   const [inline]
 

Definition at line 174 of file basic_type.h.

References _base_type.

Referenced by primNode::is_void().

void basic_type::length unsigned int    l [inline, private]
 

Definition at line 102 of file basic_type.h.

References _length.

unsigned int basic_type::length   const [inline, private]
 

Definition at line 101 of file basic_type.h.

References _length.

Referenced by alignment(), base_name(), length_name(), operator<(), operator==(), size(), and to_string().

string basic_type::length_name   const
 

Definition at line 337 of file basic_type.cc.

References base_type(), FLOAT, length(), LONG, LONGLONG, and SHORT.

Referenced by merge_in(), and to_string().

void basic_type::merge_in basic_type &    other,
Coord    coord = Coord::Unknown
 

Definition at line 158 of file basic_type.cc.

References _base_type, _length, _sign, CBZ::ANSIOnly, base_name(), is_char(), is_float(), is_int(), is_long(), is_longlong(), is_no_length(), is_no_sign(), is_no_type(), length_name(), set_longlong(), set_no_length(), set_no_sign(), sign(), sign_name(), CBZ::SyntaxError(), and CBZ::Warning().

Referenced by primNode::merge_in().

bool basic_type::operator!= const basic_type &    bt2 const [inline]
 

Definition at line 129 of file basic_type.h.

References operator==().

bool basic_type::operator< const basic_type &    bt2 const [inline]
 

Definition at line 135 of file basic_type.h.

References base_type(), length(), and sign().

bool basic_type::operator== const basic_type &    bt2 const [inline]
 

Definition at line 123 of file basic_type.h.

References base_type(), length(), and sign().

Referenced by operator!=().

void basic_type::parse_only bool    po [inline]
 

Definition at line 160 of file basic_type.h.

References _parse_only.

bool basic_type::parse_only   const [inline]
 

Definition at line 159 of file basic_type.h.

References _parse_only.

Referenced by basic_type(), finish(), and to_string().

void basic_type::set_char   [inline]
 

Definition at line 169 of file basic_type.h.

References _base_type.

void basic_type::set_ellipsis   [inline]
 

Definition at line 178 of file basic_type.h.

References _base_type.

void basic_type::set_float   [inline]
 

Definition at line 172 of file basic_type.h.

References _base_type.

void basic_type::set_int   [inline]
 

Definition at line 166 of file basic_type.h.

References _base_type.

Referenced by finish().

void basic_type::set_long   [inline]
 

Definition at line 187 of file basic_type.h.

References _length.

void basic_type::set_longlong   [inline]
 

Definition at line 190 of file basic_type.h.

References _length.

Referenced by merge_in().

void basic_type::set_no_length   [inline]
 

Definition at line 181 of file basic_type.h.

References _length.

Referenced by merge_in().

void basic_type::set_no_sign   [inline]
 

Definition at line 151 of file basic_type.h.

References _sign.

Referenced by merge_in().

void basic_type::set_no_type   [inline]
 

Definition at line 163 of file basic_type.h.

References _base_type.

void basic_type::set_short   [inline]
 

Definition at line 184 of file basic_type.h.

References _length.

void basic_type::set_signed   [inline]
 

Definition at line 154 of file basic_type.h.

References _sign.

Referenced by finish().

void basic_type::set_unsigned   [inline]
 

Definition at line 157 of file basic_type.h.

References _sign.

void basic_type::set_void   [inline]
 

Definition at line 175 of file basic_type.h.

References _base_type.

void basic_type::sign unsigned int    s [inline, private]
 

Definition at line 105 of file basic_type.h.

References _sign.

unsigned int basic_type::sign   const [inline, private]
 

Definition at line 104 of file basic_type.h.

References _sign.

Referenced by merge_in(), operator<(), operator==(), and sign_name().

string basic_type::sign_name   const
 

Definition at line 354 of file basic_type.cc.

References sign(), and UNSIGNED.

Referenced by merge_in(), and to_string().

int basic_type::size  
 

Definition at line 248 of file basic_type.cc.

References base_type(), CHAR, FLOAT, INT, length(), LONG, SHORT, CBZ::SyntaxError(), and VOID.

Referenced by constantAnalyzer::at_sizeof(), and Unify_Size::sizeOf().

int basic_type::to_num   const
 

Definition at line 422 of file basic_type.cc.

References _base_type, _length, and _sign.

string basic_type::to_string   const
 

Definition at line 364 of file basic_type.cc.

References base_name(), base_type(), CHAR, ELLIPSIS, FLOAT, INT, is_unsigned(), length(), length_name(), parse_only(), sign_name(), and VOID.

Referenced by print_walker::at_prim(), print_tree_visitor::at_prim(), primNode::output_type(), P::type_name(), and NodeInfo::type_name().


Member Data Documentation

unsigned int basic_type::_base_type [private]
 

Definition at line 93 of file basic_type.h.

Referenced by base_type(), basic_type(), is_arithmetic(), is_char(), is_ellipsis(), is_float(), is_int(), is_integer(), is_no_type(), is_scalar(), is_void(), merge_in(), set_char(), set_ellipsis(), set_float(), set_int(), set_no_type(), set_void(), and to_num().

unsigned int basic_type::_length [private]
 

Definition at line 94 of file basic_type.h.

Referenced by basic_type(), is_long(), is_longlong(), is_no_length(), is_short(), length(), merge_in(), set_long(), set_longlong(), set_no_length(), set_short(), and to_num().

unsigned int basic_type::_parse_only [private]
 

Definition at line 96 of file basic_type.h.

Referenced by basic_type(), and parse_only().

unsigned int basic_type::_sign [private]
 

Definition at line 95 of file basic_type.h.

Referenced by basic_type(), is_no_sign(), is_signed(), is_unsigned(), merge_in(), set_no_sign(), set_signed(), set_unsigned(), sign(), and to_num().

const unsigned int basic_type::BYTE_LENGTH = CHAR_BIT [static]
 

Definition at line 110 of file basic_type.cc.

const basic_type basic_type::Char [static]
 

const unsigned int basic_type::CHAR = 0x2 [static, private]
 

Definition at line 49 of file basic_type.cc.

Referenced by alignment(), base_name(), size(), and to_string().

const unsigned int basic_type::CHAR_ALIGN = CHAR_SIZE [static]
 

Definition at line 82 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::CHAR_SIZE = sizeof(char) [static]
 

Definition at line 81 of file basic_type.cc.

const basic_type basic_type::Double [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::is_equal_to(), constantAnalyzer::lookup(), constant::make_zero(), constant::to_string(), and typeNode::usual_arithmetic_conversions().

const unsigned int basic_type::DOUBLE_ALIGN = DOUBLE_SIZE [static]
 

Definition at line 94 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::DOUBLE_SIZE = sizeof(double) [static]
 

Definition at line 93 of file basic_type.cc.

const basic_type basic_type::Ellipsis [static]
 

Referenced by Unify_Size::sizeOf().

const unsigned int basic_type::ELLIPSIS = 0x5 [static, private]
 

Definition at line 52 of file basic_type.cc.

Referenced by base_name(), and to_string().

const basic_type basic_type::Float [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::is_equal_to(), constantAnalyzer::lookup(), constant::make_zero(), constant::to_string(), and typeNode::usual_arithmetic_conversions().

const unsigned int basic_type::FLOAT = 0x3 [static, private]
 

Definition at line 50 of file basic_type.cc.

Referenced by alignment(), base_name(), length_name(), size(), and to_string().

const unsigned int basic_type::FLOAT_ALIGN = FLOAT_SIZE [static]
 

Definition at line 91 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::FLOAT_SIZE = sizeof(float) [static]
 

Definition at line 90 of file basic_type.cc.

const basic_type basic_type::Int [static]
 

const unsigned int basic_type::INT = 0x1 [static, private]
 

Definition at line 48 of file basic_type.cc.

Referenced by alignment(), base_name(), size(), and to_string().

const unsigned int basic_type::INT_ALIGN = INT_SIZE [static]
 

Definition at line 88 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::INT_SIZE = sizeof(int) [static]
 

Definition at line 87 of file basic_type.cc.

const basic_type basic_type::IntParseOnly [static]
 

const basic_type basic_type::Long [static]
 

const unsigned int basic_type::LONG = 0x2 [static, private]
 

Definition at line 57 of file basic_type.cc.

Referenced by alignment(), base_name(), length_name(), and size().

const unsigned int basic_type::LONG_ALIGN = LONG_SIZE [static]
 

Definition at line 100 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::LONG_SIZE = sizeof(long) [static]
 

Definition at line 99 of file basic_type.cc.

const basic_type basic_type::LongDouble [static]
 

Referenced by typeNode::usual_arithmetic_conversions().

const unsigned int basic_type::LONGDOUBLE_ALIGN = LONGDOUBLE_SIZE [static]
 

Definition at line 97 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::LONGDOUBLE_SIZE = sizeof(long double) [static]
 

Definition at line 96 of file basic_type.cc.

const basic_type basic_type::LongLong [static]
 

Definition at line 77 of file basic_type.h.

const unsigned int basic_type::LONGLONG = 0x3 [static, private]
 

Definition at line 58 of file basic_type.cc.

Referenced by alignment(), base_name(), and length_name().

const unsigned int basic_type::NO_LENGTH = 0x0 [static, private]
 

Definition at line 55 of file basic_type.cc.

const unsigned int basic_type::NO_SIGN = 0x0 [static, private]
 

Definition at line 62 of file basic_type.cc.

const unsigned int basic_type::NO_TYPE = 0x0 [static, private]
 

Definition at line 47 of file basic_type.cc.

const unsigned int basic_type::PARSE_ONLY = 0x1 [static, private]
 

Definition at line 67 of file basic_type.cc.

const unsigned int basic_type::POINTER_ALIGN = POINTER_SIZE [static]
 

Definition at line 108 of file basic_type.cc.

const unsigned int basic_type::POINTER_SIZE = sizeof(void *) [static]
 

Definition at line 107 of file basic_type.cc.

const basic_type basic_type::SChar [static]
 

Referenced by constant::cast(), constantAnalyzer::lookup(), and constant::to_string().

const basic_type basic_type::Short [static]
 

const unsigned int basic_type::SHORT = 0x1 [static, private]
 

Definition at line 56 of file basic_type.cc.

Referenced by alignment(), length_name(), and size().

const unsigned int basic_type::SHORT_ALIGN = SHORT_SIZE [static]
 

Definition at line 85 of file basic_type.cc.

Referenced by alignment().

const unsigned int basic_type::SHORT_SIZE = sizeof(short) [static]
 

Definition at line 84 of file basic_type.cc.

const basic_type basic_type::Signed [static]
 

const unsigned int basic_type::SIGNED = 0x1 [static, private]
 

Definition at line 63 of file basic_type.cc.

const basic_type basic_type::SInt [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), and constant::to_string().

const basic_type basic_type::SLong [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), constant::to_string(), and typeNode::usual_arithmetic_conversions().

const basic_type basic_type::SLongLong [static]
 

const basic_type basic_type::SShort [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), and constant::to_string().

const unsigned int basic_type::TARGET_MAX_INT = INT_MAX [static]
 

Definition at line 74 of file basic_type.cc.

const unsigned int basic_type::TARGET_MAX_LONG = LONG_MAX [static]
 

Definition at line 76 of file basic_type.cc.

const unsigned int basic_type::TARGET_MAX_UCHAR = 256 [static]
 

Definition at line 73 of file basic_type.cc.

const unsigned int basic_type::TARGET_MAX_UINT = UINT_MAX [static]
 

Definition at line 75 of file basic_type.cc.

const unsigned int basic_type::TARGET_MAX_ULONG = ULONG_MAX [static]
 

Definition at line 77 of file basic_type.cc.

const basic_type basic_type::UChar [static]
 

Referenced by constant::cast(), constantAnalyzer::lookup(), and constant::to_string().

const basic_type basic_type::UInt [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), constant::to_string(), and typeNode::usual_arithmetic_conversions().

const basic_type basic_type::ULong [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::eval(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), constant::to_string(), and typeNode::usual_arithmetic_conversions().

const basic_type basic_type::ULongLong [static]
 

const basic_type basic_type::Unsigned [static]
 

const unsigned int basic_type::UNSIGNED = 0x2 [static, private]
 

Definition at line 64 of file basic_type.cc.

Referenced by sign_name().

const basic_type basic_type::UShort [static]
 

Referenced by constant::Boolean(), constant::cast(), constant::Integer(), constantAnalyzer::lookup(), constant::make_zero(), and constant::to_string().

const basic_type basic_type::Void [static]
 

Referenced by Unify_Size::sizeOf().

const unsigned int basic_type::VOID = 0x4 [static, private]
 

Definition at line 51 of file basic_type.cc.

Referenced by alignment(), base_name(), size(), and to_string().

const unsigned int basic_type::WORD_LENGTH = (INT_SIZE * BYTE_LENGTH) [static]
 

Definition at line 111 of file basic_type.cc.


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

Generated on August 27, 2003
Back to the C-Breeze home page