[llvm-commits] [llvm] r78828 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Dan Gohman
gohman at apple.com
Wed Aug 12 11:32:22 PDT 2009
Author: djg
Date: Wed Aug 12 13:32:22 2009
New Revision: 78828
URL: http://llvm.org/viewvc/llvm-project?rev=78828&view=rev
Log:
Use PadToColumn instead of tabs for aligning comments. Fix one place
that emitted unnecessary whitespace outside of VerboseAsm mode.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=78828&r1=78827&r2=78828&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 12 13:32:22 2009
@@ -336,8 +336,9 @@
Offset = NewOffset + TM.getTargetData()->getTypeAllocSize(Ty);
O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
- << CPI << ":\t\t\t\t\t";
+ << CPI << ':';
if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
O << TAI->getCommentString() << ' ';
WriteTypeSymbolic(O, CPE.getType(), 0);
}
@@ -610,8 +611,8 @@
void AsmPrinter::EOL(const std::string &Comment) const {
if (VerboseAsm && !Comment.empty()) {
- O << '\t'
- << TAI->getCommentString()
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< ' '
<< Comment;
}
@@ -620,8 +621,8 @@
void AsmPrinter::EOL(const char* Comment) const {
if (VerboseAsm && *Comment) {
- O << '\t'
- << TAI->getCommentString()
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< ' '
<< Comment;
}
@@ -1021,30 +1022,40 @@
uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
if (TAI->getData64bitsDirective(AddrSpace)) {
O << TAI->getData64bitsDirective(AddrSpace) << i;
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " double value: " << Val;
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " double value: " << Val;
+ }
O << '\n';
} else if (TD->isBigEndian()) {
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " double most significant word " << Val;
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " double least significant word " << Val;
+ }
O << '\n';
} else {
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " double least significant word " << Val;
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " double most significant word " << Val;
+ }
O << '\n';
}
return;
@@ -1052,8 +1063,10 @@
float Val = CFP->getValueAPF().convertToFloat(); // for comment only
O << TAI->getData32bitsDirective(AddrSpace)
<< CFP->getValueAPF().bitcastToAPInt().getZExtValue();
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " float " << Val;
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " float " << Val;
+ }
O << '\n';
return;
} else if (CFP->getType() == Type::X86_FP80Ty) {
@@ -1068,54 +1081,74 @@
&ignored);
if (TD->isBigEndian()) {
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double most significant halfword of ~"
<< DoubleVal.convertToDouble();
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " long double next halfword";
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " long double next halfword";
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " long double next halfword";
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double least significant halfword";
+ }
O << '\n';
} else {
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double least significant halfword of ~"
<< DoubleVal.convertToDouble();
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next halfword";
+ }
O << '\n';
O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double most significant halfword";
+ }
O << '\n';
}
EmitZeros(TD->getTypeAllocSize(Type::X86_FP80Ty) -
@@ -1128,45 +1161,61 @@
const uint64_t *p = api.getRawData();
if (TD->isBigEndian()) {
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double most significant word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double least significant word";
+ }
O << '\n';
} else {
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double least significant word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double next word";
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " long double most significant word";
+ }
O << '\n';
}
return;
@@ -1195,25 +1244,33 @@
O << TAI->getData64bitsDirective(AddrSpace) << Val << '\n';
else if (TD->isBigEndian()) {
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " Double-word most significant word " << Val;
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " Double-word least significant word " << Val;
+ }
O << '\n';
} else {
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " Double-word least significant word " << Val;
+ }
O << '\n';
O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32);
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString()
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString()
<< " Double-word most significant word " << Val;
+ }
O << '\n';
}
}
@@ -1518,9 +1575,11 @@
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
void AsmPrinter::printImplicitDef(const MachineInstr *MI) const {
- if (VerboseAsm)
- O << '\t' << TAI->getCommentString() << " implicit-def: "
+ if (VerboseAsm) {
+ O.PadToColumn(TAI->getCommentColumn(), 1);
+ O << TAI->getCommentString() << " implicit-def: "
<< TRI->getAsmName(MI->getOperand(0).getReg()) << '\n';
+ }
}
/// printLabel - This method prints a local label used by debug and
More information about the llvm-commits
mailing list