Commit a05ffbd9 authored by Jan Stolarek's avatar Jan Stolarek

Remove unused code

I am removing old loopification code that has been commented out
for long long time. We now have loopification implemented in
the code generator (see Note [Self-recursive tail calls]) so we
won't need to resurect this old code.
parent 738e2f12
......@@ -387,54 +387,6 @@ exactLog2 x_
pow2 x | x ==# _ILIT(1) = _ILIT(0)
| otherwise = _ILIT(1) +# pow2 (x `shiftR_FastInt` _ILIT(1))
-- -----------------------------------------------------------------------------
-- Loopify for C
{-
This is a simple pass that replaces tail-recursive functions like this:
fac() {
...
jump fac();
}
with this:
fac() {
L:
...
goto L;
}
the latter generates better C code, because the C compiler treats it
like a loop, and brings full loop optimisation to bear.
In my measurements this makes little or no difference to anything
except factorial, but what the hell.
-}
{-
cmmLoopifyForC :: DynFlags -> RawCmmDecl -> RawCmmDecl
-- XXX: revisit if we actually want to do this
-- cmmLoopifyForC p@(CmmProc Nothing _ _) = p -- only if there's an info table, ignore case alts
cmmLoopifyForC dflags (CmmProc infos entry_lbl live
(ListGraph blocks@(BasicBlock top_id _ : _))) =
-- pprTrace "jump_lbl" (ppr jump_lbl <+> ppr entry_lbl) $
CmmProc infos entry_lbl live (ListGraph blocks')
where blocks' = [ BasicBlock id (map do_stmt stmts)
| BasicBlock id stmts <- blocks ]
do_stmt (CmmJump (CmmLit (CmmLabel lbl)) _) | lbl == jump_lbl
= CmmBranch top_id
do_stmt stmt = stmt
jump_lbl | tablesNextToCode dflags = toInfoLbl entry_lbl
| otherwise = entry_lbl
cmmLoopifyForC _ top = top
-}
-- -----------------------------------------------------------------------------
-- Utils
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment