1 //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Mips specific subclass of MachineFunctionInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPS_MACHINE_FUNCTION_INFO_H
15 #define MIPS_MACHINE_FUNCTION_INFO_H
17 #include "MipsSubtarget.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/CodeGen/MachineFrameInfo.h"
20 #include "llvm/Target/TargetFrameLowering.h"
21 #include "llvm/Target/TargetMachine.h"
26 /// MipsFunctionInfo - This class is derived from MachineFunction private
27 /// Mips target-specific information for each MachineFunction.
28 class MipsFunctionInfo : public MachineFunctionInfo {
29 virtual void anchor();
32 /// 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;
37 /// 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;
42 /// 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
45 unsigned Mips16SPAliasReg;
47 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
48 int VarArgsFrameIndex;
50 // Formal argument information obtained during call to LowerFormalArguments.
51 unsigned NextStackOffset;
54 // Size of incoming argument area.
55 unsigned IncomingArgSize;
58 MipsFunctionInfo(MachineFunction& MF)
59 : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
63 unsigned getSRetReturnReg() const { return SRetReturnReg; }
64 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
66 bool globalBaseRegSet() const;
67 unsigned getGlobalBaseReg();
69 bool mips16SPAliasRegSet() const;
70 unsigned getMips16SPAliasReg();
72 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
73 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
75 unsigned nextStackOffset() const { return NextStackOffset; }
76 bool hasByvalArg() const { return HasByvalArg; }
77 void setFormalArgInfo(unsigned Offset, bool HasByval) {
78 NextStackOffset = Offset;
79 HasByvalArg = HasByval;
82 unsigned getIncomingArgSize() const { return IncomingArgSize; }
83 void setIncomingArgSize(unsigned S) { IncomingArgSize = S; }
86 } // end of namespace llvm
88 #endif // MIPS_MACHINE_FUNCTION_INFO_H