Commit baee5161 authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏘
Browse files

Convert Conditionals in the conditional expression of another Conditional to BEGuardNodes

parent ffd5905b
......@@ -1237,7 +1237,7 @@ convertRootExpr aliasDummyId (Let {let_expr}) main_dcl_module_n varHeap
= convertRootExpr aliasDummyId let_expr main_dcl_module_n varHeap
convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=Yes else}) main_dcl_module_n varHeap
= beGuardNode
(convertExpr cond main_dcl_module_n varHeap)
(convertCondExpr cond main_dcl_module_n varHeap)
(convertRhsNodeDefs aliasDummyId then main_dcl_module_n varHeap)
(convertRhsStrictNodeIds then varHeap)
(convertRootExpr aliasDummyId then main_dcl_module_n varHeap)
......@@ -1246,7 +1246,7 @@ convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=Y
(convertRootExpr aliasDummyId else main_dcl_module_n varHeap)
convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=No}) main_dcl_module_n varHeap
= beGuardNode
(convertExpr cond main_dcl_module_n varHeap)
(convertCondExpr cond main_dcl_module_n varHeap)
(convertRhsNodeDefs aliasDummyId then main_dcl_module_n varHeap)
(convertRhsStrictNodeIds then varHeap)
(convertRootExpr aliasDummyId then main_dcl_module_n varHeap)
......@@ -1256,6 +1256,19 @@ convertRootExpr aliasDummyId (Conditional {if_cond=cond, if_then=then, if_else=N
convertRootExpr _ expr main_dcl_module_n varHeap
= convertExpr expr main_dcl_module_n varHeap
convertCondExpr :: Expression Int VarHeap -> BEMonad BENodeP
convertCondExpr (Conditional {if_cond=cond, if_then=then, if_else=Yes else}) main_dcl_module_n varHeap
= beGuardNode
(convertCondExpr cond main_dcl_module_n varHeap)
beNoNodeDefs
beNoStrictNodeIds
(convertCondExpr then main_dcl_module_n varHeap)
beNoNodeDefs
beNoStrictNodeIds
(convertCondExpr else main_dcl_module_n varHeap)
convertCondExpr expr main_dcl_module_n varHeap
= convertExpr expr main_dcl_module_n varHeap
// RWS +++ rewrite
convertLhsNodeDefs :: [FunctionPattern] BENodeDefP VarHeap -> BEMonad BENodeDefP
convertLhsNodeDefs [FP_Basic value (Yes freeVar) : patterns] nodeDefs varHeap
......@@ -1463,8 +1476,10 @@ where
= 1
arity (Yes {glob_object={ds_arity}})
= ds_arity
// this alternative should be deleted (can't occur)
convertExpr (Conditional {if_cond=cond, if_then, if_else=Yes else}) varHeap
= beIfNode (convertExpr cond varHeap) (convertExpr if_then varHeap) (convertExpr else varHeap)
convertExpr expr _
= undef <<- ("backendconvert, convertExpr: unknown expression", expr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment