[clang] [llvm] [WebAssembly] Refactor Wasm Reference Types as TargetExtType (PR #71540)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 06:37:02 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 7c636728c0fc18fc79831bfc3cdf41841b9b517c dfe73198afa1e18fc37b5d21a6a8e6e1e3261f88 -- clang/test/CodeGen/WebAssembly/builtins-table.c clang/test/CodeGen/WebAssembly/wasm-externref.c clang/test/CodeGen/builtins-wasm.c llvm/include/llvm/IR/Intrinsics.h llvm/include/llvm/IR/Type.h llvm/lib/CodeGen/ValueTypes.cpp llvm/lib/IR/Function.cpp llvm/lib/IR/Type.cpp llvm/lib/Target/WebAssembly/Utils/WasmAddressSpaces.h llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h llvm/lib/Target/WebAssembly/WebAssembly.h llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 4156f00e6d19..8fbb29961958 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -305,15 +305,14 @@ public:
getTypeID() == PointerTyID || getTypeID() == X86_MMXTyID ||
getTypeID() == X86_AMXTyID || getTypeID() == TargetExtTyID)
return true;
-
+
// If it is not something that can have a size (e.g. a function or label),
// it doesn't have a size.
- if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
- !isVectorTy())
+ if (getTypeID() != StructTyID && getTypeID() != ArrayTyID && !isVectorTy())
return false;
// A target extension type will be sized depending on its alignment type.
- //if (getTypeID() == TargetExtTyID)
+ // if (getTypeID() == TargetExtTyID)
// return static_cast<TargetExtType>(this)->getLayoutType()->isSized();
// Otherwise we have to try harder to decide.
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index e9d6a14228b0..79cd446ec9bb 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -590,7 +590,7 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
TargetExtType *TargetExtTy = cast<TargetExtType>(Ty);
if (TargetExtTy->getName() == "aarch64.svcount")
return MVT(MVT::aarch64svcount);
- else if(TargetExtTy->getName() == "wasm.externref")
+ else if (TargetExtTy->getName() == "wasm.externref")
return MVT(MVT::externref);
else if (TargetExtTy->getName().starts_with("spirv."))
return MVT(MVT::spirvbuiltin);
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 1b3a7c980e33..81951102206b 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -845,7 +845,8 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
// Opaque types in the WebAssembly name space.
if (Name == "wasm.externref")
- return TargetTypeInfo(PointerType::getUnqual(C), TargetExtType::HasZeroInit, TargetExtType::CanBeGlobal);
+ return TargetTypeInfo(PointerType::getUnqual(C), TargetExtType::HasZeroInit,
+ TargetExtType::CanBeGlobal);
return TargetTypeInfo(Type::getVoidTy(C));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71540
More information about the llvm-commits
mailing list