2014-10-25 00:15:27 +08:00
|
|
|
//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-01-26 16:19:53 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSABIINFO_H
|
2014-10-25 00:15:27 +08:00
|
|
|
|
2014-11-03 00:09:29 +08:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2015-01-27 01:33:46 +08:00
|
|
|
#include "llvm/ADT/Triple.h"
|
2014-11-07 23:03:53 +08:00
|
|
|
#include "llvm/IR/CallingConv.h"
|
2015-01-14 19:23:27 +08:00
|
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
2014-11-03 00:09:29 +08:00
|
|
|
|
2014-10-25 00:15:27 +08:00
|
|
|
namespace llvm {
|
2014-11-03 00:09:29 +08:00
|
|
|
|
2015-01-27 01:33:46 +08:00
|
|
|
class MCTargetOptions;
|
|
|
|
class StringRef;
|
2015-04-17 17:50:21 +08:00
|
|
|
class TargetRegisterClass;
|
2015-01-27 01:33:46 +08:00
|
|
|
|
2014-10-25 00:15:27 +08:00
|
|
|
class MipsABIInfo {
|
|
|
|
public:
|
|
|
|
enum class ABI { Unknown, O32, N32, N64, EABI };
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ABI ThisABI;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}
|
|
|
|
|
|
|
|
static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
|
|
|
|
static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
|
|
|
|
static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
|
|
|
|
static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
|
|
|
|
static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }
|
2015-01-27 01:33:46 +08:00
|
|
|
static MipsABIInfo computeTargetABI(Triple TT, StringRef CPU,
|
|
|
|
const MCTargetOptions &Options);
|
2014-10-25 00:15:27 +08:00
|
|
|
|
|
|
|
bool IsKnown() const { return ThisABI != ABI::Unknown; }
|
|
|
|
bool IsO32() const { return ThisABI == ABI::O32; }
|
|
|
|
bool IsN32() const { return ThisABI == ABI::N32; }
|
|
|
|
bool IsN64() const { return ThisABI == ABI::N64; }
|
|
|
|
bool IsEABI() const { return ThisABI == ABI::EABI; }
|
|
|
|
ABI GetEnumValue() const { return ThisABI; }
|
|
|
|
|
2014-11-07 20:21:37 +08:00
|
|
|
/// The registers to use for byval arguments.
|
2014-11-03 00:09:29 +08:00
|
|
|
const ArrayRef<MCPhysReg> GetByValArgRegs() const;
|
|
|
|
|
2014-11-07 20:21:37 +08:00
|
|
|
/// The registers to use for the variable argument list.
|
|
|
|
const ArrayRef<MCPhysReg> GetVarArgRegs() const;
|
|
|
|
|
2014-11-07 23:03:53 +08:00
|
|
|
/// Obtain the size of the area allocated by the callee for arguments.
|
|
|
|
/// CallingConv::FastCall affects the value for O32.
|
|
|
|
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;
|
|
|
|
|
2014-10-25 00:15:27 +08:00
|
|
|
/// Ordering of ABI's
|
|
|
|
/// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
|
|
|
|
/// multiple ABI options.
|
|
|
|
bool operator<(const MipsABIInfo Other) const {
|
|
|
|
return ThisABI < Other.GetEnumValue();
|
|
|
|
}
|
2015-04-17 17:50:21 +08:00
|
|
|
|
|
|
|
unsigned GetStackPtr() const;
|
|
|
|
unsigned GetFramePtr() const;
|
2015-06-02 21:14:46 +08:00
|
|
|
unsigned GetBasePtr() const;
|
2015-04-17 17:50:21 +08:00
|
|
|
unsigned GetNullPtr() const;
|
|
|
|
unsigned GetPtrAdduOp() const;
|
|
|
|
unsigned GetPtrAddiuOp() const;
|
|
|
|
inline bool ArePtrs64bit() const { return IsN64(); }
|
|
|
|
|
|
|
|
unsigned GetEhDataReg(unsigned I) const;
|
2014-10-25 00:15:27 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|