Changes between Version 49 and Version 50 of Internships/JanStolarek


Ignore:
Timestamp:
Oct 8, 2013 8:42:26 AM (2 years ago)
Author:
jstolarek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Internships/JanStolarek

    v49 v50  
    22
    33= Wise people say... =
    4 
    5 Geoffrey:
    6   - In the past, LLVM could not recognize all loops output by the LLVm back end as loops. Perhaps that has changed.
    7   - Answering the question "What does loopification do that isn't already being done?" would still be useful
    8   - So figuring out how to make LLVM recognize more loops would be good.
    9   - if you write a simple, tight loop in Haskell of the sort a C compiler would vectorize, will LLVm vectorize it? If not, why?
    104
    115Austin Seipp:
     
    6155  * Simon M. says: The !CmmSink pass before stack layout is disabled because I never got around to measuring it to determine whether it is a good idea or not. By all means do that!
    6256
    63 == Cleaning up the STG ->Cmm pass ==
    64 When generating Cmm from STG there is some [wiki:Commentary/Rts/Storage/GC/CAFs SRT information] being generated. It is not used and has to be rebuilt anyway after converting to CPS Cmm. Below are some random notes and pieces of code that might related to this:
    65  
    66   * Cmm conversions in the compiler pipeline: `main/HscMain.hs` has `tryNewCodeGen` (l. 1300), which first calls `StgCmm.codegen` and then passes the generated Cmm to `cmmPipeline` function from `cmm/CmmPipeline.hs`. According to Austin Seipp `cpsTop` in `cmm/CmmPipeline.hs` takes care of converting to CPS: "yeah, !CmmPipeline does take care of it. it's partially cpsTop that does it, and doSRTs elaborates the top-level info tables and stuff beyond that but mostly cpsTop. i think your general turning point is after the stack layout and stack pointer manifestation".
    67 
    68 This code in `cmm/Cmm.hs` that might be relevant (or not):
    69 
    70 {{{
    71 -- (line 141 and onwards)
    72 -- | Info table as a haskell data type
    73 data CmmInfoTable
    74   = CmmInfoTable {
    75       cit_lbl  :: CLabel, -- Info table label
    76       cit_rep  :: SMRep,
    77       cit_prof :: ProfilingInfo,
    78       cit_srt  :: C_SRT
    79     }
    80 
    81 data ProfilingInfo
    82   = NoProfilingInfo
    83   | ProfilingInfo [Word8] [Word8] -- closure_type, closure_desc
    84 
    85 -- C_SRT is what StgSyn.SRT gets translated to...
    86 -- we add a label for the table, and expect only the 'offset/length' form
    87 
    88 data C_SRT = NoC_SRT
    89            | C_SRT !CLabel !WordOff !StgHalfWord {-bitmap or escape-}
    90            deriving (Eq)
    91 
    92 needsSRT :: C_SRT -> Bool
    93 needsSRT NoC_SRT       = False
    94 needsSRT (C_SRT _ _ _) = True
    95 }}}
    96 
    97 
    98 == Random code ==
    99   * `main/HscMain.lhs:1300``. Is:
    100 
    101 {{{
    102 | otherwise
    103   = {-# SCC "cmmPipeline" #-}
    104     let initTopSRT = initUs_ us emptySRT in
    105 
    106     let run_pipeline topSRT cmmgroup = do
    107           (topSRT, cmmgroup) <- cmmPipeline hsc_env topSRT cmmgroup
    108           return (topSRT,cmmgroup)
    109 
    110     in do topSRT <- Stream.mapAccumL run_pipeline initTopSRT ppr_stream1
    111           Stream.yield (srtToData topSRT)
    112 }}}
    113 
    114 The `<- / return` sequence in the definition of `run_pipeline` can be eliminated, which allows to remove the `do` notation, which allows to do eta-reduction, which (finally) allows to remove the `run_pipeline` binding and using `(cmmPipeline hsc_env)` instead:
    115 
    116 {{{
    117 | otherwise
    118   = {-# SCC "cmmPipeline" #-}
    119     let initTopSRT = initUs_ us emptySRT
    120     in do topSRT <- Stream.mapAccumL (cmmPipeline hsc_env) initTopSRT ppr_stream1
    121           Stream.yield (srtToData topSRT)
    122 }}}
    123 
    124   * `cmm/CmmUtils.hs`, function `toBlockListEntryFirst` - perhaps it would be safer to return a tuple in this case? This would probably make the invariant more explicit.
    125 
    126 == Wiki ==
    127 
    128   * [wiki:Commentary/Compiler/NewCodeGenPipeline NewCodeGenPipeline] has some outdated sections in the Cmm pipeline description: Add spill/reload, Rewrite assignments. So far I only marked them as OUTDATED
    129   * [wiki:Commentary/Compiler/NewCodeGenModules NewCodeGenModules] - mostly outdated. Mentioned data types and modules no longer exist.
    130 
    13157= Various stuff =
    13258Tickets that I could potentially look into:
     
    14167  * #8072 - Optimizations change result of div for Word
    14268
    143 Other things to do:
    144   * investigate opportunities for improving heap checks. An idea: if a worker knows its heap requirements it could pass them to the caller, thus avoiding the heap check. A question: how much time do we really spend on heap checks?
    145 
    14669Some LLVM notes that may be useful:
    14770  - [wiki:Commentary/Compiler/Backends/LLVM/Alias LLVM Alias Notes]