[PATCH] Add support for ARM modified immediate syntax

Tim Northover t.p.northover at gmail.com
Mon Jul 29 08:31:41 PDT 2013


Hi Mihail,

> Please review the attached patch. It adds support for "modified immediate"
> syntax form to the relevant ARM instructions. Basically these immediate
> fields are represented via a pair of values: one being a base value and the
> other a modifier.

A good goal, but I think this is the wrong approach, for two reasons:
1. Copy-pasting a dozen instructions usable only for AsmParsing just
to support this syntax is horrific.
2. It doesn't handle (or extend to handling) the disassembly case
neatly. Some of these instructions *should* print without the extra
immediate (e.g. "movs r11, #99, #0").

I think this is a perfect candidate for adding a "ParserMethod" to the
so_imm Operand type (well, SOImmAsmOperand)[1]. Obviously
isSOImmAsmOperand would have to change too (probably to become
trivial). Then when you get around to implementing disassembly, you
just need to add a single PrintMethod and you're done.

Cheers.

Tim.

[1] Well, actually I think your new instructions are better than the
existing ones and should be canonical, with the single-immediate
version handled by an InstAlias. Unfortunately, I don't think TableGen
is anywhere near sophisticated enough to handle that neatly yet)



More information about the llvm-commits mailing list