Skip to content

Commit 21ad776

Browse files
committed
Added Types: attributes
1 parent f03ee96 commit 21ad776

File tree

2 files changed

+97
-24
lines changed

2 files changed

+97
-24
lines changed

llvm-api/LLVM/Core/Diagnostic.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ public struct Diagnostic: DiagnosticInfoRef {
2020
Context.getDiagInfoSeverity(diagnosticInfo: self)
2121
}
2222
}
23-

llvm-api/LLVM/Core/Types/Types.swift

Lines changed: 97 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -576,29 +576,21 @@ public enum ThreadLocalMode: UInt32 {
576576

577577
public enum AtomicOrdering: UInt32 {
578578
case AtomicOrderingNotAtomic = 0 /** < A load or store which is not atomic */
579-
case AtomicOrderingUnordered = 1 /** < Lowest level of atomicity, guarantees
580-
somewhat sane results, lock free. */
581-
case AtomicOrderingMonotonic = 2 /** < guarantees that if you take all the
582-
operations affecting a specific address,
583-
a consistent ordering exists */
584-
case AtomicOrderingAcquire = 4 /** < Acquire provides a barrier of the sort
585-
necessary to acquire a lock to access other
586-
memory with normal loads and stores. */
587-
case AtomicOrderingRelease = 5 /** < Release is similar to Acquire, but with
588-
a barrier of the sort necessary to release
589-
a lock. */
590-
case AtomicOrderingAcquireRelease = 6 /** < provides both an Acquire and a
591-
Release barrier (for fences and
592-
operations which both read and write
593-
memory). */
594-
case AtomicOrderingSequentiallyConsistent = 7 /** < provides Acquire semantics
595-
for loads and Release
596-
semantics for stores.
597-
Additionally, it guarantees
598-
that a total ordering exists
599-
between all
600-
SequentiallyConsistent
601-
operations. */
579+
/// Lowest level of atomicity, guarantees somewhat sane results, lock free.
580+
case AtomicOrderingUnordered = 1
581+
/// guarantees that if you take all the operations affecting a specific address, a consistent ordering exists
582+
case AtomicOrderingMonotonic = 2
583+
/// Acquire provides a barrier of the sort
584+
/// necessary to acquire a lock to access other memory with normal loads and stores.
585+
case AtomicOrderingAcquire = 4
586+
/// Release is similar to Acquire, but with a barrier of the sort necessary to release a lock.
587+
case AtomicOrderingRelease = 5
588+
/// provides both an Acquire and Release barrier (for fences and operations which both read and memory).
589+
case AtomicOrderingAcquireRelease = 6
590+
/// provides Acquire semantics for loads and Release semantics for stores.
591+
/// Additionally, it guarantees that a total ordering exists between
592+
/// SequentiallyConsistent operations.
593+
case AtomicOrderingSequentiallyConsistent = 7
602594
/// Init enum from `LLVMAtomicOrdering`
603595
public init?(from val: LLVMAtomicOrdering) {
604596
self.init(rawValue: val.rawValue)
@@ -647,3 +639,85 @@ public enum DiagnosticSeverity: UInt32 {
647639
/// Get `LLVMDiagnosticSeverity` from current type
648640
public var llvm: LLVMDiagnosticSeverity { LLVMDiagnosticSeverity(rawValue: rawValue) }
649641
}
642+
643+
public enum InlineAsmDialect: UInt32 {
644+
case InlineAsmDialectATT = 0
645+
case InlineAsmDialectIntel
646+
647+
/// Init enum from `LLVMInlineAsmDialect`
648+
public init?(from val: LLVMInlineAsmDialect) {
649+
self.init(rawValue: val.rawValue)
650+
}
651+
652+
/// Get `LLVMInlineAsmDialect` from current type
653+
public var llvm: LLVMInlineAsmDialect { LLVMInlineAsmDialect(rawValue: rawValue) }
654+
}
655+
656+
public enum ModuleFlagBehavior: UInt32 {
657+
/// Emits an error if two values disagree, otherwise the resulting value is
658+
/// that of the operands.
659+
case ModuleFlagBehaviorError = 0
660+
661+
/// Emits a warning if two values disagree. The result value will be the
662+
/// operand for the flag from the first module being linked.
663+
case ModuleFlagBehaviorWarning
664+
665+
/// Adds a requirement that another module flag be present and have a
666+
/// specified value after linking is performed. The value must be a metadata
667+
/// pair, where the first element of the pair is the ID of the module flag
668+
/// to be restricted, and the second element of the pair is the value the
669+
/// module flag should be restricted to. This behavior can be used to
670+
/// restrict the allowable results (via triggering of an error) of linking
671+
/// IDs with the **Override** behavior.
672+
case ModuleFlagBehaviorRequire
673+
674+
/// Uses the specified value, regardless of the behavior or value of the
675+
/// other module. If both modules specify **Override**, but the values
676+
/// differ, an error will be emitted.
677+
case ModuleFlagBehaviorOverride
678+
679+
/// Appends the two values, which are required to be metadata nodes.
680+
case ModuleFlagBehaviorAppend
681+
682+
/// Appends the two values, which are required to be metadata
683+
/// nodes. However, duplicate entries in the second list are dropped
684+
/// during the append operation.
685+
case ModuleFlagBehaviorAppendUnique
686+
687+
/// Init enum from `LLVMModuleFlagBehavior`
688+
public init?(from val: LLVMModuleFlagBehavior) {
689+
self.init(rawValue: val.rawValue)
690+
}
691+
692+
/// Get `LLVMModuleFlagBehavior` from current type
693+
public var llvm: LLVMModuleFlagBehavior { LLVMModuleFlagBehavior(rawValue: rawValue) }
694+
}
695+
696+
/// Attribute index is parameter number from 1 to N.
697+
public struct AttributeIndex2 {
698+
let llvm: LLVMAttributeIndex
699+
700+
public init?(from val: LLVMAttributeIndex) {
701+
llvm = val
702+
}
703+
704+
public init(index: UInt32) {
705+
llvm = LLVMAttributeIndex(index)
706+
}
707+
708+
/// Get attribute index
709+
public var index: UInt32 { llvm }
710+
}
711+
712+
/// `LLVMAttributeReturnIndex` is anonymous enum
713+
public struct AttributeReturnIndex {
714+
public var llvm = LLVMAttributeReturnIndex
715+
}
716+
717+
/// `LLVMAttributeFunctionIndex` is anonymous enum
718+
/// ISO C restricts enumerator values to range of 'int'
719+
/// (4294967295 is too large)
720+
/// LLVMAttributeFunctionIndex = ~0U,
721+
public struct AttributeFunctionIndex {
722+
public var llvm = LLVMAttributeFunctionIndex
723+
}

0 commit comments

Comments
 (0)