This is the mail archive of the gcc-help@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: Retrieve label name


On Wed, 15 Apr 2009 08:35:09 -0700, Ian Lance Taylor <iant@google.com>
wrote:
> "Vincent R." <forumer@smartmobili.com> writes:
> 
>> when declaring a label like this :
>>
>> tree block, body, cond, except_stmt, label, tlabel, name;
>>   location_t loc, loclabel;
>>   gcc_assert (c_parser_next_token_is_keyword (parser, RID_SEH_TRY));
>>
>>   /* label try */
>>   loclabel = c_parser_peek_token (parser)->location;
>>   name = c_parser_peek_token (parser)->value;
>>   cfun->seh_try_begin_label = name;
>>   tlabel = define_label (loclabel, name);
>>   ...
>>
>>
>>
>> How can we know the label name( that will be generated ?
> 
> Do you mean what label will be generated in the assembler code?  That is
> almost certainly not the right question to ask during the parse, so: why
> do you want to know?
> 
> In any case, there is no answer in the frontend.  The assembly level
> label name is normally not determined until RTL is generated.
> 
> Ian


We are supposed to fill an array with __try __except address, so it means
we are generating some
labels and after we are doing this :

void
arm_seh_rdata_gen (FILE *fp, char *name, tree decl)
{
  int   has_seh = cfun->has_seh;

  asm_fprintf (fp, ".L%s_end:\n", name);
  //  if (has_seh)
  if (cfun->has_seh)
    {
      asm_fprintf (fp, "\t.section .rdata /* SEH SCOPE_TABLE */\n");
      asm_fprintf (fp, ".L%s_handler_data:\n", name);
      asm_fprintf (fp, "\t.word 1 /* Count */\n");
      asm_fprintf (fp, "\t.word %s /* BeginAddress */\n", ?????????); /*
begin of __try block */
      asm_fprintf (fp, "\t.word .L%s_end /* EndAddress */\n", name);  /*
end of __try block */
      asm_fprintf (fp, "\t.word 0 /* HandleAddress */\n");            /*
exception filter */
      asm_fprintf (fp, "\t.word 0 /* JumpTarget */\n");               /* 
    }
}

In the .rdata section we need to know the label corresponding to end of
__try, so how are we supposed to do that ?





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