blob: 663aaecf5c06953419ef7c7c6b3f8d1112c2b58b [file] [log] [blame]
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00001//===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +00007//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00008//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +00009//
10// This file declares the Mips specific subclass of MachineFunctionInfo.
11//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000012//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000013
14#ifndef MIPS_MACHINE_FUNCTION_INFO_H
15#define MIPS_MACHINE_FUNCTION_INFO_H
16
Akira Hatanakaa76220a2012-06-14 01:15:36 +000017#include "MipsSubtarget.h"
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000018#include "llvm/CodeGen/MachineFunction.h"
Bruno Cardoso Lopes2d4575e2007-08-28 05:04:41 +000019#include "llvm/CodeGen/MachineFrameInfo.h"
Akira Hatanakaa76220a2012-06-14 01:15:36 +000020#include "llvm/Target/TargetFrameLowering.h"
21#include "llvm/Target/TargetMachine.h"
Craig Topper79aa3412012-03-17 18:46:09 +000022#include <utility>
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000023
24namespace llvm {
25
26/// MipsFunctionInfo - This class is derived from MachineFunction private
27/// Mips target-specific information for each MachineFunction.
28class MipsFunctionInfo : public MachineFunctionInfo {
David Blaikie2d24e2a2011-12-20 02:50:00 +000029 virtual void anchor();
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000030
Akira Hatanaka21afc632011-06-21 00:40:49 +000031 MachineFunction& MF;
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000032 /// SRetReturnReg - Some subtargets require that sret lowering includes
33 /// returning the value of the returned struct in a register. This field
34 /// holds the virtual register into which the sret argument is passed.
35 unsigned SRetReturnReg;
36
Dan Gohman99114052009-06-03 20:30:14 +000037 /// GlobalBaseReg - keeps track of the virtual register initialized for
38 /// use as the global base register. This is used for PIC in some PIC
39 /// relocation models.
40 unsigned GlobalBaseReg;
41
Reed Kotlerf99998a2012-10-28 06:02:37 +000042 /// Mips16SPAliasReg - keeps track of the virtual register initialized for
43 /// use as an alias for SP for use in load/store of halfword/byte from/to
44 /// the stack
45 unsigned Mips16SPAliasReg;
46
Dan Gohman1e93df62010-04-17 14:41:14 +000047 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
48 int VarArgsFrameIndex;
49
Akira Hatanakab33b34a2012-10-30 19:37:25 +000050 // Formal argument information obtained during call to LowerFormalArguments.
51 unsigned NextStackOffset;
52 bool HasByvalArg;
53
Akira Hatanaka95f95a72012-03-27 19:08:42 +000054 bool EmitNOAT;
55
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000056public:
Che-Liang Chiouacf1d482010-09-28 10:06:53 +000057 MipsFunctionInfo(MachineFunction& MF)
Reed Kotlerf99998a2012-10-28 06:02:37 +000058 : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
59 VarArgsFrameIndex(0), EmitNOAT(false)
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000060 {}
61
Bruno Cardoso Lopes225ca9c2008-07-05 19:05:21 +000062 unsigned getSRetReturnReg() const { return SRetReturnReg; }
63 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
Dan Gohman99114052009-06-03 20:30:14 +000064
Akira Hatanaka648f00c2012-02-24 22:34:47 +000065 bool globalBaseRegSet() const;
66 unsigned getGlobalBaseReg();
Dan Gohman1e93df62010-04-17 14:41:14 +000067
Reed Kotlerf99998a2012-10-28 06:02:37 +000068 bool mips16SPAliasRegSet() const;
69 unsigned getMips16SPAliasReg();
70
Dan Gohman1e93df62010-04-17 14:41:14 +000071 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
72 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
Akira Hatanakada0a3572011-05-20 01:17:58 +000073
Akira Hatanakab33b34a2012-10-30 19:37:25 +000074 unsigned nextStackOffset() const { return NextStackOffset; }
75 bool hasByvalArg() const { return HasByvalArg; }
76 void setFormalArgInfo(unsigned Offset, bool HasByval) {
77 NextStackOffset = Offset;
78 HasByvalArg = HasByval;
79 }
80
Akira Hatanaka95f95a72012-03-27 19:08:42 +000081 bool getEmitNOAT() const { return EmitNOAT; }
82 void setEmitNOAT() { EmitNOAT = true; }
Bruno Cardoso Lopes4215a592007-07-11 22:44:21 +000083};
84
85} // end of namespace llvm
86
Bruno Cardoso Lopes2d4575e2007-08-28 05:04:41 +000087#endif // MIPS_MACHINE_FUNCTION_INFO_H