[llvm] cfd36aa - [WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 12:48:37 PDT 2023
Author: Heejin Ahn
Date: 2023-03-29T12:48:23-07:00
New Revision: cfd36aa5b7738363653c66fc2f6fcde32bc8f829
URL: https://github.com/llvm/llvm-project/commit/cfd36aa5b7738363653c66fc2f6fcde32bc8f829
DIFF: https://github.com/llvm/llvm-project/commit/cfd36aa5b7738363653c66fc2f6fcde32bc8f829.diff
LOG: [WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)
It is recommended to use `SmallVectorImpl`/`ArrayRef` over
`SmallVector<TypeName, N>` for function parameters:
https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D146841
Added:
Modified:
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
index 997065037dda3..5303f446fbdb8 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
@@ -53,7 +53,8 @@ void WebAssemblyAsmTypeCheck::funcDecl(const wasm::WasmSignature &Sig) {
ReturnTypes.assign(Sig.Returns.begin(), Sig.Returns.end());
}
-void WebAssemblyAsmTypeCheck::localDecl(const SmallVector<wasm::ValType, 4> &Locals) {
+void WebAssemblyAsmTypeCheck::localDecl(
+ const SmallVectorImpl<wasm::ValType> &Locals) {
LocalTypes.insert(LocalTypes.end(), Locals.begin(), Locals.end());
}
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
index 9c190e6beae76..1418ffb4aa9cc 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.h
@@ -52,7 +52,7 @@ class WebAssemblyAsmTypeCheck final {
WebAssemblyAsmTypeCheck(MCAsmParser &Parser, const MCInstrInfo &MII, bool is64);
void funcDecl(const wasm::WasmSignature &Sig);
- void localDecl(const SmallVector<wasm::ValType, 4> &Locals);
+ void localDecl(const SmallVectorImpl<wasm::ValType> &Locals);
void setLastSig(const wasm::WasmSignature &Sig) { LastSig = Sig; }
bool endOfFunction(SMLoc ErrorLoc);
bool typeCheck(SMLoc ErrorLoc, const MCInst &Inst, OperandVector &Operands);
diff --git a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
index ed1fde9a1cd59..81544e20a16ad 100644
--- a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
+++ b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
@@ -69,7 +69,7 @@ wasm::ValType WebAssembly::regClassToValType(const TargetRegisterClass *RC) {
}
void WebAssembly::wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
- const SmallVector<MVT, 1> &VTs) {
+ const ArrayRef<MVT> &VTs) {
assert(!Sym->getType());
// Tables are represented as Arrays in LLVM IR therefore
diff --git a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
index 65107df7dfd15..79fc677456c35 100644
--- a/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
+++ b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
@@ -76,7 +76,7 @@ wasm::ValType regClassToValType(const TargetRegisterClass *RC);
/// Sets a Wasm Symbol Type.
void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
- const SmallVector<MVT, 1> &VTs);
+ const ArrayRef<MVT> &VTs);
} // end namespace WebAssembly
} // end namespace llvm
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index 85ece58f98b35..5ceeebdeab5ef 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -140,8 +140,8 @@ MCOperand WebAssemblyMCInstLower::lowerSymbolOperand(const MachineOperand &MO,
}
MCOperand WebAssemblyMCInstLower::lowerTypeIndexOperand(
- SmallVector<wasm::ValType, 1> &&Returns,
- SmallVector<wasm::ValType, 4> &&Params) const {
+ SmallVectorImpl<wasm::ValType> &&Returns,
+ SmallVectorImpl<wasm::ValType> &&Params) const {
auto Signature = std::make_unique<wasm::WasmSignature>(std::move(Returns),
std::move(Params));
MCSymbol *Sym = Printer.createTempSymbol("typeindex");
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.h b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
index d79c54097eb76..9f08499e5cde1 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.h
@@ -34,8 +34,8 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
- MCOperand lowerTypeIndexOperand(SmallVector<wasm::ValType, 1> &&,
- SmallVector<wasm::ValType, 4> &&) const;
+ MCOperand lowerTypeIndexOperand(SmallVectorImpl<wasm::ValType> &&,
+ SmallVectorImpl<wasm::ValType> &&) const;
public:
WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
More information about the llvm-commits
mailing list