From d0a9db06f53d26fed2294e49c8cadf8d03acd226 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 24 Oct 2020 13:20:42 -0400 Subject: [PATCH] Add Into instance for OptLevel --- compiler/gen/src/llvm/build.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/gen/src/llvm/build.rs b/compiler/gen/src/llvm/build.rs index 3024a29fb7..abde3b5437 100644 --- a/compiler/gen/src/llvm/build.rs +++ b/compiler/gen/src/llvm/build.rs @@ -50,6 +50,15 @@ pub enum OptLevel { Optimize, } +impl Into for OptLevel { + fn into(self) -> OptimizationLevel { + match self { + OptLevel::Normal => OptimizationLevel::None, + OptLevel::Optimize => OptimizationLevel::Aggressive, + } + } +} + #[derive(Default, Debug, Clone, PartialEq)] pub struct Scope<'a, 'ctx> { symbols: ImMap, PointerValue<'ctx>)>,