1 //===-- SystemZMCTargetDesc.h - SystemZ target descriptions -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H
11 #define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H
13 #include "llvm/Support/DataTypes.h"
23 class MCSubtargetInfo;
26 class raw_pwrite_stream;
29 extern Target TheSystemZTarget;
32 // How many bytes are in the ABI-defined, caller-allocated part of
34 const int64_t CallFrameSize = 160;
36 // The offset of the DWARF CFA from the incoming stack pointer.
37 const int64_t CFAOffsetFromInitialSP = CallFrameSize;
39 // Maps of asm register numbers to LLVM register numbers, with 0 indicating
40 // an invalid register. In principle we could use 32-bit and 64-bit register
41 // classes directly, provided that we relegated the GPR allocation order
42 // in SystemZRegisterInfo.td to an AltOrder and left the default order
43 // as %r0-%r15. It seems better to provide the same interface for
44 // all classes though.
45 extern const unsigned GR32Regs[16];
46 extern const unsigned GRH32Regs[16];
47 extern const unsigned GR64Regs[16];
48 extern const unsigned GR128Regs[16];
49 extern const unsigned FP32Regs[16];
50 extern const unsigned FP64Regs[16];
51 extern const unsigned FP128Regs[16];
53 // Return the 0-based number of the first architectural register that
54 // contains the given LLVM register. E.g. R1D -> 1.
55 unsigned getFirstReg(unsigned Reg);
57 // Return the given register as a GR64.
58 inline unsigned getRegAsGR64(unsigned Reg) {
59 return GR64Regs[getFirstReg(Reg)];
62 // Return the given register as a low GR32.
63 inline unsigned getRegAsGR32(unsigned Reg) {
64 return GR32Regs[getFirstReg(Reg)];
67 // Return the given register as a high GR32.
68 inline unsigned getRegAsGRH32(unsigned Reg) {
69 return GRH32Regs[getFirstReg(Reg)];
71 } // end namespace SystemZMC
73 MCCodeEmitter *createSystemZMCCodeEmitter(const MCInstrInfo &MCII,
74 const MCRegisterInfo &MRI,
77 MCAsmBackend *createSystemZMCAsmBackend(const Target &T,
78 const MCRegisterInfo &MRI,
79 StringRef TT, StringRef CPU);
81 MCObjectWriter *createSystemZObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI);
82 } // end namespace llvm
84 // Defines symbolic names for SystemZ registers.
85 // This defines a mapping from register name to register number.
86 #define GET_REGINFO_ENUM
87 #include "SystemZGenRegisterInfo.inc"
89 // Defines symbolic names for the SystemZ instructions.
90 #define GET_INSTRINFO_ENUM
91 #include "SystemZGenInstrInfo.inc"
93 #define GET_SUBTARGETINFO_ENUM
94 #include "SystemZGenSubtargetInfo.inc"