From: Richard Henderson <rth@cygnus.com>
Subject: Re: Error: macro requires $at register while noat in effect
Date: Thu, 11 Sep 1997 11:38:46 -0700 (PDT) [thread overview]
Message-ID: <199709111838.LAA20427@rtl.cygnus.com> (raw)
In-Reply-To: <199709111242.PAA23522@blinky.bfr.co.il>
> My code is straight C. It doesn't have any assembler in it.
Sure enough. Here's a patch.
r~
--- config/alpha/alpha.c.orig Thu Sep 11 11:26:12 1997
+++ config/alpha/alpha.c Thu Sep 11 11:28:46 1997
@@ -1553,7 +1553,7 @@ output_prolog (file, size)
int int_reg_save_area_size = 0;
rtx insn;
unsigned reg_mask = 0;
- int i;
+ int i, sa_reg;
/* There seems to be no good hook to reset per-function flags.
Do so here. */
@@ -1708,11 +1708,29 @@ output_prolog (file, size)
frame_size, current_function_pretend_args_size);
}
+ /* Cope with very large offsets to the register save area. */
+ sa_reg = 30;
+ if (reg_offset + sa_size > 0x8000)
+ {
+ int low = ((reg_offset & 0xffff) ^ 0x8000) - 0x8000;
+ if (low + sa_size <= 0x8000)
+ {
+ add_long_const (file, reg_offset - low, 30, 24, 24);
+ reg_offset = low;
+ }
+ else
+ {
+ add_long_const (file, reg_offset, 30, 24, 24);
+ reg_offset = 0;
+ }
+ sa_reg = 24;
+ }
+
/* Save register 26 if any other register needs to be saved. */
if (sa_size != 0)
{
reg_mask |= 1 << 26;
- fprintf (file, "\tstq $26,%d($30)\n", reg_offset);
+ fprintf (file, "\tstq $26,%d($%d)\n", reg_offset, sa_reg);
reg_offset += 8;
int_reg_save_area_size += 8;
}
@@ -1722,7 +1740,7 @@ output_prolog (file, size)
if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i] && i != 26)
{
reg_mask |= 1 << i;
- fprintf (file, "\tstq $%d,%d($30)\n", i, reg_offset);
+ fprintf (file, "\tstq $%d,%d($%d)\n", i, reg_offset, sa_reg);
reg_offset += 8;
int_reg_save_area_size += 8;
}
@@ -1742,7 +1760,7 @@ output_prolog (file, size)
&& regs_ever_live[i + 32])
{
reg_mask |= 1 << i;
- fprintf (file, "\tstt $f%d,%d($30)\n", i, reg_offset);
+ fprintf (file, "\tstt $f%d,%d($%d)\n", i, reg_offset, sa_reg);
reg_offset += 8;
}
@@ -1790,6 +1808,7 @@ output_epilog (file, size)
if (insn == 0 || GET_CODE (insn) != BARRIER)
{
int fp_offset = 0;
+ int sa_reg;
final_prescan_insn (NULL_RTX, NULL_RTX, 0);
@@ -1797,11 +1816,29 @@ output_epilog (file, size)
if (frame_pointer_needed)
fprintf (file, "\tbis $15,$15,$30\n");
+ /* Cope with large offsets to the register save area. */
+ sa_reg = 30;
+ if (reg_offset + sa_size > 0x8000)
+ {
+ int low = ((reg_offset & 0xffff) ^ 0x8000) - 0x8000;
+ if (low + sa_size <= 0x8000)
+ {
+ add_long_const (file, reg_offset - low, 30, 24, 24);
+ reg_offset = low;
+ }
+ else
+ {
+ add_long_const (file, reg_offset, 30, 24, 24);
+ reg_offset = 0;
+ }
+ sa_reg = 24;
+ }
+
/* Restore all the registers, starting with the return address
register. */
if (sa_size != 0)
{
- fprintf (file, "\tldq $26,%d($30)\n", reg_offset);
+ fprintf (file, "\tldq $26,%d($%d)\n", reg_offset, sa_reg);
reg_offset += 8;
}
@@ -1816,7 +1853,7 @@ output_epilog (file, size)
if (i == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)
fp_offset = reg_offset;
else
- fprintf (file, "\tldq $%d,%d($30)\n", i, reg_offset);
+ fprintf (file, "\tldq $%d,%d($%d)\n", i, reg_offset, sa_reg);
reg_offset += 8;
}
@@ -1824,7 +1861,7 @@ output_epilog (file, size)
if (! fixed_regs[i + 32] && ! call_used_regs[i + 32]
&& regs_ever_live[i + 32])
{
- fprintf (file, "\tldt $f%d,%d($30)\n", i, reg_offset);
+ fprintf (file, "\tldt $f%d,%d($%d)\n", i, reg_offset, sa_reg);
reg_offset += 8;
}
@@ -1839,7 +1876,7 @@ output_epilog (file, size)
now. This must be done in one instruction immediately
before the SP update. */
if (restore_fp && fp_offset)
- fprintf (file, "\tldq $15,%d($30)\n", fp_offset);
+ fprintf (file, "\tldq $15,%d($%d)\n", fp_offset, sa_reg);
/* Now update the stack pointer, if needed. Only one instruction must
modify the stack pointer. It must be the last instruction in the
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next parent reply other threads:[~1997-09-11 18:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <199709111242.PAA23522@blinky.bfr.co.il>
1997-09-11 18:38 ` Richard Henderson [this message]
[not found] <199709110542.WAA05294@dot.cygnus.com>
1997-09-11 12:42 ` Error: macro requires $at register while noat in effect Harvey J. Stein
[not found] <199709102254.BAA08044@blinky.bfr.co.il>
1997-09-11 5:42 ` Richard Henderson
1997-09-10 22:54 Harvey J. Stein
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox