@@ -51,16 +51,16 @@ public enum IntPredicate {
51
51
/// less than or equal to the second.
52
52
case signedLessThanOrEqual
53
53
54
- static let predicateMapping : [ IntPredicate : LLVMIntPredicate ] = [
54
+ private static let predicateMapping : [ IntPredicate : LLVMIntPredicate ] = [
55
55
. equal: LLVMIntEQ, . notEqual: LLVMIntNE, . unsignedGreaterThan: LLVMIntUGT,
56
56
. unsignedGreaterThanOrEqual: LLVMIntUGE, . unsignedLessThan: LLVMIntULT,
57
57
. unsignedLessThanOrEqual: LLVMIntULE, . signedGreaterThan: LLVMIntSGT,
58
58
. signedGreaterThanOrEqual: LLVMIntSGE, . signedLessThan: LLVMIntSLT,
59
59
. signedLessThanOrEqual: LLVMIntSLE,
60
- ]
60
+ ]
61
61
62
62
/// Retrieves the corresponding `LLVMIntPredicate`.
63
- public var llvm : LLVMIntPredicate {
63
+ var llvm : LLVMIntPredicate {
64
64
return IntPredicate . predicateMapping [ self ] !
65
65
}
66
66
}
@@ -100,7 +100,7 @@ public enum RealPredicate {
100
100
/// No comparison, always returns `true`.
101
101
case `true`
102
102
103
- static let predicateMapping : [ RealPredicate : LLVMRealPredicate ] = [
103
+ private static let predicateMapping : [ RealPredicate : LLVMRealPredicate ] = [
104
104
. false : LLVMRealPredicateFalse, . orderedEqual: LLVMRealOEQ,
105
105
. orderedGreaterThan: LLVMRealOGT, . orderedGreaterThanOrEqual: LLVMRealOGE,
106
106
. orderedLessThan: LLVMRealOLT, . orderedLessThanOrEqual: LLVMRealOLE,
@@ -109,10 +109,10 @@ public enum RealPredicate {
109
109
. unorderedGreaterThanOrEqual: LLVMRealUGE, . unorderedLessThan: LLVMRealULT,
110
110
. unorderedLessThanOrEqual: LLVMRealULE, . unorderedNotEqual: LLVMRealUNE,
111
111
. true : LLVMRealPredicateTrue,
112
- ]
112
+ ]
113
113
114
114
/// Retrieves the corresponding `LLVMRealPredicate`.
115
- public var llvm : LLVMRealPredicate {
115
+ var llvm : LLVMRealPredicate {
116
116
return RealPredicate . predicateMapping [ self ] !
117
117
}
118
118
}
@@ -207,7 +207,7 @@ public enum AtomicOrdering: Comparable {
207
207
}
208
208
209
209
/// Retrieves the corresponding `LLVMAtomicOrdering`.
210
- public var llvm : LLVMAtomicOrdering {
210
+ var llvm : LLVMAtomicOrdering {
211
211
return AtomicOrdering . orderingMapping [ self ] !
212
212
}
213
213
}
@@ -290,7 +290,7 @@ public enum AtomicReadModifyWriteOperation {
290
290
/// ```
291
291
case umin
292
292
293
- static let atomicRMWMapping : [ AtomicReadModifyWriteOperation : LLVMAtomicRMWBinOp ] = [
293
+ private static let atomicRMWMapping : [ AtomicReadModifyWriteOperation : LLVMAtomicRMWBinOp ] = [
294
294
. xchg: LLVMAtomicRMWBinOpXchg, . add: LLVMAtomicRMWBinOpAdd,
295
295
. sub: LLVMAtomicRMWBinOpSub, . and: LLVMAtomicRMWBinOpAnd,
296
296
. nand: LLVMAtomicRMWBinOpNand, . or: LLVMAtomicRMWBinOpOr,
@@ -300,7 +300,43 @@ public enum AtomicReadModifyWriteOperation {
300
300
]
301
301
302
302
/// Retrieves the corresponding `LLVMAtomicRMWBinOp`.
303
- public var llvm : LLVMAtomicRMWBinOp {
303
+ var llvm : LLVMAtomicRMWBinOp {
304
304
return AtomicReadModifyWriteOperation . atomicRMWMapping [ self ] !
305
305
}
306
306
}
307
+
308
+ /// Enumerates the dialects of inline assembly LLVM's parsers can handle.
309
+ public enum InlineAssemblyDialect {
310
+ /// The dialect of assembly created at Bell Labs by AT&T.
311
+ ///
312
+ /// AT&T syntax differs from Intel syntax in a number of ways. Notably:
313
+ ///
314
+ /// - The source operand is before the destination operand
315
+ /// - Immediate operands are prefixed by a dollar-sign (`$`)
316
+ /// - Register operands are preceded by a percent-sign (`%`)
317
+ /// - The size of memory operands is determined from the last character of the
318
+ /// the opcode name. Valid suffixes include `b` for "byte" (8-bit),
319
+ /// `w` for "word" (16-bit), `l` for "long-word" (32-bit), and `q` for
320
+ /// "quad-word" (64-bit) memory references
321
+ case att
322
+ /// The dialect of assembly created at Intel.
323
+ ///
324
+ /// Intel syntax differs from AT&T syntax in a number of ways. Notably:
325
+ ///
326
+ /// - The destination operand is before the source operand
327
+ /// - Immediate and register operands have no prefix.
328
+ /// - Memory operands are annotated with their sizes. Valid annotations
329
+ /// include `byte ptr` (8-bit), `word ptr` (16-bit), `dword ptr` (32-bit) and
330
+ /// `qword ptr` (64-bit).
331
+ case intel
332
+
333
+ private static let dialectMapping : [ InlineAssemblyDialect : LLVMInlineAsmDialect ] = [
334
+ . att: LLVMInlineAsmDialectATT,
335
+ . intel: LLVMInlineAsmDialectIntel,
336
+ ]
337
+
338
+ /// Retrieves the corresponding `LLVMInlineAsmDialect`.
339
+ var llvm : LLVMInlineAsmDialect {
340
+ return InlineAssemblyDialect . dialectMapping [ self ] !
341
+ }
342
+ }
0 commit comments