From a44bf3d6c2cbadd0b194238fcf3f17f46db590b1 Mon Sep 17 00:00:00 2001 From: Tony Tao Date: Tue, 22 Oct 2024 15:13:04 -0400 Subject: [PATCH 1/2] Add GNU and HLASM differences to asmwriter and update tests --- .../MCTargetDesc/SystemZHLASMInstPrinter.cpp | 8 +- .../lib/Target/SystemZ/SystemZInstrFormats.td | 3 +- llvm/test/CodeGen/SystemZ/call-zos-01.ll | 88 ++-- llvm/test/CodeGen/SystemZ/call-zos-02.ll | 4 +- llvm/test/CodeGen/SystemZ/call-zos-i128.ll | 26 +- llvm/test/CodeGen/SystemZ/call-zos-vararg.ll | 376 +++++++++--------- llvm/test/CodeGen/SystemZ/call-zos-vec.ll | 28 +- llvm/test/CodeGen/SystemZ/mixed-ptr-sizes.ll | 156 ++++---- .../CodeGen/SystemZ/zos-ada-relocations.ll | 48 +-- llvm/test/CodeGen/SystemZ/zos-ada.ll | 26 +- llvm/test/CodeGen/SystemZ/zos-frameaddr.ll | 26 +- llvm/test/CodeGen/SystemZ/zos-landingpad.ll | 4 +- .../CodeGen/SystemZ/zos-prologue-epilog.ll | 184 ++++----- llvm/test/CodeGen/SystemZ/zos-ret-addr.ll | 20 +- llvm/test/CodeGen/SystemZ/zos-stackpointer.ll | 2 +- 15 files changed, 503 insertions(+), 496 deletions(-) diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp index ed7ff83a3c6df..e3eb1e608cf33 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp @@ -30,6 +30,12 @@ void SystemZHLASMInstPrinter::printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) { - printInstruction(MI, Address, O); + std::string Str; + raw_string_ostream RSO(Str); + printInstruction(MI, Address, RSO); + // Eat the first tab character and replace it with a space since it is + // hardcoded in AsmWriterEmitter::EmitPrintInstruction + // TODO: introduce a line prefix member to AsmWriter to avoid this problem + O << " " << Str.substr(1, Str.length()); printAnnotation(O, Annot); } diff --git a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td index 50f636a8d9686..6e136b10aed42 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td @@ -18,7 +18,8 @@ class InstSystemZ