diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2015-03-10 09:04:31 +0100 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2015-03-10 09:04:31 +0100 |
commit | 8257cbe459ef40ec08338e622de2d82236305e08 (patch) | |
tree | 5d7ebaac5f4da8fbc1be7e9bb5fdce2812b7c815 | |
parent | 0c8dd275e1dfd79d15ec7fadb2a34e66bc5815b6 (diff) | |
download | haskell-8257cbe459ef40ec08338e622de2d82236305e08.tar.gz |
Add a overview comment to CmmCreateSwitchPlan
that explains its purpose and the division between CmmCreateSwitchPlan
and CmmSwitch.
-rw-r--r-- | compiler/cmm/CmmCreateSwitchPlans.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/cmm/CmmCreateSwitchPlans.hs b/compiler/cmm/CmmCreateSwitchPlans.hs index 570ed6efb2..1b3ecb4443 100644 --- a/compiler/cmm/CmmCreateSwitchPlans.hs +++ b/compiler/cmm/CmmCreateSwitchPlans.hs @@ -14,6 +14,21 @@ import CmmSwitch import UniqSupply import DynFlags + +-- +-- This module replaces Switch statements as generated by the Stg -> Cmm +-- transformation, which might be huge and sparse and hence unsuitable for +-- assembly code, by proper constructs (if-then-else trees, dense jump tables). +-- +-- The actual, abstract strategy is determined by createSwitchPlan in +-- CmmSwitch and returned as a SwitchPlan; here is just the implementation in +-- terms of Cmm code. See Note [Cmm Switches, the general plan] in CmmSwitch. +-- +-- This division into different modules is both to clearly separte concerns, +-- but also because createSwitchPlan needs access to the constructors of +-- SwitchTargets, a data type exported abstractly by CmmSwitch. +-- + cmmCreateSwitchPlans :: DynFlags -> CmmGraph -> UniqSM CmmGraph cmmCreateSwitchPlans dflags g = do blocks' <- concat <$> mapM (visitSwitches dflags) (toBlockList g) |