19
19
#include " llvm/CodeGen/MachineModuleInfo.h"
20
20
#include " llvm/CodeGen/MachineRegisterInfo.h"
21
21
#include " llvm/CodeGen/TargetInstrInfo.h"
22
- #include " llvm/CodeGen/TargetLowering.h"
23
22
#include " llvm/CodeGen/TargetPassConfig.h"
24
23
#include " llvm/CodeGen/TargetSubtargetInfo.h"
25
24
#include " llvm/ExecutionEngine/Orc/LLJIT.h"
@@ -61,17 +60,7 @@ static bool generateSnippetSetupCode(
61
60
}
62
61
BBF.addInstructions (ET.setStackRegisterToAuxMem ());
63
62
}
64
- Register StackPointerRegister = BBF.MF .getSubtarget ()
65
- .getTargetLowering ()
66
- ->getStackPointerRegisterToSaveRestore ();
67
63
for (const RegisterValue &RV : RegisterInitialValues) {
68
- if (GenerateMemoryInstructions) {
69
- // If we're generating memory instructions, don't load in the value for
70
- // the register with the stack pointer as it will be used later to finish
71
- // the setup.
72
- if (RV.Register == StackPointerRegister)
73
- continue ;
74
- }
75
64
// Load a constant in the register.
76
65
const auto SetRegisterCode = ET.setRegTo (*MSI, RV.Register , RV.Value );
77
66
if (SetRegisterCode.empty ())
@@ -82,18 +71,6 @@ static bool generateSnippetSetupCode(
82
71
#ifdef HAVE_LIBPFM
83
72
BBF.addInstructions (ET.configurePerfCounter (PERF_EVENT_IOC_RESET, true ));
84
73
#endif // HAVE_LIBPFM
85
- for (const RegisterValue &RV : RegisterInitialValues) {
86
- // Load in the stack register now as we're done using it elsewhere
87
- // and need to set the value in preparation for executing the
88
- // snippet.
89
- if (RV.Register == StackPointerRegister)
90
- continue ;
91
- const auto SetRegisterCode = ET.setRegTo (*MSI, RV.Register , RV.Value );
92
- if (SetRegisterCode.empty ())
93
- IsSnippetSetupComplete = false ;
94
- BBF.addInstructions (SetRegisterCode);
95
- break ;
96
- }
97
74
}
98
75
return IsSnippetSetupComplete;
99
76
}
0 commit comments