|
|
|
|
|
Description |
The LLVM (Low Level Virtual Machine) is virtual machine at a machine code level.
It supports both stand alone code generation and JITing.
The Haskell llvm package is a (relatively) high level interface to the LLVM.
The high level interface makes it easy to construct LLVM code.
There is also an interface to the raw low level LLVM API as exposed by the LLVM C interface.
LLVM code is organized into modules (type Module).
Each module contains a number of global variables and functions (type Function).
Each functions has a number of basic blocks (type BasicBlock).
Each basic block has a number instructions, where each instruction produces
a value (type Value).
Unlike assembly code for a real processor the assembly code for LLVM is
in SSA (Static Single Assignment) form. This means that each instruction generates
a new bound variable which may not be assigned again.
A consequence of this is that where control flow joins from several execution
paths there has to be a phi pseudo instruction if you want different variables
to be joined into one.
The definition of several of the LLVM entities (Module, Function, and BasicBlock)
follow the same pattern. First the entity has to be created using newX (where X
is one of Module, Function, or BasicBlock), then at some later point it has to
given its definition using defineX. The reason for splitting the creation and
definition is that you often need to be able to refer to an entity before giving
it's body, e.g., in two mutually recursive functions.
The the newX and defineX function can also be done at the same time by using
createX. Furthermore, an explicit name can be given to an entity by the
newNamedX function; the newX function just generates a fresh name.
|
|
Synopsis |
|
data Module | | newModule :: IO Module | | newNamedModule :: String -> IO Module | | defineModule :: Module -> CodeGenModule a -> IO a | | destroyModule :: Module -> IO () | | createModule :: CodeGenModule a -> IO a | | data ModuleProvider | | createModuleProviderForExistingModule :: Module -> IO ModuleProvider | | data PassManager | | createPassManager :: IO PassManager | | createFunctionPassManager :: ModuleProvider -> IO PassManager | | writeBitcodeToFile :: String -> Module -> IO () | | readBitcodeFromFile :: String -> IO Module | | getModuleValues :: Module -> IO [(String, ModuleValue)] | | data ModuleValue | | castModuleValue :: forall a. IsType a => ModuleValue -> Maybe (Value a) | | ret :: Ret a r => a -> CodeGenFunction r Terminate | | condBr :: Value Bool -> BasicBlock -> BasicBlock -> CodeGenFunction r Terminate | | br :: BasicBlock -> CodeGenFunction r Terminate | | switch :: IsInteger a => Value a -> BasicBlock -> [(ConstValue a, BasicBlock)] -> CodeGenFunction r Terminate | | invoke :: CallArgs f g => BasicBlock -> BasicBlock -> Function f -> g | | unwind :: CodeGenFunction r Terminate | | unreachable :: CodeGenFunction r Terminate | | add :: (IsArithmetic c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | sub :: (IsArithmetic c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | mul :: (IsArithmetic c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | neg :: IsArithmetic a => Value a -> CodeGenFunction r (Value a) | | udiv :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | sdiv :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | fdiv :: (IsFloating c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | urem :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | srem :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | frem :: (IsFloating c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | shl :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | lshr :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | ashr :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | and :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | or :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | xor :: (IsInteger c, ABinOp a b (v c)) => a -> b -> CodeGenFunction r (v c) | | inv :: IsInteger a => Value a -> CodeGenFunction r (Value a) | | extractelement :: Value (Vector n a) -> Value Word32 -> CodeGenFunction r (Value a) | | insertelement :: Value (Vector n a) -> Value a -> Value Word32 -> CodeGenFunction r (Value (Vector n a)) | | shufflevector :: Value (Vector n a) -> Value (Vector n a) -> ConstValue (Vector n Word32) -> CodeGenFunction r (Value (Vector n a)) | | malloc :: forall a r s. IsSized a s => CodeGenFunction r (Value (Ptr a)) | | arrayMalloc :: forall a n r s. (IsSized a n, AllocArg s) => s -> CodeGenFunction r (Value (Ptr a)) | | alloca :: forall a r s. IsSized a s => CodeGenFunction r (Value (Ptr a)) | | arrayAlloca :: forall a n r s. (IsSized a n, AllocArg s) => s -> CodeGenFunction r (Value (Ptr a)) | | free :: Value (Ptr a) -> CodeGenFunction r (Value ()) | | load :: Value (Ptr a) -> CodeGenFunction r (Value a) | | store :: Value a -> Value (Ptr a) -> CodeGenFunction r (Value ()) | | getElementPtr :: forall a o i n r. (GetElementPtr o i n, IsIndexArg a) => Value (Ptr o) -> (a, i) -> CodeGenFunction r (Value (Ptr n)) | | trunc :: (IsInteger a, IsInteger b, IsPrimitive a, IsPrimitive b, IsSized a sa, IsSized b sb, sa :>: sb) => Value a -> CodeGenFunction r (Value b) | | zext :: (IsInteger a, IsInteger b, IsPrimitive a, IsPrimitive b, IsSized a sa, IsSized b sb, sa :<: sb) => Value a -> CodeGenFunction r (Value b) | | sext :: (IsInteger a, IsInteger b, IsPrimitive a, IsPrimitive b, IsSized a sa, IsSized b sb, sa :<: sb) => Value a -> CodeGenFunction r (Value b) | | fptrunc :: (IsFloating a, IsFloating b, IsPrimitive a, IsPrimitive b, IsSized a sa, IsSized b sb, sa :>: sb) => Value a -> CodeGenFunction r (Value b) | | fpext :: (IsFloating a, IsFloating b, IsPrimitive a, IsPrimitive b, IsSized a sa, IsSized b sb, sa :<: sb) => Value a -> CodeGenFunction r (Value b) | | fptoui :: (IsFloating a, IsInteger b, IsPrimitive a, IsPrimitive b) => Value a -> CodeGenFunction r (Value b) | | fptosi :: (IsFloating a, IsInteger b, IsPrimitive a, IsPrimitive b) => Value a -> CodeGenFunction r (Value b) | | uitofp :: (IsInteger a, IsFloating b, IsPrimitive a, IsPrimitive b) => Value a -> CodeGenFunction r (Value b) | | sitofp :: (IsInteger a, IsFloating b, IsPrimitive a, IsPrimitive b) => Value a -> CodeGenFunction r (Value b) | | ptrtoint :: (IsInteger b, IsPrimitive b) => Value (Ptr a) -> CodeGenFunction r (Value b) | | inttoptr :: (IsInteger a, IsType b) => Value (Ptr a) -> CodeGenFunction r (Value (Ptr b)) | | bitcast :: (IsFirstClass a, IsFirstClass b, IsSized a sa, IsSized b sb, sa :==: sb) => Value a -> CodeGenFunction r (Value b) | | | | | | class CmpRet a b | a -> b | | icmp :: (IsInteger c, CmpOp a b c d, CmpRet c d) => IntPredicate -> a -> b -> CodeGenFunction r (Value d) | | fcmp :: (IsFloating c, CmpOp a b c d, CmpRet c d) => FPPredicate -> a -> b -> CodeGenFunction r (Value d) | | select :: (IsFirstClass a, CmpRet a b) => Value b -> Value a -> Value a -> CodeGenFunction r (Value a) | | phi :: forall a r. IsFirstClass a => [(Value a, BasicBlock)] -> CodeGenFunction r (Value a) | | addPhiInputs :: forall a r. IsFirstClass a => Value a -> [(Value a, BasicBlock)] -> CodeGenFunction r () | | call :: CallArgs f g => Function f -> g | | type Terminate = () | | class Ret a r | | class CallArgs f g | f -> g, g -> f | | class ABinOp a b c | a b -> c | | class CmpOp a b c d | a b -> c | | class FunctionArgs f g r | f -> g r, g r -> f | | class FunctionArgs (IO a) (CodeGenFunction a ()) (CodeGenFunction a ()) => FunctionRet a | | class IsArithmetic a => IsConst a | | class AllocArg a | | class GetElementPtr optr ixs nptr | optr ixs -> nptr | | class IsIndexArg a | | class IsType a where | | | class IsFirstClass a => IsArithmetic a | | class IsArithmetic a => IsInteger a | | class IsArithmetic a => IsFloating a | | class IsType a => IsPrimitive a | | class IsType a => IsFirstClass a | | class (IsType a, Pos s) => IsSized a s | a -> s | | class IsType a => IsFunction a | | class Pos n => IsPowerOf2 n | | | | isFloating :: IsArithmetic a => a -> Bool | | isSigned :: IsInteger a => a -> Bool | | typeRef :: IsType a => a -> TypeRef | | typeName :: IsType a => a -> String | | data VarArgs a | | class CastVarArgs a b | | newtype Pos n => IntN n = IntN Integer | | newtype Pos n => WordN n = WordN Integer | | newtype FP128 = FP128 Rational | | newtype Nat n => Array n a = Array [a] | | newtype Vector n a = Vector [a] | | Ptr (Ptr) | | data Label | | data Value a | | data ConstValue a | | valueOf :: IsConst a => a -> Value a | | value :: ConstValue a -> Value a | | zero :: forall a. IsType a => ConstValue a | | allOnes :: forall a. IsInteger a => ConstValue a | | undef :: forall a. IsType a => ConstValue a | | createString :: String -> TGlobal (Array n Word8) | | createStringNul :: String -> TGlobal (Array n Word8) | | constVector :: forall a n. Pos n => [ConstValue a] -> ConstValue (Vector n a) | | constArray :: forall a n s. (IsSized a s, Nat n) => [ConstValue a] -> ConstValue (Array n a) | | toVector :: MkVector va n a => va -> Vector n a | | fromVector :: MkVector va n a => Vector n a -> va | | data CodeGenFunction r a | | data CodeGenModule a | | type Function a = Value (Ptr a) | | newFunction :: forall a. IsFunction a => Linkage -> CodeGenModule (Function a) | | newNamedFunction :: forall a. IsFunction a => Linkage -> String -> CodeGenModule (Function a) | | defineFunction :: forall f g r. FunctionArgs f g (CodeGenFunction r ()) => Function f -> g -> CodeGenModule () | | createFunction :: (IsFunction f, FunctionArgs f g (CodeGenFunction r ())) => Linkage -> g -> CodeGenModule (Function f) | | createNamedFunction :: (IsFunction f, FunctionArgs f g (CodeGenFunction r ())) => Linkage -> String -> g -> CodeGenModule (Function f) | | type TFunction a = CodeGenModule (Function a) | | type Global a = Value (Ptr a) | | newGlobal :: forall a. IsType a => Bool -> Linkage -> TGlobal a | | newNamedGlobal :: forall a. IsType a => Bool -> Linkage -> String -> TGlobal a | | defineGlobal :: Global a -> ConstValue a -> CodeGenModule () | | createGlobal :: IsType a => Bool -> Linkage -> ConstValue a -> TGlobal a | | createNamedGlobal :: IsType a => Bool -> Linkage -> String -> ConstValue a -> TGlobal a | | externFunction :: forall a r. IsFunction a => String -> CodeGenFunction r (Function a) | | type TGlobal a = CodeGenModule (Global a) | | | | data BasicBlock | | newBasicBlock :: CodeGenFunction r BasicBlock | | newNamedBasicBlock :: String -> CodeGenFunction r BasicBlock | | defineBasicBlock :: BasicBlock -> CodeGenFunction r () | | createBasicBlock :: CodeGenFunction r BasicBlock | | getCurrentBasicBlock :: CodeGenFunction r BasicBlock | | fromLabel :: Value Label -> BasicBlock | | toLabel :: BasicBlock -> Value Label | | addAttributes :: Value a -> Int -> [Attribute] -> CodeGenFunction r () | | | | castVarArgs :: CastVarArgs a b => Function a -> Function b | | dumpValue :: Value a -> IO () | | dumpType :: Value a -> IO () | | getValueName :: Value a -> IO String | | addCFGSimplificationPass :: PassManager -> IO () | | addConstantPropagationPass :: PassManager -> IO () | | addDemoteMemoryToRegisterPass :: PassManager -> IO () | | addGVNPass :: PassManager -> IO () | | addInstructionCombiningPass :: PassManager -> IO () | | addPromoteMemoryToRegisterPass :: PassManager -> IO () | | addReassociatePass :: PassManager -> IO () | | addTargetData :: TargetDataRef -> PassManager -> IO () |
|
|
|
Modules
|
|
|
Type of top level modules.
|
|
|
|
Create a new module.
|
|
|
:: String | module name
| -> IO Module | | Create a new explicitely named module.
|
|
|
|
|
|
|
Free all storage related to a module. *Note*, this is a dangerous call, since referring
to the module after this call is an error. The reason for the explicit call to free
the module instead of an automatic lifetime management is that modules have a
somewhat complicated ownership. Handing a module to a module provider changes
the ownership of the module, and the module provider will free the module when necessary.
|
|
|
:: | | => CodeGenModule a | module body
| -> IO a | | Create a new module with the given body.
|
|
|
|
A module provider is used by the code generator to get access to a module.
|
|
|
|
Turn a module into a module provider.
|
|
|
|
|
|
Create a pass manager.
|
|
|
Create a pass manager for a module.
|
|
|
Write a module to a file.
|
|
|
Read a module from a file.
|
|
|
|
|
|
|
|
Instructions
|
|
Terminator instructions
|
|
|
Return from the current function with the given value. Use () as the return value for what would be a void function is C.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Unwind the call stack until a function call performed with invoke is reached.
I.e., throw a non-local exception.
|
|
|
Inform the code generator that this code can never be reached.
|
|
Arithmetic binary operations
|
|
Arithmetic operations with the normal semantics.
The u instractions are unsigned, the s instructions are signed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Floating point division.
|
|
|
|
|
|
|
Floating point remainder.
|
|
Logical binary operations
|
|
Logical instructions with the normal semantics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Vector operations
|
|
|
|
|
|
|
|
|
Permute vector.
|
|
Memory access
|
|
|
Allocate heap memory.
|
|
|
Allocate heap (array) memory.
|
|
|
Allocate stack memory.
|
|
|
Allocate stack (array) memory.
|
|
|
Free heap memory.
|
|
|
|
|
|
|
|
|
Address arithmetic. See LLVM description.
The index is a nested tuple of the form (i1,(i2,( ... ()))).
(This is without a doubt the most confusing LLVM instruction, but the types help.)
|
|
Conversions
|
|
|
Truncate a value to a shorter bit width.
|
|
|
Zero extend a value to a wider width.
|
|
|
Sign extend a value to wider width.
|
|
|
Truncate a floating point value.
|
|
|
Extend a floating point value.
|
|
|
Convert a floating point value to an unsigned integer.
|
|
|
Convert a floating point value to a signed integer.
|
|
|
Convert an unsigned integer to a floating point value.
|
|
|
Convert a signed integer to a floating point value.
|
|
|
Convert a pointer to an integer.
|
|
|
Convert an integer to a pointer.
|
|
|
Convert between to values of the same size by just copying the bit pattern.
|
|
Comparison
|
|
|
Constructors | IntEQ | equal
| IntNE | not equal
| IntUGT | unsigned greater than
| IntUGE | unsigned greater or equal
| IntULT | unsigned less than
| IntULE | unsigned less or equal
| IntSGT | signed greater than
| IntSGE | signed greater or equal
| IntSLT | signed less than
| IntSLE | signed less or equal
|
| Instances | |
|
|
|
Constructors | FPFalse | Always false (always folded)
| FPOEQ | True if ordered and equal
| FPOGT | True if ordered and greater than
| FPOGE | True if ordered and greater than or equal
| FPOLT | True if ordered and less than
| FPOLE | True if ordered and less than or equal
| FPONE | True if ordered and operands are unequal
| FPORD | True if ordered (no nans)
| FPUNO | True if unordered: isnan(X) | isnan(Y)
| FPUEQ | True if unordered or equal
| FPUGT | True if unordered or greater than
| FPUGE | True if unordered, greater than, or equal
| FPULT | True if unordered or less than
| FPULE | True if unordered, less than, or equal
| FPUNE | True if unordered or not equal
| FPT | Always true (always folded)
|
| Instances | |
|
|
class CmpRet a b | a -> b | Source |
|
| Instances | |
|
|
|
Compare integers.
|
|
|
Compare floating point values.
|
|
|
Select between two values depending on a boolean.
|
|
Other
|
|
|
Join several variables (virtual registers) from different basic blocks into one.
All of the variables in the list are joined. See also addPhiInputs.
|
|
|
:: forall a r . IsFirstClass a | | => Value a | Must be a variable from a call to phi.
| -> [(Value a, BasicBlock)] | Variables to add.
| -> CodeGenFunction r () | | Add additional inputs to an existing phi node.
The reason for this instruction is that sometimes the structure of the code
makes it impossible to have all variables in scope at the point where you need the phi node.
|
|
|
|
Call a function with the given arguments. The call instruction is variadic, i.e., the number of arguments
it takes depends on the type of f.
|
|
Classes and types
|
|
|
|
|
Acceptable arguments to the ret instruction.
| | Instances | |
|
|
class CallArgs f g | f -> g, g -> f | Source |
|
Acceptable arguments to call.
| | Instances | |
|
|
class ABinOp a b c | a b -> c | Source |
|
Acceptable arguments to arithmetic binary instructions.
| | Instances | |
|
|
class CmpOp a b c d | a b -> c | Source |
|
Acceptable operands to comparison instructions.
| | Instances | |
|
|
class FunctionArgs f g r | f -> g r, g r -> f | Source |
|
| Instances | |
|
|
|
This class is just to simplify contexts.
|
|
|
|
| Instances | |
|
|
|
Acceptable argument to array memory allocation.
| | Instances | |
|
|
class GetElementPtr optr ixs nptr | optr ixs -> nptr | Source |
|
Acceptable arguments to getElementPointer.
| | Instances | |
|
|
|
Acceptable single index to getElementPointer.
| | Instances | |
|
|
Types classification
|
|
Type classifier
|
|
|
The IsType class classifies all types that have an LLVM representation.
| | Methods | | | Instances | |
|
|
Special type classifiers
|
|
|
Arithmetic types, i.e., integral and floating types.
| | Instances | |
|
|
|
Integral types.
| | Instances | |
|
|
|
Floating types.
| | Instances | |
|
|
|
Primitive types.
| | Instances | |
|
|
|
First class types, i.e., the types that can be passed as arguments, etc.
| | Instances | |
|
|
|
Types with a fixed size.
| | Instances | |
|
|
|
Function type.
| | Instances | |
|
|
Others
|
|
|
|
|
Type tests
|
|
|
Type descriptor, used to convey type information through the LLVM API.
| Constructors | | Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
The VarArgs type is a placeholder for the real IO type that
cen be obtained with castVarArgs.
| Instances | |
|
|
|
Define what vararg types are permissible.
| | Instances | |
|
|
Extra types
|
|
|
Variable sized signed integer.
The n parameter should belong to PosI.
| Constructors | | Instances | |
|
|
|
Variable sized unsigned integer.
The n parameter should belong to PosI.
| Constructors | | Instances | |
|
|
|
128 bit floating point.
| Constructors | | Instances | |
|
|
|
Fixed sized arrays, the array size is encoded in the n parameter.
| Constructors | | Instances | |
|
|
|
Fixed sized vector, the array size is encoded in the n parameter.
| Constructors | | Instances | (Enum a, Pos n) => Enum (Vector n a) | Eq a => Eq (Vector n a) | (Floating a, Pos n) => Floating (Vector n a) | (Fractional a, Pos n) => Fractional (Vector n a) | (Integral a, Pos n) => Integral (Vector n a) | (Num a, Pos n) => Num (Vector n a) | Ord a => Ord (Vector n a) | (Real a, Pos n) => Real (Vector n a) | (RealFloat a, Pos n) => RealFloat (Vector n a) | (RealFrac a, Pos n) => RealFrac (Vector n a) | Show a => Show (Vector n a) | (Storable a, IsPowerOf2 n, IsPrimitive a) => Storable (Vector n a) | (IsPowerOf2 n, IsPrimitive a) => IsFirstClass (Vector n a) | (IsPowerOf2 n, IsPrimitive a, IsFloating a) => IsFloating (Vector n a) | (IsPowerOf2 n, IsPrimitive a, IsInteger a) => IsInteger (Vector n a) | (IsPowerOf2 n, IsPrimitive a, IsArithmetic a) => IsArithmetic (Vector n a) | (IsPowerOf2 n, IsPrimitive a) => IsType (Vector n a) | (IsPowerOf2 n, IsPrimitive a, IsConst a) => IsConst (Vector n a) | (IsPowerOf2 n, IsPrimitive a, CallIntrinsic a) => CallIntrinsic (Vector n a) | (IsPowerOf2 n, IsPrimitive a, IsSized a s, Mul n s ns, Pos ns) => IsSized (Vector n a) ns | CmpRet (Vector n a) (Vector n Bool) | IsPowerOf2 n => Cmp (Vector n Word32) (Vector n Bool) | IsPowerOf2 n => Cmp (Vector n Float) (Vector n Bool) | (GetElementPtr o i n, IsIndexArg a) => GetElementPtr (Vector k o) ((,) a i) n |
|
|
|
Ptr (Ptr) |
|
|
Label type, produced by a basic block.
| Instances | |
|
|
Values and constants
|
|
|
Instances | |
|
|
|
Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Make a constant vector. Replicates or truncates the list to get length n.
|
|
|
Make a constant array. Replicates or truncates the list to get length n.
|
|
|
|
|
|
Code generation
|
|
data CodeGenFunction r a | Source |
|
Instances | Monad (CodeGenFunction r) | Functor (CodeGenFunction r) | MonadIO (CodeGenFunction r) | MonadState (CGFState r) (CodeGenFunction r) | FunctionArgs (IO Bool) (FA Bool) (FA Bool) | FunctionArgs (IO Double) (FA Double) (FA Double) | FunctionArgs (IO Float) (FA Float) (FA Float) | FunctionArgs (IO Int8) (FA Int8) (FA Int8) | FunctionArgs (IO Int16) (FA Int16) (FA Int16) | FunctionArgs (IO Int32) (FA Int32) (FA Int32) | FunctionArgs (IO Int64) (FA Int64) (FA Int64) | FunctionArgs (IO Word8) (FA Word8) (FA Word8) | FunctionArgs (IO Word16) (FA Word16) (FA Word16) | FunctionArgs (IO Word32) (FA Word32) (FA Word32) | FunctionArgs (IO Word64) (FA Word64) (FA Word64) | IsType a => FunctionArgs (IO (Ptr a)) (FA (Ptr a)) (FA (Ptr a)) | FunctionArgs (IO ()) (FA ()) (FA ()) | (Pos n, IsPrimitive a) => FunctionArgs (IO (Vector n a)) (FA (Vector n a)) (FA (Vector n a)) | FunctionArgs (IO FP128) (FA FP128) (FA FP128) | Pos n => FunctionArgs (IO (WordN n)) (FA (WordN n)) (FA (WordN n)) | Pos n => FunctionArgs (IO (IntN n)) (FA (IntN n)) (FA (IntN n)) | CallArgs (IO a) (CodeGenFunction r (Value a)) | (Cmp a b, Num a, IsConst a) => Enum (TValue r a) | Eq (TValue r a) | (Cmp a b, CallIntrinsic a, Floating a, IsConst a, IsFloating a) => Floating (TValue r a) | (Cmp a b, Fractional a, IsConst a, IsFloating a) => Fractional (TValue r a) | (Cmp a b, Num a, IsConst a, IsInteger a) => Integral (TValue r a) | (Cmp a b, Num a, IsConst a) => Num (TValue r a) | Ord (TValue r a) | (Cmp a b, Num a, IsConst a) => Real (TValue r a) | (Cmp a b, CallIntrinsic a, RealFloat a, IsConst a, IsFloating a) => RealFloat (TValue r a) | (Cmp a b, Fractional a, IsConst a, IsFloating a) => RealFrac (TValue r a) | Show (TValue r a) | UncurryN (CodeGenFunction r a) (() -> CodeGenFunction r a) | Ret a r => ArithFunction (CodeGenFunction r a) (CodeGenFunction r ()) |
|
|
|
|
Instances | |
|
|
Functions
|
|
|
A function is simply a pointer to the function.
|
|
|
Create a new function. Use newNamedFunction to create a function with external linkage, since
it needs a known name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Global variable creation
|
|
|
|
|
Create a new global variable.
|
|
|
|
|
|
Give a global variable a (constant) value.
|
|
|
Create and define a global variable.
|
|
|
Create and define a named global variable.
|
|
|
Create a reference to an external function while code generating for a function.
|
|
|
|
Globals
|
|
|
An enumeration for the kinds of linkage for global values.
| Constructors | ExternalLinkage | Externally visible function
| LinkOnceLinkage | Keep one copy of function when linking (inline)
| WeakLinkage | Keep one copy of named function when linking (weak)
| AppendingLinkage | Special purpose, only applies to global arrays
| InternalLinkage | Rename collisions when linking (static functions)
| DLLImportLinkage | Function to be imported from DLL
| DLLExportLinkage | Function to be accessible from DLL
| ExternalWeakLinkage | ExternalWeak linkage description
| GhostLinkage | Stand-in functions for streaming fns from BC files
|
| Instances | |
|
|
Basic blocks
|
|
|
A basic block is a sequence of non-branching instructions, terminated by a control flow instruction.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Misc
|
|
|
Add attributes to a value. Beware, what attributes are allowed depends on
what kind of value it is.
|
|
|
Constructors | ZExtAttribute | | SExtAttribute | | NoReturnAttribute | | InRegAttribute | | StructRetAttribute | | NoUnwindAttribute | | NoAliasAttribute | | ByValAttribute | | NestAttribute | | ReadNoneAttribute | | ReadOnlyAttribute | |
| Instances | |
|
|
|
Convert a varargs function to a regular function.
|
|
Debugging
|
|
|
Print a value.
|
|
|
Print a type.
|
|
|
Get the name of a Value.
|
|
Transformations
|
|
|
Add a control flow graph simplification pass to the manager.
|
|
|
Add a constant propagation pass to the manager.
|
|
|
|
|
Add a global value numbering pass to the manager.
|
|
|
|
|
|
|
|
|
|
Produced by Haddock version 2.4.2 |