ARMMachineFunctionInfo.h revision 8bed6c968fd7164222bc0cf4b86686c88381c3b8
1//====- ARMMachineFuctionInfo.h - ARM machine function info -----*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 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. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file declares ARM-specific per-machine-function information. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef ARMMACHINEFUNCTIONINFO_H 15#define ARMMACHINEFUNCTIONINFO_H 16 17#include "ARMSubtarget.h" 18#include "llvm/CodeGen/MachineFunction.h" 19#include "llvm/Target/TargetMachine.h" 20 21namespace llvm { 22 23/// ARMFunctionInfo - This class is derived from MachineFunction private 24/// ARM target-specific information for each MachineFunction. 25class ARMFunctionInfo : public MachineFunctionInfo { 26 27 /// isThumb - True if this function is compiled under Thumb mode. 28 /// 29 bool isThumb; 30 31 /// VarArgsRegSaveSize - Size of the register save area for vararg functions. 32 /// 33 unsigned VarArgsRegSaveSize; 34 35 /// HasStackFrame - True if this function has a stack frame. Set by 36 /// processFunctionBeforeCalleeSavedScan(). 37 bool HasStackFrame; 38 39 /// LRSForceSpilled - True if the LR register has been for spilled to enable 40 /// far jump. 41 bool LRForceSpilled; 42 43 /// R3IsLiveIn - True if R3 is live in to this function. 44 /// 45 bool R3IsLiveIn; 46 47 /// FramePtrSpillOffset - If HasStackFrame, this records the frame pointer 48 /// spill stack offset. 49 unsigned FramePtrSpillOffset; 50 51 /// GPRCS1Offset, GPRCS2Offset, DPRCSOffset - Starting offset of callee saved 52 /// register spills areas. For Mac OS X: 53 /// 54 /// GPR callee-saved (1) : r4, r5, r6, r7, lr 55 /// -------------------------------------------- 56 /// GPR callee-saved (2) : r8, r10, r11 57 /// -------------------------------------------- 58 /// DPR callee-saved : d8 - d15 59 unsigned GPRCS1Offset; 60 unsigned GPRCS2Offset; 61 unsigned DPRCSOffset; 62 63 /// GPRCS1Size, GPRCS2Size, DPRCSSize - Sizes of callee saved register spills 64 /// areas. 65 unsigned GPRCS1Size; 66 unsigned GPRCS2Size; 67 unsigned DPRCSSize; 68 69 /// GPRCS1Frames, GPRCS2Frames, DPRCSFrames - Keeps track of frame indices 70 /// which belong to these spill areas. 71 std::vector<bool> GPRCS1Frames; 72 std::vector<bool> GPRCS2Frames; 73 std::vector<bool> DPRCSFrames; 74 75 /// JumpTableUId - Unique id for jumptables. 76 /// 77 unsigned JumpTableUId; 78 79public: 80 ARMFunctionInfo() : 81 isThumb(false), 82 VarArgsRegSaveSize(0), HasStackFrame(false), 83 LRForceSpilled(false), R3IsLiveIn(false), 84 FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0), 85 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {} 86 87 ARMFunctionInfo(MachineFunction &MF) : 88 isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()), 89 VarArgsRegSaveSize(0), HasStackFrame(false), 90 LRForceSpilled(false), R3IsLiveIn(false), 91 FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0), 92 GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), JumpTableUId(0) {} 93 94 bool isThumbFunction() const { return isThumb; } 95 96 unsigned getVarArgsRegSaveSize() const { return VarArgsRegSaveSize; } 97 void setVarArgsRegSaveSize(unsigned s) { VarArgsRegSaveSize = s; } 98 99 bool hasStackFrame() const { return HasStackFrame; } 100 void setHasStackFrame(bool s) { HasStackFrame = s; } 101 102 bool isLRForceSpilled() const { return LRForceSpilled; } 103 void setLRIsForceSpilled(bool s) { LRForceSpilled = s; } 104 105 bool isR3IsLiveIn() const { return R3IsLiveIn; } 106 void setR3IsLiveIn(bool l) { R3IsLiveIn = l; } 107 108 unsigned getFramePtrSpillOffset() const { return FramePtrSpillOffset; } 109 void setFramePtrSpillOffset(unsigned o) { FramePtrSpillOffset = o; } 110 111 unsigned getGPRCalleeSavedArea1Offset() const { return GPRCS1Offset; } 112 unsigned getGPRCalleeSavedArea2Offset() const { return GPRCS2Offset; } 113 unsigned getDPRCalleeSavedAreaOffset() const { return DPRCSOffset; } 114 115 void setGPRCalleeSavedArea1Offset(unsigned o) { GPRCS1Offset = o; } 116 void setGPRCalleeSavedArea2Offset(unsigned o) { GPRCS2Offset = o; } 117 void setDPRCalleeSavedAreaOffset(unsigned o) { DPRCSOffset = o; } 118 119 unsigned getGPRCalleeSavedArea1Size() const { return GPRCS1Size; } 120 unsigned getGPRCalleeSavedArea2Size() const { return GPRCS2Size; } 121 unsigned getDPRCalleeSavedAreaSize() const { return DPRCSSize; } 122 123 void setGPRCalleeSavedArea1Size(unsigned s) { GPRCS1Size = s; } 124 void setGPRCalleeSavedArea2Size(unsigned s) { GPRCS2Size = s; } 125 void setDPRCalleeSavedAreaSize(unsigned s) { DPRCSSize = s; } 126 127 bool isGPRCalleeSavedArea1Frame(int fi) const { 128 if (fi < 0 || fi >= (int)GPRCS1Frames.size()) 129 return false; 130 return GPRCS1Frames[fi]; 131 } 132 bool isGPRCalleeSavedArea2Frame(int fi) const { 133 if (fi < 0 || fi >= (int)GPRCS2Frames.size()) 134 return false; 135 return GPRCS2Frames[fi]; 136 } 137 bool isDPRCalleeSavedAreaFrame(int fi) const { 138 if (fi < 0 || fi >= (int)DPRCSFrames.size()) 139 return false; 140 return DPRCSFrames[fi]; 141 } 142 143 void addGPRCalleeSavedArea1Frame(int fi) { 144 if (fi >= 0) { 145 if (fi >= (int)GPRCS1Frames.size()) 146 GPRCS1Frames.resize(fi+1); 147 GPRCS1Frames[fi] = true; 148 } 149 } 150 void addGPRCalleeSavedArea2Frame(int fi) { 151 if (fi >= 0) { 152 if (fi >= (int)GPRCS2Frames.size()) 153 GPRCS2Frames.resize(fi+1); 154 GPRCS2Frames[fi] = true; 155 } 156 } 157 void addDPRCalleeSavedAreaFrame(int fi) { 158 if (fi >= 0) { 159 if (fi >= (int)DPRCSFrames.size()) 160 DPRCSFrames.resize(fi+1); 161 DPRCSFrames[fi] = true; 162 } 163 } 164 165 unsigned createJumpTableUId() { 166 return JumpTableUId++; 167 } 168}; 169} // End llvm namespace 170 171#endif // ARMMACHINEFUNCTIONINFO_H 172