Path: blob/main/contrib/llvm-project/llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h
35294 views
//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//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_MIPS_MCTARGETDESC_MIPSABIINFO_H9#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H1011#include "llvm/IR/CallingConv.h"12#include "llvm/MC/MCRegisterInfo.h"13#include "llvm/TargetParser/Triple.h"1415namespace llvm {1617template <typename T> class ArrayRef;18class MCTargetOptions;19class StringRef;2021class MipsABIInfo {22public:23enum class ABI { Unknown, O32, N32, N64 };2425protected:26ABI ThisABI;2728public:29MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}3031static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }32static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }33static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }34static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }35static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU,36const MCTargetOptions &Options);3738bool IsKnown() const { return ThisABI != ABI::Unknown; }39bool IsO32() const { return ThisABI == ABI::O32; }40bool IsN32() const { return ThisABI == ABI::N32; }41bool IsN64() const { return ThisABI == ABI::N64; }42ABI GetEnumValue() const { return ThisABI; }4344/// The registers to use for byval arguments.45ArrayRef<MCPhysReg> GetByValArgRegs() const;4647/// The registers to use for the variable argument list.48ArrayRef<MCPhysReg> GetVarArgRegs() const;4950/// Obtain the size of the area allocated by the callee for arguments.51/// CallingConv::FastCall affects the value for O32.52unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;5354/// Ordering of ABI's55/// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given56/// multiple ABI options.57bool operator<(const MipsABIInfo Other) const {58return ThisABI < Other.GetEnumValue();59}6061unsigned GetStackPtr() const;62unsigned GetFramePtr() const;63unsigned GetBasePtr() const;64unsigned GetGlobalPtr() const;65unsigned GetNullPtr() const;66unsigned GetZeroReg() const;67unsigned GetPtrAdduOp() const;68unsigned GetPtrAddiuOp() const;69unsigned GetPtrSubuOp() const;70unsigned GetPtrAndOp() const;71unsigned GetGPRMoveOp() const;72inline bool ArePtrs64bit() const { return IsN64(); }73inline bool AreGprs64bit() const { return IsN32() || IsN64(); }7475unsigned GetEhDataReg(unsigned I) const;76};77}7879#endif808182