[PATCH] D22112: Disambiguate a constant with both 0B prefix and H suffix.
Yunzhong Gao via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 14:01:06 PDT 2016
ygao added a subscriber: majnemer.
ygao added a comment.
> Since the parsing style is specified on the command line at startup, can a
> flag be attached to MCAsmInfo which specifies whether prefix-bool parsing is
> activated? It looks like there are similar things already put there such as
> CommentString and DollarIsPC
I did not find a command-line option to control the parsing style. I found a
"-x86-asm-syntax" option which controls only the output assembly dialect. Do
you have something specific in mind?
I think what I can do is to add a flag to MCAsmInfo, and then flip the value
of the flag upon seeing either the ".intel_syntax" or ".att_syntax" directive.
What do you think that the flag should control?
Option#1: whether the "0b" prefix should be supported.
Current behavior:
"0b00" is binary;
"0bed" is syntax error;
"0b00h" is syntax error;
With "0b" prefix disabled, all three above are hexadecimal.
Option#2: whether the "h" suffix should be supported.
Option#3: when there is both the "0b" prefix and "h" suffix, which one wins.
David asked me what is the current behavior with "0777h". So,
"0777" => octal number (decimal=511)
"0777h" => hexadecimal (decimal=1911)
"0x77h" => hexadecimal
So it appears that the "h" suffix trumps everything else at the moment.
The Option#1 above does not impact the octal numbers, but if we implement
option#2 and when the "h" suffix is disabled, "0777h" and "0x77h" would be
syntax errors.
http://reviews.llvm.org/D22112
More information about the llvm-commits
mailing list