[PATCH] D113924: [asm] Make EmitMSInlineAsmStr and EmitGCCInlineAsmStr more alike
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 10:58:49 PST 2021
thakis created this revision.
thakis added a reviewer: hans.
Herald added a subscriber: hiraditya.
thakis requested review of this revision.
Herald added a project: LLVM.
https://reviews.llvm.org/D71677 copied a bunch of code from
EmitGCCInlineAsmStr() to EmitMSInlineAsmStr() but made a few small
(likely unintentional) changes. This makes these pieces look the same.
No behavior change.
(Why are these functions two copies? No great reason as far as I can tell.
https://reviews.llvm.org/rG1778831a3d1d24ab6545635f63da4d9c5f8f0ac7 did the
split; we might want to undo them at some point. But PR23933 suggests
that a bigger change is planned for this file in the future, so keeping
this incremental for now.)
https://reviews.llvm.org/D113924
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -176,7 +176,7 @@
// If we have ${:foo}, then this is not a real operand reference, it is a
// "magic" string reference, just like in .td files. Arrange to call
// PrintSpecial.
- if (HasCurlyBraces && LastEmitted[0] == ':') {
+ if (HasCurlyBraces && *LastEmitted == ':') {
++LastEmitted;
const char *StrStart = LastEmitted;
const char *StrEnd = strchr(StrStart, '}');
@@ -369,6 +369,10 @@
Twine(AsmStr) + "'");
LastEmitted = IDEnd;
+ if (Val >= NumOperands-1)
+ report_fatal_error("Invalid $ operand number in inline asm string: '" +
+ Twine(AsmStr) + "'");
+
char Modifier[2] = { 0, 0 };
if (HasCurlyBraces) {
@@ -390,10 +394,6 @@
++LastEmitted; // Consume '}' character.
}
- if (Val >= NumOperands-1)
- report_fatal_error("Invalid $ operand number in inline asm string: '" +
- Twine(AsmStr) + "'");
-
// Okay, we finally have a value number. Ask the target to print this
// operand!
if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113924.387330.patch
Type: text/x-patch
Size: 1417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/cd8a2d0a/attachment.bin>
More information about the llvm-commits
mailing list