diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-07-01 23:18:29 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-07-01 23:18:29 +0000 |
commit | 6547e406cf934346db7a206b61bcf09635afff0d (patch) | |
tree | 425e8b9b5d3952e58719f8341d8226569f69a734 /lib/CodeGen/AsmPrinter.cpp | |
parent | 4474c792c6ef21862dd166fd0de59d70c4c8d489 (diff) |
Avoid creating expensive comment string if it's not going to be printed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 1320663397..35c3671980 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -21,7 +21,6 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" @@ -29,14 +28,12 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/SmallPtrSet.h" #include <cerrno> using namespace llvm; -static cl::opt<bool> -AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives.")); - char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T) @@ -553,7 +550,7 @@ void AsmPrinter::EOL() const { } void AsmPrinter::EOL(const std::string &Comment) const { - if (AsmVerbose && !Comment.empty()) { + if (VerboseAsm && !Comment.empty()) { O << '\t' << TAI->getCommentString() << ' ' @@ -563,7 +560,7 @@ void AsmPrinter::EOL(const std::string &Comment) const { } void AsmPrinter::EOL(const char* Comment) const { - if (AsmVerbose && *Comment) { + if (VerboseAsm && *Comment) { O << '\t' << TAI->getCommentString() << ' ' |