Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 1 | //===- SIMachineFunctionInfo.h - SIMachineFunctionInfo interface -*- C++ -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | /// \file |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_R600_SIMACHINEFUNCTIONINFO_H |
| 16 | #define LLVM_LIB_TARGET_R600_SIMACHINEFUNCTIONINFO_H |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 17 | |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 18 | #include "AMDGPUMachineFunction.h" |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 19 | #include "SIRegisterInfo.h" |
Tom Stellard | c149dc0 | 2013-11-27 21:23:35 +0000 | [diff] [blame] | 20 | #include <map> |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 21 | |
| 22 | namespace llvm { |
| 23 | |
Tom Stellard | c149dc0 | 2013-11-27 21:23:35 +0000 | [diff] [blame] | 24 | class MachineRegisterInfo; |
| 25 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 26 | /// This class keeps track of the SPI_SP_INPUT_ADDR config register, which |
| 27 | /// tells the hardware which interpolation parameters to load. |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 28 | class SIMachineFunctionInfo : public AMDGPUMachineFunction { |
Craig Topper | 5656db4 | 2014-04-29 07:57:24 +0000 | [diff] [blame] | 29 | void anchor() override; |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 30 | |
| 31 | unsigned TIDReg; |
Matt Arsenault | 5b22dfa | 2015-11-05 05:27:10 +0000 | [diff] [blame] | 32 | bool HasSpilledSGPRs; |
Tom Stellard | 42fb60e | 2015-01-14 15:42:31 +0000 | [diff] [blame] | 33 | bool HasSpilledVGPRs; |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 34 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 35 | public: |
Tom Stellard | c149dc0 | 2013-11-27 21:23:35 +0000 | [diff] [blame] | 36 | |
| 37 | struct SpilledReg { |
| 38 | unsigned VGPR; |
| 39 | int Lane; |
| 40 | SpilledReg(unsigned R, int L) : VGPR (R), Lane (L) { } |
| 41 | SpilledReg() : VGPR(0), Lane(-1) { } |
| 42 | bool hasLane() { return Lane != -1;} |
| 43 | }; |
| 44 | |
Tom Stellard | c149dc0 | 2013-11-27 21:23:35 +0000 | [diff] [blame] | 45 | // SIMachineFunctionInfo definition |
| 46 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 47 | SIMachineFunctionInfo(const MachineFunction &MF); |
Tom Stellard | c5cf2f0 | 2014-08-21 20:40:54 +0000 | [diff] [blame] | 48 | SpilledReg getSpilledReg(MachineFunction *MF, unsigned FrameIndex, |
| 49 | unsigned SubIdx); |
Christian Konig | 99ee0f4 | 2013-03-07 09:04:14 +0000 | [diff] [blame] | 50 | unsigned PSInputAddr; |
Tom Stellard | b02094e | 2014-07-21 15:45:01 +0000 | [diff] [blame] | 51 | unsigned NumUserSGPRs; |
Tom Stellard | c5cf2f0 | 2014-08-21 20:40:54 +0000 | [diff] [blame] | 52 | std::map<unsigned, unsigned> LaneVGPRs; |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 53 | unsigned LDSWaveSpillSize; |
Tom Stellard | e99fb65 | 2015-01-20 19:33:04 +0000 | [diff] [blame] | 54 | unsigned ScratchOffsetReg; |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 55 | bool hasCalculatedTID() const { return TIDReg != AMDGPU::NoRegister; }; |
| 56 | unsigned getTIDReg() const { return TIDReg; }; |
| 57 | void setTIDReg(unsigned Reg) { TIDReg = Reg; } |
Matt Arsenault | 5b22dfa | 2015-11-05 05:27:10 +0000 | [diff] [blame] | 58 | |
| 59 | bool hasSpilledSGPRs() const { |
| 60 | return HasSpilledSGPRs; |
| 61 | } |
| 62 | |
| 63 | void setHasSpilledSGPRs(bool Spill = true) { |
| 64 | HasSpilledSGPRs = Spill; |
| 65 | } |
| 66 | |
| 67 | bool hasSpilledVGPRs() const { |
| 68 | return HasSpilledVGPRs; |
| 69 | } |
| 70 | |
| 71 | void setHasSpilledVGPRs(bool Spill = true) { |
| 72 | HasSpilledVGPRs = Spill; |
| 73 | } |
Tom Stellard | 9646890 | 2014-09-24 01:33:17 +0000 | [diff] [blame] | 74 | |
| 75 | unsigned getMaximumWorkGroupSize(const MachineFunction &MF) const; |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } // End namespace llvm |
| 79 | |
| 80 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 81 | #endif |