================
@@ -533,6 +617,21 @@ llvm::Expected<IncrementalExecutor &>
Interpreter::getExecutionEngine() {
return *IncrExecutor.get();
}
+void Interpreter::setOptLevel(unsigned OptLevel, unsigned OptSize) {
+ CodeGenerator *CG = Act->getCodeGen();
+ if (!CG)
+ return;
+
+ CodeGenOptions CGO = getCompilerInstance()->getCodeGenOpts();
+ CGO.OptimizationLevel = OptLevel;
+ CGO.OptimizeSize = OptSize;
+
+ // The next (empty) module was already staged with the old options; re-stage
+ // it so the new options apply to the next parsed input.
+ std::unique_ptr<llvm::Module> Empty(CG->ReleaseModule());
+ CG->StartModule("incr_module_opt", Empty->getContext(), CGO);
----------------
aaronj0 wrote:
This has been dropped. setOptLevel just updates the CodeGenOptions in the
CompilerInvocation, so nothing gets pushed or discarded, and whatever CodeGen
emits after the pragma picks up the new level. Which is the same as the cling
pragma.
https://github.com/llvm/llvm-project/pull/214793
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits