Path: blob/main/contrib/llvm-project/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h
35294 views
//===-- SystemZMCTargetDesc.h - SystemZ target descriptions -----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H9#define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCTARGETDESC_H1011#include "llvm/Support/DataTypes.h"1213#include <memory>1415namespace llvm {1617class MCAsmBackend;18class MCCodeEmitter;19class MCContext;20class MCInstrInfo;21class MCObjectTargetWriter;22class MCRegisterInfo;23class MCSubtargetInfo;24class MCTargetOptions;25class Target;2627namespace SystemZMC {28// How many bytes are in the ABI-defined, caller-allocated part of29// a stack frame.30const int64_t ELFCallFrameSize = 160;3132// The offset of the DWARF CFA from the incoming stack pointer.33const int64_t ELFCFAOffsetFromInitialSP = ELFCallFrameSize;3435// Maps of asm register numbers to LLVM register numbers, with 0 indicating36// an invalid register. In principle we could use 32-bit and 64-bit register37// classes directly, provided that we relegated the GPR allocation order38// in SystemZRegisterInfo.td to an AltOrder and left the default order39// as %r0-%r15. It seems better to provide the same interface for40// all classes though.41extern const unsigned GR32Regs[16];42extern const unsigned GRH32Regs[16];43extern const unsigned GR64Regs[16];44extern const unsigned GR128Regs[16];45extern const unsigned FP32Regs[16];46extern const unsigned FP64Regs[16];47extern const unsigned FP128Regs[16];48extern const unsigned VR32Regs[32];49extern const unsigned VR64Regs[32];50extern const unsigned VR128Regs[32];51extern const unsigned AR32Regs[16];52extern const unsigned CR64Regs[16];5354// Return the 0-based number of the first architectural register that55// contains the given LLVM register. E.g. R1D -> 1.56unsigned getFirstReg(unsigned Reg);5758// Return the given register as a GR64.59inline unsigned getRegAsGR64(unsigned Reg) {60return GR64Regs[getFirstReg(Reg)];61}6263// Return the given register as a low GR32.64inline unsigned getRegAsGR32(unsigned Reg) {65return GR32Regs[getFirstReg(Reg)];66}6768// Return the given register as a high GR32.69inline unsigned getRegAsGRH32(unsigned Reg) {70return GRH32Regs[getFirstReg(Reg)];71}7273// Return the given register as a VR128.74inline unsigned getRegAsVR128(unsigned Reg) {75return VR128Regs[getFirstReg(Reg)];76}77} // end namespace SystemZMC7879MCCodeEmitter *createSystemZMCCodeEmitter(const MCInstrInfo &MCII,80MCContext &Ctx);8182MCAsmBackend *createSystemZMCAsmBackend(const Target &T,83const MCSubtargetInfo &STI,84const MCRegisterInfo &MRI,85const MCTargetOptions &Options);8687std::unique_ptr<MCObjectTargetWriter>88createSystemZELFObjectWriter(uint8_t OSABI);89std::unique_ptr<MCObjectTargetWriter> createSystemZGOFFObjectWriter();90} // end namespace llvm9192// Defines symbolic names for SystemZ registers.93// This defines a mapping from register name to register number.94#define GET_REGINFO_ENUM95#include "SystemZGenRegisterInfo.inc"9697// Defines symbolic names for the SystemZ instructions.98#define GET_INSTRINFO_ENUM99#define GET_INSTRINFO_MC_HELPER_DECLS100#include "SystemZGenInstrInfo.inc"101102#define GET_SUBTARGETINFO_ENUM103#include "SystemZGenSubtargetInfo.inc"104105#endif106107108