This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] clean up insn-automata.c


On 05/11/2016 01:39 AM, Alexander Monakov wrote:
On Wed, 30 Mar 2016, Bernd Schmidt wrote:
On 03/25/2016 04:43 AM, Aldy Hernandez wrote:
If Bernd is fine with this, I'm happy to retract my patch and any
possible followups.  I'm just interested in having no path causing a
possible out of bounds access.  If your patch will do that, I'm cool.
I'll need to see that patch first to comment :-)
Here's the proposed patch.  I've found that there's only one user of the
current fancy logic in output_internal_insn_code_evaluation: handling of
NULL_RTX and const0_rtx is only useful for 'state_transition' (generated
by output_trans_func), so it's possible to inline the extended handling
there, and handle only plain non-null rtx_insns in
output_internal_insn_code_evaluation.

This change allows to remove extra checks and casting in
output_internal_insn_latency_func, as done by the patch.

As a nice bonus, it constrains prototypes of three automata functions to
accept insn_rtx rather than just rtx.

Bootstrapped and regtested on x86_64, OK?
Yes, it is ok for the trunk.  Thank you for solving this issue, Alexander.
	* genattr.c (main): Change 'rtx' to 'rtx_insn *' in prototypes of
	'insn_latency', 'maximal_insn_latency', 'min_insn_conflict_delay'.
	* genautomata.c (output_internal_insn_code_evaluation): Simplify.
	Move handling of non-insn arguments inline into the sole user:
	(output_trans_func): ...here.
	(output_min_insn_conflict_delay_func): Change 'rtx' to 'rtx_insn *' in
	emitted function prototype.
	(output_internal_insn_latency_func): Ditto.  Simplify.
	(output_internal_maximal_insn_latency_func): Ditto.  Delete
	always-unused argument.
	(output_insn_latency_func): Ditto.
	(output_maximal_insn_latency_func): Ditto.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]