LLVM 23.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
13#include "llvm/ADT/StringRef.h"
14#include "llvm/MC/MCContext.h"
15#include "llvm/MC/MCExpr.h"
16#include "llvm/MC/MCInst.h"
18#include "llvm/MC/MCStreamer.h"
19#include "llvm/MC/MCSymbol.h"
22#include <map>
23#include <utility>
24
25namespace llvm {
26class MCGOFFStreamer;
28
30public:
32
33 typedef std::pair<MCInst, const MCSubtargetInfo *> MCInstSTIPair;
34 struct CmpMCInst {
35 bool operator()(const MCInstSTIPair &MCI_STI_A,
36 const MCInstSTIPair &MCI_STI_B) const {
37 if (MCI_STI_A.second != MCI_STI_B.second)
38 return uintptr_t(MCI_STI_A.second) < uintptr_t(MCI_STI_B.second);
39 const MCInst &A = MCI_STI_A.first;
40 const MCInst &B = MCI_STI_B.first;
41 assert(A.getNumOperands() == B.getNumOperands() &&
42 A.getNumOperands() == 5 && A.getOperand(2).getImm() == 1 &&
43 B.getOperand(2).getImm() == 1 && "Unexpected EXRL target MCInst");
44 if (A.getOpcode() != B.getOpcode())
45 return A.getOpcode() < B.getOpcode();
46 if (A.getOperand(0).getReg() != B.getOperand(0).getReg())
47 return A.getOperand(0).getReg() < B.getOperand(0).getReg();
48 if (A.getOperand(1).getImm() != B.getOperand(1).getImm())
49 return A.getOperand(1).getImm() < B.getOperand(1).getImm();
50 if (A.getOperand(3).getReg() != B.getOperand(3).getReg())
51 return A.getOperand(3).getReg() < B.getOperand(3).getReg();
52 if (A.getOperand(4).getImm() != B.getOperand(4).getImm())
53 return A.getOperand(4).getImm() < B.getOperand(4).getImm();
54 return false;
55 }
56 };
57 typedef std::map<MCInstSTIPair, MCSymbol *, CmpMCInst> EXRLT2SymMap;
59
60 void emitConstantPools() override;
61
62 virtual void emitMachine(StringRef CPUOrCommand) {};
63};
64
66public:
67 /// Information about a single function needed to emit a PPA1 block.
68 struct PPA1Info {
70 MCSymbol *Fn = nullptr; // Symbol marking function begin.
71 MCSymbol *FnEnd = nullptr; // Symbol marking function end.
72 MCSymbol *PPA1 = nullptr; // Symbol marking PPA1 begin.
73 MCSymbol *EPMarker = nullptr; // Symbol marking entry point.
74 MCSymbol *EndOfProlog = nullptr; // Symbol marking the end of the prolog.
75 MCSymbol *StackUpdate = nullptr; // Symbol marking the stack updating instr.
76 int64_t OffsetFPR = 0;
77 int64_t OffsetVR = 0;
79 uint64_t PersonalityADADisp = 0; // ADA displacement for personality func.
80 uint64_t GCCEHADADisp = 0; // ADA displacement for GCCEH symbol.
81 unsigned SizeOfFnParams = 0;
89 bool IsVarArg = false;
90 bool HasStackProtector = false;
91 };
92
94
95 MCSymbol *PPA2Sym = nullptr;
96
98
99 void emitConstantPools() override;
100
102 static_cast<MCSymbolGOFF *>(Sym)->setExternalName(Name);
103 }
105 static_cast<MCSectionGOFF *>(Sec)->setExternalName(Name);
106 }
107 void emitADA(MCSymbol *Sym, MCSection *Section) {
108 static_cast<MCSymbolGOFF *>(Sym)->setADA(
109 static_cast<MCSectionGOFF *>(Section));
110 }
111
112 void emitPPA1(PPA1Info &Info);
113 virtual const MCExpr *createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi,
114 const MCSymbol *Lo) = 0;
115};
116
123
134
140
143
144public:
147 void emitMachine(StringRef CPUOrCommand) override {
148 OS << "\t.machine " << CPUOrCommand << "\n";
149 }
150};
151
152} // end namespace llvm
153
154#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")
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
This file contains the MCSymbolGOFF class.
This file defines the SmallVector class.
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
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:573
Streaming machine code generation interface.
Definition MCStreamer.h:222
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
MCTargetStreamer(MCStreamer &S)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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)
std::pair< MCInst, const MCSubtargetInfo * > MCInstSTIPair
std::map< MCInstSTIPair, MCSymbol *, CmpMCInst > EXRLT2SymMap
virtual const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo)=0
SmallVector< PPA1Info, 0 > DeferredPPA1
void emitExternalName(MCSymbol *Sym, StringRef Name)
void emitADA(MCSymbol *Sym, MCSection *Section)
void emitExternalName(MCSection *Sec, StringRef Name)
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
Information about a single function needed to emit a PPA1 block.