Skip to content

Instantly share code, notes, and snippets.

@dmjio
Created June 27, 2020 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmjio/2846705df3fab6d62ecfe3754bd17614 to your computer and use it in GitHub Desktop.
Save dmjio/2846705df3fab6d62ecfe3754bd17614 to your computer and use it in GitHub Desktop.
==================== Output Cmm ====================
2020-06-27 01:29:07.434663996 UTC
[Test.test_entry() { // [R2]
{ info_tbls: [(cA7,
label: Test.test_info
rep: HeapRep static { Fun {arity: 1 fun_type: ArgSpec 5} }
srt: Just GHC.Num.$fNumInt_closure)]
stack_info: arg_space: 8
}
{offset
cA7: // global
_sA1::P64 = R2;
if ((Sp + 8) - 32 < SpLim) (likely: False) goto cA8; else goto cA9;
cA8: // global
R2 = _sA1::P64;
R1 = Test.test_closure;
call (stg_gc_fun)(R2, R1) args: 8, res: 0, upd: 8;
cA9: // global
R2 = GHC.Num.$fNumInt_closure;
I64[Sp - 24] = stg_ap_pp_info;
P64[Sp - 16] = _sA1::P64;
P64[Sp - 8] = stg_INTLIKE_closure+273;
Sp = Sp - 24;
call GHC.Num.+_info(R2) args: 32, res: 0, upd: 8;
}
},
section ""data" . Test.test_closure" {
Test.test_closure:
const Test.test_info;
const 0;
}]
==================== STG: ====================
2020-06-27 01:29:07.396491195 UTC
$trModule1_rxz :: GHC.Prim.Addr#
[GblId, Unf=OtherCon []] =
"main"#;
$trModule2_rxF :: GHC.Types.TrName
[GblId, Unf=OtherCon []] =
CCS_DONT_CARE GHC.Types.TrNameS! [$trModule1_rxz];
$trModule3_rxG :: GHC.Prim.Addr#
[GblId, Unf=OtherCon []] =
"Test"#;
$trModule4_rxH :: GHC.Types.TrName
[GblId, Unf=OtherCon []] =
CCS_DONT_CARE GHC.Types.TrNameS! [$trModule3_rxG];
Test.$trModule :: GHC.Types.Module
[GblId, Unf=OtherCon []] =
CCS_DONT_CARE GHC.Types.Module! [$trModule2_rxF $trModule4_rxH];
Test.test [InlPrag=NOINLINE] :: GHC.Types.Int -> GHC.Types.Int
[GblId, Arity=1, Unf=OtherCon []] =
\r [n_sA1]
let {
sat_sA2 [Occ=Once] :: GHC.Types.Int
[LclId] =
CCCS GHC.Types.I#! [1#];
} in GHC.Num.+ GHC.Num.$fNumInt n_sA1 sat_sA2;
module Test where
test :: Int -> Int
test n = n + 1
{-# NOINLINE test #-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment