LLVM  15.0.0git
LoongArchAsmPrinter.cpp
Go to the documentation of this file.
1 //===- LoongArchAsmPrinter.cpp - LoongArch LLVM Assembly Printer -*- 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 // This file contains a printer that converts from our internal representation
10 // of machine-dependent LLVM code to GAS-format LoongArch assembly language.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "LoongArchAsmPrinter.h"
15 #include "LoongArch.h"
16 #include "LoongArchTargetMachine.h"
19 #include "llvm/MC/TargetRegistry.h"
20 
21 using namespace llvm;
22 
23 #define DEBUG_TYPE "loongarch-asm-printer"
24 
25 // Simple pseudo-instructions have their lowering (with expansion to real
26 // instructions) auto-generated.
27 #include "LoongArchGenMCPseudoLowering.inc"
28 
30  // Do any auto-generated pseudo lowerings.
32  return;
33 
34  MCInst TmpInst;
35  if (!lowerLoongArchMachineInstrToMCInst(MI, TmpInst, *this))
36  EmitToStreamer(*OutStreamer, TmpInst);
37 }
38 
41  return true;
42 }
43 
44 // Force static initialization.
48 }
AsmPrinter.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:104
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::LoongArchAsmPrinter::emitInstruction
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
Definition: LoongArchAsmPrinter.cpp:29
llvm::getTheLoongArch32Target
Target & getTheLoongArch32Target()
Definition: LoongArchTargetInfo.cpp:13
LoongArchAsmPrinter.h
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::AsmPrinter::EmitToStreamer
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
Definition: AsmPrinter.cpp:401
llvm::LoongArchAsmPrinter::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: LoongArchAsmPrinter.cpp:39
llvm::AsmPrinter::OutStreamer
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition: AsmPrinter.h:97
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
LLVMInitializeLoongArchAsmPrinter
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLoongArchAsmPrinter()
Definition: LoongArchAsmPrinter.cpp:45
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:126
llvm::lowerLoongArchMachineInstrToMCInst
bool lowerLoongArchMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, AsmPrinter &AP)
Definition: LoongArchMCInstLower.cpp:56
llvm::AsmPrinter::MF
MachineFunction * MF
The current machine function.
Definition: AsmPrinter.h:100
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::AsmPrinter::runOnMachineFunction
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
Definition: AsmPrinter.h:377
LoongArch.h
llvm::LoongArchAsmPrinter::emitPseudoExpansionLowering
bool emitPseudoExpansionLowering(MCStreamer &OutStreamer, const MachineInstr *MI)
LoongArchTargetInfo.h
LoongArchTargetMachine.h
llvm::RegisterAsmPrinter
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...
Definition: TargetRegistry.h:1381
TargetRegistry.h
llvm::getTheLoongArch64Target
Target & getTheLoongArch64Target()
Definition: LoongArchTargetInfo.cpp:18