From 6ed2b113e346d97f3b05f2d37445d144d44d5bb7 Mon Sep 17 00:00:00 2001 From: Lukasz Czajka Date: Fri, 6 Oct 2023 19:52:16 +0200 Subject: [PATCH] pragma inline: always --- .../Optimize/MandatoryInlining.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Juvix/Compiler/Core/Transformation/Optimize/MandatoryInlining.hs diff --git a/src/Juvix/Compiler/Core/Transformation/Optimize/MandatoryInlining.hs b/src/Juvix/Compiler/Core/Transformation/Optimize/MandatoryInlining.hs new file mode 100644 index 0000000000..96b6b32848 --- /dev/null +++ b/src/Juvix/Compiler/Core/Transformation/Optimize/MandatoryInlining.hs @@ -0,0 +1,18 @@ +module Juvix.Compiler.Core.Transformation.Optimize.MandatoryInlining where + +import Juvix.Compiler.Core.Extra +import Juvix.Compiler.Core.Transformation.Base + +convertNode :: InfoTable -> Node -> Node +convertNode tab = dmap go + where + go :: Node -> Node + go node = case node of + NIdt Ident {..} + | Just InlineAlways <- lookupIdentifierInfo tab _identSymbol ^. identifierPragmas . pragmasInline -> + lookupIdentifierNode tab _identSymbol + _ -> + node + +mandatoryInlining :: InfoTable -> InfoTable +mandatoryInlining tab = mapAllNodes (convertNode tab) tab