Skip to content

Commit 1fa9978

Browse files
committed
temp
1 parent 6e9da14 commit 1fa9978

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs

+53-3
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,9 @@ module Pass4_RewriteAssembly =
969969
// let f<tps> vss = fHat<f_freeTypars> f_freeVars vss
970970
// let fHat<tps> f_freeVars vss = f_body[<f_freeTypars>, f_freeVars]
971971
let TransTLRBindings penv (binds: Bindings) =
972+
973+
printfn $"TransTLRBindings:\t\t{binds}"
974+
972975
let g = penv.g
973976
if isNil binds then [], [] else
974977
let fc = BindingGroupSharingSameReqdItems binds
@@ -1035,6 +1038,9 @@ module Pass4_RewriteAssembly =
10351038
if penv.topValS.Contains(bind.Var) then AdjustBindToValRepr penv.g bind
10361039

10371040
let TransBindings xisRec penv (binds: Bindings) =
1041+
1042+
printfn $"TransBindings:\t\t{xisRec}\t\t{binds}"
1043+
10381044
let tlrBs, nonTlrBs = binds |> List.partition (fun b -> Zset.contains b.Var penv.tlrS)
10391045
let fclass = BindingGroupSharingSameReqdItems tlrBs
10401046

@@ -1059,6 +1065,9 @@ module Pass4_RewriteAssembly =
10591065
//-------------------------------------------------------------------------
10601066

10611067
let TransApp penv (fx, fty, tys, args, m) =
1068+
1069+
printfn $"TransApp:\t\t{fx}\t\t{fty}\t\t{tys}\t\tRange:{m}"
1070+
10621071
// Is it a val app, where the val f is TLR with arity wf?
10631072
// CLEANUP NOTE: should be using a mkApps to make all applications
10641073
match fx with
@@ -1090,6 +1099,9 @@ module Pass4_RewriteAssembly =
10901099
/// At free vals, fixup 0-call if it is an arity-met constant.
10911100
/// Other cases rewrite structurally.
10921101
let rec TransExpr (penv: RewriteContext) (z: RewriteState) expr: Expr * RewriteState =
1102+
1103+
printfn $"TransExpr:\t\t{expr}"
1104+
10931105
penv.stackGuard.Guard <| fun () ->
10941106

10951107
match expr with
@@ -1198,6 +1210,9 @@ module Pass4_RewriteAssembly =
11981210
/// Walk over linear structured terms in tail-recursive loop, using a continuation
11991211
/// to represent the rebuild-the-term stack
12001212
and TransLinearExpr penv z expr (contf: Expr * RewriteState -> Expr * RewriteState) =
1213+
1214+
printfn $"TransLinearExpr:\t\t{expr}"
1215+
12011216
match expr with
12021217
| Expr.Sequential (e1, e2, dir, m) ->
12031218
let e1, z = TransExpr penv z e1
@@ -1261,17 +1276,26 @@ module Pass4_RewriteAssembly =
12611276
contf (TransExpr penv z expr)
12621277

12631278
and TransMethod penv (z: RewriteState) (TObjExprMethod(slotsig, attribs, tps, vs, e, m)) =
1279+
1280+
printfn $"TransMethod:\t\t{vs}\t\t{e}\t\t{m}"
1281+
12641282
let z = EnterInner z
12651283
let e, z = TransExpr penv z e
12661284
let z = ExitInner z
12671285
TObjExprMethod(slotsig, attribs, tps, vs, e, m), z
12681286

12691287
and TransBindingRhs penv z (TBind(v, e, letSeqPtOpt)) : Binding * RewriteState =
1288+
1289+
printfn $"TransBindingRhs:\t\t{e}"
1290+
12701291
let shouldInline = v.ShouldInline
12711292
let z, e = EnterShouldInline shouldInline z (fun z -> TransExpr penv z e)
12721293
TBind (v, e, letSeqPtOpt), z
12731294

12741295
and TransDecisionTree penv z x: DecisionTree * RewriteState =
1296+
1297+
printfn $"TransDecisionTree:\t\t{x}"
1298+
12751299
match x with
12761300
| TDSuccess (es, n) ->
12771301
let es, z = List.mapFold (TransExpr penv) z es
@@ -1293,16 +1317,30 @@ module Pass4_RewriteAssembly =
12931317
TDSwitch (e, cases, dflt, m), z
12941318

12951319
and TransDecisionTreeTarget penv z (TTarget(vs, e, flags)) =
1320+
1321+
printfn $"TransDecisionTreeTarget:\t\t{vs}\t\t{e}"
1322+
12961323
let z = EnterInner z
12971324
let e, z = TransExpr penv z e
12981325
let z = ExitInner z
12991326
TTarget(vs, e, flags), z
13001327

1301-
and TransValBinding penv z bind = TransBindingRhs penv z bind
1328+
and TransValBinding penv z bind =
1329+
1330+
printfn $"TransBindingRhs:\t\t{bind}"
1331+
1332+
TransBindingRhs penv z bind
13021333

1303-
and TransValBindings penv z binds = List.mapFold (TransValBinding penv) z binds
1334+
and TransValBindings penv z binds =
1335+
1336+
printfn $"TransBindingRhs:\t\t{binds}"
1337+
1338+
List.mapFold (TransValBinding penv) z binds
13041339

13051340
and TransModuleContents penv (z: RewriteState) x: ModuleOrNamespaceContents * RewriteState =
1341+
1342+
printfn $"TransBindingRhs:\t\t{x}"
1343+
13061344
match x with
13071345
| TMDefRec(isRec, opens, tycons, mbinds, m) ->
13081346
let mbinds, z = TransModuleBindings penv z mbinds
@@ -1319,9 +1357,16 @@ module Pass4_RewriteAssembly =
13191357
| TMDefOpens _ ->
13201358
x, z
13211359

1322-
and TransModuleBindings penv z binds = List.mapFold (TransModuleBinding penv) z binds
1360+
and TransModuleBindings penv z binds =
1361+
1362+
printfn $"TransBindingRhs:\t\t{binds}"
1363+
1364+
List.mapFold (TransModuleBinding penv) z binds
13231365

13241366
and TransModuleBinding penv z x =
1367+
1368+
printfn $"TransBindingRhs:\t\t{x}"
1369+
13251370
match x with
13261371
| ModuleOrNamespaceBinding.Binding bind ->
13271372
let bind, z = TransValBinding penv z bind
@@ -1331,6 +1376,9 @@ module Pass4_RewriteAssembly =
13311376
ModuleOrNamespaceBinding.Module(nm, rhs), z
13321377

13331378
let TransImplFile penv z (CheckedImplFile (fragName, pragmas, signature, contents, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)) =
1379+
1380+
printfn $"TransImplFile:\t\t{fragName}"
1381+
13341382
let contentsR, z = TransModuleContents penv z contents
13351383
(CheckedImplFile (fragName, pragmas, signature, contentsR, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)), z
13361384

@@ -1374,6 +1422,8 @@ let MakeTopLevelRepresentationDecisions ccu g expr =
13741422
let z = Pass4_RewriteAssembly.rewriteState0
13751423
Pass4_RewriteAssembly.TransImplFile penv z expr
13761424

1425+
printfn $"Finished"
1426+
13771427
// pass5: copyExpr to restore "each bound is unique" property
13781428
// aka, copyExpr
13791429
if verboseTLR then dprintf "copyExpr------\n"

0 commit comments

Comments
 (0)