summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-14 10:02:58 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-14 10:02:58 +0000
commite76c5fcd70695f3b838b868ba53471f2554e0ee6 (patch)
treebb996f6afec330eee3b622142337dc8fe75d275e /llvm/lib/CodeGen/MachineOperand.cpp
parent753395fa0abe3b612e4b6e36c78b516ddad2b2a7 (diff)
downloadbcm5719-llvm-e76c5fcd70695f3b838b868ba53471f2554e0ee6.tar.gz
bcm5719-llvm-e76c5fcd70695f3b838b868ba53471f2554e0ee6.zip
[CodeGen] Print external symbols as $symbol in both MIR and debug output
Work towards the unification of MIR and debug output by printing `$symbol` instead of `<es:symbol>`. Only debug syntax is affected. llvm-svn: 320681
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index 82e635d9c62..6882e9ff700 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -19,6 +19,7 @@
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetMachine.h"
@@ -533,12 +534,17 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST,
OS << "+" << getOffset();
OS << '>';
break;
- case MachineOperand::MO_ExternalSymbol:
- OS << "<es:" << getSymbolName();
- if (getOffset())
- OS << "+" << getOffset();
- OS << '>';
+ case MachineOperand::MO_ExternalSymbol: {
+ StringRef Name = getSymbolName();
+ OS << '$';
+ if (Name.empty()) {
+ OS << "\"\"";
+ } else {
+ printLLVMNameWithoutPrefix(OS, Name);
+ }
+ printOffset(OS, getOffset());
break;
+ }
case MachineOperand::MO_BlockAddress:
OS << '<';
getBlockAddress()->printAsOperand(OS, /*PrintType=*/false, MST);
OpenPOWER on IntegriCloud