@@ -969,6 +969,9 @@ module Pass4_RewriteAssembly =
969
969
// let f<tps> vss = fHat<f_freeTypars> f_freeVars vss
970
970
// let fHat<tps> f_freeVars vss = f_body[<f_freeTypars>, f_freeVars]
971
971
let TransTLRBindings penv ( binds : Bindings ) =
972
+
973
+ printfn $" TransTLRBindings:\t\t {binds}"
974
+
972
975
let g = penv.g
973
976
if isNil binds then [], [] else
974
977
let fc = BindingGroupSharingSameReqdItems binds
@@ -1035,6 +1038,9 @@ module Pass4_RewriteAssembly =
1035
1038
if penv.topValS.Contains( bind.Var) then AdjustBindToValRepr penv.g bind
1036
1039
1037
1040
let TransBindings xisRec penv ( binds : Bindings ) =
1041
+
1042
+ printfn $" TransBindings:\t\t {xisRec}\t\t {binds}"
1043
+
1038
1044
let tlrBs , nonTlrBs = binds |> List.partition ( fun b -> Zset.contains b.Var penv.tlrS)
1039
1045
let fclass = BindingGroupSharingSameReqdItems tlrBs
1040
1046
@@ -1059,6 +1065,9 @@ module Pass4_RewriteAssembly =
1059
1065
//-------------------------------------------------------------------------
1060
1066
1061
1067
let TransApp penv ( fx , fty , tys , args , m ) =
1068
+
1069
+ printfn $" TransApp:\t\t {fx}\t\t {fty}\t\t {tys}\t\t Range:{m}"
1070
+
1062
1071
// Is it a val app, where the val f is TLR with arity wf?
1063
1072
// CLEANUP NOTE: should be using a mkApps to make all applications
1064
1073
match fx with
@@ -1090,6 +1099,9 @@ module Pass4_RewriteAssembly =
1090
1099
/// At free vals, fixup 0-call if it is an arity-met constant.
1091
1100
/// Other cases rewrite structurally.
1092
1101
let rec TransExpr ( penv : RewriteContext ) ( z : RewriteState ) expr : Expr * RewriteState =
1102
+
1103
+ printfn $" TransExpr:\t\t {expr}"
1104
+
1093
1105
penv.stackGuard.Guard <| fun () ->
1094
1106
1095
1107
match expr with
@@ -1198,6 +1210,9 @@ module Pass4_RewriteAssembly =
1198
1210
/// Walk over linear structured terms in tail-recursive loop, using a continuation
1199
1211
/// to represent the rebuild-the-term stack
1200
1212
and TransLinearExpr penv z expr ( contf : Expr * RewriteState -> Expr * RewriteState ) =
1213
+
1214
+ printfn $" TransLinearExpr:\t\t {expr}"
1215
+
1201
1216
match expr with
1202
1217
| Expr.Sequential ( e1, e2, dir, m) ->
1203
1218
let e1 , z = TransExpr penv z e1
@@ -1261,17 +1276,26 @@ module Pass4_RewriteAssembly =
1261
1276
contf ( TransExpr penv z expr)
1262
1277
1263
1278
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
+
1264
1282
let z = EnterInner z
1265
1283
let e , z = TransExpr penv z e
1266
1284
let z = ExitInner z
1267
1285
TObjExprMethod( slotsig, attribs, tps, vs, e, m), z
1268
1286
1269
1287
and TransBindingRhs penv z ( TBind ( v , e , letSeqPtOpt )) : Binding * RewriteState =
1288
+
1289
+ printfn $" TransBindingRhs:\t\t {e}"
1290
+
1270
1291
let shouldInline = v.ShouldInline
1271
1292
let z , e = EnterShouldInline shouldInline z ( fun z -> TransExpr penv z e)
1272
1293
TBind ( v, e, letSeqPtOpt), z
1273
1294
1274
1295
and TransDecisionTree penv z x : DecisionTree * RewriteState =
1296
+
1297
+ printfn $" TransDecisionTree:\t\t {x}"
1298
+
1275
1299
match x with
1276
1300
| TDSuccess ( es, n) ->
1277
1301
let es , z = List.mapFold ( TransExpr penv) z es
@@ -1293,16 +1317,30 @@ module Pass4_RewriteAssembly =
1293
1317
TDSwitch ( e, cases, dflt, m), z
1294
1318
1295
1319
and TransDecisionTreeTarget penv z ( TTarget ( vs , e , flags )) =
1320
+
1321
+ printfn $" TransDecisionTreeTarget:\t\t {vs}\t\t {e}"
1322
+
1296
1323
let z = EnterInner z
1297
1324
let e , z = TransExpr penv z e
1298
1325
let z = ExitInner z
1299
1326
TTarget( vs, e, flags), z
1300
1327
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
1302
1333
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
1304
1339
1305
1340
and TransModuleContents penv ( z : RewriteState ) x : ModuleOrNamespaceContents * RewriteState =
1341
+
1342
+ printfn $" TransBindingRhs:\t\t {x}"
1343
+
1306
1344
match x with
1307
1345
| TMDefRec( isRec, opens, tycons, mbinds, m) ->
1308
1346
let mbinds , z = TransModuleBindings penv z mbinds
@@ -1319,9 +1357,16 @@ module Pass4_RewriteAssembly =
1319
1357
| TMDefOpens _ ->
1320
1358
x, z
1321
1359
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
1323
1365
1324
1366
and TransModuleBinding penv z x =
1367
+
1368
+ printfn $" TransBindingRhs:\t\t {x}"
1369
+
1325
1370
match x with
1326
1371
| ModuleOrNamespaceBinding.Binding bind ->
1327
1372
let bind , z = TransValBinding penv z bind
@@ -1331,6 +1376,9 @@ module Pass4_RewriteAssembly =
1331
1376
ModuleOrNamespaceBinding.Module( nm, rhs), z
1332
1377
1333
1378
let TransImplFile penv z ( CheckedImplFile ( fragName , pragmas , signature , contents , hasExplicitEntryPoint , isScript , anonRecdTypes , namedDebugPointsForInlinedCode )) =
1379
+
1380
+ printfn $" TransImplFile:\t\t {fragName}"
1381
+
1334
1382
let contentsR , z = TransModuleContents penv z contents
1335
1383
( CheckedImplFile ( fragName, pragmas, signature, contentsR, hasExplicitEntryPoint, isScript, anonRecdTypes, namedDebugPointsForInlinedCode)), z
1336
1384
@@ -1374,6 +1422,8 @@ let MakeTopLevelRepresentationDecisions ccu g expr =
1374
1422
let z = Pass4_ RewriteAssembly.rewriteState0
1375
1423
Pass4_ RewriteAssembly.TransImplFile penv z expr
1376
1424
1425
+ printfn $" Finished"
1426
+
1377
1427
// pass5: copyExpr to restore "each bound is unique" property
1378
1428
// aka, copyExpr
1379
1429
if verboseTLR then dprintf " copyExpr------\n "
0 commit comments