summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-15 16:33:45 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-15 16:33:45 +0000
commit0b5bdceabfeaf67c91e5ccfed0320a82781f555c (patch)
treea69055b06a17fc2cbebac494e14e7852e1cefca0 /llvm/lib
parentb952e639d9dc0cf9c7d46231d080e436fae5f9e4 (diff)
downloadbcm5719-llvm-0b5bdceabfeaf67c91e5ccfed0320a82781f555c.tar.gz
bcm5719-llvm-0b5bdceabfeaf67c91e5ccfed0320a82781f555c.zip
[CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug output
Work towards the unification of MIR and debug output by printing `%stack.0` instead of `<fi#0>`, and `%fixed-stack.0` instead of `<fi#-4>` (supposing there are 4 fixed stack objects). Only debug syntax is affected. Differential Revision: https://reviews.llvm.org/D41027 llvm-svn: 320827
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp9
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp31
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp6
-rw-r--r--llvm/lib/Target/X86/README-SSE.txt10
4 files changed, 39 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 8cc9ad28c2a..7c4e098b564 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -758,13 +758,8 @@ void MIPrinter::printStackObjectReference(int FrameIndex) {
assert(ObjectInfo != StackObjectOperandMapping.end() &&
"Invalid frame index");
const FrameIndexOperand &Operand = ObjectInfo->second;
- if (Operand.IsFixed) {
- OS << "%fixed-stack." << Operand.ID;
- return;
- }
- OS << "%stack." << Operand.ID;
- if (!Operand.Name.empty())
- OS << '.' << Operand.Name;
+ MachineOperand::printStackObjectReference(OS, Operand.ID, Operand.IsFixed,
+ Operand.Name);
}
void MIPrinter::printOffset(int64_t Offset) {
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index c95fb127d7b..d17c481862a 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/CodeGen/MIRPrinter.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
@@ -476,6 +477,19 @@ void MachineOperand::printSymbol(raw_ostream &OS, MCSymbol &Sym) {
OS << "<mcsymbol " << Sym << ">";
}
+void MachineOperand::printStackObjectReference(raw_ostream &OS,
+ unsigned FrameIndex,
+ bool IsFixed, StringRef Name) {
+ if (IsFixed) {
+ OS << "%fixed-stack." << FrameIndex;
+ return;
+ }
+
+ OS << "%stack." << FrameIndex;
+ if (!Name.empty())
+ OS << '.' << Name;
+}
+
void MachineOperand::print(raw_ostream &OS, const TargetRegisterInfo *TRI,
const TargetIntrinsicInfo *IntrinsicInfo) const {
tryToGetTargetInfo(*this, TRI, IntrinsicInfo);
@@ -574,9 +588,22 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST,
case MachineOperand::MO_MachineBasicBlock:
OS << printMBBReference(*getMBB());
break;
- case MachineOperand::MO_FrameIndex:
- OS << "<fi#" << getIndex() << '>';
+ case MachineOperand::MO_FrameIndex: {
+ int FrameIndex = getIndex();
+ bool IsFixed = false;
+ StringRef Name;
+ if (const MachineFunction *MF = getMFIfAvailable(*this)) {
+ const MachineFrameInfo &MFI = MF->getFrameInfo();
+ IsFixed = MFI.isFixedObjectIndex(FrameIndex);
+ if (const AllocaInst *Alloca = MFI.getObjectAllocation(FrameIndex))
+ if (Alloca->hasName())
+ Name = Alloca->getName();
+ if (IsFixed)
+ FrameIndex -= MFI.getObjectIndexBegin();
+ }
+ printStackObjectReference(OS, FrameIndex, IsFixed, Name);
break;
+ }
case MachineOperand::MO_ConstantPoolIndex:
OS << "%const." << getIndex();
printOffset(OS, getOffset());
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 9e12b1a0e70..74aee126d45 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -2835,7 +2835,7 @@ MachineInstr *AArch64InstrInfo::foldMemoryOperandImpl(
// In this case we can still safely fold away the COPY and generate the
// following spill code:
//
- // STRXui %xzr, <fi#0>
+ // STRXui %xzr, %stack.0
//
// This also eliminates spilled cross register class COPYs (e.g. between x and
// d regs) of the same size. For example:
@@ -2891,7 +2891,7 @@ MachineInstr *AArch64InstrInfo::foldMemoryOperandImpl(
// where the physical register source can be widened and stored to the full
// virtual reg destination stack slot, in this case producing:
//
- // STRXui %xzr, <fi#0>
+ // STRXui %xzr, %stack.0
//
if (IsSpill && DstMO.isUndef() &&
TargetRegisterInfo::isPhysicalRegister(SrcReg)) {
@@ -2939,7 +2939,7 @@ MachineInstr *AArch64InstrInfo::foldMemoryOperandImpl(
// where we can load the full virtual reg source stack slot, into the subreg
// destination, in this case producing:
//
- // LDRWui %0:sub_32<def,read-undef>, <fi#0>
+ // LDRWui %0:sub_32<def,read-undef>, %stack.0
//
if (IsFill && SrcMO.getSubReg() == 0 && DstMO.isUndef()) {
const TargetRegisterClass *FillRC;
diff --git a/llvm/lib/Target/X86/README-SSE.txt b/llvm/lib/Target/X86/README-SSE.txt
index ffc404d5e33..73cf2769244 100644
--- a/llvm/lib/Target/X86/README-SSE.txt
+++ b/llvm/lib/Target/X86/README-SSE.txt
@@ -167,16 +167,16 @@ Still ok. After register allocation:
cond_next140 (0xa910740, LLVM BB @0xa90beb0):
%eax = MOV32ri -3
- %edx = MOV32rm <fi#3>, 1, %noreg, 0
+ %edx = MOV32rm %stack.3, 1, %noreg, 0
ADD32rm %eax<def&use>, %edx, 1, %noreg, 0
- %edx = MOV32rm <fi#7>, 1, %noreg, 0
+ %edx = MOV32rm %stack.7, 1, %noreg, 0
%edx = MOV32rm %edx, 1, %noreg, 40
IMUL32rr %eax<def&use>, %edx
- %esi = MOV32rm <fi#5>, 1, %noreg, 0
+ %esi = MOV32rm %stack.5, 1, %noreg, 0
%esi = MOV32rm %esi, 1, %noreg, 0
- MOV32mr <fi#4>, 1, %noreg, 0, %esi
+ MOV32mr %stack.4, 1, %noreg, 0, %esi
%eax = LEA32r %esi, 1, %eax, -3
- %esi = MOV32rm <fi#7>, 1, %noreg, 0
+ %esi = MOV32rm %stack.7, 1, %noreg, 0
%esi = MOV32rm %esi, 1, %noreg, 32
%edi = MOV32rr %eax
SHL32ri %edi<def&use>, 4
OpenPOWER on IntegriCloud