1 //===- subzero/src/PNaClTranslator.h - ICE from bitcode ---------*- C++ -*-===// 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 the interface for translation from PNaCl bitcode files to 12 /// ICE to machine code. 13 /// 14 //===----------------------------------------------------------------------===// 15 16 #ifndef SUBZERO_SRC_PNACLTRANSLATOR_H 17 #define SUBZERO_SRC_PNACLTRANSLATOR_H 18 19 #include "IceTranslator.h" 20 21 #include <string> 22 23 namespace llvm { 24 class MemoryBuffer; 25 class MemoryObject; 26 } // end of namespace llvm 27 28 namespace Ice { 29 30 class PNaClTranslator : public Translator { 31 PNaClTranslator() = delete; 32 PNaClTranslator(const PNaClTranslator &) = delete; 33 PNaClTranslator &operator=(const PNaClTranslator &) = delete; 34 35 public: PNaClTranslator(GlobalContext * Ctx)36 explicit PNaClTranslator(GlobalContext *Ctx) : Translator(Ctx) {} 37 ~PNaClTranslator() override = default; 38 39 /// Reads the PNaCl bitcode file and translates to ICE, which is then 40 /// converted to machine code. Sets ErrorStatus to 1 if any errors occurred. 41 /// Takes ownership of the MemoryObject. 42 void translate(const std::string &IRFilename, 43 std::unique_ptr<llvm::MemoryObject> &&MemoryObject); 44 45 /// Reads MemBuf, assuming it is the PNaCl bitcode contents of IRFilename. 46 void translateBuffer(const std::string &IRFilename, 47 llvm::MemoryBuffer *MemBuf); 48 }; 49 50 } // end of namespace Ice 51 52 #endif // SUBZERO_SRC_PNACLTRANSLATOR_H 53