blob: b6286e822f71c93d8a9d1b973ac8cb6d1597108d [file] [log] [blame]
//===- subzero/src/PNaClTranslator.h - ICE from bitcode ---------*- C++ -*-===//
//
// The Subzero Code Generator
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file declares the PNaCl bitcode file to ICE, to machine code
/// translator.
///
//===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_PNACLTRANSLATOR_H
#define SUBZERO_SRC_PNACLTRANSLATOR_H
#include "IceTranslator.h"
#include <string>
namespace llvm {
class MemoryBuffer;
class MemoryObject;
} // end of namespace llvm
namespace Ice {
class PNaClTranslator : public Translator {
PNaClTranslator() = delete;
PNaClTranslator(const PNaClTranslator &) = delete;
PNaClTranslator &operator=(const PNaClTranslator &) = delete;
public:
explicit PNaClTranslator(GlobalContext *Ctx) : Translator(Ctx) {}
/// Reads the PNaCl bitcode file and translates to ICE, which is then
/// converted to machine code. Sets ErrorStatus to 1 if any errors
/// occurred. Takes ownership of the MemoryObject.
void translate(const std::string &IRFilename,
std::unique_ptr<llvm::MemoryObject> &&MemoryObject);
/// Reads MemBuf, assuming it is the PNaCl bitcode contents of IRFilename.
void translateBuffer(const std::string &IRFilename,
llvm::MemoryBuffer *MemBuf);
};
} // end of namespace Ice
#endif // SUBZERO_SRC_PNACLTRANSLATOR_H