LLVM  14.0.0git
SystemZAsmPrinter.h
Go to the documentation of this file.
1 //===-- SystemZAsmPrinter.h - SystemZ 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 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZASMPRINTER_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZASMPRINTER_H
11 
12 #include "SystemZMCInstLower.h"
13 #include "SystemZTargetMachine.h"
15 #include "llvm/CodeGen/StackMaps.h"
16 #include "llvm/MC/MCInstBuilder.h"
17 #include "llvm/Support/Compiler.h"
18 
19 namespace llvm {
20 class MCStreamer;
21 class MachineBasicBlock;
22 class MachineInstr;
23 class Module;
24 class raw_ostream;
25 
27 private:
28  StackMaps SM;
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;
55  EXRLT2SymMap EXRLTargets2Sym;
56 
57 public:
58  SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
59  : AsmPrinter(TM, std::move(Streamer)), SM(*this) {}
60 
61  // Override AsmPrinter.
62  StringRef getPassName() const override { return "SystemZ Assembly Printer"; }
63  void emitInstruction(const MachineInstr *MI) override;
64  void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override;
65  void emitEndOfAsmFile(Module &M) override;
66  bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
67  const char *ExtraCode, raw_ostream &OS) override;
68  bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
69  const char *ExtraCode, raw_ostream &OS) override;
70 
71  bool doInitialization(Module &M) override {
72  SM.reset();
74  }
75 
76 private:
77  void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
78  void LowerSTACKMAP(const MachineInstr &MI);
79  void LowerPATCHPOINT(const MachineInstr &MI, SystemZMCInstLower &Lower);
80  void emitEXRLTargetInstructions();
81 };
82 } // end namespace llvm
83 
84 #endif
AsmPrinter.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
MCInstBuilder.h
llvm::MachineConstantPoolValue
Abstract base class for all machine specific constantpool value subclasses.
Definition: MachineConstantPool.h:35
llvm::StackMaps::reset
void reset()
Definition: StackMaps.h:294
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::SystemZAsmPrinter::doInitialization
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
Definition: SystemZAsmPrinter.h:71
llvm::StackMaps
Definition: StackMaps.h:251
llvm::SystemZMCInstLower
Definition: SystemZMCInstLower.h:24
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
SystemZTargetMachine.h
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::SystemZAsmPrinter::SystemZAsmPrinter
SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
Definition: SystemZAsmPrinter.h:58
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:79
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1605
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
Compiler.h
LLVM_LIBRARY_VISIBILITY
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Definition: Compiler.h:131
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::SystemZAsmPrinter::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: SystemZAsmPrinter.h:62
std
Definition: BitVector.h:838
StackMaps.h
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
SystemZMCInstLower.h
llvm::SystemZAsmPrinter
Definition: SystemZAsmPrinter.h:26
llvm::AsmPrinter::doInitialization
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
Definition: AsmPrinter.cpp:267