Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: src/WasmTranslator.h

Issue 1837663002: Initial Subzero WASM prototype. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review feedback and merging master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTranslator.cpp ('k') | src/WasmTranslator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- subzero/src/WasmTranslator.h - WASM to Subzero Translation ---------===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Declares a driver for translating Wasm bitcode into PNaCl bitcode.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SUBZERO_SRC_WASMTRANSLATOR_H
16 #define SUBZERO_SRC_WASMTRANSLATOR_H
17
18 #include "IceGlobalContext.h"
19 #include "IceTranslator.h"
20
21 namespace v8 {
22 namespace internal {
23 class Zone;
24 namespace wasm {
25 class FunctionEnv;
26 } // end of namespace wasm
27 } // end of namespace internal
28 } // end of namespace v8
29
30 namespace Ice {
31
32 class WasmTranslator : public Translator {
33 WasmTranslator() = delete;
34 WasmTranslator(const WasmTranslator &) = delete;
35 WasmTranslator &operator=(const WasmTranslator &) = delete;
36
37 template <typename F = std::function<void(Ostream &)>> void log(F Fn) {
38 if (BuildDefs::dump() && (getFlags().getVerbose() & IceV_Wasm)) {
39 Fn(Ctx->getStrDump());
40 Ctx->getStrDump().flush();
41 }
42 }
43
44 public:
45 explicit WasmTranslator(GlobalContext *Ctx);
46
47 void translate(const std::string &IRFilename,
48 std::unique_ptr<llvm::DataStreamer> InputStream);
49
50 /// Translates a single Wasm function.
51 ///
52 /// Parameters:
53 /// Zone - an arena for the V8 code to allocate from.
54 /// Env - information about the function (signature, variable count, etc.).
55 /// Base - a pointer to the start of the Wasm module.
56 /// Start - a pointer to the start of the function within the module.
57 /// End - a pointer to the end of the function.
58 std::unique_ptr<Cfg> translateFunction(v8::internal::Zone *Zone,
59 v8::internal::wasm::FunctionEnv *Env,
60 const uint8_t *Base,
61 const uint8_t *Start,
62 const uint8_t *End);
63
64 private:
65 std::unique_ptr<uint8_t[]> Buffer;
66 SizeT BufferSize;
67 };
68 }
69 #endif // SUBZERO_SRC_WASMTRANSLATOR_H
OLDNEW
« no previous file with comments | « src/IceTranslator.cpp ('k') | src/WasmTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698