2017-01-31 07:21:32 +08:00
|
|
|
//===- MipsMachineFunctionInfo.h - Private data used for Mips ---*- C++ -*-===//
|
2007-07-12 06:44:21 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2007-07-12 06:44:21 +08:00
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-07-12 06:44:21 +08:00
|
|
|
//
|
|
|
|
// This file declares the Mips specific subclass of MachineFunctionInfo.
|
|
|
|
//
|
2011-04-16 05:51:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-07-12 06:44:21 +08:00
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
|
2007-07-12 06:44:21 +08:00
|
|
|
|
2014-02-15 03:16:39 +08:00
|
|
|
#include "Mips16HardFloatInfo.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2013-09-28 06:30:36 +08:00
|
|
|
#include "llvm/CodeGen/MachineMemOperand.h"
|
2014-02-15 03:16:39 +08:00
|
|
|
#include <map>
|
2007-07-12 06:44:21 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
/// MipsFunctionInfo - This class is derived from MachineFunction private
|
|
|
|
/// Mips target-specific information for each MachineFunction.
|
|
|
|
class MipsFunctionInfo : public MachineFunctionInfo {
|
|
|
|
public:
|
2017-01-31 07:21:32 +08:00
|
|
|
MipsFunctionInfo(MachineFunction &MF) : MF(MF) {}
|
2007-07-12 06:44:21 +08:00
|
|
|
|
2017-01-31 07:21:32 +08:00
|
|
|
~MipsFunctionInfo() override;
|
2013-09-28 06:30:36 +08: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-06 03:05:21 +08:00
|
|
|
unsigned getSRetReturnReg() const { return SRetReturnReg; }
|
|
|
|
void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
|
2009-06-04 04:30:14 +08:00
|
|
|
|
2012-02-25 06:34:47 +08:00
|
|
|
bool globalBaseRegSet() const;
|
2019-06-25 00:16:12 +08:00
|
|
|
Register getGlobalBaseReg();
|
|
|
|
Register getGlobalBaseRegForGlobalISel();
|
2010-04-17 22:41:14 +08:00
|
|
|
|
2019-05-31 16:15:28 +08:00
|
|
|
// Insert instructions to initialize the global base register in the
|
|
|
|
// first MBB of the function.
|
|
|
|
void initGlobalBaseReg();
|
|
|
|
|
2010-04-17 22:41:14 +08:00
|
|
|
int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
|
|
|
|
void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
|
2011-05-20 09:17:58 +08:00
|
|
|
|
2012-10-31 03:37:25 +08:00
|
|
|
bool hasByvalArg() const { return HasByvalArg; }
|
2012-11-08 03:04:26 +08:00
|
|
|
void setFormalArgInfo(unsigned Size, bool HasByval) {
|
|
|
|
IncomingArgSize = Size;
|
2012-10-31 03:37:25 +08:00
|
|
|
HasByvalArg = HasByval;
|
|
|
|
}
|
2012-11-03 05:03:58 +08:00
|
|
|
|
|
|
|
unsigned getIncomingArgSize() const { return IncomingArgSize; }
|
2013-01-30 08:26:49 +08:00
|
|
|
|
|
|
|
bool callsEhReturn() const { return CallsEhReturn; }
|
|
|
|
void setCallsEhReturn() { CallsEhReturn = true; }
|
|
|
|
|
|
|
|
void createEhDataRegsFI();
|
|
|
|
int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
|
|
|
|
bool isEhDataRegFI(int FI) const;
|
|
|
|
|
2015-08-12 07:23:17 +08:00
|
|
|
/// Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue
|
|
|
|
/// object representing a GOT entry for an external function.
|
|
|
|
MachinePointerInfo callPtrInfo(const char *ES);
|
2013-09-28 06:30:36 +08:00
|
|
|
|
2015-10-26 20:38:43 +08:00
|
|
|
// Functions with the "interrupt" attribute require special prologues,
|
|
|
|
// epilogues and additional spill slots.
|
|
|
|
bool isISR() const { return IsISR; }
|
|
|
|
void setISR() { IsISR = true; }
|
|
|
|
void createISRRegFI();
|
|
|
|
int getISRRegFI(unsigned Reg) const { return ISRDataRegFI[Reg]; }
|
|
|
|
bool isISRRegFI(int FI) const;
|
|
|
|
|
2015-08-12 07:23:17 +08:00
|
|
|
/// Create a MachinePointerInfo that has a GlobalValuePseudoSourceValue object
|
2013-09-28 06:30:36 +08:00
|
|
|
/// representing a GOT entry for a global function.
|
2015-08-12 07:23:17 +08:00
|
|
|
MachinePointerInfo callPtrInfo(const GlobalValue *GV);
|
2013-09-28 06:30:36 +08:00
|
|
|
|
2014-02-15 03:16:39 +08:00
|
|
|
void setSaveS2() { SaveS2 = true; }
|
|
|
|
bool hasSaveS2() const { return SaveS2; }
|
|
|
|
|
2014-07-14 21:08:14 +08:00
|
|
|
int getMoveF64ViaSpillFI(const TargetRegisterClass *RC);
|
2014-07-14 17:40:29 +08:00
|
|
|
|
2017-01-31 07:21:32 +08:00
|
|
|
std::map<const char *, const Mips16HardFloatInfo::FuncSignature *>
|
2014-02-15 03:16:39 +08:00
|
|
|
StubsNeeded;
|
|
|
|
|
2013-09-25 08:34:42 +08:00
|
|
|
private:
|
|
|
|
virtual void anchor();
|
|
|
|
|
|
|
|
MachineFunction& MF;
|
2017-01-31 07:21:32 +08:00
|
|
|
|
2013-09-25 08:34:42 +08:00
|
|
|
/// SRetReturnReg - Some subtargets require that sret lowering includes
|
|
|
|
/// returning the value of the returned struct in a register. This field
|
|
|
|
/// holds the virtual register into which the sret argument is passed.
|
2017-01-31 07:21:32 +08:00
|
|
|
unsigned SRetReturnReg = 0;
|
2013-09-25 08:34:42 +08:00
|
|
|
|
|
|
|
/// GlobalBaseReg - keeps track of the virtual register initialized for
|
|
|
|
/// use as the global base register. This is used for PIC in some PIC
|
|
|
|
/// relocation models.
|
2017-01-31 07:21:32 +08:00
|
|
|
unsigned GlobalBaseReg = 0;
|
2013-09-25 08:34:42 +08:00
|
|
|
|
|
|
|
/// VarArgsFrameIndex - FrameIndex for start of varargs area.
|
2017-01-31 07:21:32 +08:00
|
|
|
int VarArgsFrameIndex = 0;
|
2013-09-25 08:34:42 +08:00
|
|
|
|
|
|
|
/// True if function has a byval argument.
|
|
|
|
bool HasByvalArg;
|
|
|
|
|
|
|
|
/// Size of incoming argument area.
|
|
|
|
unsigned IncomingArgSize;
|
|
|
|
|
|
|
|
/// CallsEhReturn - Whether the function calls llvm.eh.return.
|
2017-01-31 07:21:32 +08:00
|
|
|
bool CallsEhReturn = false;
|
2013-09-25 08:34:42 +08:00
|
|
|
|
|
|
|
/// Frame objects for spilling eh data registers.
|
|
|
|
int EhDataRegFI[4];
|
2013-09-28 06:30:36 +08:00
|
|
|
|
2015-10-26 20:38:43 +08:00
|
|
|
/// ISR - Whether the function is an Interrupt Service Routine.
|
2017-01-31 07:21:32 +08:00
|
|
|
bool IsISR = false;
|
2015-10-26 20:38:43 +08:00
|
|
|
|
|
|
|
/// Frame objects for spilling C0_STATUS, C0_EPC
|
|
|
|
int ISRDataRegFI[2];
|
|
|
|
|
2014-02-15 03:16:39 +08:00
|
|
|
// saveS2
|
2017-01-31 07:21:32 +08:00
|
|
|
bool SaveS2 = false;
|
2014-02-15 03:16:39 +08:00
|
|
|
|
2014-07-14 17:40:29 +08:00
|
|
|
/// FrameIndex for expanding BuildPairF64 nodes to spill and reload when the
|
|
|
|
/// O32 FPXX ABI is enabled. -1 is used to denote invalid index.
|
2017-01-31 07:21:32 +08:00
|
|
|
int MoveF64ViaSpillFI = -1;
|
2007-07-12 06:44:21 +08:00
|
|
|
};
|
|
|
|
|
2017-01-31 07:21:32 +08:00
|
|
|
} // end namespace llvm
|
2007-07-12 06:44:21 +08:00
|
|
|
|
2017-01-31 07:21:32 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_MIPS_MIPSMACHINEFUNCTION_H
|