2012-02-28 15:46:26 +08:00
|
|
|
//===-- MipsSubtarget.h - Define Subtarget for the Mips ---------*- C++ -*-===//
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-07-02 05:01:15 +08:00
|
|
|
// This file declares the Mips specific subclass of TargetSubtargetInfo.
|
2007-06-06 15:42:06 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-06-06 15:42:06 +08:00
|
|
|
|
|
|
|
#ifndef MIPSSUBTARGET_H
|
|
|
|
#define MIPSSUBTARGET_H
|
|
|
|
|
2011-06-29 09:14:12 +08:00
|
|
|
#include "llvm/MC/MCInstrItineraries.h"
|
2013-04-10 03:46:01 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2007-06-06 15:42:06 +08:00
|
|
|
#include <string>
|
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "MipsGenSubtargetInfo.inc"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
namespace llvm {
|
2011-07-07 15:07:08 +08:00
|
|
|
class StringRef;
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2013-04-10 03:46:01 +08:00
|
|
|
class MipsTargetMachine;
|
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
class MipsSubtarget : public MipsGenSubtargetInfo {
|
2011-12-20 10:50:00 +08:00
|
|
|
virtual void anchor();
|
2007-08-18 09:52:27 +08:00
|
|
|
|
2008-07-14 22:42:54 +08:00
|
|
|
public:
|
2011-09-15 01:22:51 +08:00
|
|
|
// NOTE: O64 will not be supported.
|
2008-07-14 22:42:54 +08:00
|
|
|
enum MipsABIEnum {
|
2011-09-21 10:45:29 +08:00
|
|
|
UnknownABI, O32, N32, N64, EABI
|
2011-03-05 01:51:39 +08:00
|
|
|
};
|
2008-07-14 22:42:54 +08:00
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
protected:
|
2014-05-09 17:46:21 +08:00
|
|
|
enum MipsArchEnum {
|
|
|
|
Mips1, Mips2, Mips32, Mips32r2, Mips32r6, Mips3, Mips4, Mips5, Mips64,
|
|
|
|
Mips64r2, Mips64r6
|
|
|
|
};
|
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-06 03:05:21 +08:00
|
|
|
|
2011-03-05 01:51:39 +08:00
|
|
|
// Mips architecture version
|
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-06 03:05:21 +08:00
|
|
|
MipsArchEnum MipsArchVersion;
|
|
|
|
|
2011-03-05 01:51:39 +08:00
|
|
|
// Mips supported ABIs
|
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-06 03:05:21 +08:00
|
|
|
MipsABIEnum MipsABI;
|
|
|
|
|
|
|
|
// IsLittle - The target is Little Endian
|
2008-06-04 09:45:25 +08: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-06 03:05:21 +08:00
|
|
|
|
|
|
|
// IsSingleFloat - The target only supports single precision float
|
|
|
|
// point operations. This enable the target to use all 32 32-bit
|
2008-07-09 12:45:36 +08: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-06 03:05:21 +08:00
|
|
|
bool IsSingleFloat;
|
|
|
|
|
2008-07-09 12:45:36 +08: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-06 03:05:21 +08:00
|
|
|
bool IsFP64bit;
|
|
|
|
|
2014-04-16 23:48:55 +08:00
|
|
|
// IsNan2008 - IEEE 754-2008 NaN encoding.
|
|
|
|
bool IsNaN2008bit;
|
|
|
|
|
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-06 03:05:21 +08:00
|
|
|
// IsFP64bit - General-purpose registers are 64 bits wide
|
|
|
|
bool IsGP64bit;
|
|
|
|
|
2008-07-09 13:32:22 +08: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-06 03:05:21 +08:00
|
|
|
|
2014-03-20 19:51:58 +08:00
|
|
|
// CPU supports cnMIPS (Cavium Networks Octeon CPU).
|
|
|
|
bool HasCnMips;
|
|
|
|
|
2008-07-14 22:42:54 +08:00
|
|
|
// isLinux - Target system is Linux. Is false we consider ELFOS for now.
|
|
|
|
bool IsLinux;
|
|
|
|
|
2012-08-22 11:18:13 +08:00
|
|
|
// UseSmallSection - Small section is used.
|
|
|
|
bool UseSmallSection;
|
|
|
|
|
2008-07-31 01:01:06 +08:00
|
|
|
/// Features related to the presence of specific instructions.
|
2011-03-05 01:51:39 +08:00
|
|
|
|
2014-05-09 21:02:27 +08:00
|
|
|
// HasMips3_32 - The subset of MIPS-III instructions added to MIPS32
|
|
|
|
bool HasMips3_32;
|
|
|
|
|
2014-05-13 19:45:36 +08:00
|
|
|
// HasMips3_32r2 - The subset of MIPS-III instructions added to MIPS32r2
|
|
|
|
bool HasMips3_32r2;
|
|
|
|
|
2014-05-12 19:56:16 +08:00
|
|
|
// HasMips4_32 - Has the subset of MIPS-IV present in MIPS32
|
2014-05-09 22:06:17 +08:00
|
|
|
bool HasMips4_32;
|
|
|
|
|
2014-05-12 19:56:16 +08:00
|
|
|
// HasMips4_32r2 - Has the subset of MIPS-IV present in MIPS32r2
|
|
|
|
bool HasMips4_32r2;
|
|
|
|
|
2014-05-12 20:52:44 +08:00
|
|
|
// HasMips5_32r2 - Has the subset of MIPS-V present in MIPS32r2
|
|
|
|
bool HasMips5_32r2;
|
|
|
|
|
2012-05-17 06:19:56 +08:00
|
|
|
// InMips16 -- can process Mips16 instructions
|
|
|
|
bool InMips16Mode;
|
|
|
|
|
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability.
This patch fixes returns from mips16 functions so that if the function
was in fact called by a mips32 hard float routine, then values
that would have been returned in floating point registers are so returned.
Mips16 mode has no floating point instructions so there is no way to
load values into floating point registers.
This is needed when returning float, double, single complex, double complex
in the Mips ABI.
Helper functions in libc for mips16 are available to do this.
For efficiency purposes, these helper functions have a different calling
convention from normal Mips calls.
Registers v0,v1,a0,a1 are used to pass parameters instead of
a0,a1,a2,a3.
This is because v0,v1,a0,a1 are the natural registers used to return
floating point values in soft float. These values can then be moved
to the appropriate floating point registers with no extra cost.
The only register that is modified is ra in this call.
The helper functions make sure that the return values are in the floating
point registers that they would be in if soft float was not in effect
(which it is for mips16, though the soft float is implemented using a mips32
library that uses hard float).
llvm-svn: 181641
2013-05-11 06:25:39 +08:00
|
|
|
// Mips16 hard float
|
|
|
|
bool InMips16HardFloat;
|
|
|
|
|
2013-04-10 03:46:01 +08:00
|
|
|
// PreviousInMips16 -- the function we just processed was in Mips 16 Mode
|
|
|
|
bool PreviousInMips16Mode;
|
|
|
|
|
2013-02-05 17:30:03 +08:00
|
|
|
// InMicroMips -- can process MicroMips instructions
|
|
|
|
bool InMicroMipsMode;
|
|
|
|
|
2012-09-22 07:41:49 +08:00
|
|
|
// HasDSP, HasDSPR2 -- supports DSP ASE.
|
|
|
|
bool HasDSP, HasDSPR2;
|
|
|
|
|
2013-04-10 03:46:01 +08:00
|
|
|
// Allow mixed Mips16 and Mips32 in one source file
|
|
|
|
bool AllowMixed16_32;
|
|
|
|
|
2013-04-11 00:58:04 +08:00
|
|
|
// Optimize for space by compiling all functions as Mips 16 unless
|
|
|
|
// it needs floating point. Functions needing floating point are
|
|
|
|
// compiled as Mips32
|
|
|
|
bool Os16;
|
|
|
|
|
2013-08-14 04:54:07 +08:00
|
|
|
// HasMSA -- supports MSA ASE.
|
|
|
|
bool HasMSA;
|
|
|
|
|
2007-08-18 09:52:27 +08:00
|
|
|
InstrItineraryData InstrItins;
|
|
|
|
|
2013-01-30 10:16:36 +08:00
|
|
|
// Relocation Model
|
|
|
|
Reloc::Model RM;
|
|
|
|
|
2013-04-10 03:46:01 +08:00
|
|
|
// We can override the determination of whether we are in mips16 mode
|
|
|
|
// as from the command line
|
|
|
|
enum {NoOverride, Mips16Override, NoMips16Override} OverrideMode;
|
|
|
|
|
|
|
|
MipsTargetMachine *TM;
|
|
|
|
|
2014-02-06 01:19:30 +08:00
|
|
|
Triple TargetTriple;
|
2007-06-06 15:42:06 +08:00
|
|
|
public:
|
2014-04-29 15:58:02 +08:00
|
|
|
bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
|
|
|
|
AntiDepBreakMode& Mode,
|
|
|
|
RegClassVector& CriticalPathRCs) const override;
|
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-06 03:05:21 +08:00
|
|
|
|
|
|
|
/// Only O32 and EABI supported right now.
|
|
|
|
bool isABI_EABI() const { return MipsABI == EABI; }
|
2011-09-21 04:28:08 +08:00
|
|
|
bool isABI_N64() const { return MipsABI == N64; }
|
|
|
|
bool isABI_N32() const { return MipsABI == N32; }
|
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-06 03:05:21 +08:00
|
|
|
bool isABI_O32() const { return MipsABI == O32; }
|
2008-07-14 22:42:54 +08: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-06 03:05:21 +08:00
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
/// This constructor initializes the data members to match that
|
2009-08-03 06:11:08 +08:00
|
|
|
/// of the specified triple.
|
2011-06-30 09:53:36 +08:00
|
|
|
MipsSubtarget(const std::string &TT, const std::string &CPU,
|
2013-04-10 03:46:01 +08:00
|
|
|
const std::string &FS, bool little, Reloc::Model RM,
|
|
|
|
MipsTargetMachine *TM);
|
2011-03-05 01:51:39 +08:00
|
|
|
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2007-06-06 15:42:06 +08:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2011-07-07 15:07:08 +08:00
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
2007-06-06 15:42:06 +08:00
|
|
|
|
2014-05-08 20:40:48 +08:00
|
|
|
bool hasMips2() const { return MipsArchVersion >= Mips2; }
|
2014-05-09 21:02:27 +08:00
|
|
|
bool hasMips3() const { return MipsArchVersion >= Mips3; }
|
2014-05-09 22:06:17 +08:00
|
|
|
bool hasMips4_32() const { return HasMips4_32; }
|
2014-05-12 19:56:16 +08:00
|
|
|
bool hasMips4_32r2() const { return HasMips4_32r2; }
|
2011-09-21 07:53:09 +08:00
|
|
|
bool hasMips32() const { return MipsArchVersion >= Mips32; }
|
|
|
|
bool hasMips32r2() const { return MipsArchVersion == Mips32r2 ||
|
2011-09-21 04:28:08 +08:00
|
|
|
MipsArchVersion == Mips64r2; }
|
2014-05-09 17:46:21 +08:00
|
|
|
bool hasMips32r6() const { return MipsArchVersion == Mips32r6 ||
|
|
|
|
MipsArchVersion == Mips64r6; }
|
2011-09-21 10:24:25 +08:00
|
|
|
bool hasMips64() const { return MipsArchVersion >= Mips64; }
|
|
|
|
bool hasMips64r2() const { return MipsArchVersion == Mips64r2; }
|
2014-05-09 17:46:21 +08:00
|
|
|
bool hasMips64r6() const { return MipsArchVersion == Mips64r6; }
|
2008-06-04 09:45:25 +08:00
|
|
|
|
2014-03-20 19:51:58 +08:00
|
|
|
bool hasCnMips() const { return HasCnMips; }
|
|
|
|
|
2008-06-04 09:45:25 +08:00
|
|
|
bool isLittle() const { return IsLittle; }
|
2009-12-19 15:05:23 +08:00
|
|
|
bool isFP64bit() const { return IsFP64bit; }
|
2014-04-16 23:48:55 +08:00
|
|
|
bool isNaN2008() const { return IsNaN2008bit; }
|
2013-08-21 07:38:40 +08:00
|
|
|
bool isNotFP64bit() const { return !IsFP64bit; }
|
2009-12-19 15:05:23 +08:00
|
|
|
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; }
|
2013-04-10 03:46:01 +08:00
|
|
|
bool inMips16Mode() const {
|
|
|
|
switch (OverrideMode) {
|
|
|
|
case NoOverride:
|
|
|
|
return InMips16Mode;
|
|
|
|
case Mips16Override:
|
|
|
|
return true;
|
|
|
|
case NoMips16Override:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
llvm_unreachable("Unexpected mode");
|
|
|
|
}
|
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability.
This patch fixes returns from mips16 functions so that if the function
was in fact called by a mips32 hard float routine, then values
that would have been returned in floating point registers are so returned.
Mips16 mode has no floating point instructions so there is no way to
load values into floating point registers.
This is needed when returning float, double, single complex, double complex
in the Mips ABI.
Helper functions in libc for mips16 are available to do this.
For efficiency purposes, these helper functions have a different calling
convention from normal Mips calls.
Registers v0,v1,a0,a1 are used to pass parameters instead of
a0,a1,a2,a3.
This is because v0,v1,a0,a1 are the natural registers used to return
floating point values in soft float. These values can then be moved
to the appropriate floating point registers with no extra cost.
The only register that is modified is ra in this call.
The helper functions make sure that the return values are in the floating
point registers that they would be in if soft float was not in effect
(which it is for mips16, though the soft float is implemented using a mips32
library that uses hard float).
llvm-svn: 181641
2013-05-11 06:25:39 +08:00
|
|
|
bool inMips16ModeDefault() const {
|
2013-04-10 03:46:01 +08:00
|
|
|
return InMips16Mode;
|
|
|
|
}
|
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability.
This patch fixes returns from mips16 functions so that if the function
was in fact called by a mips32 hard float routine, then values
that would have been returned in floating point registers are so returned.
Mips16 mode has no floating point instructions so there is no way to
load values into floating point registers.
This is needed when returning float, double, single complex, double complex
in the Mips ABI.
Helper functions in libc for mips16 are available to do this.
For efficiency purposes, these helper functions have a different calling
convention from normal Mips calls.
Registers v0,v1,a0,a1 are used to pass parameters instead of
a0,a1,a2,a3.
This is because v0,v1,a0,a1 are the natural registers used to return
floating point values in soft float. These values can then be moved
to the appropriate floating point registers with no extra cost.
The only register that is modified is ra in this call.
The helper functions make sure that the return values are in the floating
point registers that they would be in if soft float was not in effect
(which it is for mips16, though the soft float is implemented using a mips32
library that uses hard float).
llvm-svn: 181641
2013-05-11 06:25:39 +08:00
|
|
|
bool inMips16HardFloat() const {
|
|
|
|
return inMips16Mode() && InMips16HardFloat;
|
|
|
|
}
|
2013-02-05 17:30:03 +08:00
|
|
|
bool inMicroMipsMode() const { return InMicroMipsMode; }
|
2012-09-22 07:41:49 +08:00
|
|
|
bool hasDSP() const { return HasDSP; }
|
|
|
|
bool hasDSPR2() const { return HasDSPR2; }
|
2013-08-14 04:54:07 +08:00
|
|
|
bool hasMSA() const { return HasMSA; }
|
2009-12-19 15:05:23 +08:00
|
|
|
bool isLinux() const { return IsLinux; }
|
2012-08-22 11:18:13 +08:00
|
|
|
bool useSmallSection() const { return UseSmallSection; }
|
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-06 03:05:21 +08:00
|
|
|
|
2012-05-22 11:10:09 +08:00
|
|
|
bool hasStandardEncoding() const { return !inMips16Mode(); }
|
|
|
|
|
2013-08-31 03:40:56 +08:00
|
|
|
bool mipsSEUsesSoftFloat() const;
|
|
|
|
|
2013-10-08 03:06:57 +08:00
|
|
|
bool enableLongBranchPass() const {
|
|
|
|
return hasStandardEncoding() || allowMixed16_32();
|
|
|
|
}
|
|
|
|
|
2008-07-31 01:01:06 +08:00
|
|
|
/// Features related to the presence of specific instructions.
|
2013-10-10 07:36:17 +08:00
|
|
|
bool hasExtractInsert() const { return !inMips16Mode() && hasMips32r2(); }
|
2013-01-19 05:20:38 +08:00
|
|
|
|
2013-07-13 07:33:22 +08:00
|
|
|
const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
|
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability.
This patch fixes returns from mips16 functions so that if the function
was in fact called by a mips32 hard float routine, then values
that would have been returned in floating point registers are so returned.
Mips16 mode has no floating point instructions so there is no way to
load values into floating point registers.
This is needed when returning float, double, single complex, double complex
in the Mips ABI.
Helper functions in libc for mips16 are available to do this.
For efficiency purposes, these helper functions have a different calling
convention from normal Mips calls.
Registers v0,v1,a0,a1 are used to pass parameters instead of
a0,a1,a2,a3.
This is because v0,v1,a0,a1 are the natural registers used to return
floating point values in soft float. These values can then be moved
to the appropriate floating point registers with no extra cost.
The only register that is modified is ra in this call.
The helper functions make sure that the return values are in the floating
point registers that they would be in if soft float was not in effect
(which it is for mips16, though the soft float is implemented using a mips32
library that uses hard float).
llvm-svn: 181641
2013-05-11 06:25:39 +08:00
|
|
|
bool allowMixed16_32() const { return inMips16ModeDefault() |
|
|
|
|
AllowMixed16_32;}
|
2013-04-10 03:46:01 +08:00
|
|
|
|
2013-04-11 00:58:04 +08:00
|
|
|
bool os16() const { return Os16;};
|
|
|
|
|
2014-02-06 01:19:30 +08:00
|
|
|
bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
|
2014-02-08 01:16:40 +08:00
|
|
|
bool isNotTargetNaCl() const { return !TargetTriple.isOSNaCl(); }
|
2014-02-06 01:19:30 +08:00
|
|
|
|
2014-04-16 22:38:27 +08:00
|
|
|
// for now constant islands are on for the whole compilation unit but we only
|
|
|
|
// really use them if in addition we are in mips16 mode
|
|
|
|
static bool useConstantIslands();
|
2013-10-30 03:29:03 +08:00
|
|
|
|
2013-11-12 05:49:03 +08:00
|
|
|
unsigned stackAlignment() const { return hasMips64() ? 16 : 8; }
|
2013-10-30 03:29:03 +08:00
|
|
|
|
2013-01-30 10:16:36 +08:00
|
|
|
// Grab relocation model
|
|
|
|
Reloc::Model getRelocationModel() const {return RM;}
|
2013-04-10 03:46:01 +08:00
|
|
|
|
|
|
|
/// \brief Reset the subtarget for the Mips target.
|
|
|
|
void resetSubtarget(MachineFunction *MF);
|
|
|
|
|
|
|
|
|
2007-06-06 15:42:06 +08:00
|
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|