ModuleContext::Arities ModuleContext::GetExprArity(const Expr& expr) const { switch (expr.type()) { case ExprType::AtomicNotify: case ExprType::AtomicRmw: case ExprType::Binary: case ExprType::Compare: case ExprType::TableGrow: return {2, 1};
case ExprType::AtomicStore: case ExprType::Store: case ExprType::TableSet: return {2, 0};
case ExprType::Block: return {0, cast<BlockExpr>(&expr)->block.decl.sig.GetNumResults()};
case ExprType::Br: return {GetLabelArity(cast<BrExpr>(&expr)->var), 1, true};
case ExprType::BrIf: {
Index arity = GetLabelArity(cast<BrIfExpr>(&expr)->var); return {arity + 1, arity};
}
case ExprType::BrTable: return {GetLabelArity(cast<BrTableExpr>(&expr)->default_target) + 1, 1, true};
case ExprType::Call: { const Var& var = cast<CallExpr>(&expr)->var; return {GetFuncParamCount(var), GetFuncResultCount(var)};
}
case ExprType::ReturnCall: { const Var& var = cast<ReturnCallExpr>(&expr)->var; return {GetFuncParamCount(var), GetFuncResultCount(var), true};
}
case ExprType::Const: case ExprType::GlobalGet: case ExprType::LocalGet: case ExprType::MemorySize: case ExprType::TableSize: case ExprType::RefNull: case ExprType::RefFunc: return {0, 1};
case ExprType::Unreachable: return {0, 1, true};
case ExprType::DataDrop: case ExprType::ElemDrop: case ExprType::AtomicFence: case ExprType::CodeMetadata: return {0, 0};
case ExprType::MemoryInit: case ExprType::TableInit: case ExprType::MemoryFill: case ExprType::MemoryCopy: case ExprType::TableCopy: case ExprType::TableFill: return {3, 0};
case ExprType::AtomicLoad: case ExprType::Convert: case ExprType::Load: case ExprType::LocalTee: case ExprType::MemoryGrow: case ExprType::Unary: case ExprType::TableGet: case ExprType::RefIsNull: case ExprType::LoadSplat: case ExprType::LoadZero: return {1, 1};
case ExprType::Drop: case ExprType::GlobalSet: case ExprType::LocalSet: return {1, 0};
case ExprType::If: return {1, cast<IfExpr>(&expr)->true_.decl.sig.GetNumResults()};
case ExprType::Loop: return {0, cast<LoopExpr>(&expr)->block.decl.sig.GetNumResults()};
case ExprType::Nop: return {0, 0};
case ExprType::Return: return {static_cast<Index>(current_func_->decl.sig.result_types.size()), 1, true};
case ExprType::Rethrow: return {0, 0, true};
case ExprType::AtomicRmwCmpxchg: case ExprType::AtomicWait: case ExprType::Select: return {3, 1};
case ExprType::Throw: { auto throw_ = cast<ThrowExpr>(&expr);
Index operand_count = 0;
if (Tag* tag = module.GetTag(throw_->var)) {
operand_count = tag->decl.sig.param_types.size();
} return {operand_count, 0, true};
}
case ExprType::Try: return {0, cast<TryExpr>(&expr)->block.decl.sig.GetNumResults()};
case ExprType::Ternary: return {3, 1};
case ExprType::SimdLaneOp: { const Opcode opcode = cast<SimdLaneOpExpr>(&expr)->opcode; switch (opcode) { case Opcode::I8X16ExtractLaneS: case Opcode::I8X16ExtractLaneU: case Opcode::I16X8ExtractLaneS: case Opcode::I16X8ExtractLaneU: case Opcode::I32X4ExtractLane: case Opcode::I64X2ExtractLane: case Opcode::F32X4ExtractLane: case Opcode::F64X2ExtractLane: return {1, 1};
case Opcode::I8X16ReplaceLane: case Opcode::I16X8ReplaceLane: case Opcode::I32X4ReplaceLane: case Opcode::I64X2ReplaceLane: case Opcode::F32X4ReplaceLane: case Opcode::F64X2ReplaceLane: return {2, 1};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.