Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 1 | //=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=// |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H |
| 11 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 12 | |
| 13 | #include "llvm/CodeGen/MachineFunction.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 14 | #include <map> |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 15 | |
| 16 | namespace llvm { |
| 17 | |
| 18 | namespace Hexagon { |
| 19 | const unsigned int StartPacket = 0x1; |
| 20 | const unsigned int EndPacket = 0x2; |
| 21 | } |
| 22 | |
| 23 | |
| 24 | /// Hexagon target-specific information for each MachineFunction. |
| 25 | class HexagonMachineFunctionInfo : public MachineFunctionInfo { |
| 26 | // SRetReturnReg - Some subtargets require that sret lowering includes |
| 27 | // returning the value of the returned struct in a register. This field |
| 28 | // holds the virtual register into which the sret argument is passed. |
| 29 | unsigned SRetReturnReg; |
| 30 | std::vector<MachineInstr*> AllocaAdjustInsts; |
| 31 | int VarArgsFrameIndex; |
| 32 | bool HasClobberLR; |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 33 | bool HasEHReturn; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 34 | std::map<const MachineInstr*, unsigned> PacketInfo; |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 35 | virtual void anchor(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 36 | |
| 37 | public: |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 38 | HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0), |
| 39 | HasEHReturn(false) {} |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 40 | |
| 41 | HexagonMachineFunctionInfo(MachineFunction &MF) : SRetReturnReg(0), |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 42 | HasClobberLR(0), |
| 43 | HasEHReturn(false) {} |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 44 | |
| 45 | unsigned getSRetReturnReg() const { return SRetReturnReg; } |
| 46 | void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } |
| 47 | |
| 48 | void addAllocaAdjustInst(MachineInstr* MI) { |
| 49 | AllocaAdjustInsts.push_back(MI); |
| 50 | } |
| 51 | const std::vector<MachineInstr*>& getAllocaAdjustInsts() { |
| 52 | return AllocaAdjustInsts; |
| 53 | } |
| 54 | |
| 55 | void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; } |
| 56 | int getVarArgsFrameIndex() { return VarArgsFrameIndex; } |
| 57 | |
| 58 | void setStartPacket(MachineInstr* MI) { |
| 59 | PacketInfo[MI] |= Hexagon::StartPacket; |
| 60 | } |
| 61 | void setEndPacket(MachineInstr* MI) { |
| 62 | PacketInfo[MI] |= Hexagon::EndPacket; |
| 63 | } |
| 64 | bool isStartPacket(const MachineInstr* MI) const { |
| 65 | return (PacketInfo.count(MI) && |
| 66 | (PacketInfo.find(MI)->second & Hexagon::StartPacket)); |
| 67 | } |
| 68 | bool isEndPacket(const MachineInstr* MI) const { |
| 69 | return (PacketInfo.count(MI) && |
| 70 | (PacketInfo.find(MI)->second & Hexagon::EndPacket)); |
| 71 | } |
| 72 | void setHasClobberLR(bool v) { HasClobberLR = v; } |
| 73 | bool hasClobberLR() const { return HasClobberLR; } |
| 74 | |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 75 | bool hasEHReturn() const { return HasEHReturn; }; |
| 76 | void setHasEHReturn(bool H = true) { HasEHReturn = H; }; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 77 | }; |
| 78 | } // End llvm namespace |
| 79 | |
| 80 | #endif |