[llvm] r266640 - NFC: unify clang / LLVM atomic ordering

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 08:42:25 PDT 2016



On 04/18/2016 11:01 AM, JF Bastien via llvm-commits wrote:
> +static inline AtomicOrderingCABI toCABI(AtomicOrdering ao) {
> +  static const AtomicOrderingCABI lookup[8] = {
> +      /* NotAtomic */ AtomicOrderingCABI::relaxed,
> +      /* Unordered */ AtomicOrderingCABI::relaxed,
> +      /* relaxed   */ AtomicOrderingCABI::relaxed,
> +      /* consume   */ AtomicOrderingCABI::consume,
> +      /* acquire   */ AtomicOrderingCABI::acquire,
> +      /* release   */ AtomicOrderingCABI::release,
> +      /* acq_rel   */ AtomicOrderingCABI::acq_rel,
> +      /* seq_cst   */ AtomicOrderingCABI::seq_cst,
> +  };
> +  return lookup[(size_t)ao];
> +}
> +
> +} // End namespace llvm
This would be far more natural as a switch case.

Otherwise, good cleanup!

Philip


More information about the llvm-commits mailing list