diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-30 17:55:59 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-30 17:55:59 +0000 |
commit | 6d1e1dd9fc2fd652faba201a51d78f3d4949c036 (patch) | |
tree | f519620c84074a2493b0229fc910b3fef8d2e5ab /gcc/go/go-lang.c | |
parent | 8a21d39cf1ea8183eb1e95bbb4396d97ae0dc36d (diff) | |
download | gcc-6d1e1dd9fc2fd652faba201a51d78f3d4949c036.tar.gz |
compiler: Remove GCC langhooks from frontend proper.
* go-lang.c (go_langhook_type_for_size): Do it here, rather than
calling into Go frontend.
(go_langhook_type_for_mode): Likewise.
* go-c.h (go_type_for_size, go_type_for_mode): Don't declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209945 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/go-lang.c')
-rw-r--r-- | gcc/go/go-lang.c | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index c0f2f1f3884..3599aa85e54 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -288,7 +288,38 @@ go_langhook_parse_file (void) static tree go_langhook_type_for_size (unsigned int bits, int unsignedp) { - return go_type_for_size (bits, unsignedp); + tree type; + if (unsignedp) + { + if (bits == INT_TYPE_SIZE) + type = unsigned_type_node; + else if (bits == CHAR_TYPE_SIZE) + type = unsigned_char_type_node; + else if (bits == SHORT_TYPE_SIZE) + type = short_unsigned_type_node; + else if (bits == LONG_TYPE_SIZE) + type = long_unsigned_type_node; + else if (bits == LONG_LONG_TYPE_SIZE) + type = long_long_unsigned_type_node; + else + type = make_unsigned_type(bits); + } + else + { + if (bits == INT_TYPE_SIZE) + type = integer_type_node; + else if (bits == CHAR_TYPE_SIZE) + type = signed_char_type_node; + else if (bits == SHORT_TYPE_SIZE) + type = short_integer_type_node; + else if (bits == LONG_TYPE_SIZE) + type = long_integer_type_node; + else if (bits == LONG_LONG_TYPE_SIZE) + type = long_long_integer_type_node; + else + type = make_signed_type(bits); + } + return type; } static tree @@ -309,9 +340,40 @@ go_langhook_type_for_mode (enum machine_mode mode, int unsignedp) return NULL_TREE; } - type = go_type_for_mode (mode, unsignedp); - if (type) - return type; + // FIXME: This static_cast should be in machmode.h. + enum mode_class mc = static_cast<enum mode_class>(GET_MODE_CLASS(mode)); + if (mc == MODE_INT) + return go_langhook_type_for_size(GET_MODE_BITSIZE(mode), unsignedp); + else if (mc == MODE_FLOAT) + { + switch (GET_MODE_BITSIZE (mode)) + { + case 32: + return float_type_node; + case 64: + return double_type_node; + default: + // We have to check for long double in order to support + // i386 excess precision. + if (mode == TYPE_MODE(long_double_type_node)) + return long_double_type_node; + } + } + else if (mc == MODE_COMPLEX_FLOAT) + { + switch (GET_MODE_BITSIZE (mode)) + { + case 64: + return complex_float_type_node; + case 128: + return complex_double_type_node; + default: + // We have to check for long double in order to support + // i386 excess precision. + if (mode == TYPE_MODE(complex_long_double_type_node)) + return complex_long_double_type_node; + } + } #if HOST_BITS_PER_WIDE_INT >= 64 /* The middle-end and some backends rely on TImode being supported |