LLVM 23.0.0git
HexagonMachineFunctionInfo.h
Go to the documentation of this file.
1//=- HexagonMachineFunctionInfo.h - Hexagon machine function info -*- C++ -*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
10#define LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
11
14#include <map>
15
16namespace llvm {
17
18namespace yaml {
20} // end namespace yaml
21
22namespace Hexagon {
23
24 const unsigned int StartPacket = 0x1;
25 const unsigned int EndPacket = 0x2;
26
27} // end namespace Hexagon
28
29/// Hexagon target-specific information for each MachineFunction.
31 // SRetReturnReg - Some subtargets require that sret lowering includes
32 // returning the value of the returned struct in a register. This field
33 // holds the virtual register into which the sret argument is passed.
34 unsigned SRetReturnReg = 0;
35 Register StackAlignBaseReg = 0; // Aligned-stack base register
36 int VarArgsFrameIndex;
37 int RegSavedAreaStartFrameIndex;
38 int FirstNamedArgFrameIndex;
39 int LastNamedArgFrameIndex;
40 bool HasClobberLR = false;
41 bool HasEHReturn = false;
42 std::map<const MachineInstr*, unsigned> PacketInfo;
43 virtual void anchor();
44
45public:
47
50
54 const override;
55
57
58 unsigned getSRetReturnReg() const { return SRetReturnReg; }
59 void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
60
61 void setVarArgsFrameIndex(int v) { VarArgsFrameIndex = v; }
62 int getVarArgsFrameIndex() { return VarArgsFrameIndex; }
63
64 void setRegSavedAreaStartFrameIndex(int v) { RegSavedAreaStartFrameIndex = v;}
65 int getRegSavedAreaStartFrameIndex() { return RegSavedAreaStartFrameIndex; }
66
67 void setFirstNamedArgFrameIndex(int v) { FirstNamedArgFrameIndex = v; }
68 int getFirstNamedArgFrameIndex() { return FirstNamedArgFrameIndex; }
69
70 void setLastNamedArgFrameIndex(int v) { LastNamedArgFrameIndex = v; }
71 int getLastNamedArgFrameIndex() { return LastNamedArgFrameIndex; }
72
74 PacketInfo[MI] |= Hexagon::StartPacket;
75 }
77 PacketInfo[MI] |= Hexagon::EndPacket;
78 }
79 bool isStartPacket(const MachineInstr* MI) const {
80 auto It = PacketInfo.find(MI);
81 return It != PacketInfo.end() && (It->second & Hexagon::StartPacket);
82 }
83 bool isEndPacket(const MachineInstr* MI) const {
84 auto It = PacketInfo.find(MI);
85 return It != PacketInfo.end() && (It->second & Hexagon::EndPacket);
86 }
87 void setHasClobberLR(bool v) { HasClobberLR = v; }
88 bool hasClobberLR() const { return HasClobberLR; }
89
90 bool hasEHReturn() const { return HasEHReturn; };
91 void setHasEHReturn(bool H = true) { HasEHReturn = H; };
92
93 void setStackAlignBaseReg(Register R) { StackAlignBaseReg = R; }
94 Register getStackAlignBaseReg() const { return StackAlignBaseReg; }
95};
96
97namespace yaml {
98
99/// Hexagon-specific MachineFunction properties for YAML serialization.
110
112 static void mapping(IO &YamlIO, HexagonFunctionInfo &MFI) {
113 YamlIO.mapOptional("stackAlignBaseReg", MFI.StackAlignBaseReg);
114 }
115};
116
117} // end namespace yaml
118
119} // end namespace llvm
120
121#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONMACHINEFUNCTIONINFO_H
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
#define H(x, y, z)
Definition MD5.cpp:56
Register Reg
Register const TargetRegisterInfo * TRI
Basic Register Allocator
Hexagon target-specific information for each MachineFunction.
bool isStartPacket(const MachineInstr *MI) const
bool isEndPacket(const MachineInstr *MI) const
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
void initializeBaseYamlFields(const yaml::HexagonFunctionInfo &YamlMFI)
HexagonMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
void mapOptional(StringRef Key, T &Val)
Definition YAMLTraits.h:799
const unsigned int EndPacket
const unsigned int StartPacket
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Hexagon-specific MachineFunction properties for YAML serialization.
void mappingImpl(yaml::IO &YamlIO) override
~HexagonFunctionInfo() override=default
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
static void mapping(IO &YamlIO, HexagonFunctionInfo &MFI)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
Definition YAMLTraits.h:62
A wrapper around std::string which contains a source range that's being set during parsing.