Skip to content

Commit

Permalink
potential IR for mkList (SOA)
Browse files Browse the repository at this point in the history
  • Loading branch information
vidsinghal committed Dec 2, 2024
1 parent 01d020c commit ffb7325
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gibbon-compiler/examples/soa_ir_examples/mkList.gibbon
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ mkList length_14_82_117 =
-- SoA IR representation
{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False}}
mkList :: Int -> List
{locvars [LRM {lrmLoc = SoA "loc_140",
{locvars [LRM {lrmLoc = SoA "loc_140" [(("Cons", 0), "loc_141")],
lrmReg = SoAR (VarR "r_141") [("Cons", 0), (VarR "r_142")],
lrmMode = Output}],
effs: [],
locrets: [],
parallel: False}
mkList length_14_82_117 =
letloc (Single "loc_175") = ((Single "loc_140") + 1) in
letloc (Single "loc_176") = ((Single "loc_175") + 8) in
-- This may need a new IR primitive?? to increment an SoA loc.
letloc (SoA "loc_175" [(("Cons", 0), "loc_176")]) = (SoA ("loc_175" + 1) [(("Cons", 0), ("loc_141" + 8))]) in
let fltIf_97_118 :: Bool = <=(length_14_82_117, 0) in
if fltIf_97_118
then (Nil (Single "loc_140"))
then (Nil (SoA "loc_140" [(("Cons", 0), "loc_141")]))
else let fltAppE_98_119 :: Int = length_14_82_117 - 1 in
let rst_15_83_120 :: (Packed List (Single "loc_176")) = (mkList [(Single "loc_176")] fltAppE_98_119) in
(Cons (Single "loc_140") length_14_82_117 rst_15_83_120)
let rst_15_83_120 :: (Packed List (SoA "loc_175" [(("Cons", 0), "loc_176")])) = (mkList [(SoA "loc_175" [(("Cons", 0), "loc_176")])] fltAppE_98_119) in
(Cons (SoA "loc_140" [(("Cons", 0), "loc_141")]) length_14_82_117 rst_15_83_120)

0 comments on commit ffb7325

Please sign in to comment.