@@ -51,16 +51,16 @@ public enum IntPredicate {
5151 /// less than or equal to the second.
5252 case signedLessThanOrEqual
5353
54- static let predicateMapping : [ IntPredicate : LLVMIntPredicate ] = [
54+ private static let predicateMapping : [ IntPredicate : LLVMIntPredicate ] = [
5555 . equal: LLVMIntEQ, . notEqual: LLVMIntNE, . unsignedGreaterThan: LLVMIntUGT,
5656 . unsignedGreaterThanOrEqual: LLVMIntUGE, . unsignedLessThan: LLVMIntULT,
5757 . unsignedLessThanOrEqual: LLVMIntULE, . signedGreaterThan: LLVMIntSGT,
5858 . signedGreaterThanOrEqual: LLVMIntSGE, . signedLessThan: LLVMIntSLT,
5959 . signedLessThanOrEqual: LLVMIntSLE,
60- ]
60+ ]
6161
6262 /// Retrieves the corresponding `LLVMIntPredicate`.
63- public var llvm : LLVMIntPredicate {
63+ var llvm : LLVMIntPredicate {
6464 return IntPredicate . predicateMapping [ self ] !
6565 }
6666}
@@ -100,7 +100,7 @@ public enum RealPredicate {
100100 /// No comparison, always returns `true`.
101101 case `true`
102102
103- static let predicateMapping : [ RealPredicate : LLVMRealPredicate ] = [
103+ private static let predicateMapping : [ RealPredicate : LLVMRealPredicate ] = [
104104 . false : LLVMRealPredicateFalse, . orderedEqual: LLVMRealOEQ,
105105 . orderedGreaterThan: LLVMRealOGT, . orderedGreaterThanOrEqual: LLVMRealOGE,
106106 . orderedLessThan: LLVMRealOLT, . orderedLessThanOrEqual: LLVMRealOLE,
@@ -109,10 +109,10 @@ public enum RealPredicate {
109109 . unorderedGreaterThanOrEqual: LLVMRealUGE, . unorderedLessThan: LLVMRealULT,
110110 . unorderedLessThanOrEqual: LLVMRealULE, . unorderedNotEqual: LLVMRealUNE,
111111 . true : LLVMRealPredicateTrue,
112- ]
112+ ]
113113
114114 /// Retrieves the corresponding `LLVMRealPredicate`.
115- public var llvm : LLVMRealPredicate {
115+ var llvm : LLVMRealPredicate {
116116 return RealPredicate . predicateMapping [ self ] !
117117 }
118118}
@@ -207,7 +207,7 @@ public enum AtomicOrdering: Comparable {
207207 }
208208
209209 /// Retrieves the corresponding `LLVMAtomicOrdering`.
210- public var llvm : LLVMAtomicOrdering {
210+ var llvm : LLVMAtomicOrdering {
211211 return AtomicOrdering . orderingMapping [ self ] !
212212 }
213213}
@@ -290,7 +290,7 @@ public enum AtomicReadModifyWriteOperation {
290290 /// ```
291291 case umin
292292
293- static let atomicRMWMapping : [ AtomicReadModifyWriteOperation : LLVMAtomicRMWBinOp ] = [
293+ private static let atomicRMWMapping : [ AtomicReadModifyWriteOperation : LLVMAtomicRMWBinOp ] = [
294294 . xchg: LLVMAtomicRMWBinOpXchg, . add: LLVMAtomicRMWBinOpAdd,
295295 . sub: LLVMAtomicRMWBinOpSub, . and: LLVMAtomicRMWBinOpAnd,
296296 . nand: LLVMAtomicRMWBinOpNand, . or: LLVMAtomicRMWBinOpOr,
@@ -300,7 +300,43 @@ public enum AtomicReadModifyWriteOperation {
300300 ]
301301
302302 /// Retrieves the corresponding `LLVMAtomicRMWBinOp`.
303- public var llvm : LLVMAtomicRMWBinOp {
303+ var llvm : LLVMAtomicRMWBinOp {
304304 return AtomicReadModifyWriteOperation . atomicRMWMapping [ self ] !
305305 }
306306}
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