diff options
author | Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> | 1997-09-22 17:46:38 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1997-09-22 11:46:38 -0600 |
commit | 078e983e5101473e8aa2772a93432ede89a1c962 (patch) | |
tree | f3dfb912d786988b84272ecf03e8c80e859c1486 /gcc/config/m68k | |
parent | 9524f769a795d7ad5b9a1d5266d372ef3f466f4c (diff) | |
download | gcc-078e983e5101473e8aa2772a93432ede89a1c962.zip gcc-078e983e5101473e8aa2772a93432ede89a1c962.tar.gz gcc-078e983e5101473e8aa2772a93432ede89a1c962.tar.bz2 |
m68k.c (output_function_prologue): Add dwarf2 support.
* m68k.c (output_function_prologue): Add dwarf2 support.
* m68k.h (INCOMING_RETURN_ADDR_RTX, DWARF_FRAME_REGNUM,
INCOMING_FRAME_SP_OFFSET): New definitions.
From-SVN: r15631
Diffstat (limited to 'gcc/config/m68k')
-rw-r--r-- | gcc/config/m68k/m68k.c | 84 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.h | 12 |
2 files changed, 91 insertions, 5 deletions
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 781e11c..e8e08f9 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -164,6 +164,7 @@ output_function_prologue (stream, size) int num_saved_regs = 0; extern char call_used_regs[]; int fsize = (size + 3) & -4; + int cfa_offset = INCOMING_FRAME_SP_OFFSET, cfa_store_offset = cfa_offset; if (frame_pointer_needed) @@ -212,6 +213,15 @@ output_function_prologue (stream, size) reg_names[FRAME_POINTER_REGNUM], -fsize); #endif } + if (dwarf2out_do_frame ()) + { + char *l = (char *) dwarf2out_cfi_label (); + cfa_store_offset += 4; + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, cfa_offset); + dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, -cfa_store_offset); + cfa_store_offset += fsize; + } } else if (fsize) { @@ -282,6 +292,12 @@ output_function_prologue (stream, size) asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", - (fsize + 4)); #endif } + if (dwarf2out_do_frame ()) + { + cfa_store_offset += fsize; + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa ("", STACK_POINTER_REGNUM, cfa_offset); + } } #ifdef SUPPORT_SUN_FPA for (regno = 24; regno < 56; regno++) @@ -294,13 +310,27 @@ output_function_prologue (stream, size) asm_fprintf (stream, "\tfpmoved %s,%Rsp@-\n", reg_names[regno]); #endif + if (dwarf2out_do_frame ()) + { + char *l = (char *) dwarf2out_cfi_label (); + cfa_store_offset += 8; + if (! frame_pointer_needed) + { + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); + } + dwarf2out_reg_save (l, regno, -cfa_store_offset); + } } #endif if (TARGET_68881) { for (regno = 16; regno < 24; regno++) if (regs_ever_live[regno] && ! call_used_regs[regno]) - mask |= 1 << (regno - 16); + { + mask |= 1 << (regno - 16); + num_saved_regs++; + } if ((mask & 0xff) != 0) { #ifdef MOTOROLA @@ -308,8 +338,24 @@ output_function_prologue (stream, size) #else asm_fprintf (stream, "\tfmovem %0I0x%x,%Rsp@-\n", mask & 0xff); #endif + if (dwarf2out_do_frame ()) + { + char *l = (char *) dwarf2out_cfi_label (); + int n_regs; + cfa_store_offset += num_saved_regs * 12; + if (! frame_pointer_needed) + { + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); + } + for (regno = 16, n_regs = 0; regno < 24; regno++) + if (mask & (1 << (regno - 16))) + dwarf2out_reg_save (l, regno, + -cfa_store_offset + n_regs++ * 12); + } } mask = 0; + num_saved_regs = 0; } for (regno = 0; regno < 16; regno++) if (regs_ever_live[regno] && ! call_used_regs[regno]) @@ -347,13 +393,26 @@ output_function_prologue (stream, size) /* Undo the work from above. */ for (i = 0; i< 16; i++) if (mask & (1 << i)) - asm_fprintf (stream, + { + asm_fprintf (stream, #ifdef MOTOROLA - "\t%Omove.l %s,-(%Rsp)\n", + "\t%Omove.l %s,-(%Rsp)\n", #else - "\tmovel %s,%Rsp@-\n", + "\tmovel %s,%Rsp@-\n", #endif - reg_names[15 - i]); + reg_names[15 - i]); + if (dwarf2out_do_frame ()) + { + char *l = (char *) dwarf2out_cfi_label (); + cfa_store_offset += 4; + if (! frame_pointer_needed) + { + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); + } + dwarf2out_reg_save (l, 15 - i, -cfa_store_offset); + } + } } else if (mask) { @@ -392,6 +451,21 @@ output_function_prologue (stream, size) asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask); #endif } + if (dwarf2out_do_frame ()) + { + char *l = (char *) dwarf2out_cfi_label (); + int n_regs; + cfa_store_offset += num_saved_regs * 4; + if (! frame_pointer_needed) + { + cfa_offset = cfa_store_offset; + dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); + } + for (regno = 0, n_regs = 0; regno < 16; regno++) + if (mask & (1 << (15 - regno))) + dwarf2out_reg_save (l, regno, + -cfa_store_offset + n_regs++ * 4); + } } if (flag_pic && current_function_uses_pic_offset_table) { diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 0ac38cb..6004aaa 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -1792,6 +1792,18 @@ __transfer_from_trampoline () \ #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2) +/* Before the prologue, RA is at 0(%sp). */ +#define INCOMING_RETURN_ADDR_RTX \ + gen_rtx (MEM, VOIDmode, gen_rtx (REG, VOIDmode, STACK_POINTER_REGNUM)) + +/* We must not use the DBX register numbers for the DWARF 2 CFA column + numbers because that maps to numbers beyond FIRST_PSEUDO_REGISTER. + Instead use the identity mapping. */ +#define DWARF_FRAME_REGNUM(REG) REG + +/* Before the prologue, the top of the frame is at 4(%sp). */ +#define INCOMING_FRAME_SP_OFFSET 4 + /* This is how to output the definition of a user-level label named NAME, such as the label on a static function or variable NAME. */ |