llvm/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp

//===-- MipsTargetStreamer.cpp - Mips Target Streamer Methods -------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file provides Mips specific target streamer methods.
//
//===----------------------------------------------------------------------===//

#include "MipsTargetStreamer.h"
#include "MCTargetDesc/MipsABIInfo.h"
#include "MipsELFStreamer.h"
#include "MipsInstPrinter.h"
#include "MipsMCExpr.h"
#include "MipsMCTargetDesc.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"

usingnamespacellvm;

namespace {
static cl::opt<bool> RoundSectionSizes(
    "mips-round-section-sizes", cl::init(false),
    cl::desc("Round section sizes up to the section alignment"), cl::Hidden);
} // end anonymous namespace

static bool isMicroMips(const MCSubtargetInfo *STI) {}

static bool isMips32r6(const MCSubtargetInfo *STI) {}

MipsTargetStreamer::MipsTargetStreamer(MCStreamer &S)
    :{}
void MipsTargetStreamer::emitDirectiveSetMicroMips() {}
void MipsTargetStreamer::emitDirectiveSetNoMicroMips() {}
void MipsTargetStreamer::setUsesMicroMips() {}
void MipsTargetStreamer::emitDirectiveSetMips16() {}
void MipsTargetStreamer::emitDirectiveSetNoMips16() {}
void MipsTargetStreamer::emitDirectiveSetReorder() {}
void MipsTargetStreamer::emitDirectiveSetNoReorder() {}
void MipsTargetStreamer::emitDirectiveSetMacro() {}
void MipsTargetStreamer::emitDirectiveSetNoMacro() {}
void MipsTargetStreamer::emitDirectiveSetMsa() {}
void MipsTargetStreamer::emitDirectiveSetNoMsa() {}
void MipsTargetStreamer::emitDirectiveSetMt() {}
void MipsTargetStreamer::emitDirectiveSetNoMt() {}
void MipsTargetStreamer::emitDirectiveSetCRC() {}
void MipsTargetStreamer::emitDirectiveSetNoCRC() {}
void MipsTargetStreamer::emitDirectiveSetVirt() {}
void MipsTargetStreamer::emitDirectiveSetNoVirt() {}
void MipsTargetStreamer::emitDirectiveSetGINV() {}
void MipsTargetStreamer::emitDirectiveSetNoGINV() {}
void MipsTargetStreamer::emitDirectiveSetAt() {}
void MipsTargetStreamer::emitDirectiveSetAtWithArg(unsigned RegNo) {}
void MipsTargetStreamer::emitDirectiveSetNoAt() {}
void MipsTargetStreamer::emitDirectiveEnd(StringRef Name) {}
void MipsTargetStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {}
void MipsTargetStreamer::emitDirectiveAbiCalls() {}
void MipsTargetStreamer::emitDirectiveNaN2008() {}
void MipsTargetStreamer::emitDirectiveNaNLegacy() {}
void MipsTargetStreamer::emitDirectiveOptionPic0() {}
void MipsTargetStreamer::emitDirectiveOptionPic2() {}
void MipsTargetStreamer::emitDirectiveInsn() {}
void MipsTargetStreamer::emitFrame(unsigned StackReg, unsigned StackSize,
                                   unsigned ReturnReg) {}
void MipsTargetStreamer::emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) {}
void MipsTargetStreamer::emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) {}
void MipsTargetStreamer::emitDirectiveSetArch(StringRef Arch) {}
void MipsTargetStreamer::emitDirectiveSetMips0() {}
void MipsTargetStreamer::emitDirectiveSetMips1() {}
void MipsTargetStreamer::emitDirectiveSetMips2() {}
void MipsTargetStreamer::emitDirectiveSetMips3() {}
void MipsTargetStreamer::emitDirectiveSetMips4() {}
void MipsTargetStreamer::emitDirectiveSetMips5() {}
void MipsTargetStreamer::emitDirectiveSetMips32() {}
void MipsTargetStreamer::emitDirectiveSetMips32R2() {}
void MipsTargetStreamer::emitDirectiveSetMips32R3() {}
void MipsTargetStreamer::emitDirectiveSetMips32R5() {}
void MipsTargetStreamer::emitDirectiveSetMips32R6() {}
void MipsTargetStreamer::emitDirectiveSetMips64() {}
void MipsTargetStreamer::emitDirectiveSetMips64R2() {}
void MipsTargetStreamer::emitDirectiveSetMips64R3() {}
void MipsTargetStreamer::emitDirectiveSetMips64R5() {}
void MipsTargetStreamer::emitDirectiveSetMips64R6() {}
void MipsTargetStreamer::emitDirectiveSetPop() {}
void MipsTargetStreamer::emitDirectiveSetPush() {}
void MipsTargetStreamer::emitDirectiveSetSoftFloat() {}
void MipsTargetStreamer::emitDirectiveSetHardFloat() {}
void MipsTargetStreamer::emitDirectiveSetDsp() {}
void MipsTargetStreamer::emitDirectiveSetDspr2() {}
void MipsTargetStreamer::emitDirectiveSetNoDsp() {}
void MipsTargetStreamer::emitDirectiveSetMips3D() {}
void MipsTargetStreamer::emitDirectiveSetNoMips3D() {}
void MipsTargetStreamer::emitDirectiveCpAdd(unsigned RegNo) {}
void MipsTargetStreamer::emitDirectiveCpLoad(unsigned RegNo) {}
void MipsTargetStreamer::emitDirectiveCpLocal(unsigned RegNo) {}
bool MipsTargetStreamer::emitDirectiveCpRestore(
    int Offset, function_ref<unsigned()> GetATReg, SMLoc IDLoc,
    const MCSubtargetInfo *STI) {}
void MipsTargetStreamer::emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
                                              const MCSymbol &Sym, bool IsReg) {}
void MipsTargetStreamer::emitDirectiveCpreturn(unsigned SaveLocation,
                                               bool SaveLocationIsRegister) {}

void MipsTargetStreamer::emitDirectiveModuleFP() {}

void MipsTargetStreamer::emitDirectiveModuleOddSPReg() {}
void MipsTargetStreamer::emitDirectiveModuleSoftFloat() {}
void MipsTargetStreamer::emitDirectiveModuleHardFloat() {}
void MipsTargetStreamer::emitDirectiveModuleMT() {}
void MipsTargetStreamer::emitDirectiveModuleCRC() {}
void MipsTargetStreamer::emitDirectiveModuleNoCRC() {}
void MipsTargetStreamer::emitDirectiveModuleVirt() {}
void MipsTargetStreamer::emitDirectiveModuleNoVirt() {}
void MipsTargetStreamer::emitDirectiveModuleGINV() {}
void MipsTargetStreamer::emitDirectiveModuleNoGINV() {}
void MipsTargetStreamer::emitDirectiveSetFp(
    MipsABIFlagsSection::FpABIKind Value) {}
void MipsTargetStreamer::emitDirectiveSetOddSPReg() {}
void MipsTargetStreamer::emitDirectiveSetNoOddSPReg() {}

void MipsTargetStreamer::emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc,
                               const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1,
                                SMLoc IDLoc, const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm,
                                SMLoc IDLoc, const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1,
                                SMLoc IDLoc, const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2,
                                SMLoc IDLoc, const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1,
                                 MCOperand Op2, SMLoc IDLoc,
                                 const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1,
                                 unsigned Reg2, SMLoc IDLoc,
                                 const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1,
                                  unsigned Reg2, MCOperand Op3, SMLoc IDLoc,
                                  const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1,
                                 int16_t Imm, SMLoc IDLoc,
                                 const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitRRIII(unsigned Opcode, unsigned Reg0,
                                   unsigned Reg1, int16_t Imm0, int16_t Imm1,
                                   int16_t Imm2, SMLoc IDLoc,
                                   const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitAddu(unsigned DstReg, unsigned SrcReg,
                                  unsigned TrgReg, bool Is64Bit,
                                  const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitDSLL(unsigned DstReg, unsigned SrcReg,
                                  int16_t ShiftAmount, SMLoc IDLoc,
                                  const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc,
                                            const MCSubtargetInfo *STI) {}

void MipsTargetStreamer::emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI) {}

/// Emit the $gp restore operation for .cprestore.
void MipsTargetStreamer::emitGPRestore(int Offset, SMLoc IDLoc,
                                       const MCSubtargetInfo *STI) {}

/// Emit a store instruction with an immediate offset.
void MipsTargetStreamer::emitStoreWithImmOffset(
    unsigned Opcode, unsigned SrcReg, unsigned BaseReg, int64_t Offset,
    function_ref<unsigned()> GetATReg, SMLoc IDLoc,
    const MCSubtargetInfo *STI) {}

/// Emit a load instruction with an immediate offset. DstReg and TmpReg are
/// permitted to be the same register iff DstReg is distinct from BaseReg and
/// DstReg is a GPR. It is the callers responsibility to identify such cases
/// and pass the appropriate register in TmpReg.
void MipsTargetStreamer::emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg,
                                               unsigned BaseReg, int64_t Offset,
                                               unsigned TmpReg, SMLoc IDLoc,
                                               const MCSubtargetInfo *STI) {}

MipsTargetAsmStreamer::MipsTargetAsmStreamer(MCStreamer &S,
                                             formatted_raw_ostream &OS)
    :{}

void MipsTargetAsmStreamer::emitDirectiveSetMicroMips() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMicroMips() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips16() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMips16() {}

void MipsTargetAsmStreamer::emitDirectiveSetReorder() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoReorder() {}

void MipsTargetAsmStreamer::emitDirectiveSetMacro() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMacro() {}

void MipsTargetAsmStreamer::emitDirectiveSetMsa() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMsa() {}

void MipsTargetAsmStreamer::emitDirectiveSetMt() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMt() {}

void MipsTargetAsmStreamer::emitDirectiveSetCRC() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoCRC() {}

void MipsTargetAsmStreamer::emitDirectiveSetVirt() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoVirt() {}

void MipsTargetAsmStreamer::emitDirectiveSetGINV() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoGINV() {}

void MipsTargetAsmStreamer::emitDirectiveSetAt() {}

void MipsTargetAsmStreamer::emitDirectiveSetAtWithArg(unsigned RegNo) {}

void MipsTargetAsmStreamer::emitDirectiveSetNoAt() {}

void MipsTargetAsmStreamer::emitDirectiveEnd(StringRef Name) {}

void MipsTargetAsmStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {}

void MipsTargetAsmStreamer::emitDirectiveAbiCalls() {}

void MipsTargetAsmStreamer::emitDirectiveNaN2008() {}

void MipsTargetAsmStreamer::emitDirectiveNaNLegacy() {}

void MipsTargetAsmStreamer::emitDirectiveOptionPic0() {}

void MipsTargetAsmStreamer::emitDirectiveOptionPic2() {}

void MipsTargetAsmStreamer::emitDirectiveInsn() {}

void MipsTargetAsmStreamer::emitFrame(unsigned StackReg, unsigned StackSize,
                                      unsigned ReturnReg) {}

void MipsTargetAsmStreamer::emitDirectiveSetArch(StringRef Arch) {}

void MipsTargetAsmStreamer::emitDirectiveSetMips0() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips1() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips2() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips3() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips4() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips5() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips32() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips32R2() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips32R3() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips32R5() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips32R6() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips64() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips64R2() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips64R3() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips64R5() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips64R6() {}

void MipsTargetAsmStreamer::emitDirectiveSetDsp() {}

void MipsTargetAsmStreamer::emitDirectiveSetDspr2() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoDsp() {}

void MipsTargetAsmStreamer::emitDirectiveSetMips3D() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoMips3D() {}

void MipsTargetAsmStreamer::emitDirectiveSetPop() {}

void MipsTargetAsmStreamer::emitDirectiveSetPush() {}

void MipsTargetAsmStreamer::emitDirectiveSetSoftFloat() {}

void MipsTargetAsmStreamer::emitDirectiveSetHardFloat() {}

// Print a 32 bit hex number with all numbers.
static void printHex32(unsigned Value, raw_ostream &OS) {}

void MipsTargetAsmStreamer::emitMask(unsigned CPUBitmask,
                                     int CPUTopSavedRegOff) {}

void MipsTargetAsmStreamer::emitFMask(unsigned FPUBitmask,
                                      int FPUTopSavedRegOff) {}

void MipsTargetAsmStreamer::emitDirectiveCpAdd(unsigned RegNo) {}

void MipsTargetAsmStreamer::emitDirectiveCpLoad(unsigned RegNo) {}

void MipsTargetAsmStreamer::emitDirectiveCpLocal(unsigned RegNo) {}

bool MipsTargetAsmStreamer::emitDirectiveCpRestore(
    int Offset, function_ref<unsigned()> GetATReg, SMLoc IDLoc,
    const MCSubtargetInfo *STI) {}

void MipsTargetAsmStreamer::emitDirectiveCpsetup(unsigned RegNo,
                                                 int RegOrOffset,
                                                 const MCSymbol &Sym,
                                                 bool IsReg) {}

void MipsTargetAsmStreamer::emitDirectiveCpreturn(unsigned SaveLocation,
                                                  bool SaveLocationIsRegister) {}

void MipsTargetAsmStreamer::emitDirectiveModuleFP() {}

void MipsTargetAsmStreamer::emitDirectiveSetFp(
    MipsABIFlagsSection::FpABIKind Value) {}

void MipsTargetAsmStreamer::emitDirectiveModuleOddSPReg() {}

void MipsTargetAsmStreamer::emitDirectiveSetOddSPReg() {}

void MipsTargetAsmStreamer::emitDirectiveSetNoOddSPReg() {}

void MipsTargetAsmStreamer::emitDirectiveModuleSoftFloat() {}

void MipsTargetAsmStreamer::emitDirectiveModuleHardFloat() {}

void MipsTargetAsmStreamer::emitDirectiveModuleMT() {}

void MipsTargetAsmStreamer::emitDirectiveModuleCRC() {}

void MipsTargetAsmStreamer::emitDirectiveModuleNoCRC() {}

void MipsTargetAsmStreamer::emitDirectiveModuleVirt() {}

void MipsTargetAsmStreamer::emitDirectiveModuleNoVirt() {}

void MipsTargetAsmStreamer::emitDirectiveModuleGINV() {}

void MipsTargetAsmStreamer::emitDirectiveModuleNoGINV() {}

// This part is for ELF object output.
MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
                                             const MCSubtargetInfo &STI)
    :{}

void MipsTargetELFStreamer::emitLabel(MCSymbol *S) {}

void MipsTargetELFStreamer::finish() {}

void MipsTargetELFStreamer::emitAssignment(MCSymbol *S, const MCExpr *Value) {}

MCELFStreamer &MipsTargetELFStreamer::getStreamer() {}

void MipsTargetELFStreamer::emitDirectiveSetMicroMips() {}

void MipsTargetELFStreamer::emitDirectiveSetNoMicroMips() {}

void MipsTargetELFStreamer::setUsesMicroMips() {}

void MipsTargetELFStreamer::emitDirectiveSetMips16() {}

void MipsTargetELFStreamer::emitDirectiveSetNoReorder() {}

void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {}

void MipsTargetELFStreamer::emitDirectiveEnt(const MCSymbol &Symbol) {}

void MipsTargetELFStreamer::emitDirectiveAbiCalls() {}

void MipsTargetELFStreamer::emitDirectiveNaN2008() {}

void MipsTargetELFStreamer::emitDirectiveNaNLegacy() {}

void MipsTargetELFStreamer::emitDirectiveOptionPic0() {}

void MipsTargetELFStreamer::emitDirectiveOptionPic2() {}

void MipsTargetELFStreamer::emitDirectiveInsn() {}

void MipsTargetELFStreamer::emitFrame(unsigned StackReg, unsigned StackSize,
                                      unsigned ReturnReg_) {}

void MipsTargetELFStreamer::emitMask(unsigned CPUBitmask,
                                     int CPUTopSavedRegOff) {}

void MipsTargetELFStreamer::emitFMask(unsigned FPUBitmask,
                                      int FPUTopSavedRegOff) {}

void MipsTargetELFStreamer::emitDirectiveCpAdd(unsigned RegNo) {}

void MipsTargetELFStreamer::emitDirectiveCpLoad(unsigned RegNo) {}

void MipsTargetELFStreamer::emitDirectiveCpLocal(unsigned RegNo) {}

bool MipsTargetELFStreamer::emitDirectiveCpRestore(
    int Offset, function_ref<unsigned()> GetATReg, SMLoc IDLoc,
    const MCSubtargetInfo *STI) {}

void MipsTargetELFStreamer::emitDirectiveCpsetup(unsigned RegNo,
                                                 int RegOrOffset,
                                                 const MCSymbol &Sym,
                                                 bool IsReg) {}

void MipsTargetELFStreamer::emitDirectiveCpreturn(unsigned SaveLocation,
                                                  bool SaveLocationIsRegister) {}

void MipsTargetELFStreamer::emitMipsAbiFlags() {}