================
@@ -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);
----------------
vgvassilev wrote:
In that case, if we trigger from within executing code, that will push a
`llvm::Module` possibly discarding the currently pushed module. I'd rather have
that state be read from within the pragmahandler when we start a new module.
https://github.com/llvm/llvm-project/pull/214793
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits