Chromium Code Reviews| Index: src/WasmTranslator.h |
| diff --git a/src/WasmTranslator.h b/src/WasmTranslator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a3e364172e44def2d96d03360a71695a2db4c815 |
| --- /dev/null |
| +++ b/src/WasmTranslator.h |
| @@ -0,0 +1,42 @@ |
| +#pragma once |
|
JF
2016/03/28 18:17:14
Copyright notice for the file.
Also, pragma once?
Eric Holk
2016/03/29 19:54:12
Done.
|
| + |
| +#include "IceGlobalContext.h" |
| +#include "IceTranslator.h" |
| + |
| +#include "llvm/Support/StreamingMemoryObject.h" |
| + |
| +namespace v8::internal { |
|
John
2016/03/28 18:44:10
we tend to do
namespace v8 {
namespace internal {
John
2016/03/28 18:44:10
I would just #include the files defining these...
Eric Holk
2016/03/29 19:54:12
Done.
Eric Holk
2016/03/29 19:54:12
I decided to keep it as is, at least for now. The
|
| + class Zone; |
|
John
2016/03/28 18:44:10
no spaces? make sure clang-format is happy here.
Eric Holk
2016/03/29 19:54:12
This was what `make format` did.
|
| + namespace wasm { |
| + class FunctionEnv; |
| + } |
|
John
2016/03/28 18:44:10
// end of namespace wasm
|
| +} |
|
John
2016/03/28 18:44:10
// end of namespace v8::internal
|
| + |
| +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)) { |
| + Fn(Ctx->getStrDump()); |
| + Ctx->getStrDump().flush(); |
| + } |
| + } |
| + |
| +public: |
| + explicit WasmTranslator(GlobalContext *Ctx) : Translator(Ctx) {} |
| + ~WasmTranslator() override = default; |
| + |
| + void translate(const std::string &IRFilename, |
| + std::unique_ptr<llvm::DataStreamer> &&InputStream); |
|
John
2016/03/28 18:44:10
std::unique_ptr<> InputStream (i.e., no r-value re
Eric Holk
2016/03/29 19:54:12
Done.
|
| + |
| + std::unique_ptr<Cfg> translateFunction(v8::internal::Zone *zone, |
| + v8::internal::wasm::FunctionEnv *env, |
| + const uint8_t *base, |
| + const uint8_t *start, |
| + const uint8_t *end); |
| +}; |
| +} |
|
John
2016/03/28 18:44:10
// end of namespace Ice
|