From patchwork Sat Dec 8 00:47:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 10719055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9936D1731 for ; Sat, 8 Dec 2018 00:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 849EA2B194 for ; Sat, 8 Dec 2018 00:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72FCC2B8E5; Sat, 8 Dec 2018 00:54:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E37D2B194 for ; Sat, 8 Dec 2018 00:54:02 +0000 (UTC) Received: from localhost ([::1]:48552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVQsb-0000YU-EY for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 19:54:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVQmM-0000Df-VC for qemu-devel@nongnu.org; Fri, 07 Dec 2018 19:47:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVQmI-0000ds-Vv for qemu-devel@nongnu.org; Fri, 07 Dec 2018 19:47:34 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:8136) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gVQmF-0000YC-Am; Fri, 07 Dec 2018 19:47:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1544230047; x=1575766047; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Ih4s0j5UAUWM2vvyAEuaXwzWIhBR/JhRlby3oIb/bRg=; b=fyJFbT030s2lBSePrntrrxNTk5VWqfa0/z/PNn+30I8yyHFccv9A00vT XwaZVmk/rrneoU69CFOQQMwwpBaPd7VQNDR9U0auJGTSdRpdb51A0WXhf Rz1WIoEvDEwIE8R3/8QHiTm8LCDbcH7IpxqNrcr1+a4N4CUCltTSX2RYC 1Wzeej28Bv2muxiQD6rXcLDixbzoIlC4ny2npy3kBEHbS1rV45Sm6vgZy cUh6hjolyNYe6Y1/Di/BURtehBy7bxTG2aPj64q/VSaVqqcI9SAKCmK/D De/LlI8dfRrK6SRvRKZL37s36OBfMZGfRuLq73XK0hAQiKWEEFcyFTuco g==; X-IronPort-AV: E=Sophos;i="5.56,328,1539619200"; d="scan'208";a="101012020" Received: from mail-by2nam03lp2056.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.56]) by ob1.hgst.iphmx.com with ESMTP; 08 Dec 2018 08:47:17 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PMkJjGCCwTgm+EjotCUxyhOgpuzIVBUaKRzpR54mzHE=; b=GAfcS8WHYaF5uZsOkaq/TU5wySfS02sa+pVcA3lg1EUctQfUrg0zzdT9BdmJ2VvF45FZRMd09Lu8Y6HYZFIcVMxW4kajidt3IHxLgb6mpDhHNLuLfhPq23rPHUwqiHVRLgnHMq0Q9kiWfpCSZpYlua8MM5y1HtUJqWhX9WCsZRM= Received: from MWHPR04MB0401.namprd04.prod.outlook.com (10.173.48.18) by MWHPR04MB3725.namprd04.prod.outlook.com (10.172.169.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.18; Sat, 8 Dec 2018 00:47:16 +0000 Received: from MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::d13d:19d3:fc93:2ec5]) by MWHPR04MB0401.namprd04.prod.outlook.com ([fe80::d13d:19d3:fc93:2ec5%9]) with mapi id 15.20.1404.021; Sat, 8 Dec 2018 00:47:16 +0000 From: Alistair Francis To: "qemu-devel@nongnu.org" , "qemu-riscv@nongnu.org" Thread-Topic: [RFC v3 07/24] riscv: Add the tcg target registers Thread-Index: AQHUjo+QSBT3wdcamEqGPNR7PW98ug== Date: Sat, 8 Dec 2018 00:47:16 +0000 Message-ID: <85cb20ee870652a43e658f0eb98e03f6358f2417.1544229872.git.alistair.francis@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.1 x-clientproxiedby: BYAPR04CA0025.namprd04.prod.outlook.com (2603:10b6:a03:40::38) To MWHPR04MB0401.namprd04.prod.outlook.com (2603:10b6:300:70::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [199.255.44.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR04MB3725; 6:Zwy3QSjz4AR99d13MzG1mzJ/6lvGYqzsZ8o884PmaFmW9AuZx769YXEqEZLhdRIOrB/Bt4HWiDy9a45E2iRHvLLRg80v5wUkV1EsCGGSkwxlGGCq3xdSp9X72lkRs6jb4jBMsqh0kFtWV0m9EiDvTOgNqM4AOQCgLh+PgSFN0dgUtJaQVGwyHkJ3A7JjTOkLTmKhxNc1xbKAoHPX5E31xHn+ytXMODAu8jwj15CdHSML5U92s4u2Z+VqFynZzgs+4wV2IASsb8rtVCxKwZH9gF+ObqAlupT7OqzKMO+Fq5J5IEXi5Z+79WDur4ww4v/q3grSzE7SlemJZ6r5Gg4BABX1cEz5QpSgdyQZbrSzEY3d5xrho95uOMdl/B7AiXKHLTgMT4QwwbUURU6gIXdZ/NNJ05Txw+6Pld9gMVPMaSR0U3JketJvts+cMUHQwY+WWgEvJp2xx7HrjRX9DH6xUQ==; 5:82sPYfq/JGmNPWL8nDy65CpCDNdsJqg6+TQG/c8Ev+ukBGKeRdCaj3H1ITxnLPhPRKWwK/3hr071AFDIZ50ru+50iRfwsVha1u18sXdoaMJ8wpxj4qIIiNQQ4WKamYsW+ySCVDssvF6C7mFpZoV48KEdFRveyWI/zl7QOX3HOZo=; 7:3EoUIPzisV2BQ3zD68J8zdfLGCU59B6Xrf5d/9HcZytQFkhCY0JjD9o1von6YaEAn8R/yZ7h2oxiHJYI/7dPs+VIeV9aGT+GwqarGzhkoZjY46/J3iTbUrUzRTvIAJEO7LvTlRpWZpjT1AB+jiPQNQ== x-ms-office365-filtering-correlation-id: c13ea404-86a7-40e9-bcfc-08d65ca6b30d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB3725; x-ms-traffictypediagnostic: MWHPR04MB3725: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231455)(999002)(944501520)(52105112)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:MWHPR04MB3725; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB3725; x-forefront-prvs: 0880FB6EC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(136003)(39860400002)(396003)(189003)(199004)(68736007)(476003)(53936002)(71200400001)(8676002)(71190400001)(11346002)(44832011)(446003)(2616005)(106356001)(486006)(4326008)(66066001)(6512007)(39060400002)(5660300001)(86362001)(81156014)(118296001)(81166006)(386003)(2906002)(8936002)(6506007)(14454004)(99286004)(3846002)(52116002)(478600001)(6116002)(25786009)(72206003)(305945005)(97736004)(6436002)(6486002)(76176011)(14444005)(26005)(7736002)(186003)(36756003)(110136005)(105586002)(2501003)(50226002)(102836004)(54906003)(316002)(256004); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB3725; H:MWHPR04MB0401.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-microsoft-antispam-message-info: 5U5vH2Vdss1uMeuNfurSxBqFLJMZd6PLKVErE2MIqP21vDCyaakv6vjsOfgTiTQvf/IUTvQycJHOn7vgAS5VHiNuLE+odIgB4BdmZzCFl8cHRFvlliBUM51Re8yao1kiCDoEAkdoYMcMF2/x7xO5wJPtxYanfBqXbllAZxp2eVvCzOO7RJgC2XSMYWL8oNf59UIVMMdk1c5JOgY0LdXdsJSSEfbZOswMW9BkVMfA5cp2KkZXpXfho8kgd8SduCoC9MyAidN2aqSL+OzzjOrTdFHMtyczbTwWrEUs2WzgYUJPIK4pUFi1N8iMwozksb6IdTJ/sBjqpX285UB2qqJLwQXE1eZji4ZXAqxzB06yWK8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c13ea404-86a7-40e9-bcfc-08d65ca6b30d X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2018 00:47:16.0234 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB3725 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 216.71.153.141 Subject: [Qemu-devel] [RFC v3 07/24] riscv: Add the tcg target registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alistair23@gmail.com" , "richard.henderson@linaro.org" , Alistair Francis Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Alistair Francis Signed-off-by: Michael Clark Reviewed-by: Richard Henderson --- tcg/riscv/tcg-target.inc.c | 118 +++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 tcg/riscv/tcg-target.inc.c diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c new file mode 100644 index 0000000000..6c969e3973 --- /dev/null +++ b/tcg/riscv/tcg-target.inc.c @@ -0,0 +1,118 @@ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2018 SiFive, Inc + * Copyright (c) 2008-2009 Arnaud Patard + * Copyright (c) 2009 Aurelien Jarno + * Copyright (c) 2008 Fabrice Bellard + * + * Based on i386/tcg-target.c and mips/tcg-target.c + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "tcg-pool.inc.c" + +#ifdef CONFIG_DEBUG_TCG +static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { + "zero", + "ra", + "sp", + "gp", + "tp", + "t0", + "t1", + "t2", + "s0", + "s1", + "a0", + "a1", + "a2", + "a3", + "a4", + "a5", + "a6", + "a7", + "s2", + "s3", + "s4", + "s5", + "s6", + "s7", + "s8", + "s9", + "s10", + "s11", + "t3", + "t4", + "t5", + "t6" +}; +#endif + +static const int tcg_target_reg_alloc_order[] = { + /* Call saved registers */ + /* TCG_REG_S0 reservered for TCG_AREG0 */ + TCG_REG_S1, + TCG_REG_S2, + TCG_REG_S3, + TCG_REG_S4, + TCG_REG_S5, + TCG_REG_S6, + TCG_REG_S7, + TCG_REG_S8, + TCG_REG_S9, + TCG_REG_S10, + TCG_REG_S11, + + /* Call clobbered registers */ + TCG_REG_T0, + TCG_REG_T1, + TCG_REG_T2, + TCG_REG_T3, + TCG_REG_T4, + TCG_REG_T5, + TCG_REG_T6, + + /* Argument registers */ + TCG_REG_A0, + TCG_REG_A1, + TCG_REG_A2, + TCG_REG_A3, + TCG_REG_A4, + TCG_REG_A5, + TCG_REG_A6, + TCG_REG_A7, +}; + +static const int tcg_target_call_iarg_regs[] = { + TCG_REG_A0, + TCG_REG_A1, + TCG_REG_A2, + TCG_REG_A3, + TCG_REG_A4, + TCG_REG_A5, + TCG_REG_A6, + TCG_REG_A7, +}; + +static const int tcg_target_call_oarg_regs[] = { + TCG_REG_A0, + TCG_REG_A1, +};