Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 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 | // This file declares the PNaCl bitcode file to ICE, to machine code |
| 11 | // translator. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef SUBZERO_SRC_PNACLTRANSLATOR_H |
| 16 | #define SUBZERO_SRC_PNACLTRANSLATOR_H |
| 17 | |
Jim Stichnoth | a18cc9c | 2014-09-30 19:10:22 -0700 | [diff] [blame] | 18 | #include "IceTranslator.h" |
| 19 | |
John Porto | 67f8de9 | 2015-06-25 10:14:17 -0700 | [diff] [blame] | 20 | #include <string> |
| 21 | |
Karl Schimpf | 2e7daef | 2015-01-09 13:04:13 -0800 | [diff] [blame] | 22 | namespace llvm { |
| 23 | class MemoryBuffer; |
Jan Voung | c1f07ea | 2015-03-06 14:53:30 -0800 | [diff] [blame] | 24 | class MemoryObject; |
Karl Schimpf | 2e7daef | 2015-01-09 13:04:13 -0800 | [diff] [blame] | 25 | } // end of namespace llvm |
| 26 | |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 27 | namespace Ice { |
| 28 | |
| 29 | class PNaClTranslator : public Translator { |
Jim Stichnoth | c6ead20 | 2015-02-24 09:30:30 -0800 | [diff] [blame] | 30 | PNaClTranslator() = delete; |
Jim Stichnoth | 7b451a9 | 2014-10-15 14:39:23 -0700 | [diff] [blame] | 31 | PNaClTranslator(const PNaClTranslator &) = delete; |
| 32 | PNaClTranslator &operator=(const PNaClTranslator &) = delete; |
| 33 | |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 34 | public: |
Jim Stichnoth | c6ead20 | 2015-02-24 09:30:30 -0800 | [diff] [blame] | 35 | explicit PNaClTranslator(GlobalContext *Ctx) : Translator(Ctx) {} |
Karl Schimpf | 2e7daef | 2015-01-09 13:04:13 -0800 | [diff] [blame] | 36 | |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 37 | // Reads the PNaCl bitcode file and translates to ICE, which is then |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 38 | // converted to machine code. Sets ErrorStatus to 1 if any errors |
Jan Voung | c1f07ea | 2015-03-06 14:53:30 -0800 | [diff] [blame] | 39 | // occurred. Takes ownership of the MemoryObject. |
| 40 | void translate(const std::string &IRFilename, |
| 41 | std::unique_ptr<llvm::MemoryObject> &&MemoryObject); |
Karl Schimpf | 2e7daef | 2015-01-09 13:04:13 -0800 | [diff] [blame] | 42 | |
| 43 | // Reads MemBuf, assuming it is the PNaCl bitcode contents of IRFilename. |
| 44 | void translateBuffer(const std::string &IRFilename, |
| 45 | llvm::MemoryBuffer *MemBuf); |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 46 | }; |
Jim Stichnoth | 7b451a9 | 2014-10-15 14:39:23 -0700 | [diff] [blame] | 47 | |
| 48 | } // end of namespace Ice |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 49 | |
| 50 | #endif // SUBZERO_SRC_PNACLTRANSLATOR_H |