pin-server/0015-Pin-server-Bugfix-for-SwitchOp-change-it-to-terminat.patch

75 lines
3.0 KiB
Diff
Raw Normal View History

From 2f7eddb9820a2b8d9946431632f27490687af521 Mon Sep 17 00:00:00 2001
From: huitailangzju <804544223@qq.com>
Date: Mon, 27 Feb 2023 10:02:43 +0800
Subject: [PATCH 15/23] [Pin-server] Bugfix for SwitchOp, change it to
terminator operation
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
index 52c3ceb..db7e33f 100644
--- a/include/Dialect/PluginOps.td
+++ b/include/Dialect/PluginOps.td
@@ -521,29 +521,6 @@ def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
}];
}
-def SwitchOp : Plugin_Op<"switch", [NoSideEffect]> {
- let summary = "switch op.";
- let description = [{TODO}];
- let successors = (successor
- AnySuccessor:$defaultDestination,
- VariadicSuccessor<AnySuccessor>:$caseDestinations
- );
- let arguments = (ins UI64Attr:$id, AnyType:$index, UI64Attr:$address, AnyType:$defaultLabel, Variadic<AnyType>:$operands,
- UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
- let results = (outs AnyType:$result);
- let builders = [
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
- "ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
- "ArrayRef<Block*>":$caseDestinations, "ArrayRef<uint64_t>":$caseaddrs)>
- ];
-
- let extraClassDeclaration = [{
- unsigned GetNumLabels() { return getNumOperands() - 2; };
- Block* GetDefautDest() { return defaultDestination();}
- SmallVector<mlir::Block*> GetCaseDest() { return caseDestinations(); };
- }];
-}
-
def LabelOp : Plugin_Op<"label", [NoSideEffect]> {
let summary = "Label op.";
let description = [{TODO}];
@@ -612,6 +589,29 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
class Plugin_TerminatorOp<string mnemonic, list<OpTrait> traits = []> :
Plugin_Op<mnemonic, !listconcat(traits, [Terminator])>;
+def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> {
+ let summary = "switch op.";
+ let description = [{TODO}];
+ let successors = (successor
+ AnySuccessor:$defaultDestination,
+ VariadicSuccessor<AnySuccessor>:$caseDestinations
+ );
+ let arguments = (ins UI64Attr:$id, AnyType:$index, UI64Attr:$address, AnyType:$defaultLabel, Variadic<AnyType>:$operands,
+ UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
+ let results = (outs AnyType:$result);
+ let builders = [
+ OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
+ "ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
+ "ArrayRef<Block*>":$caseDestinations, "ArrayRef<uint64_t>":$caseaddrs)>
+ ];
+
+ let extraClassDeclaration = [{
+ unsigned GetNumLabels() { return getNumOperands() - 2; };
+ Block* GetDefautDest() { return defaultDestination();}
+ SmallVector<mlir::Block*> GetCaseDest() { return caseDestinations(); };
+ }];
+}
+
def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> {
let summary = "FallThroughOp";
let description = [{TODO}];
--
2.33.0