Skip to content

Commit

Permalink
[clang] [libc++] atomic constexpr support
Browse files Browse the repository at this point in the history
  • Loading branch information
hanickadot committed Jul 13, 2024
1 parent 3b7a7f4 commit c691efa
Show file tree
Hide file tree
Showing 7 changed files with 871 additions and 274 deletions.
84 changes: 42 additions & 42 deletions clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -1682,97 +1682,97 @@ def SyncSwapN : Builtin, SyncBuiltinsTemplate {
// C11 _Atomic operations for <stdatomic.h>.
def C11AtomicInit : AtomicBuiltin {
let Spellings = ["__c11_atomic_init"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicLoad : AtomicBuiltin {
let Spellings = ["__c11_atomic_load"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicStore : AtomicBuiltin {
let Spellings = ["__c11_atomic_store"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicExchange : AtomicBuiltin {
let Spellings = ["__c11_atomic_exchange"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicCompareExchangeStrong : AtomicBuiltin {
let Spellings = ["__c11_atomic_compare_exchange_strong"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicCompareExchangeWeak : AtomicBuiltin {
let Spellings = ["__c11_atomic_compare_exchange_weak"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchAdd : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_add"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchSub : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_sub"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchAnd : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_and"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchOr : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_or"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchXor : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_xor"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchNand : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_nand"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchMax : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_max"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicFetchMin : AtomicBuiltin {
let Spellings = ["__c11_atomic_fetch_min"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def C11AtomicThreadFence : Builtin {
let Spellings = ["__c11_atomic_thread_fence"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "void(int)";
}

def C11AtomicSignalFence : Builtin {
let Spellings = ["__c11_atomic_signal_fence"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "void(int)";
}

Expand All @@ -1785,157 +1785,157 @@ def C11AtomicIsLockFree : Builtin {
// GNU atomic builtins.
def AtomicLoad : AtomicBuiltin {
let Spellings = ["__atomic_load"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicLoadN : AtomicBuiltin {
let Spellings = ["__atomic_load_n"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicStore : AtomicBuiltin {
let Spellings = ["__atomic_store"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicStoreN : AtomicBuiltin {
let Spellings = ["__atomic_store_n"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicExchange : AtomicBuiltin {
let Spellings = ["__atomic_exchange"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicExchangeN : AtomicBuiltin {
let Spellings = ["__atomic_exchange_n"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicCompareExchange : AtomicBuiltin {
let Spellings = ["__atomic_compare_exchange"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicCompareExchangeN : AtomicBuiltin {
let Spellings = ["__atomic_compare_exchange_n"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchAdd : AtomicBuiltin {
let Spellings = ["__atomic_fetch_add"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchSub : AtomicBuiltin {
let Spellings = ["__atomic_fetch_sub"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchAnd : AtomicBuiltin {
let Spellings = ["__atomic_fetch_and"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchOr : AtomicBuiltin {
let Spellings = ["__atomic_fetch_or"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchXor : AtomicBuiltin {
let Spellings = ["__atomic_fetch_xor"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicFetchNand : AtomicBuiltin {
let Spellings = ["__atomic_fetch_nand"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicAddFetch : AtomicBuiltin {
let Spellings = ["__atomic_add_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicSubFetch : AtomicBuiltin {
let Spellings = ["__atomic_sub_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicAndFetch : AtomicBuiltin {
let Spellings = ["__atomic_and_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicOrFetch : AtomicBuiltin {
let Spellings = ["__atomic_or_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicXorFetch : AtomicBuiltin {
let Spellings = ["__atomic_xor_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicMaxFetch : AtomicBuiltin {
let Spellings = ["__atomic_max_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicMinFetch : AtomicBuiltin {
let Spellings = ["__atomic_min_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicNandFetch : AtomicBuiltin {
let Spellings = ["__atomic_nand_fetch"];
let Attributes = [CustomTypeChecking];
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}

def AtomicTestAndSet : Builtin {
let Spellings = ["__atomic_test_and_set"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "bool(void volatile*, int)";
}

def AtomicClear : Builtin {
let Spellings = ["__atomic_clear"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "void(void volatile*, int)";
}

def AtomicThreadFence : Builtin {
let Spellings = ["__atomic_thread_fence"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "void(int)";
}

def AtomicSignalFence : Builtin {
let Spellings = ["__atomic_signal_fence"];
let Attributes = [NoThrow];
let Attributes = [NoThrow, Constexpr];
let Prototype = "void(int)";
}

Expand Down
Loading

0 comments on commit c691efa

Please sign in to comment.