2007-06-06 09:42:06 +02:00
|
|
|
//=====-- MipsSubtarget.h - Define Subtarget for the Mips -----*- C++ -*--====//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the Mips specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef MIPSSUBTARGET_H
|
|
|
|
#define MIPSSUBTARGET_H
|
|
|
|
|
|
|
|
#include "llvm/Target/TargetSubtarget.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MipsSubtarget : public TargetSubtarget {
|
2007-08-18 03:52:27 +02:00
|
|
|
|
2008-07-14 16:42:54 +02:00
|
|
|
public:
|
|
|
|
enum MipsABIEnum {
|
|
|
|
O32, O64, N32, N64, EABI
|
|
|
|
};
|
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
protected:
|
2007-08-18 03:52:27 +02:00
|
|
|
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
enum MipsArchEnum {
|
2010-11-12 01:38:32 +01:00
|
|
|
Mips1, Mips2, Mips3, Mips4, Mips32, Mips32r2
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Mips architecture version
|
|
|
|
MipsArchEnum MipsArchVersion;
|
|
|
|
|
|
|
|
// Mips supported ABIs
|
|
|
|
MipsABIEnum MipsABI;
|
|
|
|
|
|
|
|
// IsLittle - The target is Little Endian
|
2008-06-04 03:45:25 +02:00
|
|
|
bool IsLittle;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
|
|
|
|
// IsSingleFloat - The target only supports single precision float
|
|
|
|
// point operations. This enable the target to use all 32 32-bit
|
2008-07-09 06:45:36 +02:00
|
|
|
// floating point registers instead of only using even ones.
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
bool IsSingleFloat;
|
|
|
|
|
2008-07-09 06:45:36 +02:00
|
|
|
// IsFP64bit - The target processor has 64-bit floating point registers.
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
bool IsFP64bit;
|
|
|
|
|
|
|
|
// IsFP64bit - General-purpose registers are 64 bits wide
|
|
|
|
bool IsGP64bit;
|
|
|
|
|
2008-07-09 07:32:22 +02:00
|
|
|
// HasVFPU - Processor has a vector floating point unit.
|
|
|
|
bool HasVFPU;
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
|
2008-07-14 16:42:54 +02:00
|
|
|
// isLinux - Target system is Linux. Is false we consider ELFOS for now.
|
|
|
|
bool IsLinux;
|
|
|
|
|
2008-07-30 19:01:06 +02:00
|
|
|
/// Features related to the presence of specific instructions.
|
|
|
|
|
|
|
|
// HasSEInReg - SEB and SEH (signext in register) instructions.
|
|
|
|
bool HasSEInReg;
|
|
|
|
|
|
|
|
// HasCondMov - Conditional mov (MOVZ, MOVN) instructions.
|
|
|
|
bool HasCondMov;
|
|
|
|
|
|
|
|
// HasMulDivAdd - Multiply add and sub (MADD, MADDu, MSUB, MSUBu)
|
|
|
|
// instructions.
|
|
|
|
bool HasMulDivAdd;
|
|
|
|
|
|
|
|
// HasMinMax - MIN and MAX instructions.
|
|
|
|
bool HasMinMax;
|
|
|
|
|
|
|
|
// HasSwap - Byte and half swap instructions.
|
|
|
|
bool HasSwap;
|
|
|
|
|
|
|
|
// HasBitCount - Count leading '1' and '0' bits.
|
|
|
|
bool HasBitCount;
|
|
|
|
|
2007-08-18 03:52:27 +02:00
|
|
|
InstrItineraryData InstrItins;
|
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
public:
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
|
|
|
|
/// Only O32 and EABI supported right now.
|
|
|
|
bool isABI_EABI() const { return MipsABI == EABI; }
|
|
|
|
bool isABI_O32() const { return MipsABI == O32; }
|
2008-07-14 16:42:54 +02:00
|
|
|
unsigned getTargetABI() const { return MipsABI; }
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
/// This constructor initializes the data members to match that
|
2009-08-03 00:11:08 +02:00
|
|
|
/// of the specified triple.
|
2009-08-03 04:22:28 +02:00
|
|
|
MipsSubtarget(const std::string &TT, const std::string &FS, bool little);
|
2007-06-06 09:42:06 +02:00
|
|
|
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2009-05-23 21:50:50 +02:00
|
|
|
std::string ParseSubtargetFeatures(const std::string &FS,
|
|
|
|
const std::string &CPU);
|
2007-06-06 09:42:06 +02:00
|
|
|
|
2009-05-27 19:23:44 +02:00
|
|
|
bool isMips1() const { return MipsArchVersion == Mips1; }
|
2010-11-12 01:38:32 +01:00
|
|
|
bool isMips32() const { return MipsArchVersion >= Mips32; }
|
2010-11-08 22:42:32 +01:00
|
|
|
bool isMips32r2() const { return MipsArchVersion == Mips32r2; }
|
2008-06-04 03:45:25 +02:00
|
|
|
|
|
|
|
bool isLittle() const { return IsLittle; }
|
2009-12-19 08:05:23 +01:00
|
|
|
bool isFP64bit() const { return IsFP64bit; }
|
|
|
|
bool isGP64bit() const { return IsGP64bit; }
|
|
|
|
bool isGP32bit() const { return !IsGP64bit; }
|
|
|
|
bool isSingleFloat() const { return IsSingleFloat; }
|
|
|
|
bool isNotSingleFloat() const { return !IsSingleFloat; }
|
|
|
|
bool hasVFPU() const { return HasVFPU; }
|
|
|
|
bool isLinux() const { return IsLinux; }
|
Several changes to Mips backend, experimental fp support being the most
important.
- Cleanup in the Subtarget info with addition of new features, not all support
yet, but they allow the future inclusion of features easier. Among new features,
we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit
integer
and float registers, allegrex vector FPU (VFPU), single float only support.
- TargetMachine now detects allegrex core.
- Added allegrex (Mips32r2) sext_inreg instructions.
- *Added Float Point Instructions*, handling single float only, and
aliased accesses for 32-bit FPUs.
- Some cleanup in FP instruction formats and FP register classes.
- Calling conventions improved to support mips 32-bit EABI.
- Added Asm Printer support for fp cond codes.
- Added support for sret copy to a return register.
- EABI support added into LowerCALL and FORMAL_ARGS.
- MipsFunctionInfo now keeps a virtual register per function to track the
sret on function entry until function ret.
- MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...),
FP cond codes mapping and initial FP Branch Analysis.
- Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond,
FPCmp
- MipsTargetLowering : handling different FP classes, Allegrex support, sret
return copy, no homing location within EABI, non 32-bit stack objects
arguments, and asm constraint for float.
llvm-svn: 53146
2008-07-05 21:05:21 +02:00
|
|
|
|
2008-07-30 19:01:06 +02:00
|
|
|
/// Features related to the presence of specific instructions.
|
2009-12-19 08:05:23 +01:00
|
|
|
bool hasSEInReg() const { return HasSEInReg; }
|
|
|
|
bool hasCondMov() const { return HasCondMov; }
|
|
|
|
bool hasMulDivAdd() const { return HasMulDivAdd; }
|
|
|
|
bool hasMinMax() const { return HasMinMax; }
|
|
|
|
bool hasSwap() const { return HasSwap; }
|
|
|
|
bool hasBitCount() const { return HasBitCount; }
|
2007-06-06 09:42:06 +02:00
|
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|