[RFC v2] Towards an assembler parser for PowerPC

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Mon Mar 11 07:14:19 PDT 2013


Roman Divacky <rdivacky at freebsd.org> wrote on 09.03.2013 12:37:37:

> So I looked at the asm parser patches and did some testing etc. Few
issues :)

Thanks for the review!


> diff-llvm-asm-address:
>
> dont remove the mayLoad
>
> -let mayLoad = 1 in
> -def LHAU8 : DForm_1a<43, (outs G8RC:$rD, ptr_rc:$ea_result), (ins
> symbolLo:$disp,
> -                            ptr_rc:$rA),
> -                    "lhau $rD, $disp($rA)", LdStLHAU,
> -                    []>, RegConstraint<"$rA = $ea_result">,
> +def LHAU8 : DForm_1<43, (outs G8RC:$rD, ptr_rc:$ea_result),
> +                    (ins memri:$addr),
> +                    "lhau $rD, $addr", LdStLHAU,
> +                    []>, RegConstraint<"$addr.reg = $ea_result">,

Ah, right.  In fact, I think the mayLoad really also ought to include
LHAUX8 and LWAUX ... those are the only loads that currently don't
have it.

> diff-llvm-asm-parser:
>
> .word parsing should not be ppc-only, gnu as supports that on all archs

Well, the other archs have .word support in their backends, too.  I had
assumed this is the case because the semantics of .word differs between
platforms (different word size).

> [rdivacky at anacreon ~]$ cat parser.s
> ld %r1,0(%r1)
> [rdivacky at anacreon ~]$ as parser.s
> [rdivacky at anacreon ~]$ ~/llvm/Release+Asserts/bin/clang -integrated-
> as parser.s
> parser.s:1:4: error: unknown operand
> ld %r1,0(%r1)
>    ^
> parser.s:1:4: error: unexpected token at start of statement
> ld %r1,0(%r1)
>    ^

Hmmm.  Right now the parser only supports the default register naming
"ld 1,0(1)".  But I agree it would probably be better to support the %r
register names, too.   I'll have a look ...



Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU/Linux compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
Wittkopp
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294





More information about the llvm-commits mailing list