Hi Zhuqing, This change looks fine to me, although I do not quite understand the need for a separate option. It should be the job of wgen to set the register_parm attribute according to the options passed to the frontend.
-David Coakley / AMD Open Source Compiler Engineering On Mon, Sep 5, 2011 at 2:57 AM, 朱庆 <zqing1...@gmail.com> wrote: > Hi all, > Can gatekeeper help review the fix for bug851. > https://bugs.open64.net/show_bug.cgi?id=851 > This is a revision for bug867. > > case: > typedef unsigned char u8; > struct biosregs { > struct { > u8 dil, dih, edi2, edi3; > u8 sil, sih, esi2, esi3; > u8 bpl, bph, ebp2, ebp3; > u8 _spl, _sph, _esp2, _esp3; > u8 bl, bh, ebx2, ebx3; > }; > > }; > int fn(struct biosregs *reg) > { > __builtin_memset(reg,0,sizeof *reg); > } > > compile with: opencc -O0 -keep a.c -show -mregparm=3 -m32 > memset's parms still transfered by stack. > movl %eax,-8(%ebp) # reg > movl -8(%ebp),%ecx # reg > movl %ecx,0(%esp) # > movl $0,%edx # > movl %edx,4(%esp) # > movl $20,%eax # > movl %eax,8(%esp) # > .loc 1 14 0 > # 14 __builtin_memset(reg,0,sizeof *reg); > .globl memset > call memset # memset > > Option "mregparm=%d" is used to set the reg parm for function call, > but it is not suitable for build-in fuctions. > There is another option "-TENV:mregparm=%d" to set that value special > for built-in fuction call. > > So the fix is to add option "-TENV:mregparm=%d" when mregparm is used. > > Patch: > Index: osprey/driver/OPTIONS > =================================================================== > --- osprey/driver/OPTIONS (revision 3730) > +++ osprey/driver/OPTIONS (working copy) > @@ -2079,7 +2079,7 @@ > "" > -malign-functions=%d warn_ignored(option_name); ALL NONE self > "" > --mregparm=%d ; Cc cfe -mregparm=%d > +-mregparm=%d ; Cc cfe,be "-mregparm=%d > -TENV:mregparm=%d" > "Control the number registers used to pass integer arguments" > %%% x86 extensions > -mmmx toggle(&mmx,TRUE); ALL ALL "" > > Thanks > zhuqing > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Open64-devel mailing list > Open64-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/open64-devel > ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel