HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Cmm.Utils

  • 86 values
  • Packageghc-9.10.3
  • Exports86
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceUtils.hs
valuecmmIndex :: Platform -> Width -> CmmExpr -> Int -> CmmExpr
#

Useful for creating an index into an array, with a statically known offset. The type is the element type; used for making the multiplier

valueregsOverlap :: Platform -> CmmReg -> CmmReg -> Bool
#

Returns True if the two STG registers overlap on the specified platform, in the sense that writing to one will clobber the other. This includes the case that the two registers are the same STG register. See Note [Overlapping global registers] for details.

valueregUsedIn :: Platform -> CmmReg -> CmmExpr -> Bool
#

Returns True if the STG register is used by the expression, in the sense that a store to the register might affect the value of the expression.

We must check for overlapping registers and not just equal registers here, otherwise CmmSink may incorrectly reorder assignments that conflict due to overlap. See #10521 and Note [Overlapping global registers].

Operations that probably don't belong here

10 declarations

Like toBlockListEntryFirst, but we strive to ensure that we order blocks so that the false case of a conditional jumps to the next block in the output list of blocks. This matches the way OldCmm blocks were output since in OldCmm the false case was a fallthrough, whereas in Cmm conditional branches have both true and false successors. Block ordering can make a big difference in performance in the LLVM backend. Note that we rely crucially on the order of successors returned for CmmCondBranch by the NonLocal instance for CmmNode defined in GHC.Cmm.Node. -GBM

Ticks

1 declaration