How to find if any fixups were created for an instruction

Kunal Parmar kunalparmar@gmail.com
Tue Apr 22 22:10:00 GMT 2008


Hi Nick,

On Fri, Apr 18, 2008 at 9:38 AM, Nick Clifton <nickc@redhat.com> wrote:
>  You could define the macros TC_FIX_TYPE and  TC_INIT_FIX_DATA and use them
> to keep track of the frag and offset of the most recently allocated fixup.
> Then you could compare this info to the info for the current instruction to
> see if it has fixups.
>
>  You could cache values of the num_fixups variable each time you generate an
> instruction and then compare the current value with previous cached values
> to see how many fixups have been created for the current instruction.
>
>  You could scan the list of fixups for the current section and look for any
> that are in the current frag/offset as the current instruction.

I have defined the macro TC_CGEN_PARSE_FIX_EXP and am using it to
to check if a fixup was created like this :

#define TC_CGEN_PARSE_FIX_EXP(opinfo, exp) \
  brc_cgen_parse_fix_exp(opinfo, exp)
extern int brc_cgen_parse_fix_exp (int, expressionS *);

int
brc_cgen_parse_fix_exp (int opinfo, expressionS * exp)
{
  if (exp->X_op != O_illegal && exp->X_op != O_absent
      && exp->X_op != O_constant && exp->X_op != O_register)
    fixup_created = 1;

  return opinfo;
}

Is it correct ?

Thanks in advance,
Kunal Parmar



More information about the Binutils mailing list