Getting rid of constrain_asm_operands
Jeffrey A Law
law@cygnus.com
Wed Dec 2 01:07:00 GMT 1998
In message <Pine.GSO.4.02A.9811282122510.10334-100000@jennifer.informatik.rwt
h-aachen.de>you write:
> This is the next part of the extract_insn changes. This patch eliminates
> the constrain_asm_operands function in reg-stack. Most of the work done
> by it is now done by contrain_operands which can now handle asm statements,
> and the rest of the work (analyzing the constraints) is done by a new
> function "preprocess_constraints". There are many places in the compiler
> that have to parse constraint strings; quite a few of those could probably
> be converted to use this function. It might be extended to gather other
> information as well (e.g., call operands_match_p for all pairs with matchin
> g
> constraints).
> One drawback of the patch is that it introduces an arbitrary value
> MAX_RECOG_ALTERNATIVES. The chosen value (30) should be large enough and
> can be increased if it ever turns out to be a problem.
>
> The patch for final.c just removes some code that ought to be handled
> transparently by extract_insn.
>
> The patch was tested by building glibc-2.0.103 with it. No errors in "make
> check".
>
> Bernd
>
> * final.c (cleanup_subreg_operands): Delete some unused code.
>
> * recog.h (MAX_RECOG_ALTERNATIVES): New macro.
> (struct insn_alternative): New structure definition.
> (recog_op_alt): Declare variable.
> (preprocess_constraints): Declare function.
> * recog.c (recog_op_alt): New variable.
> (extract_insn): Verify number of alternatives is in range.
> (preprocess_constraints): New function.
> * reg-stack.c: Include recog.h.
> (constrain_asm_operands): Delete.
> (get_asm_operand_lengths): Delete.
> (get_asm_operand_n_inputs): New function.
> (record_asm_reg_life): Delete OPERANDS, CONSTRAINTS, N_INPUTS and
> N_OUTPUTS args. All callers changed.
> Compute number of inputs and outputs here by calling
> get_asm_operand_n_inputs.
> Instead of constrain_asm_operands, call extract_insn,
> constrain_operands and preprocess_constaints. Use information
> computed by these functions throughout.
> (record_reg_life): Delete code that is unused due to changes in
> record_asm_reg_life.
> (subst_asm_stack_regs): Delete OPERANDS, OPERAND_LOC, CONSTRAINTS,
> N_INPUTS and N_OUTPUTS args. All callers changed.
> Similar changes as in record_asm_reg_life.
> (subst_stack_regs): Move n_operands declaration into the if statement
> where it's used.
> Delete code that is unused due to changes in subst_asm_stack_regs.
> * stmt.c (expand_asm_operands): Verify number of alternatives is in
> range.
> * Makefile.in (reg-stack.o): Depend on recog.h.
Looks good to me. The only change I'd like to see would be to rename this
field in struct operand_alternative:
+ /* The register class valid for this alternative (possibly NO_REGS). */
+ enum reg_class cls;
Use "class". It seems pretty silly to make the code harder to read in order
to save two characters :-)
If you could make that change and check in the updated patch it would be
greatly appreciated.
Thanks,
jeff
More information about the Gcc-patches
mailing list