aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Transforms/LocationSnapshot.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:31:57 +0900
committerNAKAMURA Takumi <geek4civic@gmail.com>2025-01-09 18:33:27 +0900
commitdf025ebf872052c0761d44a3ef9b65e9675af8a8 (patch)
tree9b4e94583e2536546d6606270bcdf846c95e1ba2 /mlir/lib/Transforms/LocationSnapshot.cpp
parent4428c9d0b1344179f85a72e183a44796976521e3 (diff)
parentbdcf47e4bcb92889665825654bb80a8bbe30379e (diff)
downloadllvm-users/chapuni/cov/single/loop.zip
llvm-users/chapuni/cov/single/loop.tar.gz
llvm-users/chapuni/cov/single/loop.tar.bz2
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts: clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'mlir/lib/Transforms/LocationSnapshot.cpp')
-rw-r--r--mlir/lib/Transforms/LocationSnapshot.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/mlir/lib/Transforms/LocationSnapshot.cpp b/mlir/lib/Transforms/LocationSnapshot.cpp
index b85850a..f701c8b 100644
--- a/mlir/lib/Transforms/LocationSnapshot.cpp
+++ b/mlir/lib/Transforms/LocationSnapshot.cpp
@@ -10,6 +10,7 @@
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Builders.h"
+#include "mlir/IR/OperationSupport.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/FileUtilities.h"
#include "llvm/Support/FileSystem.h"
@@ -131,29 +132,23 @@ LogicalResult mlir::generateLocationsFromIR(StringRef fileName, StringRef tag,
namespace {
struct LocationSnapshotPass
: public impl::LocationSnapshotBase<LocationSnapshotPass> {
- LocationSnapshotPass() = default;
- LocationSnapshotPass(OpPrintingFlags flags, StringRef fileName, StringRef tag)
- : flags(flags) {
- this->fileName = fileName.str();
- this->tag = tag.str();
- }
+ using impl::LocationSnapshotBase<LocationSnapshotPass>::LocationSnapshotBase;
void runOnOperation() override {
Operation *op = getOperation();
- if (failed(generateLocationsFromIR(fileName, op, OpPrintingFlags(), tag)))
+ if (failed(generateLocationsFromIR(fileName, op, getFlags(), tag)))
return signalPassFailure();
}
- /// The printing flags to use when creating the snapshot.
- OpPrintingFlags flags;
+private:
+ /// build the flags from the command line arguments to the pass
+ OpPrintingFlags getFlags() {
+ OpPrintingFlags flags;
+ flags.enableDebugInfo(enableDebugInfo, printPrettyDebugInfo);
+ flags.printGenericOpForm(printGenericOpForm);
+ if (useLocalScope)
+ flags.useLocalScope();
+ return flags;
+ }
};
} // namespace
-
-std::unique_ptr<Pass> mlir::createLocationSnapshotPass(OpPrintingFlags flags,
- StringRef fileName,
- StringRef tag) {
- return std::make_unique<LocationSnapshotPass>(flags, fileName, tag);
-}
-std::unique_ptr<Pass> mlir::createLocationSnapshotPass() {
- return std::make_unique<LocationSnapshotPass>();
-}