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/MCStreamer.h" 14 15 namespace llvm { 16 17 class SystemZTargetStreamer : public MCTargetStreamer { 18 public: 19 SystemZTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {} 20 21 typedef std::pair<MCInst, const MCSubtargetInfo *> MCInstSTIPair; 22 struct CmpMCInst { 23 bool operator()(const MCInstSTIPair &MCI_STI_A, 24 const MCInstSTIPair &MCI_STI_B) const { 25 if (MCI_STI_A.second != MCI_STI_B.second) 26 return uintptr_t(MCI_STI_A.second) < uintptr_t(MCI_STI_B.second); 27 const MCInst &A = MCI_STI_A.first; 28 const MCInst &B = MCI_STI_B.first; 29 assert(A.getNumOperands() == B.getNumOperands() && 30 A.getNumOperands() == 5 && A.getOperand(2).getImm() == 1 && 31 B.getOperand(2).getImm() == 1 && "Unexpected EXRL target MCInst"); 32 if (A.getOpcode() != B.getOpcode()) 33 return A.getOpcode() < B.getOpcode(); 34 if (A.getOperand(0).getReg() != B.getOperand(0).getReg()) 35 return A.getOperand(0).getReg() < B.getOperand(0).getReg(); 36 if (A.getOperand(1).getImm() != B.getOperand(1).getImm()) 37 return A.getOperand(1).getImm() < B.getOperand(1).getImm(); 38 if (A.getOperand(3).getReg() != B.getOperand(3).getReg()) 39 return A.getOperand(3).getReg() < B.getOperand(3).getReg(); 40 if (A.getOperand(4).getImm() != B.getOperand(4).getImm()) 41 return A.getOperand(4).getImm() < B.getOperand(4).getImm(); 42 return false; 43 } 44 }; 45 typedef std::map<MCInstSTIPair, MCSymbol *, CmpMCInst> EXRLT2SymMap; 46 EXRLT2SymMap EXRLTargets2Sym; 47 48 void emitConstantPools() override; 49 50 virtual void emitMachine(StringRef CPU) = 0; 51 }; 52 53 } // end namespace llvm 54 55 #endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H 56