2011-04-15 21:51:11 +00:00
|
|
|
//===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
|
2007-07-11 22:44:21 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-07-11 22:44:21 +00:00
|
|
|
//
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-07-11 22:44:21 +00:00
|
|
|
//
|
|
|
|
// This file declares the Mips specific subclass of MachineFunctionInfo.
|
|
|
|
//
|
2011-04-15 21:51:11 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2007-07-11 22:44:21 +00:00
|
|
|
|
|
|
|
#ifndef MIPS_MACHINE_FUNCTION_INFO_H
|
|
|
|
#define MIPS_MACHINE_FUNCTION_INFO_H
|
|
|
|
|
2014-02-14 19:16:39 +00:00
|
|
|
#include "Mips16HardFloatInfo.h"
|
2012-06-14 01:15:36 +00:00
|
|
|
#include "MipsSubtarget.h"
|
2013-09-27 22:30:36 +00:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2007-08-28 05:04:41 +00:00
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2013-09-27 22:30:36 +00:00
|
|
|
#include "llvm/CodeGen/MachineMemOperand.h"
|
|
|
|
#include "llvm/CodeGen/PseudoSourceValue.h"
|
|
|
|
#include "llvm/IR/GlobalValue.h"
|
2014-03-04 11:26:31 +00:00
|
|
|
#include "llvm/IR/ValueMap.h"
|
2012-06-14 01:15:36 +00:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2014-02-14 19:16:39 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2012-03-17 18:46:09 +00:00
|
|
|
#include <utility>
|
2007-07-11 22:44:21 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2013-09-27 22:30:36 +00: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);
|
2014-04-29 07:58:02 +00:00
|
|
|
bool isConstant(const MachineFrameInfo *) const override;
|
|
|
|
bool isAliased(const MachineFrameInfo *) const override;
|
|
|
|
bool mayAlias(const MachineFrameInfo *) const override;
|
2013-09-27 22:30:36 +00:00
|
|
|
|
|
|
|
private:
|
2014-04-29 07:58:02 +00:00
|
|
|
void printCustom(raw_ostream &O) const override;
|
2013-09-27 22:30:36 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
std::string Name;
|
|
|
|
const GlobalValue *Val;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2007-07-11 22:44:21 +00:00
|
|
|
/// MipsFunctionInfo - This class is derived from MachineFunction private
|
|
|
|
/// Mips target-specific information for each MachineFunction.
|
|
|
|
class MipsFunctionInfo : public MachineFunctionInfo {
|
|
|
|
public:
|
2014-02-14 19:16:39 +00:00
|
|
|
MipsFunctionInfo(MachineFunction &MF)
|
|
|
|
: MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
|
|
|
|
VarArgsFrameIndex(0), CallsEhReturn(false), SaveS2(false) {}
|
2007-07-11 22:44:21 +00:00
|
|
|
|
2013-09-27 22:30:36 +00: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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 19:05:21 +00:00
|
|
|
unsigned getSRetReturnReg() const { return SRetReturnReg; }
|
|
|
|
void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
|
2009-06-03 20:30:14 +00:00
|
|
|
|
2012-02-24 22:34:47 +00:00
|
|
|
bool globalBaseRegSet() const;
|
|
|
|
unsigned getGlobalBaseReg();
|
2010-04-17 14:41:14 +00:00
|
|
|
|
2012-10-28 06:02:37 +00:00
|
|
|
bool mips16SPAliasRegSet() const;
|
|
|
|
unsigned getMips16SPAliasReg();
|
|
|
|
|
2010-04-17 14:41:14 +00:00
|
|
|
int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
|
|
|
|
void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
|
2011-05-20 01:17:58 +00:00
|
|
|
|
2012-10-30 19:37:25 +00:00
|
|
|
bool hasByvalArg() const { return HasByvalArg; }
|
2012-11-07 19:04:26 +00:00
|
|
|
void setFormalArgInfo(unsigned Size, bool HasByval) {
|
|
|
|
IncomingArgSize = Size;
|
2012-10-30 19:37:25 +00:00
|
|
|
HasByvalArg = HasByval;
|
|
|
|
}
|
2012-11-02 21:03:58 +00:00
|
|
|
|
|
|
|
unsigned getIncomingArgSize() const { return IncomingArgSize; }
|
2013-01-30 00:26:49 +00: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-27 22:30:36 +00: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);
|
|
|
|
|
2014-02-14 19:16:39 +00:00
|
|
|
void setSaveS2() { SaveS2 = true; }
|
|
|
|
bool hasSaveS2() const { return SaveS2; }
|
|
|
|
|
|
|
|
std::map<const char *, const llvm::Mips16HardFloatInfo::FuncSignature *>
|
|
|
|
StubsNeeded;
|
|
|
|
|
2013-09-25 00:34:42 +00: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-27 22:30:36 +00:00
|
|
|
|
2014-02-14 19:16:39 +00:00
|
|
|
// saveS2
|
|
|
|
bool SaveS2;
|
|
|
|
|
2013-09-27 22:30:36 +00:00
|
|
|
/// MipsCallEntry maps.
|
|
|
|
StringMap<const MipsCallEntry *> ExternalCallEntries;
|
|
|
|
ValueMap<const GlobalValue *, const MipsCallEntry *> GlobalCallEntries;
|
2007-07-11 22:44:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace llvm
|
|
|
|
|
2007-08-28 05:04:41 +00:00
|
|
|
#endif // MIPS_MACHINE_FUNCTION_INFO_H
|