1 //====- ARMMachineFuctionInfo.h - ARM machine function info -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the Evan Cheng and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares ARM-specific per-machine-function information.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARMMACHINEFUNCTIONINFO_H
15 #define ARMMACHINEFUNCTIONINFO_H
17 #include "ARMSubtarget.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/Target/TargetMachine.h"
23 /// ARMFunctionInfo - This class is derived from MachineFunction private
24 /// ARM target-specific information for each MachineFunction.
25 class ARMFunctionInfo : public MachineFunctionInfo {
27 /// isThumb - True if this function is compiled under Thumb mode.
31 /// VarArgsRegSaveSize - Size of the register save area for vararg functions.
33 unsigned VarArgsRegSaveSize;
35 /// HasStackFrame - True if this function has a stack frame. Set by
36 /// processFunctionBeforeCalleeSavedScan().
39 /// FramePtrSpillOffset - If HasStackFrame, this records the frame pointer
40 /// spill stack offset.
41 unsigned FramePtrSpillOffset;
43 /// GPRCS1Offset, GPRCS2Offset, DPRCSOffset - Starting offset of callee saved
44 /// register spills areas. For Mac OS X:
46 /// GPR callee-saved (1) : r4, r5, r6, r7, lr
47 /// --------------------------------------------
48 /// GPR callee-saved (2) : r8, r10, r11
49 /// --------------------------------------------
50 /// DPR callee-saved : d8 - d15
51 unsigned GPRCS1Offset;
52 unsigned GPRCS2Offset;
55 /// GPRCS1Size, GPRCS2Size, DPRCSSize - Sizes of callee saved register spills
61 /// GPRCS1Frames, GPRCS2Frames, DPRCSFrames - Keeps track of frame indices
62 /// which belong to these spill areas.
63 std::vector<bool> GPRCS1Frames;
64 std::vector<bool> GPRCS2Frames;
65 std::vector<bool> DPRCSFrames;
67 /// JumpTableUId - Unique id for jumptables.
69 unsigned JumpTableUId;
74 VarArgsRegSaveSize(0), HasStackFrame(false), FramePtrSpillOffset(0),
75 GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
76 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {}
78 ARMFunctionInfo(MachineFunction &MF) :
79 isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()),
80 VarArgsRegSaveSize(0), HasStackFrame(false), FramePtrSpillOffset(0),
81 GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
82 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {}
84 bool isThumbFunction() const { return isThumb; }
86 unsigned getVarArgsRegSaveSize() const { return VarArgsRegSaveSize; }
87 void setVarArgsRegSaveSize(unsigned s) { VarArgsRegSaveSize = s; }
89 bool hasStackFrame() const { return HasStackFrame; }
90 void setHasStackFrame(bool s) { HasStackFrame = s; }
91 unsigned getFramePtrSpillOffset() const { return FramePtrSpillOffset; }
92 void setFramePtrSpillOffset(unsigned o) { FramePtrSpillOffset = o; }
94 unsigned getGPRCalleeSavedArea1Offset() const { return GPRCS1Offset; }
95 unsigned getGPRCalleeSavedArea2Offset() const { return GPRCS2Offset; }
96 unsigned getDPRCalleeSavedAreaOffset() const { return DPRCSOffset; }
98 void setGPRCalleeSavedArea1Offset(unsigned o) { GPRCS1Offset = o; }
99 void setGPRCalleeSavedArea2Offset(unsigned o) { GPRCS2Offset = o; }
100 void setDPRCalleeSavedAreaOffset(unsigned o) { DPRCSOffset = o; }
102 unsigned getGPRCalleeSavedArea1Size() const { return GPRCS1Size; }
103 unsigned getGPRCalleeSavedArea2Size() const { return GPRCS2Size; }
104 unsigned getDPRCalleeSavedAreaSize() const { return DPRCSSize; }
106 void setGPRCalleeSavedArea1Size(unsigned s) { GPRCS1Size = s; }
107 void setGPRCalleeSavedArea2Size(unsigned s) { GPRCS2Size = s; }
108 void setDPRCalleeSavedAreaSize(unsigned s) { DPRCSSize = s; }
110 bool isGPRCalleeSavedArea1Frame(int fi) const {
111 if (fi < 0 || fi >= (int)GPRCS1Frames.size())
113 return GPRCS1Frames[fi];
115 bool isGPRCalleeSavedArea2Frame(int fi) const {
116 if (fi < 0 || fi >= (int)GPRCS2Frames.size())
118 return GPRCS2Frames[fi];
120 bool isDPRCalleeSavedAreaFrame(int fi) const {
121 if (fi < 0 || fi >= (int)DPRCSFrames.size())
123 return DPRCSFrames[fi];
126 void addGPRCalleeSavedArea1Frame(int fi) {
128 if (fi >= (int)GPRCS1Frames.size())
129 GPRCS1Frames.resize(fi+1);
130 GPRCS1Frames[fi] = true;
133 void addGPRCalleeSavedArea2Frame(int fi) {
135 if (fi >= (int)GPRCS2Frames.size())
136 GPRCS2Frames.resize(fi+1);
137 GPRCS2Frames[fi] = true;
140 void addDPRCalleeSavedAreaFrame(int fi) {
142 if (fi >= (int)DPRCSFrames.size())
143 DPRCSFrames.resize(fi+1);
144 DPRCSFrames[fi] = true;
148 unsigned createJumpTableUId() {
149 return JumpTableUId++;
152 } // End llvm namespace
154 #endif // ARMMACHINEFUNCTIONINFO_H