1 //===- ReducerWorkItem.h - Wrapper for Module and MachineFunction ---------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
10 #define LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
12 #include "llvm/CodeGen/MachineFunction.h"
13 #include "llvm/CodeGen/MachineModuleInfo.h"
14 #include "llvm/IR/Module.h"
18 class ReducerWorkItem
{
20 std::shared_ptr
<Module
> M
;
21 std::unique_ptr
<MachineFunction
> MF
;
22 void print(raw_ostream
&ROS
, void *p
= nullptr) const;
23 bool isMIR() { return MF
!= nullptr; }
24 operator Module
&() const { return *M
; }
25 operator MachineFunction
&() const { return *MF
; }
28 std::unique_ptr
<ReducerWorkItem
> parseReducerWorkItem(StringRef Filename
,
30 MachineModuleInfo
*MMI
);
32 std::unique_ptr
<ReducerWorkItem
>
33 cloneReducerWorkItem(const ReducerWorkItem
&MMM
);
35 bool verifyReducerWorkItem(const ReducerWorkItem
&MMM
, raw_fd_ostream
*OS
);