Skip to content

Commit 6e952fc

Browse files
author
Luc Forget
committed
[MLIR][WASM] Implement review remarks
1 parent ee8d388 commit 6e952fc

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

mlir/include/mlir/Target/Wasm/WasmBinaryEncoding.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
// Define encodings for WebAssembly instructions, types, etc from the
7+
// Define various flags used to encode instructions, types, etc. in
88
// WebAssembly binary format.
99
//
10-
// Each encoding is defined in the WebAssembly binary specification.
10+
// These encodings are defined in the WebAssembly binary format specification.
1111
//
1212
//===----------------------------------------------------------------------===//
1313
#ifndef MLIR_TARGET_WASMBINARYENCODING
1414
#define MLIR_TARGET_WASMBINARYENCODING
1515

1616
#include <cstddef>
17+
1718
namespace mlir {
1819
struct WasmBinaryEncoding {
19-
/// Byte encodings for WASM instructions.
20+
/// Byte encodings for Wasm instructions.
2021
struct OpCode {
2122
// Locals, globals, constants.
2223
static constexpr std::byte constI32{0x41};
@@ -25,7 +26,7 @@ struct WasmBinaryEncoding {
2526
static constexpr std::byte constFP64{0x44};
2627
};
2728

28-
/// Byte encodings of types in WASM binaries
29+
/// Byte encodings of types in Wasm binaries
2930
struct Type {
3031
static constexpr std::byte emptyBlockType{0x40};
3132
static constexpr std::byte funcType{0x60};
@@ -38,15 +39,15 @@ struct WasmBinaryEncoding {
3839
static constexpr std::byte i32{0x7F};
3940
};
4041

41-
/// Byte encodings of WASM imports.
42+
/// Byte encodings of Wasm imports.
4243
struct Import {
4344
static constexpr std::byte typeID{0x00};
4445
static constexpr std::byte tableType{0x01};
4546
static constexpr std::byte memType{0x02};
4647
static constexpr std::byte globalType{0x03};
4748
};
4849

49-
/// Byte encodings for WASM limits.
50+
/// Byte encodings for Wasm limits.
5051
struct LimitHeader {
5152
static constexpr std::byte lowLimitOnly{0x00};
5253
static constexpr std::byte bothLimits{0x01};
@@ -58,7 +59,7 @@ struct WasmBinaryEncoding {
5859
static constexpr std::byte isMutable{0x01};
5960
};
6061

61-
/// Byte encodings describing WASM exports.
62+
/// Byte encodings describing Wasm exports.
6263
struct Export {
6364
static constexpr std::byte function{0x00};
6465
static constexpr std::byte table{0x01};

mlir/lib/Target/Wasm/TranslateFromWasm.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
//
9+
// This file implements the WebAssembly importer.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
813
#include "mlir/Dialect/WasmSSA/IR/WasmSSA.h"
914
#include "mlir/IR/Attributes.h"
1015
#include "mlir/IR/Builders.h"
@@ -19,6 +24,7 @@
1924
#include "llvm/Support/FormatVariadic.h"
2025
#include "llvm/Support/LEB128.h"
2126

27+
#include <climits>
2228
#include <cstdint>
2329
#include <variant>
2430

@@ -648,7 +654,7 @@ void ValueStack::dump() const {
648654
// end of the vector. Iterate in reverse so that the first thing we print
649655
// is the top of the stack.
650656
size_t stackSize = size();
651-
for (size_t idx = 0; idx < stackSize;) {
657+
for (size_t idx = 0; idx < stackSize; idx++) {
652658
size_t actualIdx = stackSize - 1 - idx;
653659
llvm::dbgs() << " ";
654660
values[actualIdx].dump();

0 commit comments

Comments
 (0)