[PATCH] D20337: [MC] Support symbolic expressions in assembly directives
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 11:51:27 PDT 2016
jyknight added a subscriber: jyknight.
jyknight added a comment.
In http://reviews.llvm.org/D20337#433834, @phosek wrote:
> That would currently trigger an error `error: expected absolute expression` since `MCAsmStreamer` doesn't currently have any layout information. Is this something you would like to support as well?
Yes, I think supporting this is necessary, since "clang -S foo.c" requires exactly that (on platforms that use the integrated assembler).
I think to make that work, everything in AsmParser that currently uses parseAbsoluteExpression/evaluateAsAbsolute will need to be switched to parsing an arbitrary expression, and passing it on to MCStreamer as-is without evaluating. MCObjectStreamer can then assert that you've only given it an absolute expression, and evaluate it. MCAsmStreamer would just emit the expression as-is for the final assembler to deal with.
For many directives, that wouldn't be too bad. ".zero", for example. You can just add an MCStreamer::EmitFill taking two expressions, instead of two integers, and change AsmParser to call that version.
For others, that actually do something with the value other than error-check it and pass it through, it'll be somewhat more complex.
Repository:
rL LLVM
http://reviews.llvm.org/D20337
More information about the llvm-commits
mailing list