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