[flang][cuda] Adding atomicadd as a cudadevice intrinsic and converting it LLVM diale...
[llvm-project.git] / llvm / lib / Target / SystemZ / MCTargetDesc / SystemZHLASMInstPrinter.cpp
blobef9881932f7c0854b6394ab0b5177491686e97d4
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 //===----------------------------------------------------------------------===//
9 #include "SystemZHLASMInstPrinter.h"
10 #include "llvm/MC/MCInst.h"
11 #include "llvm/MC/MCRegister.h"
12 #include "llvm/Support/raw_ostream.h"
14 using namespace llvm;
16 #define DEBUG_TYPE "asm-printer"
18 #include "SystemZGenHLASMAsmWriter.inc"
20 void 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);
29 void SystemZHLASMInstPrinter::printInst(const MCInst *MI, uint64_t Address,
30 StringRef Annot,
31 const MCSubtargetInfo &STI,
32 raw_ostream &O) {
33 std::string Str;
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());
41 else
42 O << Str;
44 printAnnotation(O, Annot);