IRReader.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  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 defines functions for reading LLVM IR. They support both
  11. // Bitcode and Assembly, automatically detecting the input format.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_IRREADER_IRREADER_H
  15. #define LLVM_IRREADER_IRREADER_H
  16. #include "llvm/Support/MemoryBuffer.h"
  17. #include <string>
  18. namespace llvm {
  19. class Module;
  20. class SMDiagnostic;
  21. class LLVMContext;
  22. /// If the given file holds a bitcode image, return a Module
  23. /// for it which does lazy deserialization of function bodies. Otherwise,
  24. /// attempt to parse it as LLVM Assembly and return a fully populated
  25. /// Module.
  26. std::unique_ptr<Module> getLazyIRFileModule(StringRef Filename,
  27. SMDiagnostic &Err,
  28. LLVMContext &Context);
  29. /// If the given MemoryBuffer holds a bitcode image, return a Module
  30. /// for it. Otherwise, attempt to parse it as LLVM Assembly and return
  31. /// a Module for it.
  32. std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
  33. LLVMContext &Context);
  34. /// If the given file holds a bitcode image, return a Module for it.
  35. /// Otherwise, attempt to parse it as LLVM Assembly and return a Module
  36. /// for it.
  37. std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
  38. LLVMContext &Context);
  39. }
  40. #endif