Message ID | mcrlj41pefh.fsf@google.com |
---|---|
State | New |
Headers | show |
On Tue, Dec 07, 2010 at 11:32:02AM -0800, Ian Lance Taylor wrote: > The tree vectorizer calls the type_for_mode langhook with vector modes. > I'm not sure this makes sense. If a language doesn't have any vector > types, then there is nothing sensible that the langhook can return. It > seems to me that this should be done entirely in the middle-end, using > middle-end types, rather than asking the language. > > go_langhook_type_for_mode (enum machine_mode mode, int unsignedp) > { > + /* Go has no vector types. Build them here. FIXME: It does not > + make sense for the middle-end to ask the frontend for a type > + which the frontend does not support. However, at least for now > + it is required. See PR 46805. */ > + if (VECTOR_MODE_P (mode)) > + { > + tree inner; > + > + inner = go_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp); > + if (inner != NULL_TREE) > + return build_vector_type_for_mode (inner, mode); > + return NULL_TREE; It is unfortunate that every language has essentially this same code (most don't return NULL_TREE, which causes added work in many cases). -Nathan
Index: go-lang.c =================================================================== --- go-lang.c (revision 167562) +++ go-lang.c (working copy) @@ -285,6 +285,20 @@ go_langhook_type_for_size (unsigned int static tree go_langhook_type_for_mode (enum machine_mode mode, int unsignedp) { + /* Go has no vector types. Build them here. FIXME: It does not + make sense for the middle-end to ask the frontend for a type + which the frontend does not support. However, at least for now + it is required. See PR 46805. */ + if (VECTOR_MODE_P (mode)) + { + tree inner; + + inner = go_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp); + if (inner != NULL_TREE) + return build_vector_type_for_mode (inner, mode); + return NULL_TREE; + } + return go_type_for_mode (mode, unsignedp); }