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 /// VarArgsFrameIndex - FrameIndex for start of varargs area.
43 int VarArgsFrameIndex;
45 // Range of frame object indices.
46 // InArgFIRange: Range of indices of all frame objects created during call to
47 // LowerFormalArguments.
48 // OutArgFIRange: Range of indices of all frame objects created during call to
49 // LowerCall except for the frame object for restoring $gp.
50 std::pair<int, int> InArgFIRange, OutArgFIRange;
51 unsigned MaxCallFrameSize;
56 MipsFunctionInfo(MachineFunction& MF)
57 : MF(MF), SRetReturnReg(0), GlobalBaseReg(0),
58 VarArgsFrameIndex(0), InArgFIRange(std::make_pair(-1, 0)),
59 OutArgFIRange(std::make_pair(-1, 0)), MaxCallFrameSize(0), EmitNOAT(false)
62 bool isInArgFI(int FI) const {
63 return FI <= InArgFIRange.first && FI >= InArgFIRange.second;
65 void setLastInArgFI(int FI) { InArgFIRange.second = FI; }
67 bool isOutArgFI(int FI) const {
68 return FI <= OutArgFIRange.first && FI >= OutArgFIRange.second;
70 void extendOutArgFIRange(int FirstFI, int LastFI) {
71 if (!OutArgFIRange.second)
72 // this must be the first time this function was called.
73 OutArgFIRange.first = FirstFI;
74 OutArgFIRange.second = LastFI;
77 unsigned getSRetReturnReg() const { return SRetReturnReg; }
78 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
80 bool globalBaseRegSet() const;
81 unsigned getGlobalBaseReg();
83 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
84 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
86 unsigned getMaxCallFrameSize() const { return MaxCallFrameSize; }
87 void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; }
89 bool getEmitNOAT() const { return EmitNOAT; }
90 void setEmitNOAT() { EmitNOAT = true; }
93 } // end of namespace llvm
95 #endif // MIPS_MACHINE_FUNCTION_INFO_H