#include "deltas/RunIRPasses.h"
#include "deltas/SimplifyInstructions.h"
#include "deltas/StripDebugInfo.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
#include "llvm/Transforms/Utils/Cloning.h"
#include <optional>
+using namespace llvm;
+
+ReducerWorkItem::ReducerWorkItem() = default;
+ReducerWorkItem::~ReducerWorkItem() = default;
+
extern cl::OptionCategory LLVMReduceOptions;
static cl::opt<std::string> TargetTriple("mtriple",
cl::desc("Set the target triple"),
#ifndef LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
#define LLVM_TOOLS_LLVM_REDUCE_REDUCERWORKITEM_H
-#include "llvm/Bitcode/BitcodeReader.h"
-#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
-#include "llvm/Target/TargetMachine.h"
+#include <memory>
-using namespace llvm;
+namespace llvm {
+class LLVMContext;
+class MachineModuleInfo;
+class raw_ostream;
+class TargetMachine;
+class TestRunner;
+struct BitcodeLTOInfo;
class ReducerWorkItem {
public:
return isMIR() ? computeMIRComplexityScore() : computeIRComplexityScore();
}
+ ReducerWorkItem();
+ ~ReducerWorkItem();
+ ReducerWorkItem(ReducerWorkItem &) = delete;
+ ReducerWorkItem(ReducerWorkItem &&) = default;
+
private:
uint64_t computeIRComplexityScore() const;
uint64_t computeMIRComplexityScore() const;
};
+} // namespace llvm
-std::pair<std::unique_ptr<ReducerWorkItem>, bool>
-parseReducerWorkItem(StringRef ToolName, StringRef Filename, LLVMContext &Ctxt,
- std::unique_ptr<TargetMachine> &TM, bool IsMIR);
+std::pair<std::unique_ptr<llvm::ReducerWorkItem>, bool>
+parseReducerWorkItem(llvm::StringRef ToolName, llvm::StringRef Filename,
+ llvm::LLVMContext &Ctxt,
+ std::unique_ptr<llvm::TargetMachine> &TM, bool IsMIR);
-std::unique_ptr<ReducerWorkItem>
-cloneReducerWorkItem(const ReducerWorkItem &MMM, const TargetMachine *TM);
+std::unique_ptr<llvm::ReducerWorkItem>
+cloneReducerWorkItem(const llvm::ReducerWorkItem &MMM,
+ const llvm::TargetMachine *TM);
-bool verifyReducerWorkItem(const ReducerWorkItem &MMM, raw_fd_ostream *OS);
+bool verifyReducerWorkItem(const llvm::ReducerWorkItem &MMM,
+ llvm::raw_fd_ostream *OS);
#endif
#include "ReduceDIMetadata.h"
#include "Delta.h"
#include "llvm/ADT/Sequence.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/InstIterator.h"
#include "ReduceIRReferences.h"
#include "Delta.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
using namespace llvm;
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"
+using namespace llvm;
+
static void reduceFlagsInModule(Oracle &O, ReducerWorkItem &WorkItem) {
for (Function &F : WorkItem.getModule()) {
for (Instruction &I : instructions(F)) {
#include "ReduceInstructionFlagsMIR.h"
#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
using namespace llvm;
static void removeFlagsFromModule(Oracle &O, ReducerWorkItem &WorkItem) {
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Transforms/Utils/Local.h"
+using namespace llvm;
+
static void reduceInvokesInFunction(Oracle &O, Function &F) {
for (BasicBlock &BB : F) {
InvokeInst *Invoke = dyn_cast<InvokeInst>(BB.getTerminator());
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
+using namespace llvm;
+
static void removeVolatileInFunction(Oracle &O, Function &F) {
LLVMContext &Ctx = F.getContext();
for (Instruction &I : instructions(F)) {
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
+using namespace llvm;
+
// Assume outgoing undef arguments aren't relevant.
// TODO: Maybe skip any trivial constant arguments.
static bool shouldIgnoreArgument(const Value *V) {
#include "ReduceRegisterDefs.h"
#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "ReduceRegisterMasks.h"
#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
using namespace llvm;
#include "ReduceRegisterUses.h"
#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
using namespace llvm;
#include "ReduceVirtualRegisters.h"
#include "Delta.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
using namespace llvm;
#include "DeltaManager.h"
#include "ReducerWorkItem.h"
#include "TestRunner.h"
+#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
+#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"