[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v4 19/29] Hexagon (target/hexagon) generator phase 3 - C
From: |
Richard Henderson |
Subject: |
Re: [RFC PATCH v4 19/29] Hexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree |
Date: |
Thu, 1 Oct 2020 14:54:00 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 9/29/20 6:37 AM, Philippe Mathieu-Daudé wrote:
> On 9/28/20 7:28 PM, Taylor Simpson wrote:
>> Run the C preprocessor across the instruction definition and encoding
>> files to expand macros and prepare the iset.py file. The resulting
>> fill contains python data structures used to build the decode tree.
>>
>> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
>> ---
>> target/hexagon/gen_dectree_import.c | 191
>> ++++++++++++++++++++++++++++++++++++
>> 1 file changed, 191 insertions(+)
>> create mode 100644 target/hexagon/gen_dectree_import.c
>>
>> diff --git a/target/hexagon/gen_dectree_import.c
>> b/target/hexagon/gen_dectree_import.c
>> new file mode 100644
>> index 0000000..237726e
>> --- /dev/null
>> +++ b/target/hexagon/gen_dectree_import.c
>> @@ -0,0 +1,191 @@
>> +/*
>> + * Copyright(c) 2019-2020 Qualcomm Innovation Center, Inc. All Rights
>> Reserved.
>> + *
>> + * This program 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 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
>> + */
>> +
>> +/*
>> + * This program generates the encodings file that is processed by
>> + * the dectree.py script to produce the decoding tree. We use the C
>> + * preprocessor to manipulate the files imported from the Hexagon
>> + * architecture library.
>> + */
>> +#include "qemu/osdep.h"
>> +#include "opcodes.h"
>> +
>> +#define STRINGIZE(X) #X
>> +
>> +const char *opcode_names[] = {
>
> Richard will probably ask to use "const char *const opcode_names[]".
It is good practice, even if this is a generator and so doesn't actually impact
the qemu executable itself. ;-)
>> +const char *opcode_syntax[XX_LAST_OPCODE];
>> +
>> +/*
>> + * Process the instruction definitions
>> + * Scalar core instructions have the following form
>> + * Q6INSN(A2_add,"Rd32=add(Rs32,Rt32)",ATTRIBS(),
>> + * "Add 32-bit registers",
>> + * { RdV=RsV+RtV;})
>> + */
>> +void opcode_init(void)
>> +{
>> +#define Q6INSN(TAG, BEH, ATTRIBS, DESCR, SEM) \
>> + opcode_syntax[TAG] = BEH;
>> +#define EXTINSN(TAG, BEH, ATTRIBS, DESCR, SEM) \
>> + opcode_syntax[TAG] = BEH;
>> +#include "imported/allidefs.def"
>> +#undef Q6INSN
>> +#undef EXTINSN
>> +}
What is it that about this case that can't be initialized at compile time?
r~
- Re: [RFC PATCH v4 19/29] Hexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree,
Richard Henderson <=