diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-03-24 00:17:40 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-03-24 00:17:40 +0000 |
commit | f1c0ae9de5365a578fbdfebe4625fb281b0be592 (patch) | |
tree | 2da6d58ba4016209ff0f030dcaef38a1fa0bc33a /lib | |
parent | 16581bf931c0ccf2f8993397acfa4e1d509a68dc (diff) | |
download | external_llvm-f1c0ae9de5365a578fbdfebe4625fb281b0be592.zip external_llvm-f1c0ae9de5365a578fbdfebe4625fb281b0be592.tar.gz external_llvm-f1c0ae9de5365a578fbdfebe4625fb281b0be592.tar.bz2 |
Do not emit comments unless -asm-verbose.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 243 | ||||
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 26 | ||||
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 47 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 24 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp | 7 |
5 files changed, 221 insertions, 126 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 79d14f7..e620595 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1010,30 +1010,42 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, if (CFP->getType() == Type::DoubleTy) { double Val = CFP->getValueAPF().convertToDouble(); // for comment only uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue(); - if (TAI->getData64bitsDirective(AddrSpace)) - O << TAI->getData64bitsDirective(AddrSpace) << i << '\t' - << TAI->getCommentString() << " double value: " << Val << '\n'; - else if (TD->isBigEndian()) { - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32) - << '\t' << TAI->getCommentString() - << " double most significant word " << Val << '\n'; - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i) - << '\t' << TAI->getCommentString() - << " double least significant word " << Val << '\n'; + if (TAI->getData64bitsDirective(AddrSpace)) { + O << TAI->getData64bitsDirective(AddrSpace) << i; + if (VerboseAsm) + O << '\t' << TAI->getCommentString() << " double value: " << Val; + O << '\n'; + } else if (TD->isBigEndian()) { + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " double most significant word " << Val; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " double least significant word " << Val; + O << '\n'; } else { - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i) - << '\t' << TAI->getCommentString() - << " double least significant word " << Val << '\n'; - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32) - << '\t' << TAI->getCommentString() - << " double most significant word " << Val << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " double least significant word " << Val; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " double most significant word " << Val; + O << '\n'; } return; } else if (CFP->getType() == Type::FloatTy) { float Val = CFP->getValueAPF().convertToFloat(); // for comment only O << TAI->getData32bitsDirective(AddrSpace) - << CFP->getValueAPF().bitcastToAPInt().getZExtValue() - << '\t' << TAI->getCommentString() << " float " << Val << '\n'; + << CFP->getValueAPF().bitcastToAPInt().getZExtValue(); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() << " float " << Val; + O << '\n'; return; } else if (CFP->getType() == Type::X86_FP80Ty) { // all long double variants are printed as hex @@ -1046,39 +1058,56 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven, &ignored); if (TD->isBigEndian()) { - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) - << '\t' << TAI->getCommentString() - << " long double most significant halfword of ~" - << DoubleVal.convertToDouble() << '\n'; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]) - << '\t' << TAI->getCommentString() - << " long double least significant halfword\n"; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]); + if (VerboseAsm) + O << '\t' << 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"; + O << '\n'; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32); + if (VerboseAsm) + O << '\t' << 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"; + O << '\n'; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double least significant halfword"; + O << '\n'; } else { - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]) - << '\t' << TAI->getCommentString() - << " long double least significant halfword of ~" - << DoubleVal.convertToDouble() << '\n'; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48) - << '\t' << TAI->getCommentString() - << " long double next halfword\n"; - O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) - << '\t' << TAI->getCommentString() - << " long double most significant halfword\n"; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]); + if (VerboseAsm) + O << '\t' << 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() + << " 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"; + O << '\n'; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double next halfword"; + O << '\n'; + O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double most significant halfword"; + O << '\n'; } EmitZeros(TD->getTypePaddedSize(Type::X86_FP80Ty) - TD->getTypeStoreSize(Type::X86_FP80Ty), AddrSpace); @@ -1089,31 +1118,47 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP, APInt api = CFP->getValueAPF().bitcastToAPInt(); const uint64_t *p = api.getRawData(); if (TD->isBigEndian()) { - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32) - << '\t' << TAI->getCommentString() - << " long double most significant word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]) - << '\t' << TAI->getCommentString() - << " long double next word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32) - << '\t' << TAI->getCommentString() - << " long double next word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]) - << '\t' << TAI->getCommentString() - << " long double least significant word\n"; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double most significant word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double next word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double next word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double least significant word"; + O << '\n'; } else { - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]) - << '\t' << TAI->getCommentString() - << " long double least significant word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32) - << '\t' << TAI->getCommentString() - << " long double next word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]) - << '\t' << TAI->getCommentString() - << " long double next word\n"; - O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32) - << '\t' << TAI->getCommentString() - << " long double most significant word\n"; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double least significant word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double next word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double next word"; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " long double most significant word"; + O << '\n'; } return; } else assert(0 && "Floating point constant type not handled"); @@ -1140,19 +1185,27 @@ void AsmPrinter::EmitGlobalConstantLargeInt(const ConstantInt *CI, if (TAI->getData64bitsDirective(AddrSpace)) O << TAI->getData64bitsDirective(AddrSpace) << Val << '\n'; else if (TD->isBigEndian()) { - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32) - << '\t' << TAI->getCommentString() - << " Double-word most significant word " << Val << '\n'; - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val) - << '\t' << TAI->getCommentString() - << " Double-word least significant word " << Val << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " Double-word most significant word " << Val; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " Double-word least significant word " << Val; + O << '\n'; } else { - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val) - << '\t' << TAI->getCommentString() - << " Double-word least significant word " << Val << '\n'; - O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32) - << '\t' << TAI->getCommentString() - << " Double-word most significant word " << Val << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " Double-word least significant word " << Val; + O << '\n'; + O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32); + if (VerboseAsm) + O << '\t' << TAI->getCommentString() + << " Double-word most significant word " << Val; + O << '\n'; } } } @@ -1188,10 +1241,12 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) { printDataDirective(type, AddrSpace); EmitConstantValueOnly(CV); - if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { - SmallString<40> S; - CI->getValue().toStringUnsigned(S, 16); - O << "\t\t\t" << TAI->getCommentString() << " 0x" << S.c_str(); + if (VerboseAsm) { + if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { + SmallString<40> S; + CI->getValue().toStringUnsigned(S, 16); + O << "\t\t\t" << TAI->getCommentString() << " 0x" << S.c_str(); + } } O << '\n'; } @@ -1211,7 +1266,8 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) const { if (!strcmp(Code, "private")) { O << TAI->getPrivateGlobalPrefix(); } else if (!strcmp(Code, "comment")) { - O << TAI->getCommentString(); + if (VerboseAsm) + O << TAI->getCommentString(); } else if (!strcmp(Code, "uid")) { // Assign a unique ID to this machine instruction. static const MachineInstr *LastMI = 0; @@ -1441,8 +1497,9 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { /// printImplicitDef - This method prints the specified machine instruction /// that is an implicit def. void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { - O << '\t' << TAI->getCommentString() << " implicit-def: " - << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n'; + if (VerboseAsm) + O << '\t' << TAI->getCommentString() << " implicit-def: " + << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n'; } /// printLabel - This method prints a local label used by debug and diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 816940b..5da7e9e 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -255,7 +255,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { I != E; ++I) { // Print a label for the basic block. if (I != MF.begin()) { - printBasicBlockLabel(I, true, true); + printBasicBlockLabel(I, true, true, VerboseAsm); O << '\n'; } for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); @@ -356,7 +356,9 @@ static void printSOImm(raw_ostream &O, int64_t V, const TargetAsmInfo *TAI) { if (Rot) { O << "#" << Imm << ", " << Rot; // Pretty printed version. - O << ' ' << TAI->getCommentString() << ' ' << (int)ARM_AM::rotr32(Imm, Rot); + if (VerboseAsm) + O << ' ' << TAI->getCommentString() + << ' ' << (int)ARM_AM::rotr32(Imm, Rot); } else { O << "#" << Imm; } @@ -870,8 +872,11 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << ' '; - PrintUnmangledNameSafely(GVar, O); + O << name << ":"; + if (VerboseAsm) { + O << "\t\t\t\t" << TAI->getCommentString() << ' '; + PrintUnmangledNameSafely(GVar, O); + } O << '\n'; EmitGlobalConstant(C); return; @@ -892,8 +897,10 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (TAI->getCOMMDirectiveTakesAlignment()) O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } - O << "\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(GVar, O); + if (VerboseAsm) { + O << "\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + } O << "\n"; return; } @@ -928,8 +935,11 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(GVar, O); + O << name << ":"; + if (VerboseAsm) { + O << "\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + } O << "\n"; if (TAI->hasDotTypeDotSizeDirective()) O << "\t.size " << name << ", " << Size << "\n"; diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 3de290f..91a832e 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -704,9 +704,12 @@ void PPCLinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } else { O << ".comm " << name << ',' << Size; } - O << "\t\t" << TAI->getCommentString() << " '"; - PrintUnmangledNameSafely(GVar, O); - O << "'\n"; + if (VerboseAsm) { + O << "\t\t" << TAI->getCommentString() << " '"; + PrintUnmangledNameSafely(GVar, O); + O << "'"; + } + O << '\n'; return; } @@ -737,9 +740,13 @@ void PPCLinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"; - PrintUnmangledNameSafely(GVar, O); - O << "'\n"; + O << name << ":"; + if (VerboseAsm) { + O << "\t\t\t\t" << TAI->getCommentString() << " '"; + PrintUnmangledNameSafely(GVar, O); + O << "'"; + } + O << '\n'; // If the initializer is a extern weak symbol, remember to emit the weak // reference! @@ -819,7 +826,7 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { I != E; ++I) { // Print a label for the basic block. if (I != MF.begin()) { - printBasicBlockLabel(I, true, true); + printBasicBlockLabel(I, true, true, VerboseAsm); O << '\n'; } for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end(); @@ -938,8 +945,11 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; - PrintUnmangledNameSafely(GVar, O); + O << name << ":"; + if (VerboseAsm) { + O << "\t\t\t\t" << TAI->getCommentString() << " "; + PrintUnmangledNameSafely(GVar, O); + } O << '\n'; EmitGlobalConstant(C); return; @@ -949,9 +959,12 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (Subtarget.isDarwin9()) O << ',' << Align; } - O << "\t\t" << TAI->getCommentString() << " '"; - PrintUnmangledNameSafely(GVar, O); - O << "'\n"; + if (VerboseAsm) { + O << "\t\t" << TAI->getCommentString() << " '"; + PrintUnmangledNameSafely(GVar, O); + O << "'"; + } + O << '\n'; return; } @@ -980,9 +993,13 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " '"; - PrintUnmangledNameSafely(GVar, O); - O << "'\n"; + O << name << ":"; + if (VerboseAsm) { + O << "\t\t\t\t" << TAI->getCommentString() << " '"; + PrintUnmangledNameSafely(GVar, O); + O << "'"; + } + O << '\n'; // If the initializer is a extern weak symbol, remember to emit the weak // reference! diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 5da6d7a..2a6d776 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -239,7 +239,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { I != E; ++I) { // Print a label for the basic block. if (!I->pred_empty()) { - printBasicBlockLabel(I, true, true); + printBasicBlockLabel(I, true, true, VerboseAsm); O << '\n'; } for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end(); @@ -315,7 +315,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, O << MO.getImm(); return; case MachineOperand::MO_MachineBasicBlock: - printBasicBlockLabel(MO.getMBB()); + printBasicBlockLabel(MO.getMBB(), false, false, VerboseAsm); return; case MachineOperand::MO_JumpTableIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); @@ -829,8 +829,11 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << ' '; - PrintUnmangledNameSafely(GVar, O); + O << name << ":"; + if (VerboseAsm) { + O << name << "\t\t\t\t" << TAI->getCommentString() << ' '; + PrintUnmangledNameSafely(GVar, O); + } O << '\n'; EmitGlobalConstant(C); return; @@ -848,8 +851,10 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { if (TAI->getCOMMDirectiveTakesAlignment()) O << ',' << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } - O << "\t\t" << TAI->getCommentString() << ' '; - PrintUnmangledNameSafely(GVar, O); + if (VerboseAsm) { + O << "\t\t" << TAI->getCommentString() << ' '; + PrintUnmangledNameSafely(GVar, O); + } O << '\n'; return; } @@ -887,8 +892,11 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { } EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << ' '; - PrintUnmangledNameSafely(GVar, O); + O << name << ":"; + if (VerboseAsm){ + O << name << "\t\t\t\t" << TAI->getCommentString() << ' '; + PrintUnmangledNameSafely(GVar, O); + } O << '\n'; if (TAI->hasDotTypeDotSizeDirective()) O << "\t.size\t" << name << ", " << Size << '\n'; diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp index 098b1fb..2863d6c 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp @@ -489,8 +489,11 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { if (!bCustomSegment) EmitAlignment(Align, I); - O << name << ":\t\t\t\t" << TAI->getCommentString() - << " " << I->getName() << '\n'; + O << name << ":"; + if (VerboseAsm) + O << name << "\t\t\t\t" << TAI->getCommentString() + << " " << I->getName(); + O << '\n'; EmitGlobalConstant(C); |