A global mutable variable. Maybe defined or external
Constructors
LMGlobalgetGlobalVar :: LlvmVarReturns the variable of the LMGlobal
getGlobalValue :: Maybe LlvmStaticReturn the value of the LMGlobal
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Moduleghc-9.10.3GHC2021
The LLVM Type System.
A global mutable variable. Maybe defined or external
LMGlobalgetGlobalVar :: LlvmVarReturns the variable of the LMGlobal
getGlobalValue :: Maybe LlvmStaticReturn the value of the LMGlobal
A String in LLVM
A type alias
Llvm Types
LMInt IntAn integer with a given width in bits.
LMFloat32 bit floating point
LMDouble64 bit floating point
LMFloat8080 bit (x86 only) floating point
LMFloat128128 bit floating point
LMPointer LlvmTypeA pointer to a LlvmType
LMArray Int LlvmTypeAn array of LlvmType
LMVector Int LlvmTypeA vector of LlvmType
LMLabelA LlvmVar can represent a label (address)
LMVoidVoid type
LMStruct [LlvmType]Packed structure type
LMStructU [LlvmType]Unpacked structure type
LMAlias LlvmAliasA type alias
LMMetadataLLVM Metadata
LMFunction LlvmFunctionDeclFunction type, used to create pointers to functions
Eq LlvmTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesAn LLVM section definition. If Nothing then let LLVM decide the section
LLVM Variables
LMGlobalVar LMString LlvmType LlvmLinkageType LMSection LMAlign LMConstVariables with a global scope.
LMLocalVar Unique LlvmTypeVariables local to a function or parameters.
LMNLocalVar LMString LlvmTypeNamed local variables. Sometimes we need to be able to explicitly name variables (e.g for function arguments).
LMLitVar LlvmLitA constant variable
Llvm Literal Data.
These can be used inline in expressions.
LMIntLit Integer LlvmTypeRefers to an integer constant (i64 42).
LMFloatLit Double LlvmTypeFloating point literal
LMNullLit LlvmTypeLiteral NULL, only applicable to pointer types
LMVectorLit [LlvmLit]Vector literal
LMUndefLit LlvmTypeUndefined value, random bit pattern. Useful for optimisations.
Llvm Static Data.
These represent the possible global level variables and constants.
LMComment LMStringA comment in a static section
LMStaticLit LlvmLitA static variant of a literal value
LMUninitType LlvmTypeFor uninitialised data
LMStaticStr LMString LlvmTypeDefines a static LMString
LMStaticArray [LlvmStatic] LlvmTypeA static array
LMStaticStruc [LlvmStatic] LlvmTypeA static structure type
LMStaticStrucU [LlvmStatic] LlvmTypeA static structure type
LMStaticPointer LlvmVarA pointer to other data
LMTrunc LlvmStatic LlvmTypeTruncate
LMBitc LlvmStatic LlvmTypePointer to Pointer conversion
LMPtoI LlvmStatic LlvmTypePointer to Integer conversion
LMAdd LlvmStatic LlvmStaticConstant addition operation
LMSub LlvmStatic LlvmStaticConstant subtraction operation
Return the LlvmType of the LlvmStatic
Return the LlvmLinkageType for a LlvmVar
Lift a variable to LMPointer type.
Remove the pointer indirection of the supplied type. Only LMPointer constructors can be lowered.
Lower a variable of LMPointer type.
Test if the given LlvmType is an integer
Test if the given LlvmType is a floating point type
Test if a LlvmVar is global.
Width in bits of an LlvmType, returns 0 if not applicable
The target architectures word size
The target architectures word size
An LLVM Function
LlvmFunctionDecldecName :: LMStringUnique identifier of the function
funcLinkage :: LlvmLinkageTypeLinkageType of the function
funcCc :: LlvmCallConventionThe calling convention of the function
decReturnType :: LlvmTypeType of the returned value
decVarargs :: LlvmParameterListTypeIndicates if this function uses varargs
decParams :: [LlvmParameter]Parameter types and attributes
funcAlign :: LMAlignFunction align value, must be power of 2
Eq LlvmFunctionDeclDefined in ghc-9.10.3 · GHC.Llvm.TypesLLVM Parameter Attributes.
Parameter attributes are used to communicate additional information about the result or parameters of a function
ZeroExtThis indicates to the code generator that the parameter or return value should be zero-extended to a 32-bit value by the caller (for a parameter) or the callee (for a return value).
SignExtThis indicates to the code generator that the parameter or return value should be sign-extended to a 32-bit value by the caller (for a parameter) or the callee (for a return value).
InRegThis indicates that this parameter or return value should be treated in a special target-dependent fashion during while emitting code for a function call or return (usually, by putting it in a register as opposed to memory).
ByValThis indicates that the pointer parameter should really be passed by value to the function.
SRetThis indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program.
NoAliasThis indicates that the pointer does not alias any global or any other parameter.
NoCaptureThis indicates that the callee does not make any copies of the pointer that outlive the callee itself
NestThis indicates that the pointer parameter can be excised using the trampoline intrinsics.
Eq LlvmParamAttrDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmParamAttrDefined in ghc-9.10.3 · GHC.Llvm.TypesLlvm Function Attributes.
Function attributes are set to communicate additional information about a function. Function attributes are considered to be part of the function, not of the function type, so functions with different parameter attributes can have the same function type. Functions can have multiple attributes.
Descriptions taken from http://llvm.org/docs/LangRef.html#fnattrs
AlwaysInlineThis attribute indicates that the inliner should attempt to inline this function into callers whenever possible, ignoring any active inlining size threshold for this caller.
InlineHintThis attribute indicates that the source code contained a hint that inlining this function is desirable (such as the "inline" keyword in C/C++). It is just a hint; it imposes no requirements on the inliner.
NoInlineThis attribute indicates that the inliner should never inline this function in any situation. This attribute may not be used together with the alwaysinline attribute.
OptSizeThis attribute suggests that optimization passes and code generator passes make choices that keep the code size of this function low, and otherwise do optimizations specifically to reduce code size.
NoReturnThis function attribute indicates that the function never returns normally. This produces undefined behavior at runtime if the function ever does dynamically return.
NoUnwindThis function attribute indicates that the function never returns with an unwind or exceptional control flow. If the function does unwind, its runtime behavior is undefined.
ReadNoneThis attribute indicates that the function computes its result (or decides to unwind an exception) based strictly on its arguments, without dereferencing any pointer arguments or otherwise accessing any mutable state (e.g. memory, control registers, etc) visible to caller functions. It does not write through any pointer arguments (including byval arguments) and never changes any state visible to callers. This means that it cannot unwind exceptions by calling the C++ exception throwing methods, but could use the unwind instruction.
ReadOnlyThis attribute indicates that the function does not write through any pointer arguments (including byval arguments) or otherwise modify any state (e.g. memory, control registers, etc) visible to caller functions. It may dereference pointer arguments and read state that may be set in the caller. A readonly function always returns the same value (or unwinds an exception identically) when called with the same set of arguments and global state. It cannot unwind an exception by calling the C++ exception throwing methods, but may use the unwind instruction.
SspThis attribute indicates that the function should emit a stack smashing protector. It is in the form of a "canary"—a random value placed on the stack before the local variables that's checked upon return from the function to see if it has been overwritten. A heuristic is used to determine if a function needs stack protectors or not.
If a function that has an ssp attribute is inlined into a function that doesn't have an ssp attribute, then the resulting function will have an ssp attribute.
SspReqThis attribute indicates that the function should always emit a stack smashing protector. This overrides the ssp function attribute.
If a function that has an sspreq attribute is inlined into a function that doesn't have an sspreq attribute or which has an ssp attribute, then the resulting function will have an sspreq attribute.
NoRedZoneThis attribute indicates that the code generator should not use a red zone, even if the target-specific ABI normally permits it.
NoImplicitFloatThis attributes disables implicit floating point instructions.
NakedThis attribute disables prologue / epilogue emission for the function. This can have very system-specific consequences.
Eq LlvmFuncAttrDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmFuncAttrDefined in ghc-9.10.3 · GHC.Llvm.TypesDifferent types to call a function.
Eq LlvmCallTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesShow LlvmCallTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesDifferent calling conventions a function can use.
CC_CccThe C calling convention. This calling convention (the default if no other calling convention is specified) matches the target C calling conventions. This calling convention supports varargs function calls and tolerates some mismatch in the declared prototype and implemented declaration of the function (as does normal C).
CC_FastccThis calling convention attempts to make calls as fast as possible (e.g. by passing things in registers). This calling convention allows the target to use whatever tricks it wants to produce fast code for the target, without having to conform to an externally specified ABI (Application Binary Interface). Implementations of this convention should allow arbitrary tail call optimization to be supported. This calling convention does not support varargs and requires the prototype of al callees to exactly match the prototype of the function definition.
CC_ColdccThis calling convention attempts to make code in the caller as efficient as possible under the assumption that the call is not commonly executed. As such, these calls often preserve all registers so that the call does not break any live ranges in the caller side. This calling convention does not support varargs and requires the prototype of all callees to exactly match the prototype of the function definition.
CC_GhcThe GHC-specific registerised calling convention.
CC_Ncc IntAny calling convention may be specified by number, allowing target-specific calling conventions to be used. Target specific calling conventions start at 64.
CC_X86_StdccX86 Specific StdCall convention. LLVM includes a specific alias for it rather than just using CC_Ncc.
Eq LlvmCallConventionDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmCallConventionDefined in ghc-9.10.3 · GHC.Llvm.TypesEq LlvmParameterListTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesShow LlvmParameterListTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesLinkage type of a symbol.
The description of the constructors is copied from the Llvm Assembly Language Reference Manual http://www.llvm.org/docs/LangRef.html#linkage, because they correspond to the Llvm linkage types.
InternalGlobal values with internal linkage are only directly accessible by
objects in the current module. In particular, linking code into a module
with an internal global value may cause the internal to be renamed as
necessary to avoid collisions. Because the symbol is internal to the
module, all references can be updated. This corresponds to the notion
of the static keyword in C.
LinkOnceGlobals with linkonce linkage are merged with other globals of the
same name when linkage occurs. This is typically used to implement
inline functions, templates, or other code which must be generated
in each translation unit that uses it. Unreferenced linkonce globals are
allowed to be discarded.
Weakweak linkage is exactly the same as linkonce linkage, except that
unreferenced weak globals may not be discarded. This is used for globals
that may be emitted in multiple translation units, but that are not
guaranteed to be emitted into every translation unit that uses them. One
example of this are common globals in C, such as int X; at global
scope.
Appendingappending linkage may only be applied to global variables of pointer
to array type. When two global variables with appending linkage are
linked together, the two global arrays are appended together. This is
the Llvm, typesafe, equivalent of having the system linker append
together sections with identical names when .o files are linked.
ExternWeakThe semantics of this linkage follow the ELF model: the symbol is weak until linked, if not linked, the symbol becomes null instead of being an undefined reference.
ExternallyVisibleThe symbol participates in linkage and can be used to resolve external symbol references.
ExternalAlias for ExternallyVisible but with explicit textual form in LLVM assembly.
PrivateSymbol is private to the module and should not appear in the symbol table
Eq LlvmLinkageTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmLinkageTypeDefined in ghc-9.10.3 · GHC.Llvm.TypesLlvm binary operators machine operations.
LM_MO_Addadd two integer, floating point or vector values.
LM_MO_Subsubtract two ...
LM_MO_Mulmultiply ..
LM_MO_UDivunsigned integer or vector division.
LM_MO_SDivsigned integer ..
LM_MO_URemunsigned integer or vector remainder (mod)
LM_MO_SRemsigned ...
LM_MO_FAddadd two floating point or vector values.
LM_MO_FSubsubtract two ...
LM_MO_FMulmultiply ...
LM_MO_FDivdivide ...
LM_MO_FRemremainder ...
LM_MO_ShlLeft shift
LM_MO_LShrLogical shift right Shift right, filling with zero
LM_MO_AShrArithmetic shift right The most significant bits of the result will be equal to the sign bit of the left operand.
LM_MO_AndAND bitwise logical operation.
LM_MO_OrOR bitwise logical operation.
LM_MO_XorXOR bitwise logical operation.
Eq LlvmMachOpDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmMachOpDefined in ghc-9.10.3 · GHC.Llvm.TypesLlvm compare operations.
LM_CMP_EqEqual (Signed and Unsigned)
LM_CMP_NeNot equal (Signed and Unsigned)
LM_CMP_UgtUnsigned greater than
LM_CMP_UgeUnsigned greater than or equal
LM_CMP_UltUnsigned less than
LM_CMP_UleUnsigned less than or equal
LM_CMP_SgtSigned greater than
LM_CMP_SgeSigned greater than or equal
LM_CMP_SltSigned less than
LM_CMP_SleSigned less than or equal
LM_CMP_FeqFloat equal
LM_CMP_FneFloat not equal
LM_CMP_FgtFloat greater than
LM_CMP_FgeFloat greater than or equal
LM_CMP_FltFloat less than
LM_CMP_FleFloat less than or equal
Eq LlvmCmpOpDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmCmpOpDefined in ghc-9.10.3 · GHC.Llvm.TypesLlvm cast operations.
LM_TruncInteger truncate
LM_ZextInteger extend (zero fill)
LM_SextInteger extend (sign fill)
LM_FptruncFloat truncate
LM_FpextFloat extend
LM_FptouiFloat to unsigned Integer
LM_FptosiFloat to signed Integer
LM_UitofpUnsigned Integer to Float
LM_SitofpSigned Int to Float
LM_PtrtointPointer to Integer
LM_InttoptrInteger to Pointer
LM_BitcastCast between types where no bit manipulation is needed
Eq LlvmCastOpDefined in ghc-9.10.3 · GHC.Llvm.TypesOutputable LlvmCastOpDefined in ghc-9.10.3 · GHC.Llvm.TypesConvert a Haskell Double to an LLVM hex encoded floating point form. In Llvm float literals can be printed in a big-endian hexadecimal format, regardless of underlying architecture.
See Note [LLVM Float Types].