[PATCH] D20337: [MC] Support symbolic expressions in assembly directives

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 11:29:37 PDT 2016


phosek added inline comments.

================
Comment at: lib/MC/MCAsmStreamer.cpp:823
@@ +822,3 @@
+  int64_t IntNumBytes;
+  if (NumBytes->evaluateAsAbsolute(IntNumBytes)) {
+    EmitFill(IntNumBytes, Value);
----------------
rafael wrote:
> You don't need to this in the asm streamer. My suggestion would be to just make this a variant of emitFill. We would have one overload that takes a number and one that takes an expression. The implementations would be:
> 
> * In the asm streamer: the ones taking an MCExpr does the printing. The other one creates an MCExpr and forwards.
> * In the obj streamer: what you have now. Try to evaluate the expr and maybe fail. If it works, forward to the overload that takes a number.
In case of `MCAsmStreamer`, where would we evaluate the `MCExpr` expression then? Does it mean we should always print out the expression even if it's absolute?


Repository:
  rL LLVM

http://reviews.llvm.org/D20337





More information about the llvm-commits mailing list