LLVM API Documentation
00001 //===-- SystemZMCTargetDesc.h - SystemZ target descriptions -----*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H 00011 #define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H 00012 00013 #include "llvm/Support/DataTypes.h" 00014 00015 namespace llvm { 00016 00017 class MCAsmBackend; 00018 class MCCodeEmitter; 00019 class MCContext; 00020 class MCInstrInfo; 00021 class MCObjectWriter; 00022 class MCRegisterInfo; 00023 class MCSubtargetInfo; 00024 class StringRef; 00025 class Target; 00026 class raw_ostream; 00027 00028 extern Target TheSystemZTarget; 00029 00030 namespace SystemZMC { 00031 // How many bytes are in the ABI-defined, caller-allocated part of 00032 // a stack frame. 00033 const int64_t CallFrameSize = 160; 00034 00035 // The offset of the DWARF CFA from the incoming stack pointer. 00036 const int64_t CFAOffsetFromInitialSP = CallFrameSize; 00037 00038 // Maps of asm register numbers to LLVM register numbers, with 0 indicating 00039 // an invalid register. In principle we could use 32-bit and 64-bit register 00040 // classes directly, provided that we relegated the GPR allocation order 00041 // in SystemZRegisterInfo.td to an AltOrder and left the default order 00042 // as %r0-%r15. It seems better to provide the same interface for 00043 // all classes though. 00044 extern const unsigned GR32Regs[16]; 00045 extern const unsigned GRH32Regs[16]; 00046 extern const unsigned GR64Regs[16]; 00047 extern const unsigned GR128Regs[16]; 00048 extern const unsigned FP32Regs[16]; 00049 extern const unsigned FP64Regs[16]; 00050 extern const unsigned FP128Regs[16]; 00051 00052 // Return the 0-based number of the first architectural register that 00053 // contains the given LLVM register. E.g. R1D -> 1. 00054 unsigned getFirstReg(unsigned Reg); 00055 00056 // Return the given register as a GR64. 00057 inline unsigned getRegAsGR64(unsigned Reg) { 00058 return GR64Regs[getFirstReg(Reg)]; 00059 } 00060 00061 // Return the given register as a low GR32. 00062 inline unsigned getRegAsGR32(unsigned Reg) { 00063 return GR32Regs[getFirstReg(Reg)]; 00064 } 00065 00066 // Return the given register as a high GR32. 00067 inline unsigned getRegAsGRH32(unsigned Reg) { 00068 return GRH32Regs[getFirstReg(Reg)]; 00069 } 00070 } // end namespace SystemZMC 00071 00072 MCCodeEmitter *createSystemZMCCodeEmitter(const MCInstrInfo &MCII, 00073 const MCRegisterInfo &MRI, 00074 const MCSubtargetInfo &STI, 00075 MCContext &Ctx); 00076 00077 MCAsmBackend *createSystemZMCAsmBackend(const Target &T, 00078 const MCRegisterInfo &MRI, 00079 StringRef TT, StringRef CPU); 00080 00081 MCObjectWriter *createSystemZObjectWriter(raw_ostream &OS, uint8_t OSABI); 00082 } // end namespace llvm 00083 00084 // Defines symbolic names for SystemZ registers. 00085 // This defines a mapping from register name to register number. 00086 #define GET_REGINFO_ENUM 00087 #include "SystemZGenRegisterInfo.inc" 00088 00089 // Defines symbolic names for the SystemZ instructions. 00090 #define GET_INSTRINFO_ENUM 00091 #include "SystemZGenInstrInfo.inc" 00092 00093 #define GET_SUBTARGETINFO_ENUM 00094 #include "SystemZGenSubtargetInfo.inc" 00095 00096 #endif