This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Instruction bundling on IA64 and the Intel Assembler
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: zack at codesourcery dot com, gcc at gcc dot gnu dot org
- Date: Mon, 15 Dec 2003 17:19:25 -0500
- Subject: Re: Instruction bundling on IA64 and the Intel Assembler
- References: <10312152200.AA20379@vlsi1.ultra.nyu.edu>
Richard Kenner wrote:
>
> However, that still doesn't address part of Geert's comment, which is that
> there is little or no documentation in that function and certainly no
> overview comments saying what's going on. Even if there is some simple
> way to deal with this issue, that documentation still needs to be provided.
Could you be more specific. I tried to describe the code in
details. I see the following comment for the function.
/* The following function does insn bundling. Bundling algorithm is
based on dynamic programming. It tries to insert different number of
nop insns before/after the real insns. At the end of EBB, it chooses
the
best alternative and then, moving back in EBB, inserts templates for
the best alternative. The algorithm is directed by information
(changes of simulated processor cycle) created by the 2nd insn
scheduling. */
All loops have comments to (as Geert asked) like
/* First (forward) pass -- generates states. */
/* Finding state with a minimal cost: */
/* Second (backward) pass: adding nops and templates: */
/* Insert additional cycles for MM-insns: */
The bundle state has many comments too
/* The following describes state of insn bundling. */
struct bundle_state
{
/* Unique bundle state number to identify them in the debugging
output */
int unique_num;
rtx insn; /* corresponding insn, NULL for the 1st and the last
state */
/* number nops before and after the insn */
short before_nops_num, after_nops_num;
int insn_num; /* insn number (0 - for initial state, 1 - for the 1st
insn */
int cost; /* cost of the state in cycles */
int accumulated_insns_num; /* number of all previous insns including
nops. L is considered as 2 insns */
int branch_deviation; /* deviation of previous branches from 3rd
slots */
struct bundle_state *next; /* next state with the same insn_num */
struct bundle_state *originator; /* originator (previous insn state)
*/
/* All bundle states are in the following chain. */
struct bundle_state *allocated_states_chain;
/* The DFA State after issuing the insn and the nops. */
state_t dfa_state;
};
I understand that the code is not trivial. As many parts of gcc
some work is needed to understand code. IMHO this code is far from
the worst one with the point view of comments.
Vlad