1616#include " MCTargetDesc/EVMMCTargetDesc.h"
1717#include " llvm/CodeGen/MIRYamlMapping.h"
1818#include " llvm/CodeGen/MachineRegisterInfo.h"
19- #include " llvm/MC/MCSymbolWasm.h"
2019
2120namespace llvm {
2221
22+ class EVMMachineFunctionInfo ;
23+
24+ namespace yaml {
25+
26+ struct EVMMachineFunctionInfo final : public yaml::MachineFunctionInfo {
27+ bool IsStackified = false ;
28+
29+ EVMMachineFunctionInfo () = default ;
30+ explicit EVMMachineFunctionInfo (const llvm::EVMMachineFunctionInfo &MFI);
31+ ~EVMMachineFunctionInfo () override ;
32+
33+ void mappingImpl (yaml::IO &YamlIO) override ;
34+ };
35+
36+ template <> struct MappingTraits <EVMMachineFunctionInfo> {
37+ static void mapping (IO &YamlIO, EVMMachineFunctionInfo &MFI) {
38+ YamlIO.mapOptional (" isStackified" , MFI.IsStackified , false );
39+ }
40+ };
41+ } // end namespace yaml
42+
2343// / This class is derived from MachineFunctionInfo and contains private
2444// / EVM-specific information for each MachineFunction.
25- class EVMFunctionInfo final : public MachineFunctionInfo {
45+ class EVMMachineFunctionInfo final : public MachineFunctionInfo {
2646 // / A mapping from CodeGen vreg index to a boolean value indicating whether
2747 // / the given register is considered to be "stackified", meaning it has been
2848 // / determined or made to meet the stack requirements:
@@ -34,16 +54,21 @@ class EVMFunctionInfo final : public MachineFunctionInfo {
3454 // / Number of parameters. Their type doesn't matter as it always is i256.
3555 unsigned NumberOfParameters = 0 ;
3656
57+ // / If the MF's instructions are in 'stack' form.
58+ bool IsStackified = false ;
59+
3760public:
38- explicit EVMFunctionInfo (MachineFunction &MF) {}
39- EVMFunctionInfo (const Function &F, const TargetSubtargetInfo *STI) {}
40- ~EVMFunctionInfo () override ;
61+ explicit EVMMachineFunctionInfo (MachineFunction &MF) {}
62+ EVMMachineFunctionInfo (const Function &F, const TargetSubtargetInfo *STI) {}
63+ ~EVMMachineFunctionInfo () override ;
4164
4265 MachineFunctionInfo *
4366 clone (BumpPtrAllocator &Allocator, MachineFunction &DestMF,
4467 const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
4568 const override ;
4669
70+ void initializeBaseYamlFields (const yaml::EVMMachineFunctionInfo &YamlMFI);
71+
4772 void stackifyVReg (MachineRegisterInfo &MRI, unsigned VReg) {
4873 assert (MRI.getUniqueVRegDef (VReg));
4974 auto I = Register::virtReg2Index (VReg);
@@ -72,7 +97,12 @@ class EVMFunctionInfo final : public MachineFunctionInfo {
7297 unsigned getNumParams () const {
7398 return NumberOfParameters;
7499 }
100+
101+ void setIsStackified (bool Val = true ) { IsStackified = Val; }
102+
103+ bool getIsStackified () const { return IsStackified; }
75104};
105+
76106} // end namespace llvm
77107
78108#endif // LLVM_LIB_TARGET_EVM_EVMMACHINEFUNCTIONINFO_H
0 commit comments