[LLVMdev] [llvm-commits] [RFC, AsmParser] How to handle '$' like '.' ?
Sid Manning
sidneym at codeaurora.org
Fri Feb 8 07:41:32 PST 2013
On 01/24/2013 02:38 PM, Ulrich Weigand wrote:
>
> Hello,
>
> on PowerPC and a couple of other platforms, the GNU assembler allows using
> a stand-alone '$' as part of an expression, and interprets it to refer to
> the current PC just like '.'. (You can still use '$' as part of
> identifiers otherwise.) For compatibility, we need to model the same
> behaviour in the LLVM AsmParser.
>
> Unfortunately, there don't appear to be any existing hooks within the core
> AsmParser expression parsing logic where target-specific behaviour like
> this could be implemented. Any suggestions where this should be handled?
> Thanks!
Hi Ulrich,
I started working on our target's parser recently and I have a similar
issue with colons. The Hexagon assembler allows ':' in register
assignment statements. An example would be, "r5:4 = r3:2" or "r5:4 =
combine(r3, r2)" either of which will assign the contents of registers 3
and 2 to registers 5 and 4 respectively.
I would like to add method, "colonIsLabel()" to the MCTargetAsmParser
and then let this target defined method look at the statement. If it is
not a label then break and let parseInstruction handle the statement
otherwise treat it as a label.
I have not seen any replies to your RFC but do you feel like this
approach would be reasonable. Given the irregularities of assembly it
seems like target specific methods will be needed for other notations as
well.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list