ReducerWorkItem.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===- ReducerWorkItem.h - Wrapper for Module and MachineFunction ---------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
  9. #define LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
  10. #include "llvm/CodeGen/MachineFunction.h"
  11. #include "llvm/CodeGen/MachineModuleInfo.h"
  12. #include "llvm/IR/Module.h"
  13. using namespace llvm;
  14. class ReducerWorkItem {
  15. public:
  16. std::shared_ptr<Module> M;
  17. std::unique_ptr<MachineFunction> MF;
  18. void print(raw_ostream &ROS, void *p = nullptr) const;
  19. bool isMIR() { return MF != nullptr; }
  20. operator Module &() const { return *M; }
  21. operator MachineFunction &() const { return *MF; }
  22. };
  23. std::unique_ptr<ReducerWorkItem> parseReducerWorkItem(StringRef Filename,
  24. LLVMContext &Ctxt,
  25. MachineModuleInfo *MMI);
  26. std::unique_ptr<ReducerWorkItem>
  27. cloneReducerWorkItem(const ReducerWorkItem &MMM);
  28. bool verifyReducerWorkItem(const ReducerWorkItem &MMM, raw_fd_ostream *OS);
  29. #endif