summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-04-26 16:59:41 -0700
committerGitHub <noreply@github.com>2019-04-26 16:59:41 -0700
commitdb9124f1de0478dcac525009b6f1589b44a7edd8 (patch)
treefa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/wasm/wasm.cpp
parent87636dccd404a340d75acb1d96301581343f29ca (diff)
downloadbinaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp451
1 files changed, 262 insertions, 189 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 519814cb7..22cce6e80 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -15,15 +15,15 @@
*/
#include "wasm.h"
-#include "wasm-traversal.h"
#include "ir/branch-utils.h"
+#include "wasm-traversal.h"
namespace wasm {
// shared constants
-Name WASM("wasm"),
- RETURN_FLOW("*return:)*");
+Name WASM("wasm");
+Name RETURN_FLOW("*return:)*");
namespace BinaryConsts {
namespace UserSections {
@@ -39,90 +39,127 @@ const char* ExceptionHandlingFeature = "exception-handling";
const char* TruncSatFeature = "nontrapping-fptoint";
const char* SignExtFeature = "sign-ext";
const char* SIMD128Feature = "simd128";
-}
-}
-
-Name GROW_WASM_MEMORY("__growWasmMemory"),
- WASM_CALL_CTORS("__wasm_call_ctors"),
- MEMORY_BASE("__memory_base"),
- TABLE_BASE("__table_base"),
- GET_TEMP_RET0("getTempRet0"),
- SET_TEMP_RET0("setTempRet0"),
- NEW_SIZE("newSize"),
- MODULE("module"),
- START("start"),
- FUNC("func"),
- PARAM("param"),
- RESULT("result"),
- MEMORY("memory"),
- DATA("data"),
- PASSIVE("passive"),
- EXPORT("export"),
- IMPORT("import"),
- TABLE("table"),
- ELEM("elem"),
- LOCAL("local"),
- TYPE("type"),
- CALL("call"),
- CALL_INDIRECT("call_indirect"),
- BLOCK("block"),
- BR_IF("br_if"),
- THEN("then"),
- ELSE("else"),
- _NAN("NaN"),
- _INFINITY("Infinity"),
- NEG_INFINITY("-infinity"),
- NEG_NAN("-nan"),
- CASE("case"),
- BR("br"),
- FUNCREF("funcref"),
- FAKE_RETURN("fake_return_waka123"),
- MUT("mut"),
- SPECTEST("spectest"),
- PRINT("print"),
- EXIT("exit");
+} // namespace UserSections
+} // namespace BinaryConsts
+
+Name GROW_WASM_MEMORY("__growWasmMemory");
+Name WASM_CALL_CTORS("__wasm_call_ctors");
+Name MEMORY_BASE("__memory_base");
+Name TABLE_BASE("__table_base");
+Name GET_TEMP_RET0("getTempRet0");
+Name SET_TEMP_RET0("setTempRet0");
+Name NEW_SIZE("newSize");
+Name MODULE("module");
+Name START("start");
+Name FUNC("func");
+Name PARAM("param");
+Name RESULT("result");
+Name MEMORY("memory");
+Name DATA("data");
+Name PASSIVE("passive");
+Name EXPORT("export");
+Name IMPORT("import");
+Name TABLE("table");
+Name ELEM("elem");
+Name LOCAL("local");
+Name TYPE("type");
+Name CALL("call");
+Name CALL_INDIRECT("call_indirect");
+Name BLOCK("block");
+Name BR_IF("br_if");
+Name THEN("then");
+Name ELSE("else");
+Name _NAN("NaN");
+Name _INFINITY("Infinity");
+Name NEG_INFINITY("-infinity");
+Name NEG_NAN("-nan");
+Name CASE("case");
+Name BR("br");
+Name FUNCREF("funcref");
+Name FAKE_RETURN("fake_return_waka123");
+Name MUT("mut");
+Name SPECTEST("spectest");
+Name PRINT("print");
+Name EXIT("exit");
// Expressions
const char* getExpressionName(Expression* curr) {
switch (curr->_id) {
- case Expression::Id::InvalidId: WASM_UNREACHABLE();
- case Expression::Id::BlockId: return "block";
- case Expression::Id::IfId: return "if";
- case Expression::Id::LoopId: return "loop";
- case Expression::Id::BreakId: return "break";
- case Expression::Id::SwitchId: return "switch";
- case Expression::Id::CallId: return "call";
- case Expression::Id::CallIndirectId: return "call_indirect";
- case Expression::Id::GetLocalId: return "local.get";
- case Expression::Id::SetLocalId: return "local.set";
- case Expression::Id::GetGlobalId: return "global.get";
- case Expression::Id::SetGlobalId: return "global.set";
- case Expression::Id::LoadId: return "load";
- case Expression::Id::StoreId: return "store";
- case Expression::Id::ConstId: return "const";
- case Expression::Id::UnaryId: return "unary";
- case Expression::Id::BinaryId: return "binary";
- case Expression::Id::SelectId: return "select";
- case Expression::Id::DropId: return "drop";
- case Expression::Id::ReturnId: return "return";
- case Expression::Id::HostId: return "host";
- case Expression::Id::NopId: return "nop";
- case Expression::Id::UnreachableId: return "unreachable";
- case Expression::Id::AtomicCmpxchgId: return "atomic_cmpxchg";
- case Expression::Id::AtomicRMWId: return "atomic_rmw";
- case Expression::Id::AtomicWaitId: return "atomic_wait";
- case Expression::Id::AtomicNotifyId: return "atomic_notify";
- case Expression::Id::SIMDExtractId: return "simd_extract";
- case Expression::Id::SIMDReplaceId: return "simd_replace";
- case Expression::Id::SIMDShuffleId: return "simd_shuffle";
- case Expression::Id::SIMDBitselectId: return "simd_bitselect";
- case Expression::Id::SIMDShiftId: return "simd_shift";
- case Expression::Id::MemoryInitId: return "memory_init";
- case Expression::Id::DataDropId: return "data_drop";
- case Expression::Id::MemoryCopyId: return "memory_copy";
- case Expression::Id::MemoryFillId: return "memory_fill";
- case Expression::Id::NumExpressionIds: WASM_UNREACHABLE();
+ case Expression::Id::InvalidId:
+ WASM_UNREACHABLE();
+ case Expression::Id::BlockId:
+ return "block";
+ case Expression::Id::IfId:
+ return "if";
+ case Expression::Id::LoopId:
+ return "loop";
+ case Expression::Id::BreakId:
+ return "break";
+ case Expression::Id::SwitchId:
+ return "switch";
+ case Expression::Id::CallId:
+ return "call";
+ case Expression::Id::CallIndirectId:
+ return "call_indirect";
+ case Expression::Id::GetLocalId:
+ return "local.get";
+ case Expression::Id::SetLocalId:
+ return "local.set";
+ case Expression::Id::GetGlobalId:
+ return "global.get";
+ case Expression::Id::SetGlobalId:
+ return "global.set";
+ case Expression::Id::LoadId:
+ return "load";
+ case Expression::Id::StoreId:
+ return "store";
+ case Expression::Id::ConstId:
+ return "const";
+ case Expression::Id::UnaryId:
+ return "unary";
+ case Expression::Id::BinaryId:
+ return "binary";
+ case Expression::Id::SelectId:
+ return "select";
+ case Expression::Id::DropId:
+ return "drop";
+ case Expression::Id::ReturnId:
+ return "return";
+ case Expression::Id::HostId:
+ return "host";
+ case Expression::Id::NopId:
+ return "nop";
+ case Expression::Id::UnreachableId:
+ return "unreachable";
+ case Expression::Id::AtomicCmpxchgId:
+ return "atomic_cmpxchg";
+ case Expression::Id::AtomicRMWId:
+ return "atomic_rmw";
+ case Expression::Id::AtomicWaitId:
+ return "atomic_wait";
+ case Expression::Id::AtomicNotifyId:
+ return "atomic_notify";
+ case Expression::Id::SIMDExtractId:
+ return "simd_extract";
+ case Expression::Id::SIMDReplaceId:
+ return "simd_replace";
+ case Expression::Id::SIMDShuffleId:
+ return "simd_shuffle";
+ case Expression::Id::SIMDBitselectId:
+ return "simd_bitselect";
+ case Expression::Id::SIMDShiftId:
+ return "simd_shift";
+ case Expression::Id::MemoryInitId:
+ return "memory_init";
+ case Expression::Id::DataDropId:
+ return "data_drop";
+ case Expression::Id::MemoryCopyId:
+ return "memory_copy";
+ case Expression::Id::MemoryFillId:
+ return "memory_fill";
+ case Expression::Id::NumExpressionIds:
+ WASM_UNREACHABLE();
}
WASM_UNREACHABLE();
}
@@ -134,8 +171,8 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
Name targetName;
std::vector<Type> types;
-
- TypeSeeker(Expression* target, Name targetName) : target(target), targetName(targetName) {
+ TypeSeeker(Expression* target, Name targetName)
+ : target(target), targetName(targetName) {
Expression* temp = target;
walk(temp);
}
@@ -148,9 +185,11 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
void visitSwitch(Switch* curr) {
for (auto name : curr->targets) {
- if (name == targetName) types.push_back(curr->value ? curr->value->type : none);
+ if (name == targetName)
+ types.push_back(curr->value ? curr->value->type : none);
}
- if (curr->default_ == targetName) types.push_back(curr->value ? curr->value->type : none);
+ if (curr->default_ == targetName)
+ types.push_back(curr->value ? curr->value->type : none);
}
void visitBlock(Block* curr) {
@@ -161,7 +200,9 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
types.push_back(none);
}
} else if (curr->name == targetName) {
- types.clear(); // ignore all breaks til now, they were captured by someone with the same name
+ // ignore all breaks til now, they were captured by someone with the same
+ // name
+ types.clear();
}
}
@@ -169,7 +210,9 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
if (curr == target) {
types.push_back(curr->body->type);
} else if (curr->name == targetName) {
- types.clear(); // ignore all breaks til now, they were captured by someone with the same name
+ // ignore all breaks til now, they were captured by someone with the same
+ // name
+ types.clear();
}
}
};
@@ -177,8 +220,8 @@ struct TypeSeeker : public PostWalker<TypeSeeker> {
static Type mergeTypes(std::vector<Type>& types) {
Type type = unreachable;
for (auto other : types) {
- // once none, stop. it then indicates a poison value, that must not be consumed
- // and ignore unreachable
+ // once none, stop. it then indicates a poison value, that must not be
+ // consumed and ignore unreachable
if (type != none) {
if (other == none) {
type = none;
@@ -186,7 +229,8 @@ static Type mergeTypes(std::vector<Type>& types) {
if (type == unreachable) {
type = other;
} else if (type != other) {
- type = none; // poison value, we saw multiple types; this should not be consumed
+ // poison value, we saw multiple types; this should not be consumed
+ type = none;
}
}
}
@@ -196,17 +240,23 @@ static Type mergeTypes(std::vector<Type>& types) {
// a block is unreachable if one of its elements is unreachable,
// and there are no branches to it
-static void handleUnreachable(Block* block, bool breakabilityKnown=false, bool hasBreak=false) {
- if (block->type == unreachable) return; // nothing to do
- if (block->list.size() == 0) return; // nothing to do
+static void handleUnreachable(Block* block,
+ bool breakabilityKnown = false,
+ bool hasBreak = false) {
+ if (block->type == unreachable)
+ return; // nothing to do
+ if (block->list.size() == 0)
+ return; // nothing to do
// if we are concrete, stop - even an unreachable child
// won't change that (since we have a break with a value,
// or the final child flows out a value)
- if (isConcreteType(block->type)) return;
+ if (isConcreteType(block->type))
+ return;
// look for an unreachable child
for (auto* child : block->list) {
if (child->type == unreachable) {
- // there is an unreachable child, so we are unreachable, unless we have a break
+ // there is an unreachable child, so we are unreachable, unless we have a
+ // break
if (!breakabilityKnown) {
hasBreak = BranchUtils::BranchSeeker::hasNamed(block, block->name);
}
@@ -230,9 +280,11 @@ void Block::finalize() {
// (return)
// (i32.const 10)
// )
- if (isConcreteType(type)) return;
+ if (isConcreteType(type))
+ return;
// if we are unreachable, we are done
- if (type == unreachable) return;
+ if (type == unreachable)
+ return;
// we may still be unreachable if we have an unreachable
// child
for (auto* child : list) {
@@ -268,7 +320,9 @@ void Block::finalize(Type type_, bool hasBreak) {
void If::finalize(Type type_) {
type = type_;
- if (type == none && (condition->type == unreachable || (ifFalse && ifTrue->type == unreachable && ifFalse->type == unreachable))) {
+ if (type == none && (condition->type == unreachable ||
+ (ifFalse && ifTrue->type == unreachable &&
+ ifFalse->type == unreachable))) {
type = unreachable;
}
}
@@ -307,9 +361,7 @@ void Loop::finalize(Type type_) {
}
}
-void Loop::finalize() {
- type = body->type;
-}
+void Loop::finalize() { type = body->type; }
void Break::finalize() {
if (condition) {
@@ -325,12 +377,9 @@ void Break::finalize() {
}
}
-void Switch::finalize() {
- type = unreachable;
-}
+void Switch::finalize() { type = unreachable; }
-template<typename T>
-void handleUnreachableOperands(T* curr) {
+template<typename T> void handleUnreachableOperands(T* curr) {
for (auto* child : curr->operands) {
if (child->type == unreachable) {
curr->type = unreachable;
@@ -339,9 +388,7 @@ void handleUnreachableOperands(T* curr) {
}
}
-void Call::finalize() {
- handleUnreachableOperands(this);
-}
+void Call::finalize() { handleUnreachableOperands(this); }
void CallIndirect::finalize() {
handleUnreachableOperands(this);
@@ -351,29 +398,31 @@ void CallIndirect::finalize() {
}
bool FunctionType::structuralComparison(FunctionType& b) {
- if (result != b.result) return false;
- if (params.size() != b.params.size()) return false;
+ if (result != b.result)
+ return false;
+ if (params.size() != b.params.size())
+ return false;
for (size_t i = 0; i < params.size(); i++) {
- if (params[i] != b.params[i]) return false;
+ if (params[i] != b.params[i])
+ return false;
}
return true;
}
bool FunctionType::operator==(FunctionType& b) {
- if (name != b.name) return false;
+ if (name != b.name)
+ return false;
return structuralComparison(b);
}
-bool FunctionType::operator!=(FunctionType& b) {
- return !(*this == b);
-}
+bool FunctionType::operator!=(FunctionType& b) { return !(*this == b); }
-bool SetLocal::isTee() {
- return type != none;
-}
+bool SetLocal::isTee() { return type != none; }
void SetLocal::setTee(bool is) {
- if (is) type = value->type;
- else type = none;
+ if (is)
+ type = value->type;
+ else
+ type = none;
finalize(); // type may need to be unreachable
}
@@ -415,14 +464,16 @@ void AtomicRMW::finalize() {
}
void AtomicCmpxchg::finalize() {
- if (ptr->type == unreachable || expected->type == unreachable || replacement->type == unreachable) {
+ if (ptr->type == unreachable || expected->type == unreachable ||
+ replacement->type == unreachable) {
type = unreachable;
}
}
void AtomicWait::finalize() {
type = i32;
- if (ptr->type == unreachable || expected->type == unreachable || timeout->type == unreachable) {
+ if (ptr->type == unreachable || expected->type == unreachable ||
+ timeout->type == unreachable) {
type = unreachable;
}
}
@@ -441,11 +492,20 @@ void SIMDExtract::finalize() {
case ExtractLaneUVecI8x16:
case ExtractLaneSVecI16x8:
case ExtractLaneUVecI16x8:
- case ExtractLaneVecI32x4: type = i32; break;
- case ExtractLaneVecI64x2: type = i64; break;
- case ExtractLaneVecF32x4: type = f32; break;
- case ExtractLaneVecF64x2: type = f64; break;
- default: WASM_UNREACHABLE();
+ case ExtractLaneVecI32x4:
+ type = i32;
+ break;
+ case ExtractLaneVecI64x2:
+ type = i64;
+ break;
+ case ExtractLaneVecF32x4:
+ type = f32;
+ break;
+ case ExtractLaneVecF64x2:
+ type = f64;
+ break;
+ default:
+ WASM_UNREACHABLE();
}
if (vec->type == unreachable) {
type = unreachable;
@@ -471,7 +531,8 @@ void SIMDShuffle::finalize() {
void SIMDBitselect::finalize() {
assert(left && right && cond);
type = v128;
- if (left->type == unreachable || right->type == unreachable || cond->type == unreachable) {
+ if (left->type == unreachable || right->type == unreachable ||
+ cond->type == unreachable) {
type = unreachable;
}
}
@@ -479,19 +540,19 @@ void SIMDBitselect::finalize() {
void MemoryInit::finalize() {
assert(dest && offset && size);
type = none;
- if (dest->type == unreachable || offset->type == unreachable || size->type == unreachable) {
+ if (dest->type == unreachable || offset->type == unreachable ||
+ size->type == unreachable) {
type = unreachable;
}
}
-void DataDrop::finalize() {
- type = none;
-}
+void DataDrop::finalize() { type = none; }
void MemoryCopy::finalize() {
assert(dest && source && size);
type = none;
- if (dest->type == unreachable || source->type == unreachable || size->type == unreachable) {
+ if (dest->type == unreachable || source->type == unreachable ||
+ size->type == unreachable) {
type = unreachable;
}
}
@@ -499,7 +560,8 @@ void MemoryCopy::finalize() {
void MemoryFill::finalize() {
assert(dest && value && size);
type = none;
- if (dest->type == unreachable || value->type == unreachable || size->type == unreachable) {
+ if (dest->type == unreachable || value->type == unreachable ||
+ size->type == unreachable) {
type = unreachable;
}
}
@@ -518,13 +580,9 @@ Const* Const::set(Literal value_) {
return this;
}
-void Const::finalize() {
- type = value.type;
-}
+void Const::finalize() { type = value.type; }
-bool Unary::isRelational() {
- return op == EqZInt32 || op == EqZInt64;
-}
+bool Unary::isRelational() { return op == EqZInt32 || op == EqZInt64; }
void Unary::finalize() {
if (value->type == unreachable) {
@@ -551,14 +609,33 @@ void Unary::finalize() {
case FloorFloat64:
case TruncFloat64:
case NearestFloat64:
- case SqrtFloat64: type = value->type; break;
+ case SqrtFloat64:
+ type = value->type;
+ break;
case EqZInt32:
- case EqZInt64: type = i32; break;
- case ExtendS8Int32: case ExtendS16Int32: type = i32; break;
- case ExtendSInt32: case ExtendUInt32: case ExtendS8Int64: case ExtendS16Int64: case ExtendS32Int64: type = i64; break;
- case WrapInt64: type = i32; break;
- case PromoteFloat32: type = f64; break;
- case DemoteFloat64: type = f32; break;
+ case EqZInt64:
+ type = i32;
+ break;
+ case ExtendS8Int32:
+ case ExtendS16Int32:
+ type = i32;
+ break;
+ case ExtendSInt32:
+ case ExtendUInt32:
+ case ExtendS8Int64:
+ case ExtendS16Int64:
+ case ExtendS32Int64:
+ type = i64;
+ break;
+ case WrapInt64:
+ type = i32;
+ break;
+ case PromoteFloat32:
+ type = f64;
+ break;
+ case DemoteFloat64:
+ type = f32;
+ break;
case TruncSFloat32ToInt32:
case TruncUFloat32ToInt32:
case TruncSFloat64ToInt32:
@@ -567,7 +644,9 @@ void Unary::finalize() {
case TruncSatUFloat32ToInt32:
case TruncSatSFloat64ToInt32:
case TruncSatUFloat64ToInt32:
- case ReinterpretFloat32: type = i32; break;
+ case ReinterpretFloat32:
+ type = i32;
+ break;
case TruncSFloat32ToInt64:
case TruncUFloat32ToInt64:
case TruncSFloat64ToInt64:
@@ -576,17 +655,23 @@ void Unary::finalize() {
case TruncSatUFloat32ToInt64:
case TruncSatSFloat64ToInt64:
case TruncSatUFloat64ToInt64:
- case ReinterpretFloat64: type = i64; break;
+ case ReinterpretFloat64:
+ type = i64;
+ break;
case ReinterpretInt32:
case ConvertSInt32ToFloat32:
case ConvertUInt32ToFloat32:
case ConvertSInt64ToFloat32:
- case ConvertUInt64ToFloat32: type = f32; break;
+ case ConvertUInt64ToFloat32:
+ type = f32;
+ break;
case ReinterpretInt64:
case ConvertSInt32ToFloat64:
case ConvertUInt32ToFloat64:
case ConvertSInt64ToFloat64:
- case ConvertUInt64ToFloat64: type = f64; break;
+ case ConvertUInt64ToFloat64:
+ type = f64;
+ break;
case SplatVecI8x16:
case SplatVecI16x8:
case SplatVecI32x4:
@@ -611,7 +696,9 @@ void Unary::finalize() {
case ConvertSVecI32x4ToVecF32x4:
case ConvertUVecI32x4ToVecF32x4:
case ConvertSVecI64x2ToVecF64x2:
- case ConvertUVecI64x2ToVecF64x2: type = v128; break;
+ case ConvertUVecI64x2ToVecF64x2:
+ type = v128;
+ break;
case AnyTrueVecI8x16:
case AllTrueVecI8x16:
case AnyTrueVecI16x8:
@@ -619,8 +706,11 @@ void Unary::finalize() {
case AnyTrueVecI32x4:
case AllTrueVecI32x4:
case AnyTrueVecI64x2:
- case AllTrueVecI64x2: type = i32; break;
- case InvalidUnary: WASM_UNREACHABLE();
+ case AllTrueVecI64x2:
+ type = i32;
+ break;
+ case InvalidUnary:
+ WASM_UNREACHABLE();
}
}
@@ -657,8 +747,10 @@ bool Binary::isRelational() {
case LtFloat32:
case LeFloat32:
case GtFloat32:
- case GeFloat32: return true;
- default: return false;
+ case GeFloat32:
+ return true;
+ default:
+ return false;
}
}
@@ -675,7 +767,8 @@ void Binary::finalize() {
void Select::finalize() {
assert(ifTrue && ifFalse);
- if (ifTrue->type == unreachable || ifFalse->type == unreachable || condition->type == unreachable) {
+ if (ifTrue->type == unreachable || ifFalse->type == unreachable ||
+ condition->type == unreachable) {
type = unreachable;
} else {
type = ifTrue->type;
@@ -708,33 +801,21 @@ void Host::finalize() {
}
}
-size_t Function::getNumParams() {
- return params.size();
-}
+size_t Function::getNumParams() { return params.size(); }
-size_t Function::getNumVars() {
- return vars.size();
-}
+size_t Function::getNumVars() { return vars.size(); }
-size_t Function::getNumLocals() {
- return params.size() + vars.size();
-}
+size_t Function::getNumLocals() { return params.size() + vars.size(); }
-bool Function::isParam(Index index) {
- return index < params.size();
-}
+bool Function::isParam(Index index) { return index < params.size(); }
-bool Function::isVar(Index index) {
- return index >= params.size();
-}
+bool Function::isVar(Index index) { return index >= params.size(); }
bool Function::hasLocalName(Index index) const {
return localNames.find(index) != localNames.end();
}
-Name Function::getLocalName(Index index) {
- return localNames.at(index);
-}
+Name Function::getLocalName(Index index) { return localNames.at(index); }
Name Function::getLocalNameOrDefault(Index index) {
auto nameIt = localNames.find(index);
@@ -761,9 +842,7 @@ Index Function::getLocalIndex(Name name) {
return iter->second;
}
-Index Function::getVarIndexBase() {
- return params.size();
-}
+Index Function::getVarIndexBase() { return params.size(); }
Type Function::getLocalType(Index index) {
if (isParam(index)) {
@@ -775,9 +854,7 @@ Type Function::getLocalType(Index index) {
}
}
-void Function::clearNames() {
- localNames.clear();
-}
+void Function::clearNames() { localNames.clear(); }
void Function::clearDebugInfo() {
localIndices.clear();
@@ -914,9 +991,7 @@ Global* Module::addGlobal(Global* curr) {
return curr;
}
-void Module::addStart(const Name& s) {
- start = s;
-}
+void Module::addStart(const Name& s) { start = s; }
void Module::removeFunctionType(Name name) {
for (size_t i = 0; i < functionTypes.size(); i++) {
@@ -979,8 +1054,6 @@ void Module::updateMaps() {
}
}
-void Module::clearDebugInfo() {
- debugInfoFileNames.clear();
-}
+void Module::clearDebugInfo() { debugInfoFileNames.clear(); }
} // namespace wasm