1b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum//=- HexagonMachineFuctionInfo.h - Hexagon machine function info --*- C++ -*-=// 2b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// 3b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// The LLVM Compiler Infrastructure 4b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// 5b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// This file is distributed under the University of Illinois Open Source 6b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// License. See LICENSE.TXT for details. 7b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum// 8b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum//===----------------------------------------------------------------------===// 9b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 10b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum#ifndef HexagonMACHINEFUNCTIONINFO_H 11b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum#define HexagonMACHINEFUNCTIONINFO_H 12b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 13b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum#include "llvm/CodeGen/MachineFunction.h" 14b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 15b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicumnamespace llvm { 16b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 17b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum namespace Hexagon { 18b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum const unsigned int StartPacket = 0x1; 19b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum const unsigned int EndPacket = 0x2; 20b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 21b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 22b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 23b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum/// Hexagon target-specific information for each MachineFunction. 24b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicumclass HexagonMachineFunctionInfo : public MachineFunctionInfo { 25b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum // SRetReturnReg - Some subtargets require that sret lowering includes 26b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum // returning the value of the returned struct in a register. This field 27b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum // holds the virtual register into which the sret argument is passed. 28b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum unsigned SRetReturnReg; 29b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum std::vector<MachineInstr*> AllocaAdjustInsts; 30b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum int VarArgsFrameIndex; 31b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum bool HasClobberLR; 32b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 33b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum std::map<const MachineInstr*, unsigned> PacketInfo; 34b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 35b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 36b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicumpublic: 37b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum HexagonMachineFunctionInfo() : SRetReturnReg(0), HasClobberLR(0) {} 38b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 39b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum HexagonMachineFunctionInfo(MachineFunction &MF) : SRetReturnReg(0), 40b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum HasClobberLR(0) {} 41b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 42b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum unsigned getSRetReturnReg() const { return SRetReturnReg; } 43b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } 44b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 45b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void addAllocaAdjustInst(MachineInstr* MI) { 46b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum AllocaAdjustInsts.push_back(MI); 47b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 48b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum const std::vector<MachineInstr*>& getAllocaAdjustInsts() { 49b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum return AllocaAdjustInsts; 50b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 51b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 52b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; } 53b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum int getVarArgsFrameIndex() { return VarArgsFrameIndex; } 54b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 55b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void setStartPacket(MachineInstr* MI) { 56b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum PacketInfo[MI] |= Hexagon::StartPacket; 57b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 58b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void setEndPacket(MachineInstr* MI) { 59b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum PacketInfo[MI] |= Hexagon::EndPacket; 60b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 61b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum bool isStartPacket(const MachineInstr* MI) const { 62b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum return (PacketInfo.count(MI) && 63b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum (PacketInfo.find(MI)->second & Hexagon::StartPacket)); 64b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 65b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum bool isEndPacket(const MachineInstr* MI) const { 66b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum return (PacketInfo.count(MI) && 67b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum (PacketInfo.find(MI)->second & Hexagon::EndPacket)); 68b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum } 69b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum void setHasClobberLR(bool v) { HasClobberLR = v; } 70b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum bool hasClobberLR() const { return HasClobberLR; } 71b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 72b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum}; 73b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum} // End llvm namespace 74b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum 75b4b54153ad760c69a00a08531abef4ed434a5092Tony Linthicum#endif 76