LLVM 22.0.0git
SystemZTargetStreamer.h
Go to the documentation of this file.
1//=- SystemZTargetStreamer.h - SystemZ 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_SYSTEMZ_SYSTEMZTARGETSTREAMER_H
10#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H
11
12#include "llvm/ADT/StringRef.h"
13#include "llvm/MC/MCContext.h"
14#include "llvm/MC/MCExpr.h"
15#include "llvm/MC/MCInst.h"
16#include "llvm/MC/MCStreamer.h"
17#include "llvm/MC/MCSymbol.h"
19#include <map>
20#include <utility>
21
22namespace llvm {
23class MCGOFFStreamer;
25
27public:
29
30 typedef std::pair<MCInst, const MCSubtargetInfo *> MCInstSTIPair;
31 struct CmpMCInst {
32 bool operator()(const MCInstSTIPair &MCI_STI_A,
33 const MCInstSTIPair &MCI_STI_B) const {
34 if (MCI_STI_A.second != MCI_STI_B.second)
35 return uintptr_t(MCI_STI_A.second) < uintptr_t(MCI_STI_B.second);
36 const MCInst &A = MCI_STI_A.first;
37 const MCInst &B = MCI_STI_B.first;
38 assert(A.getNumOperands() == B.getNumOperands() &&
39 A.getNumOperands() == 5 && A.getOperand(2).getImm() == 1 &&
40 B.getOperand(2).getImm() == 1 && "Unexpected EXRL target MCInst");
41 if (A.getOpcode() != B.getOpcode())
42 return A.getOpcode() < B.getOpcode();
43 if (A.getOperand(0).getReg() != B.getOperand(0).getReg())
44 return A.getOperand(0).getReg() < B.getOperand(0).getReg();
45 if (A.getOperand(1).getImm() != B.getOperand(1).getImm())
46 return A.getOperand(1).getImm() < B.getOperand(1).getImm();
47 if (A.getOperand(3).getReg() != B.getOperand(3).getReg())
48 return A.getOperand(3).getReg() < B.getOperand(3).getReg();
49 if (A.getOperand(4).getImm() != B.getOperand(4).getImm())
50 return A.getOperand(4).getImm() < B.getOperand(4).getImm();
51 return false;
52 }
53 };
54 typedef std::map<MCInstSTIPair, MCSymbol *, CmpMCInst> EXRLT2SymMap;
56
57 void emitConstantPools() override;
58
59 virtual void emitMachine(StringRef CPUOrCommand) {};
60
61 virtual const MCExpr *createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi,
62 const MCSymbol *Lo) {
63 return nullptr;
64 }
65};
66
73
84
90
93
94public:
97 void emitMachine(StringRef CPUOrCommand) override {
98 OS << "\t.machine " << CPUOrCommand << "\n";
99 }
100};
101
102} // end namespace llvm
103
104#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Streaming machine code generation interface.
Definition MCStreamer.h:220
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
MCTargetStreamer(MCStreamer &S)
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
void emitMachine(StringRef CPUOrCommand) override
void emitMachine(StringRef CPUOrCommand) override
SystemZTargetGNUStreamer(MCStreamer &S, formatted_raw_ostream &OS)
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
SystemZTargetHLASMStreamer(MCStreamer &S, formatted_raw_ostream &OS)
SystemZHLASMAsmStreamer & getHLASMStreamer()
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
virtual void emitMachine(StringRef CPUOrCommand)
virtual const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo)
std::pair< MCInst, const MCSubtargetInfo * > MCInstSTIPair
std::map< MCInstSTIPair, MCSymbol *, CmpMCInst > EXRLT2SymMap
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This is an optimization pass for GlobalISel generic memory operations.
bool operator()(const MCInstSTIPair &MCI_STI_A, const MCInstSTIPair &MCI_STI_B) const