-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Manipulating Common Intermediate Language AST -- -- Language-Cil is a Haskell library for manipulating CIL abstract syntax -- and generating .il files. -- -- Common Intermediate Language (CIL), formerly known as Microsoft -- Intermediate Language (MSIL), is the lowest level language that runs -- on Microsoft .NET and Mono. -- -- This library is still under development, it only supports a small -- subset of the full CIL. -- -- See https://github.com/tomlokhorst/language-cil#readme for an -- example of how to quickly get started. @package language-cil @version 0.2.2 -- | Abstract Syntax Tree for the Common Intermediate Language. Note; -- currently this is just a subset of CIL. module Language.Cil.Syntax keywords :: [String] -- | A name in the CIL world. These need to confirm to certain -- restrictions, altough these aren't currently checked. type DottedName = String type AssemblyName = DottedName type TypeName = DottedName type GenParamName = DottedName type MethodName = DottedName type FieldName = DottedName type ParamName = DottedName type LocalName = DottedName -- | A Version number in CIL type Version = (Int, Int, Int, Int) -- | A public key token type PublicKeyToken = String -- | An offset, e.g. for local variables or arguments type Offset = Int -- | The top level Assembly. This is the root of a CIL program. data Assembly Assembly :: [AssemblyRef] -> AssemblyName -> [TypeDef] -> Assembly -- | Assembly reference. data AssemblyRef AssemblyRef :: AssemblyName -> Version -> PublicKeyToken -> AssemblyRef -- | A Type definition in CIL, either a class or a value type. data TypeDef Class :: [ClassAttr] -> TypeName -> (Maybe TypeSpec) -> [TypeSpec] -> [ClassDecl] -> TypeDef GenericClass :: [ClassAttr] -> TypeName -> [GenParam] -> [ClassDecl] -> TypeDef -- | A parameter to a generic class. Not fully implemented yet, constraints -- aren't supported. data GenParam GenParam :: GenParamName -> GenParam -- | Attribures to class definitions. data ClassAttr CaPrivate :: ClassAttr CaPublic :: ClassAttr CaNestedPublic :: ClassAttr CaNestedPrivate :: ClassAttr -- | Class declarations, i.e. the body of a class. data ClassDecl FieldDef :: FieldDef -> ClassDecl MethodDef :: MethodDef -> ClassDecl TypeDef :: TypeDef -> ClassDecl -- | Type specification. data TypeSpec TypeSpec :: TypeName -> TypeSpec -- | Field definition. data FieldDef Field :: [FieldAttr] -> PrimitiveType -> FieldName -> FieldDef -- | Attributes to field definitions. data FieldAttr FaStatic :: FieldAttr FaPublic :: FieldAttr FaPrivate :: FieldAttr FaAssembly :: FieldAttr -- | A Method definition in CIL. data MethodDef Constructor :: [MethAttr] -> PrimitiveType -> [Parameter] -> [MethodDecl] -> MethodDef Method :: [MethAttr] -> PrimitiveType -> MethodName -> [Parameter] -> [MethodDecl] -> MethodDef -- | Attributes to method definitions. data MethAttr MaStatic :: MethAttr MaPublic :: MethAttr MaPrivate :: MethAttr MaAssembly :: MethAttr MaVirtual :: MethAttr MaHidebysig :: MethAttr -- | A formal parameter to a method. data Parameter Param :: (Maybe ParamAttr) -> PrimitiveType -> ParamName -> Parameter -- | Attributes to parameter definitions. data ParamAttr PaIn :: ParamAttr PaOut :: ParamAttr PaOpt :: ParamAttr -- | Method declarations, i.e. the body of a method. data MethodDecl Directive :: Directive -> MethodDecl Instr :: Instr -> MethodDecl Comment :: String -> MethodDecl -- | Single instruction in method definition. Either an OpCode or a -- labelled OpCode. data Instr LabOpCode :: Label -> OpCode -> Instr OpCode :: OpCode -> Instr -- | Directive meta data for method definitions. data Directive EntryPoint :: Directive LocalsInit :: [Local] -> Directive MaxStack :: Int -> Directive -- | Local variables used inside a method definition. data Local Local :: PrimitiveType -> LocalName -> Local -- | A Label in CIL. type Label = String -- | CIL OpCodes inside a method definition. See -- http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes_fields.aspx -- for a more complete list with documentation. data OpCode -- | Pops 2 values, adds the values, pushes result. Add :: OpCode -- | Pops 2 values, adds the values with a signed overflow check, pushes -- result. Add_ovf :: OpCode -- | Pops 2 values, adds the values with an unsigned overflow check, pushes -- result. Add_ovf_un :: OpCode -- | Pops 2 values, do bitwise AND between the values, pushes result. And :: OpCode -- | Pops 2 values, if first value is equal to second value, jump to -- specified label. Beq :: Label -> OpCode -- | Pops 2 values, if first value is greater or equal to second value, -- jump to specified label. Bge :: Label -> OpCode -- | Pops 2 values, if first value is greater than second value, jump to -- specified label. Bgt :: Label -> OpCode -- | Pops 2 values, if first value is less or equal to second value, jump -- to specified label. Ble :: Label -> OpCode -- | Pops 2 values, if first value is less than second value, jump to -- specified label. Blt :: Label -> OpCode -- | Pops 1 value, boxes value type, pushes object reference. Box :: PrimitiveType -> OpCode -- | Unconditionally jump to specified label. Br :: Label -> OpCode -- | Inform a debugger that a breakpoint has been reached. Break :: OpCode -- | Pops 1 value, if value is false, null reference or zero, jump to -- specified label. Brfalse :: Label -> OpCode -- | Pops 1 value, if value is true, not null or non-zero, jump to -- specified label. Brtrue :: Label -> OpCode -- | Pops n values, calls specified method, pushes return value. -- (where n is the number of formal parameters of the method). Call :: [CallConv] -> PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> OpCode -- | Method is associated with class or instance. callConv :: OpCode -> [CallConv] -- | Return type of the method. returnType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the method. methodName :: OpCode -> MethodName -- | Types of the formal parameters of the method. paramTypes :: OpCode -> [PrimitiveType] -- | Pops n values, calls specified virtual method, pushes return -- value. (where n is the number of formal parameters of the -- method). CallVirt :: PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> OpCode -- | Return type of the method. returnType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the method. methodName :: OpCode -> MethodName -- | Types of the formal parameters of the method. paramTypes :: OpCode -> [PrimitiveType] -- | Pops 2 values, if they are equal, pushes 1 to stack; otherwise, pushes -- 0. Ceq :: OpCode -- | Pops 2 values and compares them. Cgt :: OpCode -- | Pops a float or double. Throws an ArithmeticException if the popped -- value is NaN or +/- infinity. Pushes the popped value. Ckfinite :: OpCode -- | Pops 2 values and compares them. Clt :: OpCode -- | Pops 1 value, copies it, pushes the same value twise. Dup :: OpCode -- | Pops 2 values, divides the first by the second, pushes the result. Div :: OpCode -- | Pops 2 integers, divides the first by the second when consider as -- unsigned integers, pushes the result. Div_un :: OpCode -- | Tests if an object reference is an instance of class, returning either -- a null reference or an instance of that class or interface. Isinst :: TypeName -> OpCode -- | Loads n-th argument to current method onto stack. Ldarg :: Offset -> OpCode -- | Loads 0th argument to current method onto stack. Ldarg_0 :: OpCode -- | Loads 1th argument to current method onto stack. Ldarg_1 :: OpCode -- | Loads 2th argument to current method onto stack. Ldarg_2 :: OpCode -- | Loads 3th argument to current method onto stack. Ldarg_3 :: OpCode -- | Loads named argument to current method onto stack. LdargN :: DottedName -> OpCode -- | Loads the supplied 32-bit integer onto the stack. Ldc_i4 :: Integer -> OpCode -- | Loads the value 0 onto the stack. Ldc_i4_0 :: OpCode -- | Loads the value 1 onto the stack. Ldc_i4_1 :: OpCode -- | Loads the value 2 onto the stack. Ldc_i4_2 :: OpCode -- | Loads the value 3 onto the stack. Ldc_i4_3 :: OpCode -- | Loads the value 4 onto the stack. Ldc_i4_4 :: OpCode -- | Loads the value 5 onto the stack. Ldc_i4_5 :: OpCode -- | Loads the value 6 onto the stack. Ldc_i4_6 :: OpCode -- | Loads the value 7 onto the stack. Ldc_i4_7 :: OpCode -- | Loads the value 8 onto the stack. Ldc_i4_8 :: OpCode -- | Loads the value -1 onto the stack. Ldc_i4_m1 :: OpCode -- | Loads the supplied 8-bit integer onto the stack as 32-bit integer -- (short form). Ldc_i4_s :: Int -> OpCode -- | Loads the supplied 64-bit integer onto the stack. Ldc_i8 :: Integer -> OpCode -- | Loads the supplied 32-bit float onto the stack. Ldc_r4 :: Float -> OpCode -- | Loads the supplied 64-bit double onto the stack. Ldc_r8 :: Double -> OpCode -- | Pops an array reference and an index. Pushes the native integer in the -- specified slot of the array. Ldelem_i :: OpCode -- | Pops an array reference and an index. Pushes the 8-bit integer in the -- specified slot of the array. Ldelem_i1 :: OpCode -- | Pops an array reference and an index. Pushes the 16-bit integer in the -- specified slot of the array. Ldelem_i2 :: OpCode -- | Pops an array reference and an index. Pushes the 32-bit integer in the -- specified slot of the array. Ldelem_i4 :: OpCode -- | Pops an array reference and an index. Pushes the 64-bit integer in the -- specified slot of the array. Ldelem_i8 :: OpCode -- | Pops an array reference and an index. Pushes the unsigned 8-bit -- integer in the specified slot of the array. Ldelem_u1 :: OpCode -- | Pops an array reference and an index. Pushes the unsigned 16-bit -- integer in the specified slot of the array. Ldelem_u2 :: OpCode -- | Pops an array reference and an index. Pushes the unsigned 32-bit -- integer in the specified slot of the array. Ldelem_u4 :: OpCode -- | Pops an array reference and an index. Pushes the unsigned 64-bit -- integer in the specified slot of the array. Ldelem_u8 :: OpCode -- | Pops an array reference and an index. Pushes the float in the -- specified slot of the array. Ldelem_r4 :: OpCode -- | Pops an array reference and an index. Pushes the double in the -- specified slot of the array. Ldelem_r8 :: OpCode -- | Pops an array reference and an index. Pushes the object reference in -- the specified slot of the array. Ldelem_ref :: OpCode -- | Pops an array reference and an index. Pushes the address of the -- specified slot of the array. Ldelema :: OpCode -- | Pops object reference, find value of specified field on object, pushes -- value to the stack. Ldfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pops object reference, find address of specified field on the object, -- pushes address to the stack. Ldflda :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pops object reference, finds address of specified method, pushes -- address as native int to the stack. Ldftn :: PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> OpCode -- | Return type of the method. returnType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the method. methodName :: OpCode -> MethodName -- | Types of the formal parameters of the method. paramTypes :: OpCode -> [PrimitiveType] -- | Pops an address, pushes the native integer stored at the address. Ldind_i :: OpCode -- | Pops an address, pushes the 8-bit integer stored at the address as a -- 32-bit integer. Ldind_i1 :: OpCode -- | Pops an address, pushes the 16-bit integer stored at the address as a -- 32-bit integer. Ldind_i2 :: OpCode -- | Pops an address, pushes the 32-bit integer stored at the address. Ldind_i4 :: OpCode -- | Pops an address, pushes the 64-bit integer stored at the address as a -- 64-bit integer. Ldind_i8 :: OpCode -- | Pops an address, pushes the 32-bit float stored at the address. Ldind_r4 :: OpCode -- | Pops an address, pushes the 64-bit double stored at the address. Ldind_r8 :: OpCode -- | Pops an address, pushes the object reference specified at the address. Ldind_ref :: OpCode -- | Pops an address, pushes the 8-bit unsigned integer stored at the -- address as a 32-bit integer. Ldind_u1 :: OpCode -- | Pops an address, pushes the 16-bit unsigned integer stored at the -- address as a 32-bit integer. Ldind_u2 :: OpCode -- | Pops an address, pushes the 32-bit unsigned integer stored at the -- address as a 32-bit integer. Ldind_u4 :: OpCode -- | Pops an array reference, pushes the native unsigned integer length of -- the array. Ldlen :: OpCode -- | Pushes value of local variable, specified by index, to the stack. Ldloc :: Offset -> OpCode -- | Pushes 0th local variable to the stack. Ldloc_0 :: OpCode -- | Pushes 1th local variable to the stack. Ldloc_1 :: OpCode -- | Pushes 2th local variable to the stack. Ldloc_2 :: OpCode -- | Pushes 3th local variable to the stack. Ldloc_3 :: OpCode -- | Pushes value of local variable, specified by name, to the stack. LdlocN :: DottedName -> OpCode -- | Pushes address of local variable, specified by index, to the stack. Ldloca :: Offset -> OpCode -- | Pushes address of local variable, specified by name, to the stack. LdlocaN :: DottedName -> OpCode -- | Pushes a size-agnostic null reference on the stack. Ldnull :: OpCode -- | Pops type reference, find value of specified field on the type, pushes -- value to the stack. Ldsfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pops type reference, find address of specified field on the type, -- pushes address to the stack. Ldsflda :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pushes an object reference to the specified string constant. Ldstr :: String -> OpCode -- | Pops 2 values, multiplies the values, pushes result. Mul :: OpCode -- | Pops 2 values, multiplies the values with a signed overflow check, -- pushes result. Mul_ovf :: OpCode -- | Pops 2 values, multiplies the values with an unsigned overflow check, -- pushes result. Mul_ovf_un :: OpCode -- | Pops 1 value, negates the value, pushes the value. Neg :: OpCode -- | Creates a new object or instance of a value type. Pops n -- values, calls the specified constructor, pushes a new object reference -- onto the stack (where n is the number of formal parameters of -- the constructor). Newobj :: PrimitiveType -> AssemblyName -> TypeName -> [PrimitiveType] -> OpCode -- | Return type of the method. returnType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Types of the formal parameters of the method. paramTypes :: OpCode -> [PrimitiveType] -- | Creates a new one-dimensional array. Pops a native int or int32, -- pushes a new array with that length. Newarr :: PrimitiveType -> OpCode -- | No operation is performed. Nop :: OpCode -- | Pops 1 value, does a bitwise complement, pushes result. Not :: OpCode -- | Pops 2 values, do bitwise OR between the values, pushes result. Or :: OpCode -- | Pops the top of the stack. Pop :: OpCode -- | Pops 2 values, divides the first value by the second value, pushes the -- remainder. Rem :: OpCode -- | Pops 2 integers, divides the first by the second when considered as -- unsigned integers, pushes the remainder. Rem_un :: OpCode -- | Returns from the current method. Pushes top of the stack to the top of -- the callers stack (if stack is not empty). Ret :: OpCode -- | Pops 2 values, shifts the first to the left by the number of bits -- specified by the second, pushes the result. Shl :: OpCode -- | Pops 2 values, shifts the first to the right by the number of bits -- specified by the second (with sign extension), pushes the result. Shr :: OpCode -- | Pops 2 values, shifts the first to the right by the number of bits -- specified by the second (without sign extension), pushes the result. Shr_un :: OpCode -- | Pops an array reference, an index, and a native integer. Stores the -- integer in the array. Stelem_i :: OpCode -- | Pops an array reference, an index, and an 8-bit integer. Stores the -- integer in the array. Stelem_i1 :: OpCode -- | Pops an array reference, an index, and a 16-bit integer. Stores the -- integer in the array. Stelem_i2 :: OpCode -- | Pops an array reference, an index, and a 32-bit integer. Stores the -- integer in the array. Stelem_i4 :: OpCode -- | Pops an array reference, an index, and a 64-bit integer. Stores the -- integer in the array. Stelem_i8 :: OpCode -- | Pops an array reference, an index, and a float. Stores the float in -- the array. Stelem_r4 :: OpCode -- | Pops an array reference, an index, and a double integer. Stores the -- double in the array. Stelem_r8 :: OpCode -- | Pops an array reference, an index, and an object reference. Stores the -- object reference in the array. Stelem_ref :: OpCode -- | Replaces the value stored in the field of an object reference or -- pointer with a new value. Stfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pops an address and a native integer, stores the integer at the -- address. Stind_i :: OpCode -- | Pops an address and a 8-bit integer, stores the integer at the -- address. Stind_i1 :: OpCode -- | Pops an address and a 16-bit integer, stores the integer at the -- address. Stind_i2 :: OpCode -- | Pops an address and a 32-bit integer, stores the integer at the -- address. Stind_i4 :: OpCode -- | Pops an address and a 64-bit integer, stores the integer at the -- address. Stind_i8 :: OpCode -- | Pops an address and a 32-bit float, stores the float at the address. Stind_r4 :: OpCode -- | Pops an address and a 64-bit double, stores the double at the address. Stind_r8 :: OpCode -- | Pops an address and an object reference, stores the object reference -- at the address. Stind_ref :: OpCode -- | Pops 1 value, stores it in the local variable specified by index. Stloc :: Offset -> OpCode -- | Pops 1 value, stores it in the 0th local variable. Stloc_0 :: OpCode -- | Pops 1 value, stores it in the 1th local variable. Stloc_1 :: OpCode -- | Pops 1 value, stores it in the 2th local variable. Stloc_2 :: OpCode -- | Pops 1 value, stores it in the 3th local variable. Stloc_3 :: OpCode -- | Pops 1 value, stores it in the local variable specified by name. StlocN :: DottedName -> OpCode -- | Replaces the value stored in the static field of a type with a new -- value. Stsfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> OpCode -- | Type of the field. fieldType :: OpCode -> PrimitiveType -- | Name of the assembly where the method resides. assemblyName :: OpCode -> AssemblyName -- | Name of the type of which the method is a member. typeName :: OpCode -> TypeName -- | Name of the field. fieldName :: OpCode -> FieldName -- | Pops 2 values, subtracts second value from the first value, pushes -- result. Sub :: OpCode -- | Pops 2 values, subtracts second value from the first value with a -- signed overflow check, pushes result. Sub_ovf :: OpCode -- | Pops 2 values, subtracts second value from the first value with an -- unsigned overflow check, pushes result. Sub_ovf_un :: OpCode -- | Performs subsequent call as a tail call, by replacing current stack -- frame with callee stack frame. Tail :: OpCode -- | Performs provided call as a tail call, by replacing current stack -- frame with callee stack frame. Tailcall :: OpCode -> OpCode -- | Pops an object reference from the stack and throws it as an exception. Throw :: OpCode -- | Performs subsequent load or store operation under a weaker-than-usual -- alignment precondition. Unaligned :: Alignment -> OpCode -- | Performs provided load or store operation under a weaker-than-usual -- alignment precondition. UnalignedPtr :: Alignment -> OpCode -> OpCode -- | Pops 1 value, unboxes object reference, pushes value type. Unbox :: PrimitiveType -> OpCode -- | Marks subsequent pointer reference as volatile, i.e. the value it -- points at can be modified from another thread. Volatile :: OpCode -- | Marks provided pointer reference as volatile, i.e. the value it points -- at can be modified from another thread. VolatilePtr :: OpCode -> OpCode -- | Pops 2 values, do bitwise XOR between the values, pushes result. Xor :: OpCode -- | Primitive types in CIL. data PrimitiveType Void :: PrimitiveType Bool :: PrimitiveType Char :: PrimitiveType Byte :: PrimitiveType Int32 :: PrimitiveType Int64 :: PrimitiveType Float32 :: PrimitiveType Double64 :: PrimitiveType IntPtr :: PrimitiveType String :: PrimitiveType Object :: PrimitiveType ValueType :: AssemblyName -> TypeName -> PrimitiveType ReferenceType :: AssemblyName -> TypeName -> PrimitiveType GenericReferenceType :: AssemblyName -> TypeName -> [GenParamName] -> PrimitiveType ByRef :: PrimitiveType -> PrimitiveType GenericType :: Offset -> PrimitiveType -- | A specification of pointer alignment. data Alignment ByteAligned :: Alignment DoubleByteAligned :: Alignment QuadByteAligned :: Alignment -- | Calling convention for method calls. data CallConv CcInstance :: CallConv instance Show CallConv instance Show OpCode instance Show Instr instance Show Local instance Show Directive instance Show MethodDecl instance Show ParamAttr instance Show Parameter instance Show MethAttr instance Show MethodDef instance Show Alignment instance Show PrimitiveType instance Show FieldAttr instance Show FieldDef instance Show TypeSpec instance Show ClassDecl instance Show ClassAttr instance Show GenParam instance Show TypeDef instance Show AssemblyRef instance Show Assembly -- | Pretty-printer for the abstract syntax. Currenty uses ShowS, maybe -- should use some PP combinator library? module Language.Cil.Pretty class Pretty a pr :: Pretty a => a -> ShowS instance Pretty Alignment instance Pretty PrimitiveType instance Pretty CallConv instance Pretty OpCode instance Pretty Local instance Pretty Directive instance Pretty Instr instance Pretty MethodDecl instance Pretty ParamAttr instance Pretty Parameter instance Pretty MethAttr instance Pretty MethodDef instance Pretty FieldAttr instance Pretty FieldDef instance Pretty TypeSpec instance Pretty ClassDecl instance Pretty ClassAttr instance Pretty GenParam instance Pretty TypeDef instance Pretty AssemblyRef instance Pretty Assembly -- | Combinators for building abstract syntax. module Language.Cil.Build assemblyRef :: AssemblyName -> Version -> PublicKeyToken -> AssemblyRef entryPoint :: MethodDecl localsInit :: [Local] -> MethodDecl maxStack :: Int -> MethodDecl add :: MethodDecl add_ovf :: MethodDecl add_ovf_un :: MethodDecl and :: MethodDecl beq :: Label -> MethodDecl bge :: Label -> MethodDecl bgt :: Label -> MethodDecl ble :: Label -> MethodDecl blt :: Label -> MethodDecl box :: PrimitiveType -> MethodDecl br :: Label -> MethodDecl break :: MethodDecl brfalse :: Label -> MethodDecl brtrue :: Label -> MethodDecl call :: [CallConv] -> PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> MethodDecl callvirt :: PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> MethodDecl ceq :: MethodDecl cgt :: MethodDecl ckfinite :: MethodDecl clt :: MethodDecl dup :: MethodDecl div :: MethodDecl div_un :: MethodDecl isinst :: TypeName -> MethodDecl ldarg :: Offset -> MethodDecl ldargN :: DottedName -> MethodDecl ldc_i4 :: Integer -> MethodDecl ldc_i8 :: Integer -> MethodDecl ldc_r4 :: Float -> MethodDecl ldc_r8 :: Double -> MethodDecl ldchar :: Char -> MethodDecl ldelem_i :: MethodDecl ldelem_i1 :: MethodDecl ldelem_i2 :: MethodDecl ldelem_i4 :: MethodDecl ldelem_i8 :: MethodDecl ldelem_u1 :: MethodDecl ldelem_u2 :: MethodDecl ldelem_u4 :: MethodDecl ldelem_u8 :: MethodDecl ldelem_r4 :: MethodDecl ldelem_r8 :: MethodDecl ldelem_ref :: MethodDecl ldelema :: MethodDecl ldfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl ldflda :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl ldftn :: PrimitiveType -> AssemblyName -> TypeName -> MethodName -> [PrimitiveType] -> MethodDecl ldind_i :: MethodDecl ldind_i1 :: MethodDecl ldind_i2 :: MethodDecl ldind_i4 :: MethodDecl ldind_i8 :: MethodDecl ldind_r4 :: MethodDecl ldind_r8 :: MethodDecl ldind_ref :: MethodDecl ldind_u1 :: MethodDecl ldind_u2 :: MethodDecl ldind_u4 :: MethodDecl ldlen :: MethodDecl ldloc :: Offset -> MethodDecl ldlocN :: LocalName -> MethodDecl ldloca :: Offset -> MethodDecl ldlocaN :: LocalName -> MethodDecl ldnull :: MethodDecl ldsfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl ldsflda :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl ldstr :: String -> MethodDecl mul :: MethodDecl mul_ovf :: MethodDecl mul_ovf_un :: MethodDecl neg :: MethodDecl newarr :: PrimitiveType -> MethodDecl -- | Creates a new object. Note that this function assumes the constructor -- returns Void. If this is not the case, call the Newobj constructor -- manually. newobj :: AssemblyName -> TypeName -> [PrimitiveType] -> MethodDecl nop :: MethodDecl not :: MethodDecl or :: MethodDecl pop :: MethodDecl rem :: MethodDecl rem_un :: MethodDecl ret :: MethodDecl shl :: MethodDecl shr :: MethodDecl shr_un :: MethodDecl stelem_i :: MethodDecl stelem_i1 :: MethodDecl stelem_i2 :: MethodDecl stelem_i4 :: MethodDecl stelem_i8 :: MethodDecl stelem_r4 :: MethodDecl stelem_r8 :: MethodDecl stelem_ref :: MethodDecl stfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl stind_i :: MethodDecl stind_i1 :: MethodDecl stind_i2 :: MethodDecl stind_i4 :: MethodDecl stind_i8 :: MethodDecl stind_r4 :: MethodDecl stind_r8 :: MethodDecl stind_ref :: MethodDecl stloc :: Offset -> MethodDecl stlocN :: LocalName -> MethodDecl stsfld :: PrimitiveType -> AssemblyName -> TypeName -> FieldName -> MethodDecl sub :: MethodDecl sub_ovf :: MethodDecl sub_ovf_un :: MethodDecl tail :: MethodDecl tailcall :: MethodDecl -> MethodDecl throw :: MethodDecl unaligned :: Alignment -> MethodDecl unalignedPtr :: Alignment -> MethodDecl -> MethodDecl unbox :: PrimitiveType -> MethodDecl volatile :: MethodDecl volatilePtr :: MethodDecl -> MethodDecl xor :: MethodDecl -- | Relabel a labelled mdecl with a new label. label :: Label -> MethodDecl -> MethodDecl comment :: String -> MethodDecl extends :: TypeName -> Maybe TypeSpec noExtends :: Maybe TypeSpec noImplements :: [TypeSpec] classDef :: [ClassAttr] -> TypeName -> Maybe TypeSpec -> [TypeSpec] -> [FieldDef] -> [MethodDef] -> [TypeDef] -> TypeDef defaultCtor :: [Parameter] -> MethodDef extendsCtor :: AssemblyName -> TypeName -> [Parameter] -> MethodDef -- | Create a simple Assembly with one method containing the provided -- MethodDecls. simpleAssembly :: [MethodDecl] -> Assembly mscorlibRef :: AssemblyRef -- | Analysis functions over the Cil AST. module Language.Cil.Analysis instructions :: Ast a => a -> [Instr] instance Ast MethodDef instance Ast ClassDecl instance Ast TypeDef instance Ast Assembly -- | A simple abstraction over the Common Intermediate Language (also known -- as MSIL - Microsoft Intermediate Language). Currently, it only exposes -- a small subset of CIL. module Language.Cil writeAssembly :: FilePath -> Assembly -> IO ()