From f9b83e7069e35a9436130a1d51682834c20be1ab Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 22 Mar 2016 17:22:43 -0400 Subject: [PATCH 05/71] FIXME: driver support --- gcc/gcc.c | 1 + gcc/rtl/TODO.rst | 5 ++++- gcc/rtl/lang-specs.h | 25 +++++++++++++++++++++++++ gcc/rtl/rtl-frontend.c | 18 ++++++++++++++++-- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 gcc/rtl/lang-specs.h diff --git a/gcc/gcc.c b/gcc/gcc.c index 1af5920..86cc32b 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1287,6 +1287,7 @@ static const struct compiler default_compilers[] = {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0}, {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0}, {".go", "#Go", 0, 1, 0}, + {".rtl", "#RTL", 0, 1, 0}, /* Next come the entries for C. */ {".c", "@c", 0, 0, 1}, {"@c", diff --git a/gcc/rtl/TODO.rst b/gcc/rtl/TODO.rst index 44d74a1..e6650be 100644 --- a/gcc/rtl/TODO.rst +++ b/gcc/rtl/TODO.rst @@ -1,8 +1,11 @@ -TODO +DONE ==== * driver support, to automatically invoke ``rtl1`` +TODO +==== + * have it actually load RTL files * have it compile them diff --git a/gcc/rtl/lang-specs.h b/gcc/rtl/lang-specs.h new file mode 100644 index 0000000..2af33ab --- /dev/null +++ b/gcc/rtl/lang-specs.h @@ -0,0 +1,25 @@ +/* lang-specs.h -- gcc driver specs for RTL frontend. + Copyright (C) 2016 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This is the contribution to the `default_compilers' array in gcc.c + for the RTL frontend. */ + +{".rtl", "@RTL", 0, 1, 0}, +{"@RTL", "rtl1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}", + 0, 1, 0}, diff --git a/gcc/rtl/rtl-frontend.c b/gcc/rtl/rtl-frontend.c index 14ff81a..a36069e 100644 --- a/gcc/rtl/rtl-frontend.c +++ b/gcc/rtl/rtl-frontend.c @@ -142,6 +142,20 @@ rtl_langhook_init_options_struct (struct gcc_options */*opts*/) #endif } +static bool +rtl_langhook_handle_option ( + size_t scode ATTRIBUTE_UNUSED, + const char *arg ATTRIBUTE_UNUSED, + int value ATTRIBUTE_UNUSED, + int kind ATTRIBUTE_UNUSED, + location_t loc ATTRIBUTE_UNUSED, + const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) +{ + /* FIXME: pretend to handle options. */ + return true; +} + + static void directive_handler (file_location loc, const char *name) { @@ -397,7 +411,7 @@ rtl_localize_identifier (const char *ident) #undef LANG_HOOKS_INIT #undef LANG_HOOKS_OPTION_LANG_MASK #undef LANG_HOOKS_INIT_OPTIONS_STRUCT -//#undef LANG_HOOKS_HANDLE_OPTION +#undef LANG_HOOKS_HANDLE_OPTION //#undef LANG_HOOKS_POST_OPTIONS #undef LANG_HOOKS_PARSE_FILE #undef LANG_HOOKS_TYPE_FOR_MODE @@ -413,7 +427,7 @@ rtl_localize_identifier (const char *ident) #define LANG_HOOKS_INIT rtl_langhook_init #define LANG_HOOKS_OPTION_LANG_MASK rtl_langhook_option_lang_mask #define LANG_HOOKS_INIT_OPTIONS_STRUCT rtl_langhook_init_options_struct -//#define LANG_HOOKS_HANDLE_OPTION rtl_langhook_handle_option +#define LANG_HOOKS_HANDLE_OPTION rtl_langhook_handle_option //#define LANG_HOOKS_POST_OPTIONS rtl_langhook_post_options #define LANG_HOOKS_PARSE_FILE rtl_langhook_parse_file #define LANG_HOOKS_TYPE_FOR_MODE rtl_langhook_type_for_mode -- 1.8.5.3