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.CmmToLlvm.Base

Base LLVM Code Generation module

Contains functions useful through out the code generator.

  • 8 types
  • 39 values
  • Packageghc-9.10.3
  • Exports47
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceBase.hs
typetype UnresLabel = CmmLit
#

An unresolved Label.

Labels are unresolved when we haven't yet determined if they are defined in the module we are currently compiling, or an external one.

newtypenewtype LlvmM a
#

The Llvm monad. Wraps LlvmEnv state as well as the IO monad

Instances5Monad, Functor, Applicative, HasLogger, MonadUnique

Here we pre-initialise some functions that are used internally by GHC so as to make sure they have the most general type in the case that user code also uses these functions but with a different type than GHC internally. (Main offender is treating return type as void instead of 'void *'). Fixes #5486.

valueliftIO :: IO a -> LlvmM a
#

Lifting of IO actions. Not exported, as we want to encapsulate IO.

Return a list of "padding" registers for LLVM function calls.

When we generate LLVM function signatures, we can't just make any register alive on function entry. Instead, we need to insert fake arguments of the same register class until we are sure that one of them is mapped to the register we want alive. E.g. to ensure that F5 is alive, we may need to insert fake arguments mapped to F1, F2, F3 and F4.

Invariant: Cmm FPR regs with number "n" maps to real registers with number "n" If the calling convention uses registers in a different order or if the invariant doesn't hold, this code probably won't be correct.

Create/get a pointer to a global value. Might return an alias if the value in question hasn't been defined yet. We especially make no guarantees on the type of the returned pointer.

Generate definitions for aliases forward-referenced by getGlobalPtr.

Must be called at a point where we are sure that no new global definitions will be generated anymore!

valuealiasify :: LMGlobal -> LlvmM [LMGlobal]
#

Here we take a global variable definition, rename it with a $def suffix, and generate the appropriate alias.