Subzero: Fix mid-line comments when using -asm-verbose .
The llvm-mc assembler for x86 uses '#' to start a mid-line comment, while arm32 uses '@'. Those characters cause syntax errors for the other architecture. There doesn't seem to be a common character for starting mid-line comments.
However, the /* ... */ style comment works in both (all?) cases.
(The '#' character at the start of a line, preceded by optional whitespace, starts a comment in both cases.)
BUG= none
TEST= ./pydir/szbuild_spec2k.py --force -v -O2 --filetype=asm --sz=--asm-verbose --target=arm32
TEST= ./pydir/szbuild_spec2k.py --force -v -O2 --filetype=asm --sz=--asm-verbose --target=x8632
R=kschimpf@google.com
Review URL: https://codereview.chromium.org/1521863002 .
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 96a770a..f23ae0f 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -917,10 +917,10 @@
const int32_t FrameOrStackReg = Func->getTarget()->getFrameOrStackReg();
if (IsLiveIn) {
Live = &Liveness->getLiveIn(Node);
- Str << "\t\t\t\t# LiveIn=";
+ Str << "\t\t\t\t/* LiveIn=";
} else {
Live = &Liveness->getLiveOut(Node);
- Str << "\t\t\t\t# LiveOut=";
+ Str << "\t\t\t\t/* LiveOut=";
}
if (!Live->empty()) {
CfgVector<Variable *> LiveRegs;
@@ -951,7 +951,7 @@
Var->emit(Func);
}
}
- Str << "\n";
+ Str << " */\n";
}
/// Returns true if some text was emitted - in which case the caller definitely
@@ -981,11 +981,13 @@
if (Printed)
Str << ",";
else
- Str << " \t@ END=";
+ Str << " \t/* END=";
Var->emit(Func);
Printed = true;
}
}
+ if (Printed)
+ Str << " */";
return Printed;
}
@@ -1029,7 +1031,7 @@
constexpr bool IsLiveIn = true;
emitRegisterUsage(Str, Func, this, IsLiveIn, LiveRegCount);
if (getInEdges().size()) {
- Str << "\t\t\t\t# preds=";
+ Str << "\t\t\t\t/* preds=";
bool First = true;
for (CfgNode *I : getInEdges()) {
if (!First)
@@ -1037,10 +1039,10 @@
First = false;
Str << "$" << I->getName();
}
- Str << "\n";
+ Str << " */\n";
}
if (getLoopNestDepth()) {
- Str << "\t\t\t\t# loop depth=" << getLoopNestDepth() << "\n";
+ Str << "\t\t\t\t/* loop depth=" << getLoopNestDepth() << " */\n";
}
}