| 1 | //===-- LoongArchTargetStreamer.cpp - LoongArch 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 LoongArch specific target streamer methods. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "LoongArchTargetStreamer.h" |
| 14 | #include "llvm/MC/MCAsmInfo.h" |
| 15 | #include "llvm/MC/MCContext.h" |
| 16 | |
| 17 | using namespace llvm; |
| 18 | |
| 19 | LoongArchTargetStreamer::LoongArchTargetStreamer(MCStreamer &S) |
| 20 | : MCTargetStreamer(S) {} |
| 21 | |
| 22 | void LoongArchTargetStreamer::setTargetABI(LoongArchABI::ABI ABI) { |
| 23 | assert(ABI != LoongArchABI::ABI_Unknown && |
| 24 | "Improperly initialized target ABI"); |
| 25 | TargetABI = ABI; |
| 26 | } |
| 27 | |
| 28 | void LoongArchTargetStreamer::emitDirectiveOptionPush() {} |
| 29 | void LoongArchTargetStreamer::emitDirectiveOptionPop() {} |
| 30 | void LoongArchTargetStreamer::emitDirectiveOptionRelax() {} |
| 31 | void LoongArchTargetStreamer::emitDirectiveOptionNoRelax() {} |
| 32 | void LoongArchTargetStreamer::emitDTPRel32Value(const MCExpr *) {} |
| 33 | void LoongArchTargetStreamer::emitDTPRel64Value(const MCExpr *) {} |
| 34 | |
| 35 | // This part is for ascii assembly output. |
| 36 | LoongArchTargetAsmStreamer::LoongArchTargetAsmStreamer( |
| 37 | MCStreamer &S, formatted_raw_ostream &OS) |
| 38 | : LoongArchTargetStreamer(S), OS(OS) {} |
| 39 | |
| 40 | void LoongArchTargetAsmStreamer::emitDirectiveOptionPush() { |
| 41 | OS << "\t.option\tpush\n"; |
| 42 | } |
| 43 | |
| 44 | void LoongArchTargetAsmStreamer::emitDirectiveOptionPop() { |
| 45 | OS << "\t.option\tpop\n"; |
| 46 | } |
| 47 | |
| 48 | void LoongArchTargetAsmStreamer::emitDirectiveOptionRelax() { |
| 49 | OS << "\t.option\trelax\n"; |
| 50 | } |
| 51 | |
| 52 | void LoongArchTargetAsmStreamer::emitDirectiveOptionNoRelax() { |
| 53 | OS << "\t.option\tnorelax\n"; |
| 54 | } |
| 55 | |
| 56 | void LoongArchTargetAsmStreamer::emitDTPRel32Value(const MCExpr *Value) { |
| 57 | auto &MAI = getStreamer().getContext().getAsmInfo(); |
| 58 | OS << "\t.dtprelword\t"; |
| 59 | MAI.printExpr(OS, *Value); |
| 60 | OS << '\n'; |
| 61 | } |
| 62 | |
| 63 | void LoongArchTargetAsmStreamer::emitDTPRel64Value(const MCExpr *Value) { |
| 64 | auto &MAI = getStreamer().getContext().getAsmInfo(); |
| 65 | OS << "\t.dtpreldword\t"; |
| 66 | MAI.printExpr(OS, *Value); |
| 67 | OS << '\n'; |
| 68 | } |
| 69 |