diff options
author | Ian Lance Taylor <iant@google.com> | 2011-01-21 18:19:03 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-01-21 18:19:03 +0000 |
commit | ff5f50c52c421d75940ef9392211e3ab24d71332 (patch) | |
tree | 27d8768fb1d25696d3c40b42535eb5e073c278da /gcc/go | |
parent | d6ed1c8903e728f4233122554bab5910853338bd (diff) | |
download | gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.zip gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.gz gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.bz2 |
Remove the types float and complex.
Update to current version of Go library.
Update testsuite for removed types.
* go-lang.c (go_langhook_init): Omit float_type_size when calling
go_create_gogo.
* go-c.h: Update declaration of go_create_gogo.
From-SVN: r169098
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/go/go-c.h | 3 | ||||
-rw-r--r-- | gcc/go/go-lang.c | 4 | ||||
-rw-r--r-- | gcc/go/gofrontend/export.cc | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/export.h | 4 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 48 | ||||
-rw-r--r-- | gcc/go/gofrontend/go.cc | 4 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 18 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.h | 6 | ||||
-rw-r--r-- | gcc/go/gofrontend/import.cc | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 10 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.h | 30 |
12 files changed, 61 insertions, 76 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 6354ce5..7c1f272 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2011-01-21 Ian Lance Taylor <iant@google.com> + + * go-lang.c (go_langhook_init): Omit float_type_size when calling + go_create_gogo. + * go-c.h: Update declaration of go_create_gogo. + 2011-01-13 Ian Lance Taylor <iant@google.com> * go-backend.c: Include "rtl.h" and "target.h". diff --git a/gcc/go/go-c.h b/gcc/go/go-c.h index a451517..1c7a3b1 100644 --- a/gcc/go/go-c.h +++ b/gcc/go/go-c.h @@ -41,8 +41,7 @@ extern void go_set_prefix (const char*); extern void go_add_search_path (const char*); -extern void go_create_gogo (int int_type_size, int float_type_size, - int pointer_size); +extern void go_create_gogo (int int_type_size, int pointer_size); extern void go_parse_input_files (const char**, unsigned int, bool only_check_syntax, diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 323f8c5..ef019d3 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -1,5 +1,5 @@ /* go-lang.c -- Go frontend gcc interface. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -103,7 +103,7 @@ go_langhook_init (void) to, e.g., unsigned_char_type_node) but before calling build_common_builtin_nodes (because it calls, indirectly, go_type_for_size). */ - go_create_gogo (INT_TYPE_SIZE, FLOAT_TYPE_SIZE, POINTER_SIZE); + go_create_gogo (INT_TYPE_SIZE, POINTER_SIZE); build_common_builtin_nodes (); diff --git a/gcc/go/gofrontend/export.cc b/gcc/go/gofrontend/export.cc index 6b42d0c..cbf24b8 100644 --- a/gcc/go/gofrontend/export.cc +++ b/gcc/go/gofrontend/export.cc @@ -345,8 +345,6 @@ Export::register_builtin_types(Gogo* gogo) this->register_builtin_type(gogo, "int", BUILTIN_INT); this->register_builtin_type(gogo, "uint", BUILTIN_UINT); this->register_builtin_type(gogo, "uintptr", BUILTIN_UINTPTR); - this->register_builtin_type(gogo, "float", BUILTIN_FLOAT); - this->register_builtin_type(gogo, "complex", BUILTIN_COMPLEX); this->register_builtin_type(gogo, "bool", BUILTIN_BOOL); this->register_builtin_type(gogo, "string", BUILTIN_STRING); } diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h index 90c2465..4a1fd2b6 100644 --- a/gcc/go/gofrontend/export.h +++ b/gcc/go/gofrontend/export.h @@ -33,14 +33,12 @@ enum Builtin_code BUILTIN_INT = -11, BUILTIN_UINT = -12, BUILTIN_UINTPTR = -13, - BUILTIN_FLOAT = -14, BUILTIN_BOOL = -15, BUILTIN_STRING = -16, BUILTIN_COMPLEX64 = -17, BUILTIN_COMPLEX128 = -18, - BUILTIN_COMPLEX = -19, - SMALLEST_BUILTIN_CODE = -19 + SMALLEST_BUILTIN_CODE = -18 }; // This class manages exporting Go declarations. It handles the main diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 6fa1b99..8eefaee 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1932,7 +1932,7 @@ Float_expression::do_determine_type(const Type_context* context) || context->type->complex_type() != NULL)) this->type_ = context->type; else if (!context->may_be_abstract) - this->type_ = Type::lookup_float_type("float"); + this->type_ = Type::lookup_float_type("float64"); } // Return true if the floating point value VAL fits in the range of @@ -2185,7 +2185,7 @@ Complex_expression::do_determine_type(const Type_context* context) && context->type->complex_type() != NULL) this->type_ = context->type; else if (!context->may_be_abstract) - this->type_ = Type::lookup_complex_type("complex"); + this->type_ = Type::lookup_complex_type("complex128"); } // Return true if the complex value REAL/IMAG fits in the range of the @@ -6473,7 +6473,7 @@ class Builtin_call_expression : public Call_expression BUILTIN_CAP, BUILTIN_CLOSE, BUILTIN_CLOSED, - BUILTIN_CMPLX, + BUILTIN_COMPLEX, BUILTIN_COPY, BUILTIN_IMAG, BUILTIN_LEN, @@ -6501,7 +6501,7 @@ class Builtin_call_expression : public Call_expression real_imag_type(Type*); static Type* - cmplx_type(Type*); + complex_type(Type*); // A pointer back to the general IR structure. This avoids a global // variable, or passing it around everywhere. @@ -6532,8 +6532,8 @@ Builtin_call_expression::Builtin_call_expression(Gogo* gogo, this->code_ = BUILTIN_CLOSE; else if (name == "closed") this->code_ = BUILTIN_CLOSED; - else if (name == "cmplx") - this->code_ = BUILTIN_CMPLX; + else if (name == "complex") + this->code_ = BUILTIN_COMPLEX; else if (name == "copy") this->code_ = BUILTIN_COPY; else if (name == "imag") @@ -6774,9 +6774,7 @@ Builtin_call_expression::real_imag_type(Type* arg_type) return NULL; while (nt->real_type()->named_type() != NULL) nt = nt->real_type()->named_type(); - if (nt->name() == "complex") - return Type::lookup_float_type("float"); - else if (nt->name() == "complex64") + if (nt->name() == "complex64") return Type::lookup_float_type("float32"); else if (nt->name() == "complex128") return Type::lookup_float_type("float64"); @@ -6784,11 +6782,11 @@ Builtin_call_expression::real_imag_type(Type* arg_type) return NULL; } -// Return the type of the cmplx function, given the type of one of the +// Return the type of the complex function, given the type of one of the // argments. Like real_imag_type, we have to map by name. Type* -Builtin_call_expression::cmplx_type(Type* arg_type) +Builtin_call_expression::complex_type(Type* arg_type) { if (arg_type == NULL || arg_type->is_abstract()) return NULL; @@ -6797,9 +6795,7 @@ Builtin_call_expression::cmplx_type(Type* arg_type) return NULL; while (nt->real_type()->named_type() != NULL) nt = nt->real_type()->named_type(); - if (nt->name() == "float") - return Type::lookup_complex_type("complex"); - else if (nt->name() == "float32") + if (nt->name() == "float32") return Type::lookup_complex_type("complex64"); else if (nt->name() == "float64") return Type::lookup_complex_type("complex128"); @@ -6868,7 +6864,7 @@ Builtin_call_expression::do_is_constant() const return arg->field_reference_expression() != NULL; } - case BUILTIN_CMPLX: + case BUILTIN_COMPLEX: { const Expression_list* args = this->args(); if (args != NULL && args->size() == 2) @@ -7053,7 +7049,7 @@ bool Builtin_call_expression::do_complex_constant_value(mpfr_t real, mpfr_t imag, Type** ptype) const { - if (this->code_ == BUILTIN_CMPLX) + if (this->code_ == BUILTIN_COMPLEX) { const Expression_list* args = this->args(); if (args == NULL || args->size() != 2) @@ -7078,7 +7074,7 @@ Builtin_call_expression::do_complex_constant_value(mpfr_t real, mpfr_t imag, { mpfr_set(real, r, GMP_RNDN); mpfr_set(imag, i, GMP_RNDN); - *ptype = Builtin_call_expression::cmplx_type(rtype); + *ptype = Builtin_call_expression::complex_type(rtype); ret = true; } @@ -7154,7 +7150,7 @@ Builtin_call_expression::do_type() return t; } - case BUILTIN_CMPLX: + case BUILTIN_COMPLEX: { const Expression_list* args = this->args(); if (args == NULL || args->size() != 2) @@ -7166,7 +7162,7 @@ Builtin_call_expression::do_type() if (t->is_abstract()) t = t->make_non_abstract_type(); } - t = Builtin_call_expression::cmplx_type(t); + t = Builtin_call_expression::complex_type(t); if (t == NULL) t = Type::make_error_type(); return t; @@ -7195,13 +7191,13 @@ Builtin_call_expression::do_determine_type(const Type_context* context) case BUILTIN_REAL: case BUILTIN_IMAG: - arg_type = Builtin_call_expression::cmplx_type(context->type); + arg_type = Builtin_call_expression::complex_type(context->type); is_print = false; break; - case BUILTIN_CMPLX: + case BUILTIN_COMPLEX: { - // For the cmplx function the type of one operand can + // For the complex function the type of one operand can // determine the type of the other, as in a binary expression. arg_type = Builtin_call_expression::real_imag_type(context->type); if (args != NULL && args->size() == 2) @@ -7498,7 +7494,7 @@ Builtin_call_expression::do_check_types(Gogo*) } break; - case BUILTIN_CMPLX: + case BUILTIN_COMPLEX: { const Expression_list* args = this->args(); if (args == NULL || args->size() < 2) @@ -7512,9 +7508,9 @@ Builtin_call_expression::do_check_types(Gogo*) this->set_is_error(); else if (!Type::are_identical(args->front()->type(), args->back()->type(), true, NULL)) - this->report_error(_("cmplx arguments must have identical types")); + this->report_error(_("complex arguments must have identical types")); else if (args->front()->type()->float_type() == NULL) - this->report_error(_("cmplx arguments must have " + this->report_error(_("complex arguments must have " "floating-point type")); } break; @@ -8077,7 +8073,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context) arg_tree); } - case BUILTIN_CMPLX: + case BUILTIN_COMPLEX: { const Expression_list* args = this->args(); gcc_assert(args != NULL && args->size() == 2); diff --git a/gcc/go/gofrontend/go.cc b/gcc/go/gofrontend/go.cc index c756084..2f30fd8 100644 --- a/gcc/go/gofrontend/go.cc +++ b/gcc/go/gofrontend/go.cc @@ -24,10 +24,10 @@ static Gogo* gogo; GO_EXTERN_C void -go_create_gogo(int int_type_size, int float_type_size, int pointer_size) +go_create_gogo(int int_type_size, int pointer_size) { gcc_assert(::gogo == NULL); - ::gogo = new Gogo(int_type_size, float_type_size, pointer_size); + ::gogo = new Gogo(int_type_size, pointer_size); if (!unique_prefix.empty()) ::gogo->set_unique_prefix(unique_prefix); } diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 8e67074..794dd74 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -19,7 +19,7 @@ // Class Gogo. -Gogo::Gogo(int int_type_size, int float_type_size, int pointer_size) +Gogo::Gogo(int int_type_size, int pointer_size) : package_(NULL), functions_(), globals_(new Bindings(NULL)), @@ -86,12 +86,6 @@ Gogo::Gogo(int int_type_size, int float_type_size, int pointer_size) pointer_size, RUNTIME_TYPE_KIND_UINTPTR)); - this->add_named_type(Type::make_float_type("float", float_type_size, - RUNTIME_TYPE_KIND_FLOAT)); - - this->add_named_type(Type::make_complex_type("complex", float_type_size * 2, - RUNTIME_TYPE_KIND_COMPLEX)); - this->add_named_type(Type::make_named_bool_type()); this->add_named_type(Type::make_named_string_type()); @@ -199,10 +193,10 @@ Gogo::Gogo(int int_type_size, int float_type_size, int pointer_size) append_type->set_is_builtin(); this->globals_->add_function_declaration("append", NULL, append_type, loc); - Function_type* cmplx_type = Type::make_function_type(NULL, NULL, NULL, loc); - cmplx_type->set_is_varargs(); - cmplx_type->set_is_builtin(); - this->globals_->add_function_declaration("cmplx", NULL, cmplx_type, loc); + Function_type* complex_type = Type::make_function_type(NULL, NULL, NULL, loc); + complex_type->set_is_varargs(); + complex_type->set_is_builtin(); + this->globals_->add_function_declaration("complex", NULL, complex_type, loc); Function_type* real_type = Type::make_function_type(NULL, NULL, NULL, loc); real_type->set_is_varargs(); @@ -212,7 +206,7 @@ Gogo::Gogo(int int_type_size, int float_type_size, int pointer_size) Function_type* imag_type = Type::make_function_type(NULL, NULL, NULL, loc); imag_type->set_is_varargs(); imag_type->set_is_builtin(); - this->globals_->add_function_declaration("imag", NULL, cmplx_type, loc); + this->globals_->add_function_declaration("imag", NULL, imag_type, loc); this->define_builtin_function_trees(); diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index 0a822c5..cb3fe67 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -100,9 +100,9 @@ operator<(const Import_init& i1, const Import_init& i2) class Gogo { public: - // Create the IR, passing in the sizes of the types "int", "float", - // and "uintptr" in bits. - Gogo(int int_type_size, int float_type_size, int pointer_size); + // Create the IR, passing in the sizes of the types "int" and + // "uintptr" in bits. + Gogo(int int_type_size, int pointer_size); // Get the package name. const std::string& diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc index ec27aba..d926edf 100644 --- a/gcc/go/gofrontend/import.cc +++ b/gcc/go/gofrontend/import.cc @@ -704,8 +704,6 @@ Import::register_builtin_types(Gogo* gogo) this->register_builtin_type(gogo, "int", BUILTIN_INT); this->register_builtin_type(gogo, "uint", BUILTIN_UINT); this->register_builtin_type(gogo, "uintptr", BUILTIN_UINTPTR); - this->register_builtin_type(gogo, "float", BUILTIN_FLOAT); - this->register_builtin_type(gogo, "complex", BUILTIN_COMPLEX); this->register_builtin_type(gogo, "bool", BUILTIN_BOOL); this->register_builtin_type(gogo, "string", BUILTIN_STRING); } diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 418e8a8..a70f5e9 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -194,9 +194,9 @@ Type::make_non_abstract_type() case TYPE_INTEGER: return Type::lookup_integer_type("int"); case TYPE_FLOAT: - return Type::lookup_float_type("float"); + return Type::lookup_float_type("float64"); case TYPE_COMPLEX: - return Type::lookup_complex_type("complex"); + return Type::lookup_complex_type("complex128"); case TYPE_STRING: return Type::lookup_string_type(); case TYPE_BOOLEAN: @@ -1872,8 +1872,7 @@ Float_type::create_abstract_float_type() { static Float_type* abstract_type; if (abstract_type == NULL) - abstract_type = new Float_type(true, FLOAT_TYPE_SIZE, - RUNTIME_TYPE_KIND_FLOAT); + abstract_type = new Float_type(true, 64, RUNTIME_TYPE_KIND_FLOAT64); return abstract_type; } @@ -2029,8 +2028,7 @@ Complex_type::create_abstract_complex_type() { static Complex_type* abstract_type; if (abstract_type == NULL) - abstract_type = new Complex_type(true, FLOAT_TYPE_SIZE * 2, - RUNTIME_TYPE_KIND_FLOAT); + abstract_type = new Complex_type(true, 128, RUNTIME_TYPE_KIND_COMPLEX128); return abstract_type; } diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index a8d8a0b..b9e8caf 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -60,22 +60,20 @@ static const int RUNTIME_TYPE_KIND_UINT16 = 9; static const int RUNTIME_TYPE_KIND_UINT32 = 10; static const int RUNTIME_TYPE_KIND_UINT64 = 11; static const int RUNTIME_TYPE_KIND_UINTPTR = 12; -static const int RUNTIME_TYPE_KIND_FLOAT = 13; -static const int RUNTIME_TYPE_KIND_FLOAT32 = 14; -static const int RUNTIME_TYPE_KIND_FLOAT64 = 15; -static const int RUNTIME_TYPE_KIND_COMPLEX = 16; -static const int RUNTIME_TYPE_KIND_COMPLEX64 = 17; -static const int RUNTIME_TYPE_KIND_COMPLEX128 = 18; -static const int RUNTIME_TYPE_KIND_ARRAY = 19; -static const int RUNTIME_TYPE_KIND_CHAN = 20; -static const int RUNTIME_TYPE_KIND_FUNC = 21; -static const int RUNTIME_TYPE_KIND_INTERFACE = 22; -static const int RUNTIME_TYPE_KIND_MAP = 23; -static const int RUNTIME_TYPE_KIND_PTR = 24; -static const int RUNTIME_TYPE_KIND_SLICE = 25; -static const int RUNTIME_TYPE_KIND_STRING = 26; -static const int RUNTIME_TYPE_KIND_STRUCT = 27; -static const int RUNTIME_TYPE_KIND_UNSAFE_POINTER = 28; +static const int RUNTIME_TYPE_KIND_FLOAT32 = 13; +static const int RUNTIME_TYPE_KIND_FLOAT64 = 14; +static const int RUNTIME_TYPE_KIND_COMPLEX64 = 15; +static const int RUNTIME_TYPE_KIND_COMPLEX128 = 16; +static const int RUNTIME_TYPE_KIND_ARRAY = 17; +static const int RUNTIME_TYPE_KIND_CHAN = 18; +static const int RUNTIME_TYPE_KIND_FUNC = 19; +static const int RUNTIME_TYPE_KIND_INTERFACE = 20; +static const int RUNTIME_TYPE_KIND_MAP = 21; +static const int RUNTIME_TYPE_KIND_PTR = 22; +static const int RUNTIME_TYPE_KIND_SLICE = 23; +static const int RUNTIME_TYPE_KIND_STRING = 24; +static const int RUNTIME_TYPE_KIND_STRUCT = 25; +static const int RUNTIME_TYPE_KIND_UNSAFE_POINTER = 26; // To build the complete list of methods for a named type we need to // gather all methods from anonymous fields. Those methods may |