1 //=- SystemZHLASMInstPrinter.cpp - Convert SystemZ MCInst to HLASM assembly -=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "SystemZHLASMInstPrinter.h"
10 #include "llvm/MC/MCInst.h"
11 #include "llvm/MC/MCRegister.h"
12 #include "llvm/Support/raw_ostream.h"
16 #define DEBUG_TYPE "asm-printer"
18 #include "SystemZGenHLASMAsmWriter.inc"
20 void SystemZHLASMInstPrinter::printFormattedRegName(const MCAsmInfo
*MAI
,
23 const char *RegName
= getRegisterName(Reg
);
24 // Skip register prefix so that only register number is left
25 assert(isalpha(RegName
[0]) && isdigit(RegName
[1]));
26 markup(O
, Markup::Register
) << (RegName
+ 1);
29 void SystemZHLASMInstPrinter::printInst(const MCInst
*MI
, uint64_t Address
,
31 const MCSubtargetInfo
&STI
,
34 raw_string_ostream
RSO(Str
);
35 printInstruction(MI
, Address
, RSO
);
36 // Eat the first tab character and replace it with a space since it is
37 // hardcoded in AsmWriterEmitter::EmitPrintInstruction
38 // TODO: introduce a line prefix member to AsmWriter to avoid this problem
39 if (!Str
.empty() && Str
.front() == '\t')
40 O
<< " " << Str
.substr(1, Str
.length());
44 printAnnotation(O
, Annot
);