From d873a2646b259c3d70f1028c5249350890de03f9 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Wed, 20 Mar 2024 12:20:51 +0100 Subject: [PATCH] rename Reg.Const to Reg.ValConst --- src/Juvix/Compiler/Backend/C/Translation/FromReg.hs | 2 +- src/Juvix/Compiler/Casm/Translation/FromReg.hs | 8 ++++---- src/Juvix/Compiler/Core/Language/Base.hs | 2 +- src/Juvix/Compiler/Reg/Extra/Base.hs | 2 +- src/Juvix/Compiler/Reg/Extra/Info.hs | 2 +- src/Juvix/Compiler/Reg/Interpreter.hs | 2 +- src/Juvix/Compiler/Reg/Language.hs | 2 +- src/Juvix/Compiler/Reg/Pretty/Base.hs | 2 +- src/Juvix/Compiler/Reg/Transformation/InitBranchVars.hs | 2 +- src/Juvix/Compiler/Reg/Translation/FromAsm.hs | 2 +- src/Juvix/Compiler/Reg/Translation/FromSource.hs | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Juvix/Compiler/Backend/C/Translation/FromReg.hs b/src/Juvix/Compiler/Backend/C/Translation/FromReg.hs index d0d25fbeb0..145559d240 100644 --- a/src/Juvix/Compiler/Backend/C/Translation/FromReg.hs +++ b/src/Juvix/Compiler/Backend/C/Translation/FromReg.hs @@ -313,7 +313,7 @@ fromRegInstr bNoStack info = \case fromValue :: Reg.Value -> Expression fromValue = \case - Reg.Const c -> fromConst c + Reg.ValConst c -> fromConst c Reg.CRef Reg.ConstrField {..} -> case _constrFieldMemRep of Reg.MemRepConstr -> diff --git a/src/Juvix/Compiler/Casm/Translation/FromReg.hs b/src/Juvix/Compiler/Casm/Translation/FromReg.hs index b3261e6651..bf65a93727 100644 --- a/src/Juvix/Compiler/Casm/Translation/FromReg.hs +++ b/src/Juvix/Compiler/Casm/Translation/FromReg.hs @@ -110,13 +110,13 @@ fromReg tab = uncurry Result $ run $ runLabelInfoBuilderWithNextId (Reg.getNextS goValue :: Reg.Value -> ([Instruction], Value) goValue = \case - Reg.Const c -> ([], Imm $ goConst c) + Reg.ValConst c -> ([], Imm $ goConst c) Reg.CRef x -> ([mkAssignAp (goConstrField x)], Ref $ MemRef Ap (-1)) Reg.VRef x -> ([], Ref $ goVarRef x) goRValue :: Reg.Value -> RValue goRValue = \case - Reg.Const c -> Val $ Imm $ goConst c + Reg.ValConst c -> Val $ Imm $ goConst c Reg.CRef x -> goConstrField x Reg.VRef x -> Val $ Ref $ goVarRef x @@ -162,8 +162,8 @@ fromReg tab = uncurry Result $ run $ runLabelInfoBuilderWithNextId (Reg.getNextS goBinop :: Address -> Reg.InstrBinop -> Sem r [Instruction] goBinop addr x@Reg.InstrBinop {..} = case _instrBinopArg1 of - Reg.Const c1 -> case _instrBinopArg2 of - Reg.Const c2 -> case Reg.evalBinop' _instrBinopOpcode c1 c2 of + Reg.ValConst c1 -> case _instrBinopArg2 of + Reg.ValConst c2 -> case Reg.evalBinop' _instrBinopOpcode c1 c2 of Left err -> error err Right c -> return [mkAssign res (Val $ Imm $ goConst c)] diff --git a/src/Juvix/Compiler/Core/Language/Base.hs b/src/Juvix/Compiler/Core/Language/Base.hs index a307eecce5..5e70174eb9 100644 --- a/src/Juvix/Compiler/Core/Language/Base.hs +++ b/src/Juvix/Compiler/Core/Language/Base.hs @@ -12,7 +12,7 @@ import GHC.Show qualified as Show import Juvix.Compiler.Core.Info (Info, IsInfo, Key) import Juvix.Compiler.Core.Language.Builtins (BuiltinDataTag (..), builtinConstrArgsNum) import Juvix.Extra.Serialize -import Juvix.Prelude hiding (Const) +import Juvix.Prelude import Prettyprinter type Location = Interval diff --git a/src/Juvix/Compiler/Reg/Extra/Base.hs b/src/Juvix/Compiler/Reg/Extra/Base.hs index 42f2716447..b705f47b4b 100644 --- a/src/Juvix/Compiler/Reg/Extra/Base.hs +++ b/src/Juvix/Compiler/Reg/Extra/Base.hs @@ -53,7 +53,7 @@ overValueRefs f = \case goValue :: Value -> Value goValue = \case - Const c -> Const c + ValConst c -> ValConst c CRef x -> CRef $ goConstrField x VRef x -> VRef $ f x diff --git a/src/Juvix/Compiler/Reg/Extra/Info.hs b/src/Juvix/Compiler/Reg/Extra/Info.hs index 321dfc677d..386d77316c 100644 --- a/src/Juvix/Compiler/Reg/Extra/Info.hs +++ b/src/Juvix/Compiler/Reg/Extra/Info.hs @@ -144,7 +144,7 @@ computeStringMap strs = snd . run . execState (HashMap.size strs, strs) . mapM g goVal :: (Member (State (Int, HashMap Text Int)) r) => Value -> Sem r () goVal = \case - Const (ConstString str) -> + ValConst (ConstString str) -> modify' ( \(sid :: Int, sstrs) -> if diff --git a/src/Juvix/Compiler/Reg/Interpreter.hs b/src/Juvix/Compiler/Reg/Interpreter.hs index 692b4427e7..8a4d9e5aa8 100644 --- a/src/Juvix/Compiler/Reg/Interpreter.hs +++ b/src/Juvix/Compiler/Reg/Interpreter.hs @@ -88,7 +88,7 @@ runFunction hout infoTable args0 info0 = do readValue :: Args -> Vars s -> Value -> ST s Val readValue args tmps = \case - Const c -> return $ constantToValue c + ValConst c -> return $ constantToValue c CRef r -> readConstrRef args tmps r VRef r -> readVarRef args tmps r diff --git a/src/Juvix/Compiler/Reg/Language.hs b/src/Juvix/Compiler/Reg/Language.hs index eeeb1df5d2..327ad5ae5a 100644 --- a/src/Juvix/Compiler/Reg/Language.hs +++ b/src/Juvix/Compiler/Reg/Language.hs @@ -7,7 +7,7 @@ where import Juvix.Compiler.Reg.Language.Base data Value - = Const Constant + = ValConst Constant | CRef ConstrField | VRef VarRef diff --git a/src/Juvix/Compiler/Reg/Pretty/Base.hs b/src/Juvix/Compiler/Reg/Pretty/Base.hs index ba17525ccf..d5fd200ac6 100644 --- a/src/Juvix/Compiler/Reg/Pretty/Base.hs +++ b/src/Juvix/Compiler/Reg/Pretty/Base.hs @@ -43,7 +43,7 @@ instance PrettyCode ConstrField where instance PrettyCode Value where ppCode = \case - Const x -> Tree.ppCode x + ValConst x -> Tree.ppCode x CRef x -> ppCode x VRef x -> ppCode x diff --git a/src/Juvix/Compiler/Reg/Transformation/InitBranchVars.hs b/src/Juvix/Compiler/Reg/Transformation/InitBranchVars.hs index 5617cf122c..83f9b5957a 100644 --- a/src/Juvix/Compiler/Reg/Transformation/InitBranchVars.hs +++ b/src/Juvix/Compiler/Reg/Transformation/InitBranchVars.hs @@ -73,7 +73,7 @@ initBranchVars = mapT (const goFun) Assign InstrAssign { _instrAssignResult = vref, - _instrAssignValue = Const ConstVoid + _instrAssignValue = ValConst ConstVoid } checkInitialized :: InfoTable -> Bool diff --git a/src/Juvix/Compiler/Reg/Translation/FromAsm.hs b/src/Juvix/Compiler/Reg/Translation/FromAsm.hs index a1b75b325f..732999139b 100644 --- a/src/Juvix/Compiler/Reg/Translation/FromAsm.hs +++ b/src/Juvix/Compiler/Reg/Translation/FromAsm.hs @@ -131,7 +131,7 @@ fromAsmInstr funInfo tab si Asm.CmdInstr {..} = mkValue :: Asm.Value -> Value mkValue = \case - Asm.Constant c -> Const c + Asm.Constant c -> ValConst c Asm.Ref mv -> case mv of Asm.DRef dref -> VRef $ mkVar dref Asm.ConstrRef Asm.Field {..} -> diff --git a/src/Juvix/Compiler/Reg/Translation/FromSource.hs b/src/Juvix/Compiler/Reg/Translation/FromSource.hs index d3c3333110..6d2c60a92d 100644 --- a/src/Juvix/Compiler/Reg/Translation/FromSource.hs +++ b/src/Juvix/Compiler/Reg/Translation/FromSource.hs @@ -463,7 +463,7 @@ varTmp = do value :: (Members '[Reader ParserSig, InfoTableBuilder, State LocalParams] r) => ParsecS r Value -value = (Const <$> constant) <|> varOrConstrRef +value = (ValConst <$> constant) <|> varOrConstrRef varOrConstrRef :: (Members '[Reader ParserSig, InfoTableBuilder, State LocalParams] r) =>