From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103612 invoked by alias); 6 Feb 2018 13:39:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 103600 invoked by uid 89); 6 Feb 2018 13:39:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=england, England, Wales, wales X-HELO: relmlie3.idc.renesas.com Received: from relmlor4.renesas.com (HELO relmlie3.idc.renesas.com) (210.160.252.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Feb 2018 13:39:21 +0000 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 06 Feb 2018 22:39:18 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 607287DAE3; Tue, 6 Feb 2018 22:39:18 +0900 (JST) Received: from mail-sg2apc01lp0245.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.245]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 06 Feb 2018 22:39:17 +0900 Received: from HK2PR0601MB1828.apcprd06.prod.outlook.com (10.170.148.22) by HK2PR0601MB1506.apcprd06.prod.outlook.com (10.165.183.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Tue, 6 Feb 2018 13:39:14 +0000 Received: from HK2PR0601MB1828.apcprd06.prod.outlook.com ([fe80::9be:7205:8daf:f9ef]) by HK2PR0601MB1828.apcprd06.prod.outlook.com ([fe80::9be:7205:8daf:f9ef%17]) with mapi id 15.20.0464.015; Tue, 6 Feb 2018 13:39:14 +0000 From: Sebastian Perta To: DJ Delorie CC: "gcc-patches@gcc.gnu.org" Subject: RE: [PATCH] RL78 new "vector" function attribute Date: Tue, 06 Feb 2018 13:39:00 -0000 Message-ID: References: <000001d39901$6913f910$3b3beb30$@renesas.com> (sebastian.perta@renesas.com) In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Sebastian.Perta@renesas.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HK2PR0601MB1506;7:RxN0tJQI4o2OY4o4veLQxsEEu48c//n8eZogLwFefGplyyWBKs+l/y4Yo8rtrGy3T+NYTj/SEPAl0u3vwiMd2bTlodeyflkh5tIojKoWBxxg1xCXZU4jporcfBejyrB3RMjN6WbdDQ4b9QoogwdnuK7pivEF7FBsWR8wrt35sr5NXbqno1i2qhFh+2OfcEgOpW6sE8ockQPOhIoTQBQyd6bzGKbuzvC9qWGxPsbKjn+At8E628yITf8jPUA7Tko2;20:Z0iwIOjkY0i/lUMR+sU1Gwd55qWR/GEH+cDyRC3gJPtjYt9U0jFTr0Gjp1nGU1vmfJmfi0JmKI3ffoYkJjIJwJ3Brhz0yhhJIhuMvnoEaPheJezWZq81ZHqJ0N9cyLHP2tLzqpN0LvV8QJZxxNEROzKOxjUgtgEImRPmbMTgIfc= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 81d3c48c-ac0e-4075-a5db-08d56d670361 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);SRVR:HK2PR0601MB1506; x-ms-traffictypediagnostic: HK2PR0601MB1506: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(22074186197030)(183786458502308); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:HK2PR0601MB1506;BCL:0;PCL:0;RULEID:;SRVR:HK2PR0601MB1506; x-forefront-prvs: 0575F81B58 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(39380400002)(366004)(396003)(39860400002)(13464003)(199004)(189003)(6246003)(305945005)(2900100001)(9686003)(2950100002)(7736002)(6506007)(105586002)(3846002)(6116002)(3280700002)(3660700001)(76176011)(55016002)(74316002)(102836004)(97736004)(8936002)(316002)(59450400001)(5250100002)(6436002)(86362001)(81166006)(6916009)(2906002)(4326008)(99286004)(186003)(72206003)(7696005)(26005)(53546011)(81156014)(106356001)(33656002)(8676002)(14454004)(53936002)(68736007)(66066001)(229853002)(5660300001)(25786009)(478600001);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR0601MB1506;H:HK2PR0601MB1828.apcprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5c5qPjun8FaarGaYGBiyr1dE0XVHcQqsMb8jVhP+Q4/W+/DB6Y+XL6ZmadL2nJtdgMWWebUzdRzzrTrDXf19Tw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81d3c48c-ac0e-4075-a5db-08d56d670361 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2018 13:39:14.7333 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1506 X-SW-Source: 2018-02/txt/msg00232.txt.bz2 Hi DJ, I've updated the patch (extend.texi) as you suggested. Please let me know if this is OK to check-in, thank you! Best Regards, Sebastian Index: config/rl78/rl78.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- config/rl78/rl78.c(revision 257142) +++ config/rl78/rl78.c(working copy) @@ -809,7 +809,6 @@ bool * no_add_attrs) { gcc_assert (DECL_P (* node)); - gcc_assert (args =3D=3D NULL_TREE); if (TREE_CODE (* node) !=3D FUNCTION_DECL) { @@ -868,6 +867,28 @@ return NULL_TREE; } +/* Check "vector" attribute. */ + +static tree +rl78_handle_vector_attribute (tree * node, + tree name, + tree args, + int flags ATTRIBUTE_UNUSED, + bool * no_add_attrs) +{ + gcc_assert (DECL_P (* node)); + gcc_assert (args !=3D NULL_TREE); + + if (TREE_CODE (* node) !=3D FUNCTION_DECL) + { + warning (OPT_Wattributes, "%qE attribute only applies to functions", + name); + * no_add_attrs =3D true; + } + + return NULL_TREE; +} + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLErl78_attribute_table @@ -876,7 +897,7 @@ { /* Name, min_len, max_len, decl_req, type_req, fn_type_req, affects_type_identity, handler, exclude. */ - { "interrupt", 0, 0, true, false, false, false, + { "interrupt", 0, -1, true, false, false, false, rl78_handle_func_attribute, NULL }, { "brk_interrupt", 0, 0, true, false, false, false, rl78_handle_func_attribute, NULL }, @@ -884,6 +905,8 @@ rl78_handle_naked_attribute, NULL }, { "saddr", 0, 0, true, false, false, false, rl78_handle_saddr_attribute, NULL }, + { "vector", 1, -1, true, false, false, +rl78_handle_vector_attribute, false }, { NULL, 0, 0, false, false, false, false, NULL, NULL } }; @@ -1583,6 +1606,62 @@ #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUErl78_start_function +static void +add_vector_labels (FILE *file, const char *aname) +{ + tree vec_attr; + tree val_attr; + const char *vname =3D "vect"; + const char *s; + int vnum; + + /* This node is for the vector/interrupt tag itself */ + vec_attr =3D lookup_attribute (aname, DECL_ATTRIBUTES (current_function_= decl)); + if (!vec_attr) + return; + + /* Now point it at the first argument */ + vec_attr =3D TREE_VALUE (vec_attr); + + /* Iterate through the arguments. */ + while (vec_attr) + { + val_attr =3D TREE_VALUE (vec_attr); + switch (TREE_CODE (val_attr)) +{ +case STRING_CST: + s =3D TREE_STRING_POINTER (val_attr); + goto string_id_common; + +case IDENTIFIER_NODE: + s =3D IDENTIFIER_POINTER (val_attr); + +string_id_common: + if (strcmp (s, "$default") =3D=3D 0) + { + fprintf (file, "\t.global\t$tableentry$default$%s\n", vname); + fprintf (file, "$tableentry$default$%s:\n", vname); + } + else + vname =3D s; + break; + +case INTEGER_CST: + vnum =3D TREE_INT_CST_LOW (val_attr); + + fprintf (file, "\t.global\t$tableentry$%d$%s\n", vnum, vname); + fprintf (file, "$tableentry$%d$%s:\n", vnum, vname); + break; + +default: + ; +} + + vec_attr =3D TREE_CHAIN (vec_attr); + } + +} + /* We don't use this to actually emit the function prologue. We use this to insert a comment in the asm file describing the function. */ @@ -1590,6 +1669,9 @@ rl78_start_function (FILE *file) { int i; + + add_vector_labels (file, "interrupt"); + add_vector_labels (file, "vector"); if (cfun->machine->framesize =3D=3D 0) return; Index: doc/extend.texi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- doc/extend.texi(revision 257142) +++ doc/extend.texi(working copy) @@ -5182,7 +5182,7 @@ function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. -On RX targets, you may specify one or more vector numbers as arguments +On RX and RL78 targets, you may specify one or more vector numbers as argu= ments to the attribute, as well as naming an alternate table name. Parameters are handled sequentially, so one handler can be assigned to multiple entries in multiple tables. One may also pass the magic Index: testsuite/gcc.target/rl78/test_auto_vector.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- testsuite/gcc.target/rl78/test_auto_vector.c(nonexistent) +++ testsuite/gcc.target/rl78/test_auto_vector.c(working copy) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +void __attribute__ ((interrupt (5))) interrupt_5_handler (); + +void interrupt_5_handler () +{ +} + +void __attribute__ ((vector (4))) interrupt_4_handler (); + +void interrupt_4_handler () +{ +} + +void __attribute__ ((interrupt)) interrupt_handler (); + +void interrupt_handler () +{ +} + +/* { dg-final { scan-assembler "tableentry" } } */ > -----Original Message----- > From: DJ Delorie [mailto:dj@redhat.com] > Sent: 29 January 2018 21:11 > To: Sebastian Perta > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] RL78 new "vector" function attribute > > > If the RX and RL78 now share interrupt/vector semantics, can we combine > the docs? I.e. instead of a new section for RL78, can we change the RX > section to say something like "For RX and RL78..." ? Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, B= uckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered= No. 04586709.