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