LLVM 20.0.0git
SystemZHLASMInstPrinter.cpp
Go to the documentation of this file.
1//=- SystemZHLASMInstPrinter.cpp - Convert SystemZ MCInst to HLASM assembly -=//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
10#include "llvm/MC/MCInst.h"
11#include "llvm/MC/MCRegister.h"
13
14using namespace llvm;
15
16#define DEBUG_TYPE "asm-printer"
17
18#include "SystemZGenHLASMAsmWriter.inc"
19
20void SystemZHLASMInstPrinter::printFormattedRegName(const MCAsmInfo *MAI,
21 MCRegister Reg,
22 raw_ostream &O) {
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);
27}
28
30 StringRef Annot,
31 const MCSubtargetInfo &STI,
32 raw_ostream &O) {
33 std::string Str;
34 raw_string_ostream RSO(Str);
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());
41 else
42 O << Str;
43
44 printAnnotation(O, Annot);
45}
IRTranslator LLVM IR MI
#define RegName(no)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
WithMarkup markup(raw_ostream &OS, Markup M)
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
static const char * getRegisterName(MCRegister Reg)
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:661
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18