1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#if !V8_ENABLE_WEBASSEMBLY
6#error This header should only be included if WebAssembly is enabled.
7#endif  // !V8_ENABLE_WEBASSEMBLY
8
9#ifndef V8_WASM_GRAPH_BUILDER_INTERFACE_H_
10#define V8_WASM_GRAPH_BUILDER_INTERFACE_H_
11
12#include "src/wasm/decoder.h"
13#include "src/wasm/wasm-result.h"
14
15namespace v8 {
16namespace internal {
17
18namespace compiler {  // external declarations from compiler.
19class NodeOriginTable;
20class WasmGraphBuilder;
21struct WasmLoopInfo;
22}  // namespace compiler
23
24namespace wasm {
25
26struct FunctionBody;
27class WasmFeatures;
28struct WasmModule;
29
30enum InlinedStatus {
31  // Inlined function whose call node has IfSuccess/IfException outputs.
32  kInlinedHandledCall,
33  // Inlined function whose call node does not have IfSuccess/IfException
34  // outputs.
35  kInlinedNonHandledCall,
36  // Not an inlined call.
37  kRegularFunction
38};
39
40V8_EXPORT_PRIVATE DecodeResult
41BuildTFGraph(AccountingAllocator* allocator, const WasmFeatures& enabled,
42             const WasmModule* module, compiler::WasmGraphBuilder* builder,
43             WasmFeatures* detected, const FunctionBody& body,
44             std::vector<compiler::WasmLoopInfo>* loop_infos,
45             compiler::NodeOriginTable* node_origins, int func_index,
46             InlinedStatus inlined_status);
47
48}  // namespace wasm
49}  // namespace internal
50}  // namespace v8
51
52#endif  // V8_WASM_GRAPH_BUILDER_INTERFACE_H_
53