[InstCombine] Signed saturation patterns
[llvm-core.git] / lib / Target / ARC / ARCAsmPrinter.cpp
blob5c3e2c9e773cca8ebffb707927d03a37231626c1
1 //===- ARCAsmPrinter.cpp - ARC LLVM assembly writer -------------*- 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 GNU format ARC assembly language.
12 //===----------------------------------------------------------------------===//
14 #include "ARC.h"
15 #include "ARCMCInstLower.h"
16 #include "ARCSubtarget.h"
17 #include "ARCTargetMachine.h"
18 #include "MCTargetDesc/ARCInstPrinter.h"
19 #include "TargetInfo/ARCTargetInfo.h"
20 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/CodeGen/MachineInstr.h"
22 #include "llvm/MC/MCAsmInfo.h"
23 #include "llvm/MC/MCInst.h"
24 #include "llvm/MC/MCStreamer.h"
25 #include "llvm/Support/TargetRegistry.h"
26 #include "llvm/Support/raw_ostream.h"
28 using namespace llvm;
30 #define DEBUG_TYPE "asm-printer"
32 namespace {
34 class ARCAsmPrinter : public AsmPrinter {
35 ARCMCInstLower MCInstLowering;
37 public:
38 explicit ARCAsmPrinter(TargetMachine &TM,
39 std::unique_ptr<MCStreamer> Streamer)
40 : AsmPrinter(TM, std::move(Streamer)),
41 MCInstLowering(&OutContext, *this) {}
43 StringRef getPassName() const override { return "ARC Assembly Printer"; }
44 void EmitInstruction(const MachineInstr *MI) override;
47 } // end anonymous namespace
49 void ARCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
50 SmallString<128> Str;
51 raw_svector_ostream O(Str);
53 switch (MI->getOpcode()) {
54 case ARC::DBG_VALUE:
55 llvm_unreachable("Should be handled target independently");
56 break;
59 MCInst TmpInst;
60 MCInstLowering.Lower(MI, TmpInst);
61 EmitToStreamer(*OutStreamer, TmpInst);
64 // Force static initialization.
65 extern "C" void LLVMInitializeARCAsmPrinter() {
66 RegisterAsmPrinter<ARCAsmPrinter> X(getTheARCTarget());