1//===-- SparcTargetStreamer.cpp - Sparc Target Streamer Methods -----------===//
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//
9// This file provides Sparc specific target streamer methods.
10//
11//===----------------------------------------------------------------------===//
12
13#include "SparcTargetStreamer.h"
14#include "SparcInstPrinter.h"
15#include "llvm/MC/MCRegister.h"
16#include "llvm/Support/FormattedStream.h"
17
18using namespace llvm;
19
20// pin vtable to this file
21SparcTargetStreamer::SparcTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
22
23void SparcTargetStreamer::anchor() {}
24
25SparcTargetAsmStreamer::SparcTargetAsmStreamer(MCStreamer &S,
26 formatted_raw_ostream &OS)
27 : SparcTargetStreamer(S), OS(OS) {}
28
29void SparcTargetAsmStreamer::emitSparcRegisterIgnore(unsigned reg) {
30 OS << "\t.register "
31 << "%" << StringRef(SparcInstPrinter::getRegisterName(Reg: reg)).lower()
32 << ", #ignore\n";
33}
34
35void SparcTargetAsmStreamer::emitSparcRegisterScratch(unsigned reg) {
36 OS << "\t.register "
37 << "%" << StringRef(SparcInstPrinter::getRegisterName(Reg: reg)).lower()
38 << ", #scratch\n";
39}
40
41SparcTargetELFStreamer::SparcTargetELFStreamer(MCStreamer &S)
42 : SparcTargetStreamer(S) {}
43
44MCELFStreamer &SparcTargetELFStreamer::getStreamer() {
45 return static_cast<MCELFStreamer &>(Streamer);
46}
47