107 lines
3.9 KiB
Diff
107 lines
3.9 KiB
Diff
From c0da500cd20a295521d650cfcdb277b66d18bba5 Mon Sep 17 00:00:00 2001
|
|
From: benniaobufeijiushiji <linda7@huawei.com>
|
|
Date: Sun, 19 Feb 2023 11:44:30 +0800
|
|
Subject: [PATCH 5/9] [Pin-gcc-client] Add DebugOp
|
|
|
|
|
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
|
index c48d002..bac84be 100644
|
|
--- a/include/Dialect/PluginOps.td
|
|
+++ b/include/Dialect/PluginOps.td
|
|
@@ -235,6 +235,16 @@ def BaseOp : Plugin_Op<"statement_base", [NoSideEffect]> {
|
|
];
|
|
}
|
|
|
|
+def DebugOp : Plugin_Op<"debug", [NoSideEffect]> {
|
|
+ let summary = "DebugOp.";
|
|
+ let description = [{TODO}];
|
|
+ let arguments = (ins UI64Attr:$id);
|
|
+ let results = (outs AnyType);
|
|
+ let builders = [
|
|
+ OpBuilderDAG<(ins "uint64_t":$id)>
|
|
+ ];
|
|
+}
|
|
+
|
|
// Terminators
|
|
// Opaque builder used for terminator operations that contain successors.
|
|
|
|
diff --git a/include/PluginClient/PluginJson.h b/include/PluginClient/PluginJson.h
|
|
index 91bd925..a0aac8a 100755
|
|
--- a/include/PluginClient/PluginJson.h
|
|
+++ b/include/PluginClient/PluginJson.h
|
|
@@ -53,6 +53,7 @@ public:
|
|
Json::Value PhiOpJsonSerialize(mlir::Plugin::PhiOp& data);
|
|
Json::Value AssignOpJsonSerialize(mlir::Plugin::AssignOp& data);
|
|
Json::Value BaseOpJsonSerialize(mlir::Plugin::BaseOp data);
|
|
+ Json::Value DebugOpJsonSerialize(mlir::Plugin::DebugOp data);
|
|
Json::Value FallThroughOpJsonSerialize(mlir::Plugin::FallThroughOp data, uint64_t&);
|
|
Json::Value RetOpJsonSerialize(mlir::Plugin::RetOp data, uint64_t&);
|
|
Json::Value ValueJsonSerialize(mlir::Value value);
|
|
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
|
|
index 052ebfd..da5f3f3 100644
|
|
--- a/lib/Dialect/PluginOps.cpp
|
|
+++ b/lib/Dialect/PluginOps.cpp
|
|
@@ -243,6 +243,15 @@ void BaseOp::build(OpBuilder &builder, OperationState &state, uint64_t id, Strin
|
|
state.addAttribute("opCode", builder.getStringAttr(opCode));
|
|
}
|
|
|
|
+//===----------------------------------------------------------------------===//
|
|
+// DebugOp
|
|
+
|
|
+void DebugOp::build(OpBuilder &builder, OperationState &state,
|
|
+ uint64_t id)
|
|
+{
|
|
+ state.addAttribute("id", builder.getI64IntegerAttr(id));
|
|
+}
|
|
+
|
|
// ===----------------------------------------------------------------------===//
|
|
// FallThroughOp
|
|
|
|
diff --git a/lib/PluginClient/PluginJson.cpp b/lib/PluginClient/PluginJson.cpp
|
|
index 22cd489..ccadf10 100755
|
|
--- a/lib/PluginClient/PluginJson.cpp
|
|
+++ b/lib/PluginClient/PluginJson.cpp
|
|
@@ -182,6 +182,8 @@ Json::Value PluginJson::OperationJsonSerialize(mlir::Operation *operation, uint6
|
|
root = RetOpJsonSerialize(op, bbId);
|
|
} else if (BaseOp op = llvm::dyn_cast<BaseOp>(operation)) {
|
|
root = BaseOpJsonSerialize(op);
|
|
+ } else if (DebugOp op = llvm::dyn_cast<DebugOp>(operation)) {
|
|
+ root = DebugOpJsonSerialize(op);
|
|
}
|
|
root["OperationName"] = operation->getName().getStringRef().str();
|
|
return root;
|
|
@@ -203,6 +205,13 @@ Json::Value PluginJson::RetOpJsonSerialize(RetOp data, uint64_t &bbId)
|
|
return root;
|
|
}
|
|
|
|
+Json::Value PluginJson::DebugOpJsonSerialize(DebugOp data)
|
|
+{
|
|
+ Json::Value root;
|
|
+ root["id"] = std::to_string(data.idAttr().getInt());
|
|
+ return root;
|
|
+}
|
|
+
|
|
Json::Value PluginJson::FallThroughOpJsonSerialize(FallThroughOp data, uint64_t &bbId)
|
|
{
|
|
Json::Value root;
|
|
diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp
|
|
index b5974aa..2f46f6f 100644
|
|
--- a/lib/Translate/GimpleToPluginOps.cpp
|
|
+++ b/lib/Translate/GimpleToPluginOps.cpp
|
|
@@ -579,6 +579,12 @@ Operation *GimpleToPluginOps::BuildOperation(uint64_t id)
|
|
ret = condOp.getOperation();
|
|
break;
|
|
}
|
|
+ case GIMPLE_DEBUG: {
|
|
+ DebugOp debugOp = builder.create<DebugOp>(
|
|
+ builder.getUnknownLoc(), id);
|
|
+ ret = debugOp.getOperation();
|
|
+ break;
|
|
+ }
|
|
default: {
|
|
BaseOp baseOp = builder.create<BaseOp>(
|
|
builder.getUnknownLoc(), id, BaseOp::getOperationName());
|
|
--
|
|
2.27.0.windows.1
|
|
|