2011-04-16 05:51:11 +08:00
|
|
|
//===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
|
2007-07-12 06:44:21 +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-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
|
|
|
|
|
|
|
#ifndef MIPS_MACHINE_FUNCTION_INFO_H
|
|
|
|
#define MIPS_MACHINE_FUNCTION_INFO_H
|
|
|
|
|
2012-06-14 09:15:36 +08:00
|
|
|
#include "MipsSubtarget.h"
|
2013-09-28 06:30:36 +08:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
#include "llvm/ADT/ValueMap.h"
|
2007-08-28 13:04:41 +08:00
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.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"
|
|
|
|
#include "llvm/CodeGen/PseudoSourceValue.h"
|
|
|
|
#include "llvm/IR/GlobalValue.h"
|
2012-06-14 09:15:36 +08:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2012-03-18 02:46:09 +08:00
|
|
|
#include <utility>
|
2007-07-12 06:44:21 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2013-09-28 06:30:36 +08:00
|
|
|
/// \brief A class derived from PseudoSourceValue that represents a GOT entry
|
|
|
|
/// resolved by lazy-binding.
|
|
|
|
class MipsCallEntry : public PseudoSourceValue {
|
|
|
|
public:
|
|
|
|
explicit MipsCallEntry(const StringRef &N);
|
|
|
|
explicit MipsCallEntry(const GlobalValue *V);
|
|
|
|
virtual bool isConstant(const MachineFrameInfo *) const;
|
|
|
|
virtual bool isAliased(const MachineFrameInfo *) const;
|
|
|
|
virtual bool mayAlias(const MachineFrameInfo *) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual void printCustom(raw_ostream &O) const;
|
|
|
|
#ifndef NDEBUG
|
|
|
|
std::string Name;
|
|
|
|
const GlobalValue *Val;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2007-07-12 06:44:21 +08:00
|
|
|
/// MipsFunctionInfo - This class is derived from MachineFunction private
|
|
|
|
/// Mips target-specific information for each MachineFunction.
|
|
|
|
class MipsFunctionInfo : public MachineFunctionInfo {
|
|
|
|
public:
|
2010-09-28 18:06:53 +08:00
|
|
|
MipsFunctionInfo(MachineFunction& MF)
|
2012-10-28 14:02:37 +08:00
|
|
|
: MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
|
2013-01-30 08:26:49 +08:00
|
|
|
VarArgsFrameIndex(0), CallsEhReturn(false)
|
2007-07-12 06:44:21 +08:00
|
|
|
{}
|
|
|
|
|
2013-09-28 06:30:36 +08:00
|
|
|
~MipsFunctionInfo();
|
|
|
|
|
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;
|
|
|
|
unsigned getGlobalBaseReg();
|
2010-04-17 22:41:14 +08:00
|
|
|
|
2012-10-28 14:02:37 +08:00
|
|
|
bool mips16SPAliasRegSet() const;
|
|
|
|
unsigned getMips16SPAliasReg();
|
|
|
|
|
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;
|
|
|
|
|
2013-09-28 06:30:36 +08:00
|
|
|
/// \brief Create a MachinePointerInfo that has a MipsCallEntr object
|
|
|
|
/// representing a GOT entry for an external function.
|
|
|
|
MachinePointerInfo callPtrInfo(const StringRef &Name);
|
|
|
|
|
|
|
|
/// \brief Create a MachinePointerInfo that has a MipsCallEntr object
|
|
|
|
/// representing a GOT entry for a global function.
|
|
|
|
MachinePointerInfo callPtrInfo(const GlobalValue *Val);
|
|
|
|
|
2013-09-25 08:34:42 +08:00
|
|
|
private:
|
|
|
|
virtual void anchor();
|
|
|
|
|
|
|
|
MachineFunction& MF;
|
|
|
|
/// 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.
|
|
|
|
unsigned SRetReturnReg;
|
|
|
|
|
|
|
|
/// 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.
|
|
|
|
unsigned GlobalBaseReg;
|
|
|
|
|
|
|
|
/// Mips16SPAliasReg - keeps track of the virtual register initialized for
|
|
|
|
/// use as an alias for SP for use in load/store of halfword/byte from/to
|
|
|
|
/// the stack
|
|
|
|
unsigned Mips16SPAliasReg;
|
|
|
|
|
|
|
|
/// VarArgsFrameIndex - FrameIndex for start of varargs area.
|
|
|
|
int VarArgsFrameIndex;
|
|
|
|
|
|
|
|
/// True if function has a byval argument.
|
|
|
|
bool HasByvalArg;
|
|
|
|
|
|
|
|
/// Size of incoming argument area.
|
|
|
|
unsigned IncomingArgSize;
|
|
|
|
|
|
|
|
/// CallsEhReturn - Whether the function calls llvm.eh.return.
|
|
|
|
bool CallsEhReturn;
|
|
|
|
|
|
|
|
/// Frame objects for spilling eh data registers.
|
|
|
|
int EhDataRegFI[4];
|
2013-09-28 06:30:36 +08:00
|
|
|
|
|
|
|
/// MipsCallEntry maps.
|
|
|
|
StringMap<const MipsCallEntry *> ExternalCallEntries;
|
|
|
|
ValueMap<const GlobalValue *, const MipsCallEntry *> GlobalCallEntries;
|
2007-07-12 06:44:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace llvm
|
|
|
|
|
2007-08-28 13:04:41 +08:00
|
|
|
#endif // MIPS_MACHINE_FUNCTION_INFO_H
|