From 4a7a165763cd2c05a084340b46482eefe07cf4c4 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Thu, 12 Jan 2017 22:49:34 -0700 Subject: [PATCH] 100% Documentation Coverage --- Sources/LLVM/FloatType.swift | 2 +- Sources/LLVM/Instruction.swift | 1 + Sources/LLVM/OpCode.swift | 128 ++-- Sources/LLVM/StructType.swift | 9 +- Sources/LLVM/TargetData.swift | 11 + Sources/LLVM/TargetMachine.swift | 2 + docs/Classes.html | 115 ++- docs/Classes/Context.html | 24 +- docs/Classes/Function.html | 88 ++- docs/Classes/FunctionPassManager.html | 28 +- docs/Classes/IRBuilder.html | 665 +++++++++++++---- docs/Classes/JIT.html | 488 ++++++++++++ docs/Classes/Module.html | 191 +++-- docs/Classes/Target.html | 24 +- docs/Classes/TargetData.html | 119 +-- docs/Classes/TargetMachine.html | 36 +- docs/Enums.html | 241 ++++-- docs/Enums/AtomicOrdering.html | 697 ++++++++++++++++++ .../Enums/AtomicReadModifyWriteOperation.html | 669 +++++++++++++++++ docs/Enums/ByteOrder.html | 33 +- docs/Enums/CodeGenOptLevel.html | 36 +- docs/Enums/CodeModel.html | 44 +- docs/Enums/CodegenFileType.html | 32 +- docs/Enums/FloatType.html | 57 +- docs/Enums/FunctionPass.html | 583 +++++++++++++-- docs/Enums/IntPredicate.html | 64 +- docs/Enums/JITError.html | 319 ++++++++ docs/Enums/ModuleError.html | 28 +- docs/Enums/OpCode.html | 530 ++++++------- docs/Enums/OverflowBehavior.html | 28 +- docs/Enums/RealPredicate.html | 88 ++- docs/Enums/RelocMode.html | 36 +- docs/Enums/TargetMachineError.html | 32 +- docs/Extensions.html | 16 +- docs/Extensions/Bool.html | 20 +- docs/Extensions/Int.html | 20 +- docs/Extensions/Int16.html | 20 +- docs/Extensions/Int32.html | 20 +- docs/Extensions/Int64.html | 20 +- docs/Extensions/Int8.html | 20 +- docs/Extensions/LLVMValueRef.html | 20 +- docs/Extensions/String.html | 20 +- docs/Extensions/UInt.html | 20 +- docs/Extensions/UInt16.html | 20 +- docs/Extensions/UInt32.html | 20 +- docs/Extensions/UInt64.html | 20 +- docs/Extensions/UInt8.html | 20 +- docs/Protocols.html | 24 +- docs/Protocols/IRType.html | 36 +- docs/Protocols/IRValue.html | 364 ++++----- docs/Structs.html | 136 ++-- docs/Structs/ArrayType.html | 36 +- docs/Structs/BasicBlock.html | 95 ++- docs/Structs/FunctionType.html | 36 +- docs/Structs/Global.html | 66 +- docs/Structs/Instruction.html | 91 ++- docs/Structs/IntType.html | 64 +- docs/Structs/LabelType.html | 24 +- docs/Structs/MetadataType.html | 24 +- docs/Structs/Parameter.html | 28 +- docs/Structs/PhiNode.html | 36 +- docs/Structs/PointerType.html | 36 +- docs/Structs/StructType.html | 96 ++- docs/Structs/Switch.html | 24 +- docs/Structs/TokenType.html | 24 +- docs/Structs/Use.html | 32 +- docs/Structs/VectorType.html | 32 +- docs/Structs/VoidType.html | 24 +- docs/Structs/X86MMXType.html | 24 +- .../Contents/Resources/Documents/Classes.html | 115 ++- .../Resources/Documents/Classes/Context.html | 24 +- .../Resources/Documents/Classes/Function.html | 88 ++- .../Classes/FunctionPassManager.html | 28 +- .../Documents/Classes/IRBuilder.html | 665 +++++++++++++---- .../Resources/Documents/Classes/JIT.html | 488 ++++++++++++ .../Resources/Documents/Classes/Module.html | 191 +++-- .../Resources/Documents/Classes/Target.html | 24 +- .../Documents/Classes/TargetData.html | 119 +-- .../Documents/Classes/TargetMachine.html | 36 +- .../Contents/Resources/Documents/Enums.html | 241 ++++-- .../Documents/Enums/AtomicOrdering.html | 697 ++++++++++++++++++ .../Enums/AtomicReadModifyWriteOperation.html | 669 +++++++++++++++++ .../Resources/Documents/Enums/ByteOrder.html | 33 +- .../Documents/Enums/CodeGenOptLevel.html | 36 +- .../Resources/Documents/Enums/CodeModel.html | 44 +- .../Documents/Enums/CodegenFileType.html | 32 +- .../Resources/Documents/Enums/FloatType.html | 57 +- .../Documents/Enums/FunctionPass.html | 583 +++++++++++++-- .../Documents/Enums/IntPredicate.html | 64 +- .../Resources/Documents/Enums/JITError.html | 319 ++++++++ .../Documents/Enums/ModuleError.html | 28 +- .../Resources/Documents/Enums/OpCode.html | 530 ++++++------- .../Documents/Enums/OverflowBehavior.html | 28 +- .../Documents/Enums/RealPredicate.html | 88 ++- .../Resources/Documents/Enums/RelocMode.html | 36 +- .../Documents/Enums/TargetMachineError.html | 32 +- .../Resources/Documents/Extensions.html | 16 +- .../Resources/Documents/Extensions/Bool.html | 20 +- .../Resources/Documents/Extensions/Int.html | 20 +- .../Resources/Documents/Extensions/Int16.html | 20 +- .../Resources/Documents/Extensions/Int32.html | 20 +- .../Resources/Documents/Extensions/Int64.html | 20 +- .../Resources/Documents/Extensions/Int8.html | 20 +- .../Documents/Extensions/LLVMValueRef.html | 20 +- .../Documents/Extensions/String.html | 20 +- .../Resources/Documents/Extensions/UInt.html | 20 +- .../Documents/Extensions/UInt16.html | 20 +- .../Documents/Extensions/UInt32.html | 20 +- .../Documents/Extensions/UInt64.html | 20 +- .../Resources/Documents/Extensions/UInt8.html | 20 +- .../Resources/Documents/Protocols.html | 24 +- .../Resources/Documents/Protocols/IRType.html | 36 +- .../Documents/Protocols/IRValue.html | 364 ++++----- .../Contents/Resources/Documents/Structs.html | 136 ++-- .../Documents/Structs/ArrayType.html | 36 +- .../Documents/Structs/BasicBlock.html | 95 ++- .../Documents/Structs/FunctionType.html | 36 +- .../Resources/Documents/Structs/Global.html | 66 +- .../Documents/Structs/Instruction.html | 91 ++- .../Resources/Documents/Structs/IntType.html | 64 +- .../Documents/Structs/LabelType.html | 24 +- .../Documents/Structs/MetadataType.html | 24 +- .../Documents/Structs/Parameter.html | 28 +- .../Resources/Documents/Structs/PhiNode.html | 36 +- .../Documents/Structs/PointerType.html | 36 +- .../Documents/Structs/StructType.html | 96 ++- .../Resources/Documents/Structs/Switch.html | 24 +- .../Documents/Structs/TokenType.html | 24 +- .../Resources/Documents/Structs/Use.html | 32 +- .../Documents/Structs/VectorType.html | 32 +- .../Resources/Documents/Structs/VoidType.html | 24 +- .../Documents/Structs/X86MMXType.html | 24 +- .../Contents/Resources/Documents/index.html | 16 +- .../Resources/Documents/undocumented.json | 493 +------------ .../.docset/Contents/Resources/docSet.dsidx | Bin 131072 -> 131072 bytes docs/docsets/.tgz | Bin 135704 -> 149122 bytes docs/index.html | 16 +- docs/undocumented.json | 493 +------------ 138 files changed, 11166 insertions(+), 3851 deletions(-) create mode 100644 docs/Classes/JIT.html create mode 100644 docs/Enums/AtomicOrdering.html create mode 100644 docs/Enums/AtomicReadModifyWriteOperation.html create mode 100644 docs/Enums/JITError.html create mode 100644 docs/docsets/.docset/Contents/Resources/Documents/Classes/JIT.html create mode 100644 docs/docsets/.docset/Contents/Resources/Documents/Enums/AtomicOrdering.html create mode 100644 docs/docsets/.docset/Contents/Resources/Documents/Enums/AtomicReadModifyWriteOperation.html create mode 100644 docs/docsets/.docset/Contents/Resources/Documents/Enums/JITError.html diff --git a/Sources/LLVM/FloatType.swift b/Sources/LLVM/FloatType.swift index 8723b78a..78201e03 100644 --- a/Sources/LLVM/FloatType.swift +++ b/Sources/LLVM/FloatType.swift @@ -1,7 +1,7 @@ import cllvm /// `FloatType` enumerates representations of a floating value of a particular -// bit width and semantics. +/// bit width and semantics. public enum FloatType: IRType { /// 16-bit floating point value case half diff --git a/Sources/LLVM/Instruction.swift b/Sources/LLVM/Instruction.swift index 6e77a7e2..5ff99685 100644 --- a/Sources/LLVM/Instruction.swift +++ b/Sources/LLVM/Instruction.swift @@ -31,6 +31,7 @@ public struct Instruction: IRValue { return Instruction(llvm: val) } + /// Retrieves the first use of this instruction. public var firstUse: Use? { guard let use = LLVMGetFirstUse(llvm) else { return nil } return Use(llvm: use) diff --git a/Sources/LLVM/OpCode.swift b/Sources/LLVM/OpCode.swift index 60c84aaf..bb697045 100644 --- a/Sources/LLVM/OpCode.swift +++ b/Sources/LLVM/OpCode.swift @@ -7,153 +7,153 @@ import cllvm public enum OpCode: UInt32 { // MARK: Terminator Instructions - // The opcode for the `ret` instruction. + /// The opcode for the `ret` instruction. case ret = 1 - // The opcode for the `br` instruction. + /// The opcode for the `br` instruction. case br = 2 - // The opcode for the `switch` instruction. + /// The opcode for the `switch` instruction. case `switch` = 3 - // The opcode for the `indirectBr` instruction. + /// The opcode for the `indirectBr` instruction. case indirectBr = 4 - // The opcode for the `invoke` instruction. + /// The opcode for the `invoke` instruction. case invoke = 5 - // The opcode for the `unreachable` instruction. + /// The opcode for the `unreachable` instruction. case unreachable = 7 // MARK: Standard Binary Operators - // The opcode for the `add` instruction. + /// The opcode for the `add` instruction. case add = 8 - // The opcode for the `fadd` instruction. + /// The opcode for the `fadd` instruction. case fadd = 9 - // The opcode for the `sub` instruction. + /// The opcode for the `sub` instruction. case sub = 10 - // The opcode for the `fsub` instruction. + /// The opcode for the `fsub` instruction. case fsub = 11 - // The opcode for the `mul` instruction. + /// The opcode for the `mul` instruction. case mul = 12 - // The opcode for the `fmul` instruction. + /// The opcode for the `fmul` instruction. case fmul = 13 - // The opcode for the `udiv` instruction. + /// The opcode for the `udiv` instruction. case udiv = 14 - // The opcode for the `sdiv` instruction. + /// The opcode for the `sdiv` instruction. case sdiv = 15 - // The opcode for the `fdiv` instruction. + /// The opcode for the `fdiv` instruction. case fdiv = 16 - // The opcode for the `urem` instruction. + /// The opcode for the `urem` instruction. case urem = 17 - // The opcode for the `srem` instruction. + /// The opcode for the `srem` instruction. case srem = 18 - // The opcode for the `frem` instruction. + /// The opcode for the `frem` instruction. case frem = 19 // MARK: Logical Operators - // The opcode for the `shl` instruction. + /// The opcode for the `shl` instruction. case shl = 20 - // The opcode for the `lshr` instruction. + /// The opcode for the `lshr` instruction. case lshr = 21 - // The opcode for the `ashr` instruction. + /// The opcode for the `ashr` instruction. case ashr = 22 - // The opcode for the `and` instruction. + /// The opcode for the `and` instruction. case and = 23 - // The opcode for the `or` instruction. + /// The opcode for the `or` instruction. case or = 24 - // The opcode for the `xor` instruction. + /// The opcode for the `xor` instruction. case xor = 25 // MARK: Memory Operators - // The opcode for the `alloca` instruction. + /// The opcode for the `alloca` instruction. case alloca = 26 - // The opcode for the `load` instruction. + /// The opcode for the `load` instruction. case load = 27 - // The opcode for the `store` instruction. + /// The opcode for the `store` instruction. case store = 28 - // The opcode for the `getElementPtr` instruction. + /// The opcode for the `getElementPtr` instruction. case getElementPtr = 29 // MARK: Cast Operators - // The opcode for the `trunc` instruction. + /// The opcode for the `trunc` instruction. case trunc = 30 - // The opcode for the `zext` instruction. + /// The opcode for the `zext` instruction. case zext = 31 - // The opcode for the `sext` instruction. + /// The opcode for the `sext` instruction. case sext = 32 - // The opcode for the `fpToUI` instruction. + /// The opcode for the `fpToUI` instruction. case fpToUI = 33 - // The opcode for the `fpToSI` instruction. + /// The opcode for the `fpToSI` instruction. case fpToSI = 34 - // The opcode for the `uiToFP` instruction. + /// The opcode for the `uiToFP` instruction. case uiToFP = 35 - // The opcode for the `siToFP` instruction. + /// The opcode for the `siToFP` instruction. case siToFP = 36 - // The opcode for the `fpTrunc` instruction. + /// The opcode for the `fpTrunc` instruction. case fpTrunc = 37 - // The opcode for the `fpExt` instruction. + /// The opcode for the `fpExt` instruction. case fpExt = 38 - // The opcode for the `ptrToInt` instruction. + /// The opcode for the `ptrToInt` instruction. case ptrToInt = 39 - // The opcode for the `intToPtr` instruction. + /// The opcode for the `intToPtr` instruction. case intToPtr = 40 - // The opcode for the `bitCast` instruction. + /// The opcode for the `bitCast` instruction. case bitCast = 41 - // The opcode for the `addrSpaceCast` instruction. + /// The opcode for the `addrSpaceCast` instruction. case addrSpaceCast = 60 // MARK: Other Operators - // The opcode for the `icmp` instruction. + /// The opcode for the `icmp` instruction. case icmp = 42 - // The opcode for the `fcmp` instruction. + /// The opcode for the `fcmp` instruction. case fcmp = 43 - // The opcode for the `PHI` instruction. + /// The opcode for the `PHI` instruction. case PHI = 44 - // The opcode for the `call` instruction. + /// The opcode for the `call` instruction. case call = 45 - // The opcode for the `select` instruction. + /// The opcode for the `select` instruction. case select = 46 - // The opcode for the `userOp1` instruction. + /// The opcode for the `userOp1` instruction. case userOp1 = 47 - // The opcode for the `userOp2` instruction. + /// The opcode for the `userOp2` instruction. case userOp2 = 48 - // The opcode for the `vaArg` instruction. + /// The opcode for the `vaArg` instruction. case vaArg = 49 - // The opcode for the `extractElement` instruction. + /// The opcode for the `extractElement` instruction. case extractElement = 50 - // The opcode for the `insertElement` instruction. + /// The opcode for the `insertElement` instruction. case insertElement = 51 - // The opcode for the `shuffleVector` instruction. + /// The opcode for the `shuffleVector` instruction. case shuffleVector = 52 - // The opcode for the `extractValue` instruction. + /// The opcode for the `extractValue` instruction. case extractValue = 53 - // The opcode for the `insertValue` instruction. + /// The opcode for the `insertValue` instruction. case insertValue = 54 // MARK: Atomic operators - // The opcode for the `fence` instruction. + /// The opcode for the `fence` instruction. case fence = 55 - // The opcode for the `atomicCmpXchg` instruction. + /// The opcode for the `atomicCmpXchg` instruction. case atomicCmpXchg = 56 - // The opcode for the `atomicRMW` instruction. + /// The opcode for the `atomicRMW` instruction. case atomicRMW = 57 // MARK: Exception Handling Operators - // The opcode for the `resume` instruction. + /// The opcode for the `resume` instruction. case resume = 58 - // The opcode for the `landingPad` instruction. + /// The opcode for the `landingPad` instruction. case landingPad = 59 - // The opcode for the `cleanupRet` instruction. + /// The opcode for the `cleanupRet` instruction. case cleanupRet = 61 - // The opcode for the `catchRet` instruction. + /// The opcode for the `catchRet` instruction. case catchRet = 62 - // The opcode for the `catchPad` instruction. + /// The opcode for the `catchPad` instruction. case catchPad = 63 - // The opcode for the `cleanupPad` instruction. + /// The opcode for the `cleanupPad` instruction. case cleanupPad = 64 - // The opcode for the `catchSwitch` instruction. + /// The opcode for the `catchSwitch` instruction. case catchSwitch = 65 } diff --git a/Sources/LLVM/StructType.swift b/Sources/LLVM/StructType.swift index 3fa68288..3ee8c95b 100644 --- a/Sources/LLVM/StructType.swift +++ b/Sources/LLVM/StructType.swift @@ -28,6 +28,11 @@ public struct StructType: IRType { self.llvm = llvm } + /// Creates a structure type from an array of component element types. + /// + /// - parameter elementTypes: A list of types of members of this structure. + /// - parameter isPacked: Whether or not this structure is 1-byte aligned with + /// no packing between fields. Defaults to `false`. public init(elementTypes: [IRType], isPacked: Bool = false) { var irTypes = elementTypes.map { $0.asLLVM() as Optional } self.llvm = irTypes.withUnsafeMutableBufferPointer { buf in @@ -39,7 +44,7 @@ public struct StructType: IRType { /// /// - parameter types: A list of types of members of this structure. /// - parameter isPacked: Whether or not this structure is 1-byte aligned with - /// - no packing between fields. Defaults to `false`. + /// no packing between fields. Defaults to `false`. public func setBody(_ types: [IRType], isPacked: Bool = false) { var _types = types.map { $0.asLLVM() as Optional } _types.withUnsafeMutableBufferPointer { buf in @@ -52,7 +57,7 @@ public struct StructType: IRType { /// /// - parameter values: A list of values of members of this structure. /// - parameter isPacked: Whether or not this structure is 1-byte aligned with - /// - no packing between fields. Defaults to `false`. + /// no packing between fields. Defaults to `false`. /// /// - returns: A value representing a constant value of this structure type. public static func constant(values: [IRValue], isPacked: Bool = false) -> IRValue { diff --git a/Sources/LLVM/TargetData.swift b/Sources/LLVM/TargetData.swift index 0f582f7d..bfd2f22a 100644 --- a/Sources/LLVM/TargetData.swift +++ b/Sources/LLVM/TargetData.swift @@ -106,17 +106,25 @@ public class TargetData { } /// Computes the minimum ABI-required alignment for the specified type. + /// /// - parameter type: The type to whose ABI alignment you wish to compute. /// - returns: The minimum ABI-required alignment for the specified type. public func abiAlignment(of type: IRType) -> Int { return Int(LLVMABIAlignmentOfType(llvm, type.asLLVM())) } + /// Computes the minimum ABI-required alignment for the specified type. + /// + /// This function is equivalent to `TargetData.abiAlignment(of:)`. + /// + /// - parameter type: The type to whose ABI alignment you wish to compute. + /// - returns: The minimum ABI-required alignment for the specified type. public func callFrameAlignment(of type: IRType) -> Int { return Int(LLVMCallFrameAlignmentOfType(llvm, type.asLLVM())) } /// Computes the ABI size of a type in bytes for a target. + /// /// - parameter type: The type to whose ABI size you wish to compute. /// - returns: The ABI size for the specified type. public func abiSize(of type: IRType) -> Int { @@ -124,6 +132,7 @@ public class TargetData { } /// Computes the maximum number of bytes that may be overwritten by /// storing the specified type. + /// /// - parameter type: The type to whose store size you wish to compute. /// - returns: The store size of the type in the given target. public func storeSize(of type: IRType) -> Int { @@ -149,6 +158,8 @@ public class TargetData { } } +/// `ByteOrder` enumerates the ordering semantics of sequences of bytes on a +/// particular target architecture. public enum ByteOrder { /// Little-endian byte order. In a little-endian platform, the _least_ /// significant bytes come before the _most_ significant bytes in a series, diff --git a/Sources/LLVM/TargetMachine.swift b/Sources/LLVM/TargetMachine.swift index 65298fd7..5662935b 100644 --- a/Sources/LLVM/TargetMachine.swift +++ b/Sources/LLVM/TargetMachine.swift @@ -68,6 +68,8 @@ public enum TargetMachineError: Error, CustomStringConvertible { /// a host architecture, vendor, ABI, etc. public class Target { internal let llvm: LLVMTargetRef + + /// Creates a `Target` object from an LLVM target object. public init(llvm: LLVMTargetRef) { self.llvm = llvm } diff --git a/docs/Classes.html b/docs/Classes.html index 68faff3d..a62f2da6 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -13,7 +13,7 @@
-

Docs (86% documented)

+

Docs (100% documented)

@@ -41,6 +41,9 @@ + @@ -58,6 +61,12 @@
-
- +
+
+ +
+
+