2013-11-19 08:57:56 +08:00
|
|
|
//=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=//
|
2011-12-13 05:14:40 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-12-13 05:14:40 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2014-01-07 19:48:04 +08:00
|
|
|
#include <map>
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
namespace Hexagon {
|
|
|
|
|
2011-12-13 05:14:40 +08:00
|
|
|
const unsigned int StartPacket = 0x1;
|
|
|
|
const unsigned int EndPacket = 0x2;
|
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
} // end namespace Hexagon
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
/// Hexagon target-specific information for each MachineFunction.
|
|
|
|
class HexagonMachineFunctionInfo : public MachineFunctionInfo {
|
|
|
|
// SRetReturnReg - Some subtargets require that sret lowering includes
|
|
|
|
// returning the value of the returned struct in a register. This field
|
|
|
|
// holds the virtual register into which the sret argument is passed.
|
2017-01-04 10:02:05 +08:00
|
|
|
unsigned SRetReturnReg = 0;
|
|
|
|
unsigned StackAlignBaseVReg = 0; // Aligned-stack base register (virtual)
|
|
|
|
unsigned StackAlignBasePhysReg = 0; // (physical)
|
2011-12-13 05:14:40 +08:00
|
|
|
int VarArgsFrameIndex;
|
2017-01-04 10:02:05 +08:00
|
|
|
bool HasClobberLR = false;
|
|
|
|
bool HasEHReturn = false;
|
2011-12-13 05:14:40 +08:00
|
|
|
std::map<const MachineInstr*, unsigned> PacketInfo;
|
2013-11-19 08:57:56 +08:00
|
|
|
virtual void anchor();
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
public:
|
2017-01-04 10:02:05 +08:00
|
|
|
HexagonMachineFunctionInfo() = default;
|
2011-12-13 05:14:40 +08:00
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
HexagonMachineFunctionInfo(MachineFunction &MF) {}
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
unsigned getSRetReturnReg() const { return SRetReturnReg; }
|
|
|
|
void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
|
|
|
|
|
|
|
|
void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; }
|
|
|
|
int getVarArgsFrameIndex() { return VarArgsFrameIndex; }
|
|
|
|
|
|
|
|
void setStartPacket(MachineInstr* MI) {
|
|
|
|
PacketInfo[MI] |= Hexagon::StartPacket;
|
|
|
|
}
|
|
|
|
void setEndPacket(MachineInstr* MI) {
|
|
|
|
PacketInfo[MI] |= Hexagon::EndPacket;
|
|
|
|
}
|
|
|
|
bool isStartPacket(const MachineInstr* MI) const {
|
|
|
|
return (PacketInfo.count(MI) &&
|
|
|
|
(PacketInfo.find(MI)->second & Hexagon::StartPacket));
|
|
|
|
}
|
|
|
|
bool isEndPacket(const MachineInstr* MI) const {
|
|
|
|
return (PacketInfo.count(MI) &&
|
|
|
|
(PacketInfo.find(MI)->second & Hexagon::EndPacket));
|
|
|
|
}
|
|
|
|
void setHasClobberLR(bool v) { HasClobberLR = v; }
|
|
|
|
bool hasClobberLR() const { return HasClobberLR; }
|
|
|
|
|
2013-05-02 05:37:34 +08:00
|
|
|
bool hasEHReturn() const { return HasEHReturn; };
|
|
|
|
void setHasEHReturn(bool H = true) { HasEHReturn = H; };
|
2015-04-23 00:43:53 +08:00
|
|
|
|
2016-03-28 22:42:03 +08:00
|
|
|
void setStackAlignBaseVReg(unsigned R) { StackAlignBaseVReg = R; }
|
|
|
|
unsigned getStackAlignBaseVReg() const { return StackAlignBaseVReg; }
|
|
|
|
|
|
|
|
void setStackAlignBasePhysReg(unsigned R) { StackAlignBasePhysReg = R; }
|
|
|
|
unsigned getStackAlignBasePhysReg() const { return StackAlignBasePhysReg; }
|
2011-12-13 05:14:40 +08:00
|
|
|
};
|
|
|
|
|
2017-01-04 10:02:05 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
|