This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Fix handle implicit nops for unwind records


On Fri, 2004-01-16 at 14:52, H. J. Lu wrote:
> 	* config/tc-ia64.c (emit_one_bundle): Handle unwind records
> 	for implicit nops.

This doesn't look right.  Note that we don't update "curr" when we
continue, so the unwind records are still live.  We deliberately defer
updating some unwind records until after the nops have been emitted, so
that they will point to the actual instruction.  This is important. 
Otherwise, the unwind directives will not be interpreted correctly. 
Your patch gets this wrong.

The real problem here seems to be more complicated.  I see two problems.

We don't keep track of when prologue/prologue_gr/epilogue records are
set.  If we have two nops as in this case, then they get set 3 times,
each time we execute this loop.  The first time we set them they get the
right value, the next two times are wrong.  Keeping track of whether we
have initialized the values will fix this.  Thus we only set them once. 

We have a sequence of 4 unwind records attached to one instruction,
prologue/rp_when/rp_gr/body.  rp_when/rp_gr gets deferred because it is
not a prologue/body directive.  However, that is a mistake in this
case.  rp_when was emitted before the body directive, so it can occur no
later than the body record.  We need to make the code here a bit more
complicated.  We need to initialize all prologue/prologue_gr/body
records here.  Also, we need to initialize any other kind of record if
it is followed by a prologue/prologue_gr/body record.  This probably
needs to be two loops.  The first loop finds the last prologue/body
record in the list.  The second loop initializes all unwind records up
to that point.

We also have to modify the code that sets non-prologue/non-body records,
to account for the changes above.  If we added an "initialized" field as
suggested above, then we can check for that.  However, there is a
simpler alternative here I think.  Because of the second problem, we are
now setting all fields in the list up to the last prologue/body record,
and we have a pointer to it.  So when we set prologue/body records, we
could update the md.slot[curr].unwind_record pointer to point after the
last unwind record that we set.  Thus we need no initialized field, and
the code for non-prologue/non-body records no longer has to check unwind
record types.  It just sets all records that remain in the list at this
point, and then sets the list to NULL.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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