1 //===-- SparcTargetStreamer.cpp - Sparc Target Streamer Methods -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides Sparc specific target streamer methods.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "SparcTargetStreamer.h"
15 #include "InstPrinter/SparcInstPrinter.h"
16 #include "llvm/Support/FormattedStream.h"
17 
18 using namespace llvm;
19 
20 // pin vtable to this file
SparcTargetStreamer(MCStreamer & S)21 SparcTargetStreamer::SparcTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
22 
anchor()23 void SparcTargetStreamer::anchor() {}
24 
SparcTargetAsmStreamer(MCStreamer & S,formatted_raw_ostream & OS)25 SparcTargetAsmStreamer::SparcTargetAsmStreamer(MCStreamer &S,
26                                                formatted_raw_ostream &OS)
27     : SparcTargetStreamer(S), OS(OS) {}
28 
emitSparcRegisterIgnore(unsigned reg)29 void SparcTargetAsmStreamer::emitSparcRegisterIgnore(unsigned reg) {
30   OS << "\t.register "
31      << "%" << StringRef(SparcInstPrinter::getRegisterName(reg)).lower()
32      << ", #ignore\n";
33 }
34 
emitSparcRegisterScratch(unsigned reg)35 void SparcTargetAsmStreamer::emitSparcRegisterScratch(unsigned reg) {
36   OS << "\t.register "
37      << "%" << StringRef(SparcInstPrinter::getRegisterName(reg)).lower()
38      << ", #scratch\n";
39 }
40 
SparcTargetELFStreamer(MCStreamer & S)41 SparcTargetELFStreamer::SparcTargetELFStreamer(MCStreamer &S)
42     : SparcTargetStreamer(S) {}
43 
getStreamer()44 MCELFStreamer &SparcTargetELFStreamer::getStreamer() {
45   return static_cast<MCELFStreamer &>(Streamer);
46 }
47