@@ -214,111 +214,6 @@ public enum AtomicOrdering: Comparable {
214214 }
215215}
216216
217- /// `BinaryOperation` enumerates the subset of opcodes that are binary operations.
218- public enum BinaryOperation {
219- /// The `add` instruction.
220- case add
221- /// The `fadd` instruction.
222- case fadd
223- /// The `sub` instruction.
224- case sub
225- /// The `fsub` instruction.
226- case fsub
227- /// The `mul` instruction.
228- case mul
229- /// The `fmul` instruction.
230- case fmul
231- /// The `udiv` instruction.
232- case udiv
233- /// The `sdiv` instruction.
234- case sdiv
235- /// The `fdiv` instruction.
236- case fdiv
237- /// The `urem` instruction.
238- case urem
239- /// The `srem` instruction.
240- case srem
241- /// The `frem` instruction.
242- case frem
243-
244- /// The `shl` instruction.
245- case shl
246- /// The `lshr` instruction.
247- case lshr
248- /// The `ashr` instruction.
249- case ashr
250- /// The `and` instruction.
251- case and
252- /// The `or` instruction.
253- case or
254- /// The `xor` instruction.
255- case xor
256-
257- static let binaryOperationMap : [ BinaryOperation : LLVMOpcode ] = [
258- . add: LLVMAdd, . fadd: LLVMFAdd, . sub: LLVMSub, . fsub: LLVMFSub,
259- . mul: LLVMMul, . fmul: LLVMFMul, . udiv: LLVMUDiv, . sdiv: LLVMSDiv,
260- . fdiv: LLVMFDiv, . urem: LLVMURem, . srem: LLVMSRem, . frem: LLVMFRem,
261- . shl: LLVMShl, . lshr: LLVMLShr, . ashr: LLVMAShr, . and: LLVMAnd,
262- . or: LLVMOr, . xor: LLVMXor,
263- ]
264-
265- /// Retrieves the corresponding `LLVMOpcode`.
266- public var llvm : LLVMOpcode {
267- return BinaryOperation . binaryOperationMap [ self ] !
268- }
269- }
270-
271- /// `CastOperation` enumerates the subset of opcodes that are cast operations.
272- public enum CastOperation {
273- /// The `trunc` instruction.
274- case trunc
275- /// The `zext` instruction.
276- case zext
277- /// The `sext` instruction.
278- case sext
279- /// The `fpToUI` instruction.
280- case fpToUI
281- /// The `fpToSI` instruction.
282- case fpToSI
283- /// The `uiToFP` instruction.
284- case uiToFP
285- /// The `siToFP` instruction.
286- case siToFP
287- /// The `fpTrunc` instruction.
288- case fpTrunc
289- /// The `fpext` instruction.
290- case fpext
291- /// The `ptrToInt` instruction.
292- case ptrToInt
293- /// The `intToPtr` instruction.
294- case intToPtr
295- /// The `bitCast` instruction.
296- case bitCast
297- /// The `addrSpaceCast` instruction.
298- case addrSpaceCast
299-
300- static let castOperationMap : [ CastOperation : LLVMOpcode ] = [
301- . trunc: LLVMTrunc,
302- . zext: LLVMZExt,
303- . sext: LLVMSExt,
304- . fpToUI: LLVMFPToUI,
305- . fpToSI: LLVMFPToSI,
306- . uiToFP: LLVMUIToFP,
307- . siToFP: LLVMSIToFP,
308- . fpTrunc: LLVMFPTrunc,
309- . fpext: LLVMFPExt,
310- . ptrToInt: LLVMPtrToInt,
311- . intToPtr: LLVMIntToPtr,
312- . bitCast: LLVMBitCast,
313- . addrSpaceCast: LLVMAddrSpaceCast,
314- ]
315-
316- /// Retrieves the corresponding `LLVMOpcode`.
317- public var llvm : LLVMOpcode {
318- return CastOperation . castOperationMap [ self ] !
319- }
320- }
321-
322217/// `AtomicReadModifyWriteOperation` enumerates the kinds of supported atomic
323218/// read-write-modify operations.
324219public enum AtomicReadModifyWriteOperation {
@@ -537,7 +432,7 @@ public class IRBuilder {
537432 ///
538433 /// - returns: A value representing the result of perfomring the given binary
539434 /// operation with the given values as arguments.
540- public func buildBinaryOperation( _ op: BinaryOperation , _ lhs: IRValue , _ rhs: IRValue , name: String = " " ) -> IRValue {
435+ public func buildBinaryOperation( _ op: OpCode . Binary , _ lhs: IRValue , _ rhs: IRValue , name: String = " " ) -> IRValue {
541436 return LLVMBuildBinOp ( llvm, op. llvm, lhs. asLLVM ( ) , rhs. asLLVM ( ) , name)
542437 }
543438
@@ -551,7 +446,7 @@ public class IRBuilder {
551446 ///
552447 /// - returns: A value representing the result of casting the given value to
553448 /// the given destination type using the given operation.
554- public func buildCast( _ op: CastOperation , value: IRValue , type: IRType , name: String = " " ) -> IRValue {
449+ public func buildCast( _ op: OpCode . Cast , value: IRValue , type: IRType , name: String = " " ) -> IRValue {
555450 return LLVMBuildCast ( llvm, op. llvm, value. asLLVM ( ) , type. asLLVM ( ) , name)
556451 }
557452
@@ -1176,7 +1071,7 @@ public class IRBuilder {
11761071 /// This instruction is used to implement the `va_arg` macro in C.
11771072 ///
11781073 /// - parameter list: A value of type `va_list*`
1179- /// - parameter type: THe type of values in the variable argument area.
1074+ /// - parameter type: The type of values in the variable argument area.
11801075 /// - parameter name: The name for the newly inserted instruction.
11811076 ///
11821077 /// - returns: A value of the specified argument type. In addition, the
0 commit comments