|
16 | 16 | #include "llvm/ADT/ArrayRef.h" |
17 | 17 | #include "llvm/ADT/SmallVector.h" |
18 | 18 | #include "llvm/CodeGen/CallingConvLower.h" |
| 19 | +#include "llvm/CodeGen/MIRYamlMapping.h" |
19 | 20 | #include "llvm/CodeGen/MachineFunction.h" |
| 21 | +#include "llvm/Support/YAMLTraits.h" |
20 | 22 | #include <set> |
21 | 23 |
|
22 | 24 | namespace llvm { |
23 | 25 |
|
24 | 26 | enum AMXProgModelEnum { None = 0, DirectReg = 1, ManagedRA = 2 }; |
25 | 27 |
|
| 28 | +class X86MachineFunctionInfo; |
| 29 | + |
| 30 | +namespace yaml { |
| 31 | +template <> struct ScalarEnumerationTraits<AMXProgModelEnum> { |
| 32 | + static void enumeration(IO &YamlIO, AMXProgModelEnum &Value) { |
| 33 | + YamlIO.enumCase(Value, "None", AMXProgModelEnum::None); |
| 34 | + YamlIO.enumCase(Value, "DirectReg", AMXProgModelEnum::DirectReg); |
| 35 | + YamlIO.enumCase(Value, "ManagedRA", AMXProgModelEnum::ManagedRA); |
| 36 | + } |
| 37 | +}; |
| 38 | + |
| 39 | +struct X86MachineFunctionInfo final : public yaml::MachineFunctionInfo { |
| 40 | + AMXProgModelEnum AMXProgModel; |
| 41 | + |
| 42 | + X86MachineFunctionInfo() = default; |
| 43 | + X86MachineFunctionInfo(const llvm::X86MachineFunctionInfo &MFI); |
| 44 | + |
| 45 | + void mappingImpl(yaml::IO &YamlIO) override; |
| 46 | + ~X86MachineFunctionInfo() = default; |
| 47 | +}; |
| 48 | + |
| 49 | +template <> struct MappingTraits<X86MachineFunctionInfo> { |
| 50 | + static void mapping(IO &YamlIO, X86MachineFunctionInfo &MFI) { |
| 51 | + YamlIO.mapOptional("amxProgModel", MFI.AMXProgModel); |
| 52 | + } |
| 53 | +}; |
| 54 | +} // end namespace yaml |
| 55 | + |
26 | 56 | /// X86MachineFunctionInfo - This class is derived from MachineFunction and |
27 | 57 | /// contains private X86 target-specific information for each MachineFunction. |
28 | 58 | class X86MachineFunctionInfo : public MachineFunctionInfo { |
@@ -160,6 +190,8 @@ class X86MachineFunctionInfo : public MachineFunctionInfo { |
160 | 190 | const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) |
161 | 191 | const override; |
162 | 192 |
|
| 193 | + void initializeBaseYamlFields(const yaml::X86MachineFunctionInfo &YamlMFI); |
| 194 | + |
163 | 195 | bool getForceFramePointer() const { return ForceFramePointer;} |
164 | 196 | void setForceFramePointer(bool forceFP) { ForceFramePointer = forceFP; } |
165 | 197 |
|
|
0 commit comments