2007-06-06 09:42:06 +02:00
|
|
|
//===- MipsRegisterInfo.cpp - MIPS Register Information -== -----*- 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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-02-10 19:45:23 +01:00
|
|
|
// This file contains the MIPS implementation of the TargetRegisterInfo class.
|
2007-06-06 09:42:06 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "mips-reg-info"
|
|
|
|
|
|
|
|
#include "Mips.h"
|
2008-07-14 16:42:54 +02:00
|
|
|
#include "MipsSubtarget.h"
|
2007-06-06 09:42:06 +02:00
|
|
|
#include "MipsRegisterInfo.h"
|
2007-07-12 01:21:31 +02:00
|
|
|
#include "MipsMachineFunction.h"
|
2007-06-06 09:42:06 +02:00
|
|
|
#include "llvm/Constants.h"
|
|
|
|
#include "llvm/Type.h"
|
|
|
|
#include "llvm/Function.h"
|
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
|
|
|
#include "llvm/CodeGen/MachineLocation.h"
|
2011-01-10 13:39:04 +01:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2007-06-06 09:42:06 +02:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetOptions.h"
|
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
2009-07-11 22:10:48 +02:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2009-07-25 02:23:56 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2007-06-06 09:42:06 +02:00
|
|
|
#include "llvm/ADT/BitVector.h"
|
|
|
|
#include "llvm/ADT/STLExtras.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2008-07-14 16:42:54 +02:00
|
|
|
MipsRegisterInfo::MipsRegisterInfo(const MipsSubtarget &ST,
|
|
|
|
const TargetInstrInfo &tii)
|
2007-06-06 09:42:06 +02:00
|
|
|
: MipsGenRegisterInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP),
|
2008-07-14 16:42:54 +02:00
|
|
|
Subtarget(ST), TII(tii) {}
|
2007-06-06 09:42:06 +02:00
|
|
|
|
2007-08-28 07:13:42 +02:00
|
|
|
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
|
|
|
/// Mips::RA, return the number that it corresponds to (e.g. 31).
|
|
|
|
unsigned MipsRegisterInfo::
|
|
|
|
getRegisterNumbering(unsigned RegEnum)
|
|
|
|
{
|
|
|
|
switch (RegEnum) {
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::ZERO : case Mips::F0 : case Mips::D0 : return 0;
|
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
|
|
|
case Mips::AT : case Mips::F1 : return 1;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::V0 : case Mips::F2 : case Mips::D1 : return 2;
|
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
|
|
|
case Mips::V1 : case Mips::F3 : return 3;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::A0 : case Mips::F4 : case Mips::D2 : return 4;
|
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
|
|
|
case Mips::A1 : case Mips::F5 : return 5;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::A2 : case Mips::F6 : case Mips::D3 : return 6;
|
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
|
|
|
case Mips::A3 : case Mips::F7 : return 7;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::T0 : case Mips::F8 : case Mips::D4 : return 8;
|
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
|
|
|
case Mips::T1 : case Mips::F9 : return 9;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::T2 : case Mips::F10: case Mips::D5: return 10;
|
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
|
|
|
case Mips::T3 : case Mips::F11: return 11;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::T4 : case Mips::F12: case Mips::D6: return 12;
|
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
|
|
|
case Mips::T5 : case Mips::F13: return 13;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::T6 : case Mips::F14: case Mips::D7: return 14;
|
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
|
|
|
case Mips::T7 : case Mips::F15: return 15;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::T8 : case Mips::F16: case Mips::D8: return 16;
|
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
|
|
|
case Mips::T9 : case Mips::F17: return 17;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::S0 : case Mips::F18: case Mips::D9: return 18;
|
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
|
|
|
case Mips::S1 : case Mips::F19: return 19;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::S2 : case Mips::F20: case Mips::D10: return 20;
|
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
|
|
|
case Mips::S3 : case Mips::F21: return 21;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::S4 : case Mips::F22: case Mips::D11: return 22;
|
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
|
|
|
case Mips::S5 : case Mips::F23: return 23;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::S6 : case Mips::F24: case Mips::D12: return 24;
|
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
|
|
|
case Mips::S7 : case Mips::F25: return 25;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::K0 : case Mips::F26: case Mips::D13: return 26;
|
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
|
|
|
case Mips::K1 : case Mips::F27: return 27;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::GP : case Mips::F28: case Mips::D14: return 28;
|
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
|
|
|
case Mips::SP : case Mips::F29: return 29;
|
2008-08-06 08:14:43 +02:00
|
|
|
case Mips::FP : case Mips::F30: case Mips::D15: return 30;
|
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
|
|
|
case Mips::RA : case Mips::F31: return 31;
|
2009-07-14 18:55:14 +02:00
|
|
|
default: llvm_unreachable("Unknown register number!");
|
2007-08-28 07:13:42 +02:00
|
|
|
}
|
2008-03-30 20:22:13 +02:00
|
|
|
return 0; // Not reached
|
2007-08-28 07:13:42 +02:00
|
|
|
}
|
|
|
|
|
2009-08-13 00:10:57 +02:00
|
|
|
unsigned MipsRegisterInfo::getPICCallReg() { return Mips::T9; }
|
2008-07-14 16:42:54 +02:00
|
|
|
|
2007-08-28 07:13:42 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Callee Saved Registers methods
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
/// Mips Callee Saved Registers
|
|
|
|
const unsigned* MipsRegisterInfo::
|
Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
"add{l} {$src2, $dst|$dst, $src2}",
[(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
llvm-svn: 40033
2007-07-19 03:14:50 +02:00
|
|
|
getCalleeSavedRegs(const MachineFunction *MF) const
|
2007-06-06 09:42:06 +02:00
|
|
|
{
|
2008-08-06 08:14:43 +02:00
|
|
|
// Mips callee-save register range is $16-$23, $f20-$f30
|
|
|
|
static const unsigned SingleFloatOnlyCalleeSavedRegs[] = {
|
2007-06-06 09:42:06 +02:00
|
|
|
Mips::S0, Mips::S1, Mips::S2, Mips::S3,
|
2008-08-06 08:14:43 +02:00
|
|
|
Mips::S4, Mips::S5, Mips::S6, Mips::S7,
|
|
|
|
Mips::F20, Mips::F21, Mips::F22, Mips::F23, Mips::F24, Mips::F25,
|
|
|
|
Mips::F26, Mips::F27, Mips::F28, Mips::F29, Mips::F30, 0
|
2007-06-06 09:42:06 +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
|
|
|
|
2008-08-06 08:14:43 +02:00
|
|
|
static const unsigned BitMode32CalleeSavedRegs[] = {
|
|
|
|
Mips::S0, Mips::S1, Mips::S2, Mips::S3,
|
|
|
|
Mips::S4, Mips::S5, Mips::S6, Mips::S7,
|
2009-11-25 01:47:43 +01:00
|
|
|
Mips::F20, Mips::F22, Mips::F24, Mips::F26, Mips::F28, Mips::F30, 0
|
2008-08-06 08:14:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
if (Subtarget.isSingleFloat())
|
|
|
|
return SingleFloatOnlyCalleeSavedRegs;
|
|
|
|
else
|
|
|
|
return BitMode32CalleeSavedRegs;
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BitVector MipsRegisterInfo::
|
2010-11-18 22:19:35 +01:00
|
|
|
getReservedRegs(const MachineFunction &MF) const {
|
2007-06-06 09:42:06 +02:00
|
|
|
BitVector Reserved(getNumRegs());
|
|
|
|
Reserved.set(Mips::ZERO);
|
|
|
|
Reserved.set(Mips::AT);
|
|
|
|
Reserved.set(Mips::K0);
|
|
|
|
Reserved.set(Mips::K1);
|
|
|
|
Reserved.set(Mips::GP);
|
|
|
|
Reserved.set(Mips::SP);
|
|
|
|
Reserved.set(Mips::FP);
|
|
|
|
Reserved.set(Mips::RA);
|
2009-03-21 01:05:07 +01:00
|
|
|
|
|
|
|
// SRV4 requires that odd register can't be used.
|
|
|
|
if (!Subtarget.isSingleFloat())
|
|
|
|
for (unsigned FReg=(Mips::F0)+1; FReg < Mips::F30; FReg+=2)
|
|
|
|
Reserved.set(FReg);
|
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
return Reserved;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function eliminate ADJCALLSTACKDOWN,
|
|
|
|
// ADJCALLSTACKUP pseudo instructions
|
|
|
|
void MipsRegisterInfo::
|
|
|
|
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I) const {
|
|
|
|
// Simply discard ADJCALLSTACKDOWN, ADJCALLSTACKUP instructions.
|
|
|
|
MBB.erase(I);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FrameIndex represent objects inside a abstract stack.
|
|
|
|
// We must replace FrameIndex with an stack/frame pointer
|
|
|
|
// direct reference.
|
2010-08-27 01:32:16 +02:00
|
|
|
void MipsRegisterInfo::
|
2009-10-07 19:12:56 +02:00
|
|
|
eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
2010-08-27 01:32:16 +02:00
|
|
|
RegScavenger *RS) const {
|
2007-11-05 04:02:32 +01:00
|
|
|
MachineInstr &MI = *II;
|
2007-06-06 09:42:06 +02:00
|
|
|
MachineFunction &MF = *MI.getParent()->getParent();
|
|
|
|
|
2007-07-12 01:21:31 +02:00
|
|
|
unsigned i = 0;
|
2008-10-03 17:45:36 +02:00
|
|
|
while (!MI.getOperand(i).isFI()) {
|
2007-06-06 09:42:06 +02:00
|
|
|
++i;
|
|
|
|
assert(i < MI.getNumOperands() &&
|
|
|
|
"Instr doesn't have FrameIndex operand!");
|
|
|
|
}
|
|
|
|
|
2009-08-23 08:49:22 +02:00
|
|
|
DEBUG(errs() << "\nFunction : " << MF.getFunction()->getName() << "\n";
|
|
|
|
errs() << "<--------->\n" << MI);
|
2008-08-02 21:42:36 +02:00
|
|
|
|
2007-12-31 00:10:15 +01:00
|
|
|
int FrameIndex = MI.getOperand(i).getIndex();
|
2007-06-06 09:42:06 +02:00
|
|
|
int stackSize = MF.getFrameInfo()->getStackSize();
|
|
|
|
int spOffset = MF.getFrameInfo()->getObjectOffset(FrameIndex);
|
|
|
|
|
2009-08-23 08:49:22 +02:00
|
|
|
DEBUG(errs() << "FrameIndex : " << FrameIndex << "\n"
|
|
|
|
<< "spOffset : " << spOffset << "\n"
|
|
|
|
<< "stackSize : " << stackSize << "\n");
|
2007-06-06 09:42:06 +02:00
|
|
|
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
llvm-svn: 78142
2009-08-05 03:29:28 +02:00
|
|
|
// as explained on LowerFormalArguments, detect negative offsets
|
2007-08-28 07:13:42 +02:00
|
|
|
// and adjust SPOffsets considering the final stack size.
|
|
|
|
int Offset = ((spOffset < 0) ? (stackSize + (-(spOffset+4))) : (spOffset));
|
|
|
|
Offset += MI.getOperand(i-1).getImm();
|
2007-06-06 09:42:06 +02:00
|
|
|
|
2009-08-23 08:49:22 +02:00
|
|
|
DEBUG(errs() << "Offset : " << Offset << "\n" << "<--------->\n");
|
2007-06-06 09:42:06 +02:00
|
|
|
|
|
|
|
MI.getOperand(i-1).ChangeToImmediate(Offset);
|
2007-11-05 04:02:32 +01:00
|
|
|
MI.getOperand(i).ChangeToRegister(getFrameRegister(MF), false);
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MipsRegisterInfo::
|
2007-07-12 01:21:31 +02:00
|
|
|
processFunctionBeforeFrameFinalized(MachineFunction &MF) const {
|
2009-11-09 15:27:49 +01:00
|
|
|
// Set the stack offset where GP must be saved/loaded from.
|
2007-11-05 04:02:32 +01:00
|
|
|
MachineFrameInfo *MFI = MF.getFrameInfo();
|
2009-11-09 15:27:49 +01:00
|
|
|
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
|
|
|
if (MipsFI->needGPSaveRestore())
|
2007-11-05 04:02:32 +01:00
|
|
|
MFI->setObjectOffset(MipsFI->getGPFI(), MipsFI->getGPStackOffset());
|
2007-07-12 01:21:31 +02:00
|
|
|
}
|
2007-06-06 09:42:06 +02:00
|
|
|
|
|
|
|
unsigned MipsRegisterInfo::
|
|
|
|
getRARegister() const {
|
|
|
|
return Mips::RA;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned MipsRegisterInfo::
|
2009-11-12 21:49:22 +01:00
|
|
|
getFrameRegister(const MachineFunction &MF) const {
|
2011-01-10 13:39:04 +01:00
|
|
|
const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering();
|
2010-11-18 22:19:35 +01:00
|
|
|
|
|
|
|
return TFI->hasFP(MF) ? Mips::FP : Mips::SP;
|
2007-06-06 09:42:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned MipsRegisterInfo::
|
|
|
|
getEHExceptionRegister() const {
|
2009-07-14 18:55:14 +02:00
|
|
|
llvm_unreachable("What is the exception register");
|
2007-06-06 09:42:06 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned MipsRegisterInfo::
|
|
|
|
getEHHandlerRegister() const {
|
2009-07-14 18:55:14 +02:00
|
|
|
llvm_unreachable("What is the exception handler register");
|
2007-06-06 09:42:06 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-11-11 20:50:10 +01:00
|
|
|
int MipsRegisterInfo::
|
2007-11-13 20:13:01 +01:00
|
|
|
getDwarfRegNum(unsigned RegNum, bool isEH) const {
|
2009-07-14 18:55:14 +02:00
|
|
|
llvm_unreachable("What is the dwarf register number");
|
2007-11-11 20:50:10 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2007-06-06 09:42:06 +02:00
|
|
|
#include "MipsGenRegisterInfo.inc"
|