Path: blob/main/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp
213845 views
//=- SystemZHLASMInstPrinter.cpp - Convert SystemZ MCInst to HLASM assembly -=//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "SystemZHLASMInstPrinter.h"9#include "llvm/MC/MCInst.h"10#include "llvm/MC/MCRegister.h"11#include "llvm/Support/raw_ostream.h"1213using namespace llvm;1415#define DEBUG_TYPE "asm-printer"1617#include "SystemZGenHLASMAsmWriter.inc"1819void SystemZHLASMInstPrinter::printFormattedRegName(const MCAsmInfo *MAI,20MCRegister Reg,21raw_ostream &O) {22const char *RegName = getRegisterName(Reg);23// Skip register prefix so that only register number is left24assert(isalpha(RegName[0]) && isdigit(RegName[1]));25markup(O, Markup::Register) << (RegName + 1);26}2728void SystemZHLASMInstPrinter::printInst(const MCInst *MI, uint64_t Address,29StringRef Annot,30const MCSubtargetInfo &STI,31raw_ostream &O) {32std::string Str;33raw_string_ostream RSO(Str);34printInstruction(MI, Address, RSO);35// Eat the first tab character and replace it with a space since it is36// hardcoded in AsmWriterEmitter::EmitPrintInstruction37// TODO: introduce a line prefix member to AsmWriter to avoid this problem38if (!Str.empty() && Str.front() == '\t')39O << " " << Str.substr(1, Str.length());40else41O << Str;4243printAnnotation(O, Annot);44}454647