NewPMDriver.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //===- NewPMDriver.h - Function to drive opt with the new PM ----*- 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. /// \file
  10. ///
  11. /// A single function which is called to drive the opt behavior for the new
  12. /// PassManager.
  13. ///
  14. /// This is only in a separate TU with a header to avoid including all of the
  15. /// old pass manager headers and the new pass manager headers into the same
  16. /// file. Eventually all of the routines here will get folded back into
  17. /// opt.cpp.
  18. ///
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
  21. #define LLVM_TOOLS_OPT_NEWPMDRIVER_H
  22. #include "llvm/ADT/StringRef.h"
  23. namespace llvm {
  24. class LLVMContext;
  25. class Module;
  26. class TargetMachine;
  27. class tool_output_file;
  28. namespace opt_tool {
  29. enum OutputKind {
  30. OK_NoOutput,
  31. OK_OutputAssembly,
  32. OK_OutputBitcode
  33. };
  34. enum VerifierKind {
  35. VK_NoVerifier,
  36. VK_VerifyInAndOut,
  37. VK_VerifyEachPass
  38. };
  39. }
  40. /// \brief Driver function to run the new pass manager over a module.
  41. ///
  42. /// This function only exists factored away from opt.cpp in order to prevent
  43. /// inclusion of the new pass manager headers and the old headers into the same
  44. /// file. It's interface is consequentially somewhat ad-hoc, but will go away
  45. /// when the transition finishes.
  46. bool runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
  47. TargetMachine *TM, tool_output_file *Out,
  48. StringRef PassPipeline, opt_tool::OutputKind OK,
  49. opt_tool::VerifierKind VK,
  50. bool ShouldPreserveAssemblyUseListOrder,
  51. bool ShouldPreserveBitcodeUseListOrder);
  52. }
  53. #endif