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/Support/FormattedStream.h" 16 17 using namespace llvm; 18 19 // pin vtable to this file SparcTargetStreamer(MCStreamer & S)20SparcTargetStreamer::SparcTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {} 21 anchor()22void SparcTargetStreamer::anchor() {} 23 SparcTargetAsmStreamer(MCStreamer & S,formatted_raw_ostream & OS)24SparcTargetAsmStreamer::SparcTargetAsmStreamer(MCStreamer &S, 25 formatted_raw_ostream &OS) 26 : SparcTargetStreamer(S), OS(OS) {} 27 emitSparcRegisterIgnore(unsigned reg)28void SparcTargetAsmStreamer::emitSparcRegisterIgnore(unsigned reg) { 29 OS << "\t.register " 30 << "%" << StringRef(SparcInstPrinter::getRegisterName(reg)).lower() 31 << ", #ignore\n"; 32 } 33 emitSparcRegisterScratch(unsigned reg)34void SparcTargetAsmStreamer::emitSparcRegisterScratch(unsigned reg) { 35 OS << "\t.register " 36 << "%" << StringRef(SparcInstPrinter::getRegisterName(reg)).lower() 37 << ", #scratch\n"; 38 } 39 SparcTargetELFStreamer(MCStreamer & S)40SparcTargetELFStreamer::SparcTargetELFStreamer(MCStreamer &S) 41 : SparcTargetStreamer(S) {} 42 getStreamer()43MCELFStreamer &SparcTargetELFStreamer::getStreamer() { 44 return static_cast<MCELFStreamer &>(Streamer); 45 } 46