This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Named asm operands
- To: gcc-patches at gcc dot gnu dot org
- Subject: Named asm operands
- From: Espen Skoglund <esk at ira dot uka dot de>
- Date: Mon, 7 May 2001 13:10:42 +0200 (CEST)
Hi,
The response I got on this list when I asked for having more operands
in asm constructs was that one really wants to have named operands.
So, I went along and extended the asm constructs a bit. Using the
patch attached below, one can now write asm constructs like:
asm (" popfl %[flags] \n"
" movl %[pgtab], %%cr3 \n"
: [flags] "=rm"(eflags)
: [pgtab] "r");
The patch also sets max number of operands to minimum 30 (that was the
reason I added this stuff in the first place). As I started doing my
additions I realized that I needed more changes to gcc than
anticipated. Anyhow, I believe I managed to get all the necessary
stuff in there making as few modifications as possible.
eSk
2001-05-04 Espen Skoglund <esk@ira.uka.de>
* genconfig.c (main): Increased max_recog_operands.
* rtl.def: Added new operands output-operand-name and
opname-vector to ASM_OPERANDS.
* rtl.h: Added arg to decode_asm_operands().
(ASM_OPERANDS_OUTPUT_NAME): New macro.
(ASM_OPERANDS_INPUT_NAME_VEC): New macro.
(ASM_OPERANDS_INPUT_NAME_EXP): New macro.
(ASM_OPERANDS_INPUT_NAME): New macro.
(ASM_OPERANDS_*): Modified field indexes.
* c-parse.in: Added possibility of prepending asm constraint with
operanad name.
* cp/parse.y: Ditto.
* stmt.c (expand_asm_operands): Handle named asm operands.
* final.c: Added variable `operand_names'.
(asm_insn_count): Add arg to decode_asm_entry().
(output_asm_insn): Handle named operands in asm input.
* recog.h (struct recog_data): Added opnames array.
* recog.c (decode_asm_operands): Put operand names into new
argument OPNAMES if OPNAMES is nonzero.
(extract_insn): Extraxct operand names into recog_data.
* reload1.c (maybe_fix_stack_asms): Added arg to
decode_asm_operands().
* config/sh/sh.c (sh_insn_length_adjustment): Ditto.
* cse.c (canon_hash): Take operand names into account when
generating hashes.
(exp_equiv_p): Take operand names into account when comparing asm
insns.
* gcse.c (hash_expr_1): Take operand names into account when
generating hashes.
(expr_equiv_p): Take operand names into account when comparing asm
insns.
* integrate.c (copy_rtx_and_substitute): Copy output_name and
input_name_vec when copying asm insn.
* integrate.h (struct inline_remap): Added
`copy_asm_opnames_vector'.
* emit-rtl.c: New variables {orig,copy}_asm_opnames_vector.
(copy_insn): Zero out *_asm_opnames_vector before copying insn.
(copy_insn_1): Make copy of operand names vector.
named-operands.diff