Chromium Code Reviews| Index: src/WasmTranslator.h |
| diff --git a/src/WasmTranslator.h b/src/WasmTranslator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..96af8068272373a2bb6105c3931857a9e4896469 |
| --- /dev/null |
| +++ b/src/WasmTranslator.h |
| @@ -0,0 +1,58 @@ |
| +//===- subzero/src/WasmTranslator.h - WASM to Subzero Translation ---------===// |
| +// |
| +// The Subzero Code Generator |
| +// |
| +// This file is distributed under the University of Illinois Open Source |
| +// License. See LICENSE.TXT for details. |
| +// |
| +//===----------------------------------------------------------------------===// |
|
Jim Stichnoth
2016/04/01 01:46:45
The license boilerplate usually also includes a bl
Eric Holk
2016/04/01 19:15:03
Done.
|
| + |
| +#ifndef SUBZERO_SRC_WASMTRANSLATOR_H |
| +#define SUBZERO_SRC_WASMTRANSLATOR_H |
| + |
| +#include "IceGlobalContext.h" |
| +#include "IceTranslator.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| +class Zone; |
| +namespace wasm { |
| +class FunctionEnv; |
| +} // end of namespace wasm |
| +} // end of namespace internal |
| +} // end of namespace v8 |
| + |
| +namespace Ice { |
| + |
| +class WasmTranslator : public Translator { |
| + WasmTranslator() = delete; |
| + WasmTranslator(const WasmTranslator &) = delete; |
| + WasmTranslator &operator=(const WasmTranslator &) = delete; |
| + |
| + template <typename F = std::function<void(Ostream &)>> void log(F Fn) { |
| + if (BuildDefs::dump() && (Ctx->getFlags().getVerbose() & IceV_Wasm)) { |
| + OstreamLocker L(Ctx); |
|
Jim Stichnoth
2016/04/01 01:46:45
The "new" Subzero style is to name this RAII varia
Eric Holk
2016/04/01 19:15:02
Done.
|
| + Fn(Ctx->getStrDump()); |
| + Ctx->getStrDump().flush(); |
|
Jim Stichnoth
2016/04/01 01:46:45
Just curious if this flush() is necessary and if w
Eric Holk
2016/04/01 19:15:02
It's normally not necessary. Early on I had insert
|
| + } |
| + } |
| + |
| +public: |
| + explicit WasmTranslator(GlobalContext *Ctx); |
| + ~WasmTranslator() override; |
| + |
| + void translate(const std::string &IRFilename, |
| + std::unique_ptr<llvm::DataStreamer> InputStream); |
| + |
| + std::unique_ptr<Cfg> translateFunction(v8::internal::Zone *zone, |
|
Jim Stichnoth
2016/04/01 01:46:45
Capitalize variable names per LLVM convention.
Eric Holk
2016/04/01 19:15:03
Done.
|
| + v8::internal::wasm::FunctionEnv *env, |
| + const uint8_t *base, |
|
Jim Stichnoth
2016/04/01 01:46:45
Can you document these arguments, especially base/
Eric Holk
2016/04/01 19:15:03
Done.
With the latest v8 changes (coming in my ne
|
| + const uint8_t *start, |
| + const uint8_t *end); |
| + |
| +private: |
| + uint8_t *Buffer; |
| + SizeT BufferSize; |
| +}; |
| +} |
| +#endif // SUBZERO_SRC_WASMTRANSLATOR_H |