[Mlir-commits] [mlir] Fix linkage enum attr order to mirror one defined in llvm::GlobalValue (PR #118484)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Dec 3 04:56:23 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Henrich Lauko (xlauko)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/118484.diff
2 Files Affected:
- (modified) mlir/include/mlir-c/Dialect/LLVM.h (+9-9)
- (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td (+21-21)
``````````diff
diff --git a/mlir/include/mlir-c/Dialect/LLVM.h b/mlir/include/mlir-c/Dialect/LLVM.h
index 0e6434073437a5..ed9b23c343150c 100644
--- a/mlir/include/mlir-c/Dialect/LLVM.h
+++ b/mlir/include/mlir-c/Dialect/LLVM.h
@@ -175,17 +175,17 @@ MLIR_CAPI_EXPORTED MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx,
MlirLLVMComdat comdat);
enum MlirLLVMLinkage {
- MlirLLVMLinkagePrivate = 0,
- MlirLLVMLinkageInternal = 1,
- MlirLLVMLinkageAvailableExternally = 2,
- MlirLLVMLinkageLinkonce = 3,
+ MlirLLVMLinkageExternal = 0,
+ MlirLLVMLinkageAvailableExternally = 1,
+ MlirLLVMLinkageLinkonce = 2,
+ MlirLLVMLinkageLinkonceODR = 3,
MlirLLVMLinkageWeak = 4,
- MlirLLVMLinkageCommon = 5,
+ MlirLLVMLinkageWeakODR = 5,
MlirLLVMLinkageAppending = 6,
- MlirLLVMLinkageExternWeak = 7,
- MlirLLVMLinkageLinkonceODR = 8,
- MlirLLVMLinkageWeakODR = 9,
- MlirLLVMLinkageExternal = 10,
+ MlirLLVMLinkageInternal = 7,
+ MlirLLVMLinkagePrivate = 8,
+ MlirLLVMLinkageExternWeak = 9,
+ MlirLLVMLinkageCommon = 10,
};
typedef enum MlirLLVMLinkage MlirLLVMLinkage;
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
index 4a43c16903394f..c08b75de036473 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
@@ -615,40 +615,40 @@ def ICmpPredicate : LLVM_EnumAttr<
//===----------------------------------------------------------------------===//
// Linkage attribute is used on functions and globals. The order follows that of
-// https://llvm.org/docs/LangRef.html#linkage-types. The names are equivalent to
-// visible names in the IR rather than to enum values names in llvm::GlobalValue
-// since the latter is easier to change.
-def LinkagePrivate
- : LLVM_EnumAttrCase<"Private", "private", "PrivateLinkage", 0>;
-def LinkageInternal
- : LLVM_EnumAttrCase<"Internal", "internal", "InternalLinkage", 1>;
+// llvm::GlobalValue::LinkageTypes from llvm/IR/GlobalValue.h. The names are
+// equivalent to visible names in the IR rather than to enum values names in
+// llvm::GlobalValue since the latter is easier to change.
+def LinkageExternal
+ : LLVM_EnumAttrCase<"External", "external", "ExternalLinkage", 0>;
def LinkageAvailableExternally
: LLVM_EnumAttrCase<"AvailableExternally", "available_externally",
- "AvailableExternallyLinkage", 2>;
+ "AvailableExternallyLinkage", 1>;
def LinkageLinkonce
- : LLVM_EnumAttrCase<"Linkonce", "linkonce", "LinkOnceAnyLinkage", 3>;
+ : LLVM_EnumAttrCase<"Linkonce", "linkonce", "LinkOnceAnyLinkage", 2>;
+def LinkageLinkonceODR
+ : LLVM_EnumAttrCase<"LinkonceODR", "linkonce_odr", "LinkOnceODRLinkage", 3>;
def LinkageWeak
: LLVM_EnumAttrCase<"Weak", "weak", "WeakAnyLinkage", 4>;
-def LinkageCommon
- : LLVM_EnumAttrCase<"Common", "common", "CommonLinkage", 5>;
+def LinkageWeakODR
+ : LLVM_EnumAttrCase<"WeakODR", "weak_odr", "WeakODRLinkage", 5>;
def LinkageAppending
: LLVM_EnumAttrCase<"Appending", "appending", "AppendingLinkage", 6>;
+def LinkageInternal
+ : LLVM_EnumAttrCase<"Internal", "internal", "InternalLinkage", 7>;
+def LinkagePrivate
+ : LLVM_EnumAttrCase<"Private", "private", "PrivateLinkage", 8>;
def LinkageExternWeak
- : LLVM_EnumAttrCase<"ExternWeak", "extern_weak", "ExternalWeakLinkage", 7>;
-def LinkageLinkonceODR
- : LLVM_EnumAttrCase<"LinkonceODR", "linkonce_odr", "LinkOnceODRLinkage", 8>;
-def LinkageWeakODR
- : LLVM_EnumAttrCase<"WeakODR", "weak_odr", "WeakODRLinkage", 9>;
-def LinkageExternal
- : LLVM_EnumAttrCase<"External", "external", "ExternalLinkage", 10>;
+ : LLVM_EnumAttrCase<"ExternWeak", "extern_weak", "ExternalWeakLinkage", 9>;
+def LinkageCommon
+ : LLVM_EnumAttrCase<"Common", "common", "CommonLinkage", 10>;
def LinkageEnum : LLVM_EnumAttr<
"Linkage",
"::llvm::GlobalValue::LinkageTypes",
"LLVM linkage types",
- [LinkagePrivate, LinkageInternal, LinkageAvailableExternally,
- LinkageLinkonce, LinkageWeak, LinkageCommon, LinkageAppending,
- LinkageExternWeak, LinkageLinkonceODR, LinkageWeakODR, LinkageExternal]> {
+ [LinkageExternal, LinkageAvailableExternally, LinkageLinkonce,
+ LinkageLinkonceODR, LinkageWeak, LinkageWeakODR, LinkageAppending,
+ LinkageInternal, LinkagePrivate, LinkageExternWeak, LinkageCommon]> {
let cppNamespace = "::mlir::LLVM::linkage";
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/118484
More information about the Mlir-commits
mailing list