summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp15
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp8
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp2
3 files changed, 18 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e6205957c7f..48085d59a26 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -21,6 +21,7 @@
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/DwarfWriter.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetAsmInfo.h"
@@ -35,13 +36,23 @@
#include <cerrno>
using namespace llvm;
+static cl::opt<cl::boolOrDefault>
+AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
+ cl::init(cl::BOU_UNSET));
+
char AsmPrinter::ID = 0;
AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm,
- const TargetAsmInfo *T, bool F)
+ const TargetAsmInfo *T, bool F, bool VDef)
: MachineFunctionPass(&ID), FunctionNumber(0), Fast(F), O(o),
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
IsInTextSection(false)
-{}
+{
+ switch (AsmVerbose) {
+ case cl::BOU_UNSET: VerboseAsm = VDef; break;
+ case cl::BOU_TRUE: VerboseAsm = true; break;
+ case cl::BOU_FALSE: VerboseAsm = false; break;
+ }
+}
AsmPrinter::~AsmPrinter() {
for (gcp_iterator I = GCMetadataPrinters.begin(),
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 4dbab67da71..ab4fe728bf0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -1072,7 +1072,7 @@ public:
Asm->EOL("Offset");
} else if (Reg < 64) {
Asm->EmitInt8(DW_CFA_offset + Reg);
- if (VerboseAsm)
+ if (Asm->isVerbose())
Asm->EOL("DW_CFA_offset + Reg (" + utostr(Reg) + ")");
else
Asm->EOL();
@@ -2197,7 +2197,7 @@ private:
// Emit the code (index) for the abbreviation.
Asm->EmitULEB128Bytes(AbbrevNumber);
- if (VerboseAsm)
+ if (Asm->isVerbose())
Asm->EOL(std::string("Abbrev [" +
utostr(AbbrevNumber) +
"] 0x" + utohexstr(Die->getOffset()) +
@@ -2487,7 +2487,7 @@ private:
// Isolate current sections line info.
const std::vector<SrcLineInfo> &LineInfos = SectionSourceLines[j];
- if (VerboseAsm) {
+ if (Asm->isVerbose()) {
const Section* S = SectionMap[j + 1];
O << '\t' << TAI->getCommentString() << " Section"
<< S->getName() << '\n';
@@ -2504,7 +2504,7 @@ private:
unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID());
if (!LabelID) continue;
- if (!VerboseAsm)
+ if (!Asm->isVerbose())
Asm->EOL();
else {
std::pair<unsigned, unsigned> SourceID =
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index f29944c7c90..086104912b7 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -76,7 +76,7 @@ LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
default:
break;
case TargetMachine::AssemblyFile:
- if (addAssemblyEmitter(PM, Fast, Out))
+ if (addAssemblyEmitter(PM, Fast, getAsmVerbosityDefault(), Out))
return FileModel::Error;
return FileModel::AsmFile;
case TargetMachine::ObjectFile:
OpenPOWER on IntegriCloud