[fpc-devel] question about parameter loading code

Fuxin Zhang zhangfx at lemote.com
Sun Jun 10 08:15:18 CEST 2012


Dear sirs,

  When trying to generate code debuggable by GDB, I meet a problem:

* it seems mips C code will expect a frame pointer = sp after stack
adjustment
* but in cpupara.pas, when we create para info, we don't know yet the
whole stack size, thus the reference offset cannot be set correctly

In current code, I use
   move fp, sp
   addiu sp,sp,-LocalSize
   ...
and use the frame pointer fp as reference base, so the offset for callee
can be the same as the caller side.

In MIPS ABI, the parameter area for callee functions is at the bottom of
caller function's stack, so the offsets are decided only by parameters
when use fp(or the caller's sp, or the sp upon function entry) as the
base.

   C code is something like:

  addiu sp,sp,-LocalSize
  sw    fp, 4(sp)
  move  fp, sp

in this way, I don't know how to generate parameter references since no
usable base register to get fixed offset for parameters in
create_paraloc_info_intern.

Could you give some hints?

Best Regards




More information about the fpc-devel mailing list