[llvm-dev] Parse Instruction

Sky Flyer via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 28 01:53:13 PDT 2015


Hi all,

in most of the architectures, assembly operands are comma-separated.
I would like to parse an assembly code that is space-separated and I am
having a bit of problem.
In *ParseInstruction* function, I don't know what is the easiest way to
figure out how many operands a mnemonic expected to have.
In comma-separated assembly code, it just consuming commas (while
(getLexer().is(AsmToken::Comma))) and adds operands, but it's not the case
for space...

I have a dirty hack, that I manually provide such information (number of
operands) in a function called for example getMnemonicAcceptInfo and with a
for loop I parse the operand!!

What would you suggest for parsing space-separated assembly codes when it
comes to figuring out if a mnemonic has two operands or one?

Cheers,
ES
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150928/bd2d9bf9/attachment.html>


More information about the llvm-dev mailing list