1 //===-- RISCVTargetStreamer.h - RISCV Target Streamer ----------*- C++ -*--===// 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 #ifndef LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVTARGETSTREAMER_H 10 #define LLVM_LIB_TARGET_RISCV_MCTARGETDESC_RISCVTARGETSTREAMER_H 11 12 #include "llvm/MC/MCStreamer.h" 13 #include "llvm/MC/MCSubtargetInfo.h" 14 15 namespace llvm { 16 17 class formatted_raw_ostream; 18 19 class RISCVTargetStreamer : public MCTargetStreamer { 20 public: 21 RISCVTargetStreamer(MCStreamer &S); 22 void finish() override; 23 24 virtual void emitDirectiveOptionPush(); 25 virtual void emitDirectiveOptionPop(); 26 virtual void emitDirectiveOptionPIC(); 27 virtual void emitDirectiveOptionNoPIC(); 28 virtual void emitDirectiveOptionRVC(); 29 virtual void emitDirectiveOptionNoRVC(); 30 virtual void emitDirectiveOptionRelax(); 31 virtual void emitDirectiveOptionNoRelax(); 32 virtual void emitAttribute(unsigned Attribute, unsigned Value); 33 virtual void finishAttributeSection(); 34 virtual void emitTextAttribute(unsigned Attribute, StringRef String); 35 virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, 36 StringRef StringValue); 37 38 void emitTargetAttributes(const MCSubtargetInfo &STI); 39 }; 40 41 // This part is for ascii assembly output 42 class RISCVTargetAsmStreamer : public RISCVTargetStreamer { 43 formatted_raw_ostream &OS; 44 45 void finishAttributeSection() override; 46 void emitAttribute(unsigned Attribute, unsigned Value) override; 47 void emitTextAttribute(unsigned Attribute, StringRef String) override; 48 void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, 49 StringRef StringValue) override; 50 51 public: 52 RISCVTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS); 53 54 void emitDirectiveOptionPush() override; 55 void emitDirectiveOptionPop() override; 56 void emitDirectiveOptionPIC() override; 57 void emitDirectiveOptionNoPIC() override; 58 void emitDirectiveOptionRVC() override; 59 void emitDirectiveOptionNoRVC() override; 60 void emitDirectiveOptionRelax() override; 61 void emitDirectiveOptionNoRelax() override; 62 }; 63 64 } 65 #endif 66