diff options
| author | Blue Swirl <blauwirbel@gmail.com> | 2009-08-06 20:19:15 +0000 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2009-08-01 20:30:19 -0700 |
| commit | 94a27dcf4ac83ca900be9e3f78bb545290a46f79 (patch) | |
| tree | 27c4da9a030f2020c52e5c43663b7ea623e3081f /parse.c | |
| parent | 0be55c9fb2192301f3d916412ed06b30c2fda46e (diff) | |
| download | sparse-dev-94a27dcf4ac83ca900be9e3f78bb545290a46f79.tar.gz | |
Add support for TImode type (__int128_t)
GCC provides a 128 bit type called internally as TImode (__int128_t)on 64 bit
platforms (at least x86_64 and Sparc64). These types are used by OpenBIOS.
Add support for types "long long long", __mode__(TI) and __(u)int128_t.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -70,7 +70,7 @@ static attr_t typedef struct symbol *to_mode_t(struct symbol *); static to_mode_t - to_QI_mode, to_HI_mode, to_SI_mode, to_DI_mode, to_word_mode; + to_QI_mode, to_HI_mode, to_SI_mode, to_DI_mode, to_TI_mode, to_word_mode; enum { Set_T = 1, @@ -347,6 +347,11 @@ static struct symbol_op mode_DI_op = { .to_mode = to_DI_mode }; +static struct symbol_op mode_TI_op = { + .type = KW_MODE, + .to_mode = to_TI_mode +}; + static struct symbol_op mode_word_op = { .type = KW_MODE, .to_mode = to_word_mode @@ -386,6 +391,8 @@ static struct init_keyword { /* Predeclared types */ { "__builtin_va_list", NS_TYPEDEF, .type = &ptr_ctype, .op = &spec_op }, + { "__int128_t", NS_TYPEDEF, .type = &lllong_ctype, .op = &spec_op }, + { "__uint128_t",NS_TYPEDEF, .type = &ulllong_ctype, .op = &spec_op }, /* Extended types */ { "typeof", NS_TYPEDEF, .op = &typeof_op }, @@ -457,6 +464,8 @@ static struct init_keyword { { "__SI__", NS_KEYWORD, .op = &mode_SI_op }, { "DI", NS_KEYWORD, MOD_LONGLONG, .op = &mode_DI_op }, { "__DI__", NS_KEYWORD, MOD_LONGLONG, .op = &mode_DI_op }, + { "TI", NS_KEYWORD, MOD_LONGLONGLONG, .op = &mode_TI_op }, + { "__TI__", NS_KEYWORD, MOD_LONGLONGLONG, .op = &mode_TI_op }, { "word", NS_KEYWORD, MOD_LONG, .op = &mode_word_op }, { "__word__", NS_KEYWORD, MOD_LONG, .op = &mode_word_op }, @@ -1042,6 +1051,14 @@ static struct symbol *to_DI_mode(struct symbol *ctype) : &sllong_ctype; } +static struct symbol *to_TI_mode(struct symbol *ctype) +{ + if (ctype->ctype.base_type != &int_type) + return NULL; + return ctype->ctype.modifiers & MOD_UNSIGNED ? &ulllong_ctype + : &slllong_ctype; +} + static struct symbol *to_word_mode(struct symbol *ctype) { if (ctype->ctype.base_type != &int_type) @@ -1322,9 +1339,11 @@ Catch_all: static struct symbol * const int_types[] = {&short_ctype, &int_ctype, &long_ctype, &llong_ctype}; static struct symbol * const signed_types[] = - {&sshort_ctype, &sint_ctype, &slong_ctype, &sllong_ctype}; + {&sshort_ctype, &sint_ctype, &slong_ctype, &sllong_ctype, + &slllong_ctype}; static struct symbol * const unsigned_types[] = - {&ushort_ctype, &uint_ctype, &ulong_ctype, &ullong_ctype}; + {&ushort_ctype, &uint_ctype, &ulong_ctype, &ullong_ctype, + &ulllong_ctype}; static struct symbol * const real_types[] = {&float_ctype, &double_ctype, &ldouble_ctype}; static struct symbol * const char_types[] = |
