This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Add access restriction check for application registers (wasRe: Is this a gas bug?)
- From: Jie Zhang <jiez at citiz dot net>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: george dot gan at intel dot com, "binutils at sources dot redhat dot com" <binutils at sources dot redhat dot com>, "bug-binutils at gnu dot org" <bug-binutils at gnu dot org>
- Date: Mon, 24 May 2004 23:15:59 +0800
- Subject: PATCH: Add access restriction check for application registers (wasRe: Is this a gas bug?)
- References: <1085333524.2233.56.camel@mars> <jesmdrow2p.fsf@sykes.suse.de>
On Mon, 2004-05-24 at 02:08, Andreas Schwab wrote:
> Jie Zhang <jiez@citiz.net> writes:
>
> > Gas puts these two alloc instruction into M-unit type slot without
> > noting that ar.pfs can only be accessed by I-unit. I have no time to fix
> > this now. I will try to fix it if nobody submit patch for it in about
> > two weeks.
>
> alloc surely is an M-unit insn. The access restrictions about application
> registers apply only to the mov insn.
>
> Andreas.
Oh, my mistake! Here is the modified patch for this issue. Since the
access restriction about application registers apply only to the mov
insn, I move the check from emit_one_bundle () to md_assemble () and
make it only check the first two operands of mov.i and mov.m. Now make
check is OK. No need for another patch now:-)
Jie Zhang
2004-05-24 Jie Zhang <jiez@citiz.net>
* config/tc-ia64.c (md_assemble): Check if the
application register is accessed by the right execution
unit.
Index: tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.109
diff -c -3 -p -r1.109 tc-ia64.c
*** tc-ia64.c 6 May 2004 22:32:44 -0000 1.109
--- tc-ia64.c 24 May 2004 14:51:35 -0000
*************** md_assemble (str)
*** 9992,9997 ****
--- 9992,10026 ----
if (!idesc)
goto done;
+ /* Make sure that application register is accessed by the
+ right execution unit. The access restrictions about
+ application registers apply only to the mov instruction.
+ So only mov.i and mov.m insn need to be checked. */
+
+ if (strcmp (idesc->name, "mov.i") == 0
+ || strcmp (idesc->name, "mov.m") == 0)
+ {
+ enum ia64_opnd opnd1, opnd2;
+ int rop;
+
+ opnd1 = idesc->operands[0];
+ opnd2 = idesc->operands[1];
+ if (opnd1 == IA64_OPND_AR3)
+ rop = 0;
+ else if (opnd2 == IA64_OPND_AR3)
+ rop = 1;
+ else
+ abort ();
+ if (idesc->name[4] == 'i'
+ && !ar_is_in_integer_unit (CURR_SLOT.opnd[rop].X_add_number))
+ as_bad ("appliction register %lld cannot be accessed by I-unit",
+ CURR_SLOT.opnd[rop].X_add_number - REG_AR);
+ else if (idesc->name[4] == 'm'
+ && ar_is_in_integer_unit (CURR_SLOT.opnd[rop].X_add_number))
+ as_bad ("appliction register %lld cannot be accessed by M-unit",
+ CURR_SLOT.opnd[rop].X_add_number - REG_AR);
+ }
+
/* Handle the dynamic ops we can handle now: */
if (idesc->type == IA64_TYPE_DYN)
{