MLIR
22.0.0git
include
mlir
Reducer
Tester.h
Go to the documentation of this file.
1
//===- Tester.h -------------------------------------------------*- C++ -*-===//
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
//
9
// This file defines the Tester class used in the MLIR Reduce tool.
10
//
11
// A Tester object is passed as an argument to the reduction passes and it is
12
// used to run the interestingness testing script on the different generated
13
// reduced variants of the test case.
14
//
15
//===----------------------------------------------------------------------===//
16
17
#ifndef MLIR_REDUCER_TESTER_H
18
#define MLIR_REDUCER_TESTER_H
19
20
#include "
mlir/IR/BuiltinOps.h
"
21
#include "llvm/ADT/SmallString.h"
22
#include "llvm/Support/Error.h"
23
#include "llvm/Support/FileSystem.h"
24
#include "llvm/Support/Program.h"
25
26
namespace
mlir
{
27
28
/// This class is used to keep track of the testing environment of the tool. It
29
/// contains a method to run the interestingness testing script on a MLIR test
30
/// case file.
31
class
Tester
{
32
public
:
33
enum class
Interestingness
{
34
True
,
35
False
,
36
Untested
,
37
};
38
39
Tester
() =
default
;
40
Tester
(
const
Tester
&) =
default
;
41
42
Tester
(StringRef testScript,
ArrayRef<std::string>
testScriptArgs);
43
44
/// Runs the interestingness testing script on a MLIR test case file. Returns
45
/// true if the interesting behavior is present in the test case or false
46
/// otherwise.
47
std::pair<Interestingness, size_t>
isInteresting
(ModuleOp module)
const
;
48
49
/// Return whether the file in the given path is interesting.
50
Interestingness
isInteresting
(StringRef testCase)
const
;
51
52
void
setTestScript
(StringRef script) { testScript = script; }
53
void
setTestScriptArgs
(
ArrayRef<std::string>
args) { testScriptArgs = args; }
54
55
private
:
56
StringRef testScript;
57
ArrayRef<std::string>
testScriptArgs;
58
};
59
60
}
// namespace mlir
61
62
#endif
BuiltinOps.h
llvm::ArrayRef
Definition
LLVM.h:48
mlir::Tester::Interestingness
Interestingness
Definition
Tester.h:33
mlir::Tester::Interestingness::Untested
@ Untested
Definition
Tester.h:36
mlir::Tester::Interestingness::True
@ True
Definition
Tester.h:34
mlir::Tester::Interestingness::False
@ False
Definition
Tester.h:35
mlir::Tester::setTestScriptArgs
void setTestScriptArgs(ArrayRef< std::string > args)
Definition
Tester.h:53
mlir::Tester::isInteresting
std::pair< Interestingness, size_t > isInteresting(ModuleOp module) const
Runs the interestingness testing script on a MLIR test case file.
Definition
Tester.cpp:27
mlir::Tester::Tester
Tester()=default
mlir::Tester::setTestScript
void setTestScript(StringRef script)
Definition
Tester.h:52
mlir::Tester::Tester
Tester(const Tester &)=default
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
Generated on
for MLIR by
1.14.0