1217 lines
57 KiB
Diff
1217 lines
57 KiB
Diff
|
|
From 862e94cb9cd06370548584a6f0a3a2e07bbc6e11 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||
|
|
Date: Wed, 10 Apr 2024 17:31:27 +0800
|
||
|
|
Subject: [PATCH] [MLIR17] Adaptation to llvm17/mlir17.
|
||
|
|
|
||
|
|
---
|
||
|
|
include/Dialect/PluginOps.td | 123 ++++++------
|
||
|
|
include/Dialect/PluginTypes.h | 2 +
|
||
|
|
lib/Dialect/PluginOps.cpp | 37 ++--
|
||
|
|
lib/PluginClient/PluginJson.cpp | 286 ++++++++++++++--------------
|
||
|
|
lib/Translate/GimpleToPluginOps.cpp | 20 +-
|
||
|
|
5 files changed, 239 insertions(+), 229 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||
|
|
index d9b0893..6ec7961 100644
|
||
|
|
--- a/include/Dialect/PluginOps.td
|
||
|
|
+++ b/include/Dialect/PluginOps.td
|
||
|
|
@@ -24,7 +24,7 @@ include "PluginDialect.td"
|
||
|
|
include "mlir/Interfaces/SideEffectInterfaces.td"
|
||
|
|
include "mlir/Interfaces/CallInterfaces.td"
|
||
|
|
|
||
|
|
-def CGnodeOp : Plugin_Op<"callgraphnode", [NoSideEffect]> {
|
||
|
|
+def CGnodeOp : Plugin_Op<"callgraphnode", [NoMemoryEffect]> {
|
||
|
|
let summary = "callgraph node operation";
|
||
|
|
let description = [{
|
||
|
|
TODO.
|
||
|
|
@@ -47,7 +47,7 @@ def CGnodeOp : Plugin_Op<"callgraphnode", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def FunctionOp : Plugin_Op<"function", [NoSideEffect]> {
|
||
|
|
+def FunctionOp : Plugin_Op<"function", [NoMemoryEffect]> {
|
||
|
|
let summary = "function with a region";
|
||
|
|
let description = [{
|
||
|
|
TODO.
|
||
|
|
@@ -72,7 +72,7 @@ def FunctionOp : Plugin_Op<"function", [NoSideEffect]> {
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def LocalDeclOp : Plugin_Op<"declaration", [NoSideEffect]> {
|
||
|
|
+def LocalDeclOp : Plugin_Op<"declaration", [NoMemoryEffect]> {
|
||
|
|
let summary = "local variable declaration";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins OptionalAttr<UI64Attr>:$id,
|
||
|
|
@@ -86,7 +86,7 @@ def LocalDeclOp : Plugin_Op<"declaration", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def LoopOp : Plugin_Op<"loop", [NoSideEffect]> {
|
||
|
|
+def LoopOp : Plugin_Op<"loop", [NoMemoryEffect]> {
|
||
|
|
let summary = "loop operation";
|
||
|
|
let description = [{
|
||
|
|
TODO.
|
||
|
|
@@ -132,7 +132,7 @@ def CallOp : Plugin_Op<"call", [
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def PhiOp : Plugin_Op<"phi", [NoSideEffect]> {
|
||
|
|
+def PhiOp : Plugin_Op<"phi", [NoMemoryEffect]> {
|
||
|
|
let summary = "phi op";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id,
|
||
|
|
@@ -150,7 +150,7 @@ def PhiOp : Plugin_Op<"phi", [NoSideEffect]> {
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def AssignOp : Plugin_Op<"assign", [NoSideEffect]> {
|
||
|
|
+def AssignOp : Plugin_Op<"assign", [NoMemoryEffect]> {
|
||
|
|
let summary = "assign op";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id,
|
||
|
|
@@ -169,7 +169,7 @@ def AssignOp : Plugin_Op<"assign", [NoSideEffect]> {
|
||
|
|
// let printer = [{ return ::print(p, *this); }];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def NopOp : Plugin_Op<"nop", [NoSideEffect]> {
|
||
|
|
+def NopOp : Plugin_Op<"nop", [NoMemoryEffect]> {
|
||
|
|
let summary = "nop";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id);
|
||
|
|
@@ -179,7 +179,7 @@ def NopOp : Plugin_Op<"nop", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def EHElseOp : Plugin_Op<"eh_else", [NoSideEffect]> {
|
||
|
|
+def EHElseOp : Plugin_Op<"eh_else", [NoMemoryEffect]> {
|
||
|
|
let summary = "EHElseOP";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, ArrayAttr:$nBody, ArrayAttr:$eBody);
|
||
|
|
@@ -293,13 +293,13 @@ def DeclBaseOp : DeclBase<"decl"> {
|
||
|
|
let builders = [
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
|
||
|
|
"bool":$readOnly, "bool":$addressable, "bool":$used, "int":$uid, "Value":$initial,
|
||
|
|
- "Value":$name, "Optional<uint64_t>":$chain, "Type":$retType)>
|
||
|
|
+ "Value":$name, "std::optional<uint64_t>":$chain, "Type":$retType)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
|
||
|
|
- Value GetInitial() { return initial(); }
|
||
|
|
- Value GetName() { return name(); }
|
||
|
|
- Optional<uint64_t> GetChain() { return chain(); }
|
||
|
|
+ Value GetInitial() { return getInitial(); }
|
||
|
|
+ Value GetName() { return getName(); }
|
||
|
|
+ std::optional<uint64_t> GetChain() { return getChain(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -308,17 +308,17 @@ def BlockOp : BLOCK<"block"> {
|
||
|
|
let description = [{TODO}];
|
||
|
|
let builders = [
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
|
||
|
|
- "bool":$readOnly, "Optional<Value>":$vars, "Optional<uint64_t>":$supercontext,
|
||
|
|
- "Optional<Value>":$subblocks, "Optional<Value>":$chain,
|
||
|
|
- "Optional<Value>":$abstract_origin, "Type":$retType)>
|
||
|
|
+ "bool":$readOnly, "std::optional<Value>":$vars, "std::optional<uint64_t>":$supercontext,
|
||
|
|
+ "std::optional<Value>":$subblocks, "std::optional<Value>":$chain,
|
||
|
|
+ "std::optional<Value>":$abstract_origin, "Type":$retType)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
|
||
|
|
- Value GetVars() { return vars(); }
|
||
|
|
- Optional<uint64_t> GetSupercontext() { return supercontext(); }
|
||
|
|
- Value GetSubblocks() { return subblocks(); }
|
||
|
|
- Value GetChain() { return chain(); }
|
||
|
|
- Value GetAbstractorigin() { return abstract_origin(); }
|
||
|
|
+ Value GetVars() { return getVars(); }
|
||
|
|
+ std::optional<uint64_t> GetSupercontext() { return getSupercontext(); }
|
||
|
|
+ Value GetSubblocks() { return getSubblocks(); }
|
||
|
|
+ Value GetChain() { return getChain(); }
|
||
|
|
+ Value GetAbstractorigin() { return getAbstractOrigin(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -342,11 +342,11 @@ def FieldDeclOp : FieldDecl<"field"> {
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
|
||
|
|
- Value GetInitial() { return initial(); }
|
||
|
|
- Value GetName() { return name(); }
|
||
|
|
- Optional<uint64_t> GetChain() { return chain(); }
|
||
|
|
- Value GetFieldOffset() { return fieldOffset(); }
|
||
|
|
- Value GetFieldBitOffset() { return fieldBitOffset(); }
|
||
|
|
+ Value GetInitial() { return getInitial(); }
|
||
|
|
+ Value GetName() { return getName(); }
|
||
|
|
+ std::optional<uint64_t> GetChain() { return getChain(); }
|
||
|
|
+ Value GetFieldOffset() { return getFieldOffset(); }
|
||
|
|
+ Value GetFieldBitOffset() { return getFieldBitOffset(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -359,7 +359,7 @@ def AddressOp : Address<"address"> {
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
|
||
|
|
- Value GetOperand() { return operand(); }
|
||
|
|
+ Value GetOperand() { return getOperand(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -471,7 +471,7 @@ def ArrayOp : ArrayRef<"ArrayRef"> {
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def BaseOp : Plugin_Op<"statement_base", [NoSideEffect]> {
|
||
|
|
+def BaseOp : Plugin_Op<"statement_base", [NoMemoryEffect]> {
|
||
|
|
let summary = "Base operation, just like placeholder for statement.";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, StrAttr:$opCode);
|
||
|
|
@@ -481,7 +481,7 @@ def BaseOp : Plugin_Op<"statement_base", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def DebugOp : Plugin_Op<"debug", [NoSideEffect]> {
|
||
|
|
+def DebugOp : Plugin_Op<"debug", [NoMemoryEffect]> {
|
||
|
|
let summary = "DebugOp.";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id);
|
||
|
|
@@ -491,7 +491,7 @@ def DebugOp : Plugin_Op<"debug", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
|
||
|
|
+def AsmOp : Plugin_Op<"asm", [NoMemoryEffect]> {
|
||
|
|
let summary = "asm Op";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, StrAttr:$statement, UI32Attr:$nInputs, UI32Attr:$nOutputs, UI32Attr:$nClobbers,
|
||
|
|
@@ -503,17 +503,17 @@ def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- unsigned GetNInputs() { return this->nInputsAttr().getInt(); };
|
||
|
|
- unsigned GetNoutputs() { return this->nOutputsAttr().getInt(); };
|
||
|
|
- unsigned GetNClobbers() { return this->nClobbersAttr().getInt(); };
|
||
|
|
+ unsigned GetNInputs() { return this->getNInputsAttr().getInt(); };
|
||
|
|
+ unsigned GetNoutputs() { return this->getNOutputsAttr().getInt(); };
|
||
|
|
+ unsigned GetNClobbers() { return this->getNClobbersAttr().getInt(); };
|
||
|
|
Value GetInputOp(unsigned index) { return getOperand(index); };
|
||
|
|
- Value GetOutputOp(unsigned index) { return getOperand(this->nInputsAttr().getInt() + index); };
|
||
|
|
+ Value GetOutputOp(unsigned index) { return getOperand(this->getNInputsAttr().getInt() + index); };
|
||
|
|
Value GetCkobberOp(unsigned index) {
|
||
|
|
- return getOperand(this->nInputsAttr().getInt() + this->nOutputsAttr().getInt() + index); };
|
||
|
|
+ return getOperand(this->getNInputsAttr().getInt() + this->getNOutputsAttr().getInt() + index); };
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def LabelOp : Plugin_Op<"label", [NoSideEffect]> {
|
||
|
|
+def LabelOp : Plugin_Op<"label", [NoMemoryEffect]> {
|
||
|
|
let summary = "Label op.";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
@@ -526,7 +526,7 @@ def LabelOp : Plugin_Op<"label", [NoSideEffect]> {
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def EHMntOp : Plugin_Op<"eh_mnt", [NoSideEffect]> {
|
||
|
|
+def EHMntOp : Plugin_Op<"eh_mnt", [NoMemoryEffect]> {
|
||
|
|
let summary = "EH_MUST_NOT_THROW op.";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
@@ -535,11 +535,11 @@ def EHMntOp : Plugin_Op<"eh_mnt", [NoSideEffect]> {
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "Value":$decl)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- Value Getfndecl() { return decl(); };
|
||
|
|
+ Value Getfndecl() { return getDecl(); };
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def BindOp : Plugin_Op<"Bind", [NoSideEffect]> {
|
||
|
|
+def BindOp : Plugin_Op<"Bind", [NoMemoryEffect]> {
|
||
|
|
let summary = "BindOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
@@ -548,12 +548,12 @@ def BindOp : Plugin_Op<"Bind", [NoSideEffect]> {
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "Value":$vars, "ArrayRef<uint64_t>":$body, "Value":$block)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- Value GetVars() { return vars(); };
|
||
|
|
- Value GetBlock() { return block(); };
|
||
|
|
+ Value GetVars() { return getVars(); };
|
||
|
|
+ Value GetBlock() { return getBlock(); };
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def TryOp : Plugin_Op<"try", [NoSideEffect]> {
|
||
|
|
+def TryOp : Plugin_Op<"try", [NoMemoryEffect]> {
|
||
|
|
let summary = "TryOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
@@ -563,7 +563,7 @@ def TryOp : Plugin_Op<"try", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
|
||
|
|
+def CatchOp : Plugin_Op<"catch", [NoMemoryEffect]> {
|
||
|
|
let summary = "CatchOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
@@ -572,7 +572,7 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "Value":$types, "ArrayRef<uint64_t>":$handler)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- Value GetTypes() { return types(); };
|
||
|
|
+ Value GetTypes() { return getTypes(); };
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
// Terminators
|
||
|
|
@@ -581,30 +581,31 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
|
||
|
|
class Plugin_TerminatorOp<string mnemonic, list<Trait> traits = []> :
|
||
|
|
Plugin_Op<mnemonic, !listconcat(traits, [Terminator])>;
|
||
|
|
|
||
|
|
-def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> {
|
||
|
|
+def SwitchOp : Plugin_TerminatorOp<"switch", [NoMemoryEffect]> {
|
||
|
|
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 arguments = (ins UI64Attr:$id, AnyType:$index, UI64Attr:$address,
|
||
|
|
+ AnyType:$defaultLabel, Variadic<AnyType>:$args,
|
||
|
|
+ UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
|
||
|
|
let results = (outs AnyType:$result);
|
||
|
|
let builders = [
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
|
||
|
|
- "ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
|
||
|
|
+ "ArrayRef<Value>":$args, "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(); };
|
||
|
|
+ Block* GetDefautDest() { return getDefaultDestination(); }
|
||
|
|
+ SmallVector<mlir::Block*> GetCaseDest() { return getCaseDestinations(); };
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> {
|
||
|
|
+def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoMemoryEffect]> {
|
||
|
|
let summary = "FallThroughOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let successors = (successor AnySuccessor:$dest);
|
||
|
|
@@ -616,7 +617,7 @@ def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def CondOp : Plugin_TerminatorOp<"condition", [NoSideEffect]> {
|
||
|
|
+def CondOp : Plugin_TerminatorOp<"condition", [NoMemoryEffect]> {
|
||
|
|
let summary = "condition op";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, UI64Attr:$address,
|
||
|
|
@@ -639,7 +640,7 @@ def CondOp : Plugin_TerminatorOp<"condition", [NoSideEffect]> {
|
||
|
|
}
|
||
|
|
|
||
|
|
// todo: currently RetOp do not have a correct assemblyFormat
|
||
|
|
-def RetOp : Plugin_TerminatorOp<"ret", [NoSideEffect]> {
|
||
|
|
+def RetOp : Plugin_TerminatorOp<"ret", [NoMemoryEffect]> {
|
||
|
|
let summary = "RetOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$address); // for bb address
|
||
|
|
@@ -649,7 +650,7 @@ def RetOp : Plugin_TerminatorOp<"ret", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def GotoOp : Plugin_TerminatorOp<"goto", [NoSideEffect]> {
|
||
|
|
+def GotoOp : Plugin_TerminatorOp<"goto", [NoMemoryEffect]> {
|
||
|
|
let summary = "GotoOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, UI64Attr:$address, AnyType:$dest, UI64Attr:$successaddr);
|
||
|
|
@@ -664,7 +665,7 @@ def GotoOp : Plugin_TerminatorOp<"goto", [NoSideEffect]> {
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def TransactionOp : Plugin_TerminatorOp<"transaction", [NoSideEffect]> {
|
||
|
|
+def TransactionOp : Plugin_TerminatorOp<"transaction", [NoMemoryEffect]> {
|
||
|
|
let summary = "TransactionOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, UI64Attr:$address, ArrayAttr:$stmtaddr, AnyType:$labelNorm,
|
||
|
|
@@ -678,13 +679,13 @@ def TransactionOp : Plugin_TerminatorOp<"transaction", [NoSideEffect]> {
|
||
|
|
];
|
||
|
|
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- Value GetTransactionNormal() { return labelNorm(); }
|
||
|
|
- Value GetTransactionUinst() { return labelUninst(); }
|
||
|
|
- Value GetTransactionOver() { return labelOver(); }
|
||
|
|
+ Value GetTransactionNormal() { return getLabelNorm(); }
|
||
|
|
+ Value GetTransactionUinst() { return getLabelUninst(); }
|
||
|
|
+ Value GetTransactionOver() { return getLabelOver(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def ResxOp : Plugin_TerminatorOp<"resx", [NoSideEffect]> {
|
||
|
|
+def ResxOp : Plugin_TerminatorOp<"resx", [NoMemoryEffect]> {
|
||
|
|
let summary = "ResxOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, UI64Attr:$address, UI64Attr:$region);
|
||
|
|
@@ -693,11 +694,11 @@ def ResxOp : Plugin_TerminatorOp<"resx", [NoSideEffect]> {
|
||
|
|
OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- uint64_t GetTransactionNormal() { return region(); }
|
||
|
|
+ uint64_t GetTransactionNormal() { return getRegion(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
-def EHDispatchOp : Plugin_TerminatorOp<"dispatch", [NoSideEffect]> {
|
||
|
|
+def EHDispatchOp : Plugin_TerminatorOp<"dispatch", [NoMemoryEffect]> {
|
||
|
|
let summary = "EHDispatchOp";
|
||
|
|
let description = [{TODO}];
|
||
|
|
let arguments = (ins UI64Attr:$id, UI64Attr:$address, UI64Attr:$region, ArrayAttr:$ehHandlersaddrs);
|
||
|
|
@@ -708,7 +709,7 @@ def EHDispatchOp : Plugin_TerminatorOp<"dispatch", [NoSideEffect]> {
|
||
|
|
"ArrayRef<uint64_t>":$ehHandlersaddrs)>
|
||
|
|
];
|
||
|
|
let extraClassDeclaration = [{
|
||
|
|
- uint64_t GetTransactionNormal() { return region(); }
|
||
|
|
+ uint64_t GetTransactionNormal() { return getRegion(); }
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
#endif // PLUGIN_OPS_TD
|
||
|
|
diff --git a/include/Dialect/PluginTypes.h b/include/Dialect/PluginTypes.h
|
||
|
|
index 3603798..7402c56 100644
|
||
|
|
--- a/include/Dialect/PluginTypes.h
|
||
|
|
+++ b/include/Dialect/PluginTypes.h
|
||
|
|
@@ -64,6 +64,8 @@ enum PluginTypeID {
|
||
|
|
class PluginTypeBase : public Type {
|
||
|
|
public:
|
||
|
|
using Type::Type;
|
||
|
|
+ /// FIXME.
|
||
|
|
+ static bool classof(Type type) { return true; }
|
||
|
|
|
||
|
|
PluginTypeID getPluginTypeID ();
|
||
|
|
unsigned getPluginIntOrFloatBitWidth ();
|
||
|
|
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
|
||
|
|
index d4eca75..d4808ef 100644
|
||
|
|
--- a/lib/Dialect/PluginOps.cpp
|
||
|
|
+++ b/lib/Dialect/PluginOps.cpp
|
||
|
|
@@ -71,7 +71,7 @@ void FunctionOp::build(OpBuilder &builder, OperationState &state,
|
||
|
|
|
||
|
|
Type FunctionOp::getResultType()
|
||
|
|
{
|
||
|
|
- PluginIR::PluginFunctionType resultType = type().dyn_cast<PluginIR::PluginFunctionType>();
|
||
|
|
+ PluginIR::PluginFunctionType resultType = getType().dyn_cast<PluginIR::PluginFunctionType>();
|
||
|
|
return resultType;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -173,7 +173,7 @@ void PointerOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
|
||
|
|
void DeclBaseOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
IDefineCode defCode, bool readOnly, bool addressable, bool used, int32_t uid, Value initial,
|
||
|
|
- Value name, Optional<uint64_t> chain, Type retType)
|
||
|
|
+ Value name, std::optional<uint64_t> chain, Type retType)
|
||
|
|
{
|
||
|
|
state.addAttribute("id", builder.getI64IntegerAttr(id));
|
||
|
|
state.addAttribute("defCode",
|
||
|
|
@@ -184,7 +184,7 @@ void DeclBaseOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
state.addAttribute("uid", builder.getI32IntegerAttr(uid));
|
||
|
|
state.addOperands(initial);
|
||
|
|
if(chain) {
|
||
|
|
- state.addAttribute("chain", builder.getI64IntegerAttr(chain.getValue()));
|
||
|
|
+ state.addAttribute("chain", builder.getI64IntegerAttr(chain.value()));
|
||
|
|
}
|
||
|
|
state.addOperands(name);
|
||
|
|
state.addTypes(retType);
|
||
|
|
@@ -194,27 +194,27 @@ void DeclBaseOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
// BlockOp
|
||
|
|
|
||
|
|
void BlockOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
- IDefineCode defCode, bool readOnly, Optional<Value> vars, Optional<uint64_t> supercontext,
|
||
|
|
- Optional<Value> subblocks, Optional<Value> abstract_origin, Optional<Value> chain, Type retType)
|
||
|
|
+ IDefineCode defCode, bool readOnly, std::optional<Value> vars, std::optional<uint64_t> supercontext,
|
||
|
|
+ std::optional<Value> subblocks, std::optional<Value> abstract_origin, std::optional<Value> chain, Type retType)
|
||
|
|
{
|
||
|
|
state.addAttribute("id", builder.getI64IntegerAttr(id));
|
||
|
|
state.addAttribute("defCode",
|
||
|
|
builder.getI32IntegerAttr(static_cast<int32_t>(defCode)));
|
||
|
|
state.addAttribute("readOnly", builder.getBoolAttr(readOnly));
|
||
|
|
if(vars) {
|
||
|
|
- state.addOperands(vars.getValue());
|
||
|
|
+ state.addOperands(vars.value());
|
||
|
|
}
|
||
|
|
if(supercontext) {
|
||
|
|
- state.addAttribute("supercontext", builder.getI64IntegerAttr(supercontext.getValue()));
|
||
|
|
+ state.addAttribute("supercontext", builder.getI64IntegerAttr(supercontext.value()));
|
||
|
|
}
|
||
|
|
if(subblocks) {
|
||
|
|
- state.addOperands(subblocks.getValue());
|
||
|
|
+ state.addOperands(subblocks.value());
|
||
|
|
}
|
||
|
|
if(abstract_origin) {
|
||
|
|
- state.addOperands(abstract_origin.getValue());
|
||
|
|
+ state.addOperands(abstract_origin.value());
|
||
|
|
}
|
||
|
|
if(chain) {
|
||
|
|
- state.addOperands(chain.getValue());
|
||
|
|
+ state.addOperands(chain.value());
|
||
|
|
}
|
||
|
|
state.addTypes(retType);
|
||
|
|
}
|
||
|
|
@@ -378,11 +378,17 @@ CallInterfaceCallable CallOp::getCallableForCallee()
|
||
|
|
return (*this)->getAttrOfType<SymbolRefAttr>("callee");
|
||
|
|
}
|
||
|
|
|
||
|
|
+/// Set the callee for the generic call operation, this is required by the call
|
||
|
|
+/// interface.
|
||
|
|
+void CallOp::setCalleeFromCallable(CallInterfaceCallable callee) {
|
||
|
|
+ (*this)->setAttr("callee", callee.get<SymbolRefAttr>());
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
/// Get the argument operands to the called function, this is required by the
|
||
|
|
/// call interface.
|
||
|
|
Operation::operand_range CallOp::getArgOperands()
|
||
|
|
{
|
||
|
|
- return inputs();
|
||
|
|
+ return this->getInputs();
|
||
|
|
}
|
||
|
|
|
||
|
|
// ===----------------------------------------------------------------------===//
|
||
|
|
@@ -448,9 +454,10 @@ void AsmOp::build(OpBuilder &builder, OperationState &state,
|
||
|
|
|
||
|
|
//===----------------------------------------------------------------------===//
|
||
|
|
// SwitchOp
|
||
|
|
-void SwitchOp::build(OpBuilder &builder, OperationState &state,
|
||
|
|
- uint64_t id, Value index, uint64_t address, Value defaultLabel, ArrayRef<Value> operands,
|
||
|
|
- Block* defaultDest, uint64_t defaultaddr, ArrayRef<Block*> caseDest, ArrayRef<uint64_t> caseaddr)
|
||
|
|
+void SwitchOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||
|
|
+ Value index, uint64_t address, Value defaultLabel,
|
||
|
|
+ ArrayRef<Value> args, Block* defaultDest, uint64_t defaultaddr,
|
||
|
|
+ ArrayRef<Block*> caseDest, ArrayRef<uint64_t> caseaddr)
|
||
|
|
{
|
||
|
|
state.addAttribute("id", builder.getI64IntegerAttr(id));
|
||
|
|
state.addAttribute("address", builder.getI64IntegerAttr(address));
|
||
|
|
@@ -462,7 +469,7 @@ void SwitchOp::build(OpBuilder &builder, OperationState &state,
|
||
|
|
state.addAttribute("caseaddrs", builder.getArrayAttr(attributes));
|
||
|
|
state.addOperands(index);
|
||
|
|
state.addOperands(defaultLabel);
|
||
|
|
- state.addOperands(operands);
|
||
|
|
+ state.addOperands(args);
|
||
|
|
state.addSuccessors(defaultDest);
|
||
|
|
state.addSuccessors(caseDest);
|
||
|
|
}
|
||
|
|
diff --git a/lib/PluginClient/PluginJson.cpp b/lib/PluginClient/PluginJson.cpp
|
||
|
|
index 70532df..4e7ec38 100755
|
||
|
|
--- a/lib/PluginClient/PluginJson.cpp
|
||
|
|
+++ b/lib/PluginClient/PluginJson.cpp
|
||
|
|
@@ -188,14 +188,14 @@ void PluginJson::CGnodeOpJsonSerialize(CGnodeOp& cgnode, string& out)
|
||
|
|
Json::Value operationObj;
|
||
|
|
Json::Value item;
|
||
|
|
|
||
|
|
- root["id"] = std::to_string(cgnode.idAttr().getInt());
|
||
|
|
- root["attributes"]["order"] = std::to_string(cgnode.orderAttr().getInt());
|
||
|
|
- if (cgnode.definitionAttr().getValue()) {
|
||
|
|
+ root["id"] = std::to_string(cgnode.getIdAttr().getInt());
|
||
|
|
+ root["attributes"]["order"] = std::to_string(cgnode.getOrderAttr().getInt());
|
||
|
|
+ if (cgnode.getDefinitionAttr().getValue()) {
|
||
|
|
root["attributes"]["definition"] = "1";
|
||
|
|
}else {
|
||
|
|
root["attributes"]["definition"] = "0";
|
||
|
|
}
|
||
|
|
- root["attributes"]["symbolName"] = cgnode.symbolNameAttr().getValue().str().c_str();
|
||
|
|
+ root["attributes"]["symbolName"] = cgnode.getSymbolNameAttr().getValue().str().c_str();
|
||
|
|
out = root.toStyledString();
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -208,17 +208,17 @@ void PluginJson::FunctionOpJsonSerialize(vector<FunctionOp>& data, string& out)
|
||
|
|
int i = 0;
|
||
|
|
string operation;
|
||
|
|
for (auto& d: data) {
|
||
|
|
- item["id"] = std::to_string(d.idAttr().getInt());
|
||
|
|
- if (d.declaredInlineAttr().getValue()) {
|
||
|
|
+ item["id"] = std::to_string(d.getIdAttr().getInt());
|
||
|
|
+ if (d.getDeclaredInlineAttr().getValue()) {
|
||
|
|
item["attributes"]["declaredInline"] = "1";
|
||
|
|
} else {
|
||
|
|
item["attributes"]["declaredInline"] = "0";
|
||
|
|
}
|
||
|
|
- item["attributes"]["funcName"] = d.funcNameAttr().getValue().str().c_str();
|
||
|
|
+ item["attributes"]["funcName"] = d.getFuncNameAttr().getValue().str().c_str();
|
||
|
|
|
||
|
|
- if (d.validTypeAttr().getValue()) {
|
||
|
|
+ if (d.getValidTypeAttr().getValue()) {
|
||
|
|
item["attributes"]["validType"] = "1";
|
||
|
|
- mlir::Type fnty = d.type();
|
||
|
|
+ mlir::Type fnty = d.getType();
|
||
|
|
if (auto ty = fnty.dyn_cast<PluginIR::PluginFunctionType>()) {
|
||
|
|
if (auto retTy = ty.dyn_cast<PluginIR::PluginTypeBase>()) {
|
||
|
|
item["retType"] = TypeJsonSerialize(retTy);
|
||
|
|
@@ -282,7 +282,7 @@ Json::Value PluginJson::OperationJsonSerialize(mlir::Operation *operation, uint6
|
||
|
|
root = AssignOpJsonSerialize(op);
|
||
|
|
} else if (CallOp op = llvm::dyn_cast<CallOp>(operation)) {
|
||
|
|
root = CallOpJsonSerialize(op);
|
||
|
|
- bbId = op.addressAttr().getInt();
|
||
|
|
+ bbId = op.getAddressAttr().getInt();
|
||
|
|
} else if (CondOp op = llvm::dyn_cast<CondOp>(operation)) {
|
||
|
|
root = CondOpJsonSerialize(op, bbId);
|
||
|
|
} else if (PhiOp op = llvm::dyn_cast<PhiOp>(operation)) {
|
||
|
|
@@ -329,15 +329,15 @@ Json::Value PluginJson::OperationJsonSerialize(mlir::Operation *operation, uint6
|
||
|
|
Json::Value PluginJson::BaseOpJsonSerialize(BaseOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["opCode"] = data.opCodeAttr().getValue().str().c_str();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["opCode"] = data.getOpCodeAttr().getValue().str().c_str();
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::RetOpJsonSerialize(RetOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
@@ -345,16 +345,16 @@ Json::Value PluginJson::RetOpJsonSerialize(RetOp data, uint64_t &bbId)
|
||
|
|
Json::Value PluginJson::DebugOpJsonSerialize(DebugOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::FallThroughOpJsonSerialize(FallThroughOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
- root["destaddr"] = std::to_string(data.destaddrAttr().getInt());
|
||
|
|
+ root["destaddr"] = std::to_string(data.getDestaddrAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -367,10 +367,10 @@ void PluginJson::LocalDeclsJsonSerialize(vector<LocalDeclOp>& decls, string& out
|
||
|
|
string operation;
|
||
|
|
|
||
|
|
for (auto& decl: decls) {
|
||
|
|
- item["id"] = std::to_string(decl.idAttr().getInt());
|
||
|
|
- item["attributes"]["symName"] = decl.symNameAttr().getValue().str().c_str();
|
||
|
|
- item["attributes"]["typeID"] = decl.typeIDAttr().getInt();
|
||
|
|
- item["attributes"]["typeWidth"] = decl.typeWidthAttr().getInt();
|
||
|
|
+ item["id"] = std::to_string(decl.getIdAttr().getInt());
|
||
|
|
+ item["attributes"]["symName"] = decl.getSymNameAttr().getValue().str().c_str();
|
||
|
|
+ item["attributes"]["typeID"] = decl.getTypeIDAttr().getInt();
|
||
|
|
+ item["attributes"]["typeWidth"] = decl.getTypeWidthAttr().getInt();
|
||
|
|
operation = "localDecl" + std::to_string(i++);
|
||
|
|
root[operation] = item;
|
||
|
|
item.clear();
|
||
|
|
@@ -421,11 +421,11 @@ void PluginJson::LoopOpsJsonSerialize(vector<mlir::Plugin::LoopOp>& loops, strin
|
||
|
|
string operation;
|
||
|
|
|
||
|
|
for (auto& loop: loops) {
|
||
|
|
- item["id"] = std::to_string(loop.idAttr().getInt());
|
||
|
|
- item["index"] = std::to_string(loop.indexAttr().getInt());
|
||
|
|
- item["attributes"]["innerLoopId"] = std::to_string(loop.innerLoopIdAttr().getInt());
|
||
|
|
- item["attributes"]["outerLoopId"] = std::to_string(loop.outerLoopIdAttr().getInt());
|
||
|
|
- item["attributes"]["numBlock"] = std::to_string(loop.numBlockAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(loop.getIdAttr().getInt());
|
||
|
|
+ item["index"] = std::to_string(loop.getIndexAttr().getInt());
|
||
|
|
+ item["attributes"]["innerLoopId"] = std::to_string(loop.getInnerLoopIdAttr().getInt());
|
||
|
|
+ item["attributes"]["outerLoopId"] = std::to_string(loop.getOuterLoopIdAttr().getInt());
|
||
|
|
+ item["attributes"]["numBlock"] = std::to_string(loop.getNumBlockAttr().getInt());
|
||
|
|
operation = "loopOp" + std::to_string(i++);
|
||
|
|
root[operation] = item;
|
||
|
|
item.clear();
|
||
|
|
@@ -436,11 +436,11 @@ void PluginJson::LoopOpsJsonSerialize(vector<mlir::Plugin::LoopOp>& loops, strin
|
||
|
|
void PluginJson::LoopOpJsonSerialize(mlir::Plugin::LoopOp& loop, string& out)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(loop.idAttr().getInt());
|
||
|
|
- root["index"] = std::to_string(loop.indexAttr().getInt());
|
||
|
|
- root["attributes"]["innerLoopId"] = std::to_string(loop.innerLoopIdAttr().getInt());
|
||
|
|
- root["attributes"]["outerLoopId"] = std::to_string(loop.outerLoopIdAttr().getInt());
|
||
|
|
- root["attributes"]["numBlock"] = std::to_string(loop.numBlockAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(loop.getIdAttr().getInt());
|
||
|
|
+ root["index"] = std::to_string(loop.getIndexAttr().getInt());
|
||
|
|
+ root["attributes"]["innerLoopId"] = std::to_string(loop.getInnerLoopIdAttr().getInt());
|
||
|
|
+ root["attributes"]["outerLoopId"] = std::to_string(loop.getOuterLoopIdAttr().getInt());
|
||
|
|
+ root["attributes"]["numBlock"] = std::to_string(loop.getNumBlockAttr().getInt());
|
||
|
|
out = root.toStyledString();
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -543,8 +543,8 @@ void PluginJson::GetPhiOpsJsonSerialize(vector<PhiOp> phiOps, string & out)
|
||
|
|
Json::Value PluginJson::CallOpJsonSerialize(CallOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- Optional<StringRef> calleeName = data.callee();
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ std::optional<StringRef> calleeName = data.getCallee();
|
||
|
|
if (calleeName) {
|
||
|
|
item["callee"] = calleeName->str();
|
||
|
|
}
|
||
|
|
@@ -561,26 +561,26 @@ Json::Value PluginJson::CallOpJsonSerialize(CallOp& data)
|
||
|
|
Json::Value PluginJson::CondOpJsonSerialize(CondOp& data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- item["condCode"] = std::to_string(data.condCodeAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ item["condCode"] = std::to_string(data.getCondCodeAttr().getInt());
|
||
|
|
item["lhs"] = ValueJsonSerialize(data.GetLHS());
|
||
|
|
item["rhs"] = ValueJsonSerialize(data.GetRHS());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
item["address"] = std::to_string(bbId);
|
||
|
|
- item["tbaddr"] = std::to_string(data.tbaddrAttr().getInt());
|
||
|
|
- item["fbaddr"] = std::to_string(data.fbaddrAttr().getInt());
|
||
|
|
+ item["tbaddr"] = std::to_string(data.getTbaddrAttr().getInt());
|
||
|
|
+ item["fbaddr"] = std::to_string(data.getFbaddrAttr().getInt());
|
||
|
|
return item;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::PhiOpJsonSerialize(PhiOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- item["capacity"] = std::to_string(data.capacityAttr().getInt());
|
||
|
|
- item["nArgs"] = std::to_string(data.nArgsAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ item["capacity"] = std::to_string(data.getCapacityAttr().getInt());
|
||
|
|
+ item["nArgs"] = std::to_string(data.getNArgsAttr().getInt());
|
||
|
|
item["OperationName"] = data.getOperation()->getName().getStringRef().str();
|
||
|
|
size_t opIdx = 0;
|
||
|
|
- for (mlir::Value v : data.operands()) {
|
||
|
|
+ for (mlir::Value v : data.getOperands()) {
|
||
|
|
string input = "input" + std::to_string(opIdx++);
|
||
|
|
item["operands"][input] = ValueJsonSerialize(v);
|
||
|
|
}
|
||
|
|
@@ -591,13 +591,13 @@ Json::Value PluginJson::PhiOpJsonSerialize(PhiOp& data)
|
||
|
|
Json::Value PluginJson::SSAOpJsonSerialize(SSAOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- item["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- item["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- item["nameVarId"] = std::to_string(data.nameVarIdAttr().getInt());
|
||
|
|
- item["ssaParmDecl"] = std::to_string(data.ssaParmDeclAttr().getInt());
|
||
|
|
- item["version"] = std::to_string(data.versionAttr().getInt());
|
||
|
|
- item["definingId"] = std::to_string(data.definingIdAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ item["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ item["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ item["nameVarId"] = std::to_string(data.getNameVarIdAttr().getInt());
|
||
|
|
+ item["ssaParmDecl"] = std::to_string(data.getSsaParmDeclAttr().getInt());
|
||
|
|
+ item["version"] = std::to_string(data.getVersionAttr().getInt());
|
||
|
|
+ item["definingId"] = std::to_string(data.getDefiningIdAttr().getInt());
|
||
|
|
auto retTy = data.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
item["retType"] = TypeJsonSerialize(retTy);
|
||
|
|
return item;
|
||
|
|
@@ -606,11 +606,11 @@ Json::Value PluginJson::SSAOpJsonSerialize(SSAOp& data)
|
||
|
|
Json::Value PluginJson::AssignOpJsonSerialize(AssignOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- item["exprCode"] = std::to_string(data.exprCodeAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ item["exprCode"] = std::to_string(data.getExprCodeAttr().getInt());
|
||
|
|
item["OperationName"] = data.getOperation()->getName().getStringRef().str();
|
||
|
|
size_t opIdx = 0;
|
||
|
|
- for (mlir::Value v : data.operands()) {
|
||
|
|
+ for (mlir::Value v : data.getOperands()) {
|
||
|
|
string input = "input" + std::to_string(opIdx++);
|
||
|
|
item["operands"][input] = ValueJsonSerialize(v);
|
||
|
|
}
|
||
|
|
@@ -624,9 +624,9 @@ Json::Value PluginJson::ValueJsonSerialize(mlir::Value data)
|
||
|
|
if (ConstOp cOp = data.getDefiningOp<ConstOp>()) {
|
||
|
|
auto retTy = data.getType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
root["retType"] = TypeJsonSerialize(retTy);
|
||
|
|
- root["id"] = std::to_string(cOp.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(cOp.getIdAttr().getInt());
|
||
|
|
root["defCode"] = std::to_string(static_cast<int32_t>(IDefineCode::IntCST));
|
||
|
|
- root["value"] = std::to_string(cOp.initAttr().cast<mlir::IntegerAttr>().getInt());
|
||
|
|
+ root["value"] = std::to_string(cOp.getInitAttr().cast<mlir::IntegerAttr>().getInt());
|
||
|
|
} else if (MemOp mOp = data.getDefiningOp<MemOp>()) {
|
||
|
|
root = MemOpJsonSerialize(mOp);
|
||
|
|
} else if (SSAOp sOp = data.getDefiningOp<SSAOp>()) {
|
||
|
|
@@ -652,8 +652,8 @@ Json::Value PluginJson::ValueJsonSerialize(mlir::Value data)
|
||
|
|
} else if (BlockOp sOp = data.getDefiningOp<BlockOp>()) {
|
||
|
|
root = BlockOpJsonSerialize(sOp);
|
||
|
|
} else if (PlaceholderOp phOp = data.getDefiningOp<PlaceholderOp>()) {
|
||
|
|
- root["id"] = std::to_string(phOp.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(phOp.defCodeAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(phOp.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(phOp.getDefCodeAttr().getInt());
|
||
|
|
auto retTy = phOp.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
root["retType"] = TypeJsonSerialize(retTy);
|
||
|
|
} else {
|
||
|
|
@@ -665,9 +665,9 @@ Json::Value PluginJson::ValueJsonSerialize(mlir::Value data)
|
||
|
|
Json::Value PluginJson::MemOpJsonSerialize(MemOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
mlir::Value base = data.GetBase();
|
||
|
|
mlir::Value offset = data.GetOffset();
|
||
|
|
root["base"] = ValueJsonSerialize(base);
|
||
|
|
@@ -694,13 +694,13 @@ void PluginJson::StringSerialize(const string& data, string& out)
|
||
|
|
Json::Value PluginJson::AsmOpJsonSerialize(mlir::Plugin::AsmOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["statement"] = data.statementAttr().getValue().str().c_str();
|
||
|
|
- root["nInputs"] = std::to_string(data.nInputsAttr().getInt());
|
||
|
|
- root["nOutputs"] = std::to_string(data.nOutputsAttr().getInt());
|
||
|
|
- root["nClobbers"] = std::to_string(data.nClobbersAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["statement"] = data.getStatementAttr().getValue().str().c_str();
|
||
|
|
+ root["nInputs"] = std::to_string(data.getNInputsAttr().getInt());
|
||
|
|
+ root["nOutputs"] = std::to_string(data.getNOutputsAttr().getInt());
|
||
|
|
+ root["nClobbers"] = std::to_string(data.getNClobbersAttr().getInt());
|
||
|
|
size_t opIdx = 0;
|
||
|
|
- for(mlir::Value v : data.operands()) {
|
||
|
|
+ for(mlir::Value v : data.getOperands()) {
|
||
|
|
string index = std::to_string(opIdx++);
|
||
|
|
root["operands"][index] = ValueJsonSerialize(v);
|
||
|
|
}
|
||
|
|
@@ -710,17 +710,17 @@ Json::Value PluginJson::AsmOpJsonSerialize(mlir::Plugin::AsmOp data)
|
||
|
|
Json::Value PluginJson::SwitchOpJsonSerialize(mlir::Plugin::SwitchOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
size_t opIdx = 0;
|
||
|
|
- for(mlir::Value v : data.operands()) {
|
||
|
|
+ for(mlir::Value v : data.getOperands()) {
|
||
|
|
string index = std::to_string(opIdx++);
|
||
|
|
root["operands"][index] = ValueJsonSerialize(v);
|
||
|
|
}
|
||
|
|
- root["defaultaddr"] = std::to_string(data.defaultaddrAttr().getInt());
|
||
|
|
- root["address"] = std::to_string(data.addressAttr().getInt());
|
||
|
|
+ root["defaultaddr"] = std::to_string(data.getDefaultaddrAttr().getInt());
|
||
|
|
+ root["address"] = std::to_string(data.getAddressAttr().getInt());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.caseaddrsAttr()) {
|
||
|
|
+ for (auto attr : data.getCaseaddrsAttr()) {
|
||
|
|
root["case"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
return root;
|
||
|
|
@@ -729,21 +729,21 @@ Json::Value PluginJson::SwitchOpJsonSerialize(mlir::Plugin::SwitchOp data, uint6
|
||
|
|
Json::Value PluginJson::ResxOpJsonSerialize(ResxOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
- root["region"] = std::to_string(data.regionAttr().getInt());
|
||
|
|
+ root["region"] = std::to_string(data.getRegionAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::BindOpJsonSerialize(BindOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
root["vars"] = ValueJsonSerialize(data.GetVars());
|
||
|
|
root["block"] = ValueJsonSerialize(data.GetBlock());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.bodyAttr()) {
|
||
|
|
+ for (auto attr : data.getBodyAttr()) {
|
||
|
|
root["body"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
return root;
|
||
|
|
@@ -752,26 +752,26 @@ Json::Value PluginJson::BindOpJsonSerialize(BindOp data)
|
||
|
|
Json::Value PluginJson::TryOpJsonSerialize(TryOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.evalAttr()) {
|
||
|
|
+ for (auto attr : data.getEvalAttr()) {
|
||
|
|
root["eval"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
index = 0;
|
||
|
|
- for (auto attr : data.cleanupAttr()) {
|
||
|
|
+ for (auto attr : data.getCleanupAttr()) {
|
||
|
|
root["cleanup"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
- root["kind"] = std::to_string(data.kindAttr().getInt());
|
||
|
|
+ root["kind"] = std::to_string(data.getKindAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::CatchOpJsonSerialize(CatchOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
root["types"] = ValueJsonSerialize(data.GetTypes());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.handlerAttr()) {
|
||
|
|
+ for (auto attr : data.getHandlerAttr()) {
|
||
|
|
root["handler"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
return root;
|
||
|
|
@@ -780,12 +780,12 @@ Json::Value PluginJson::CatchOpJsonSerialize(CatchOp data)
|
||
|
|
Json::Value PluginJson::EHDispatchOpJsonSerialize(EHDispatchOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
- root["region"] = std::to_string(data.regionAttr().getInt());
|
||
|
|
+ root["region"] = std::to_string(data.getRegionAttr().getInt());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.ehHandlersaddrsAttr()) {
|
||
|
|
+ for (auto attr : data.getEhHandlersaddrsAttr()) {
|
||
|
|
root["ehHandlersaddrs"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
return root;
|
||
|
|
@@ -794,37 +794,37 @@ Json::Value PluginJson::EHDispatchOpJsonSerialize(EHDispatchOp data, uint64_t &b
|
||
|
|
Json::Value PluginJson::GotoOpJsonSerialize(GotoOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
root["dest"] = ValueJsonSerialize(data.GetLabel());
|
||
|
|
- root["successaddr"] = std::to_string(data.successaddrAttr().getInt());
|
||
|
|
+ root["successaddr"] = std::to_string(data.getSuccessaddrAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::TransactionOpJsonSerialize(TransactionOp data, uint64_t &bbId)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- bbId = data.addressAttr().getInt();
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ bbId = data.getAddressAttr().getInt();
|
||
|
|
root["address"] = std::to_string(bbId);
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.stmtaddrAttr()) {
|
||
|
|
+ for (auto attr : data.getStmtaddrAttr()) {
|
||
|
|
root["stmt"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
root["labelNorm"] = ValueJsonSerialize(data.GetTransactionNormal());
|
||
|
|
root["labelUninst"] = ValueJsonSerialize(data.GetTransactionUinst());
|
||
|
|
root["labelOver"] = ValueJsonSerialize(data.GetTransactionOver());
|
||
|
|
|
||
|
|
- root["fallthroughaddr"] = std::to_string(data.fallthroughaddrAttr().getInt());
|
||
|
|
- root["abortaddr"] = std::to_string(data.abortaddrAttr().getInt());
|
||
|
|
+ root["fallthroughaddr"] = std::to_string(data.getFallthroughaddrAttr().getInt());
|
||
|
|
+ root["abortaddr"] = std::to_string(data.getAbortaddrAttr().getInt());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::LabelOpJsonSerialize(LabelOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
root["label"] = ValueJsonSerialize(data.GetLabelLabel());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
@@ -832,7 +832,7 @@ Json::Value PluginJson::LabelOpJsonSerialize(LabelOp data)
|
||
|
|
Json::Value PluginJson::EHMntOpJsonSerialize(EHMntOp data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
root["decl"] = ValueJsonSerialize(data.Getfndecl());
|
||
|
|
return root;
|
||
|
|
}
|
||
|
|
@@ -840,21 +840,21 @@ Json::Value PluginJson::EHMntOpJsonSerialize(EHMntOp data)
|
||
|
|
Json::Value PluginJson::NopOpJsonSerialize(NopOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
return item;
|
||
|
|
}
|
||
|
|
|
||
|
|
Json::Value PluginJson::EHElseOpJsonSerialize(EHElseOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
|
||
|
|
int index = 0;
|
||
|
|
- for (auto attr : data.nBodyAttr()) {
|
||
|
|
+ for (auto attr : data.getNBodyAttr()) {
|
||
|
|
item["nbody"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
index = 0;
|
||
|
|
- for (auto attr : data.eBodyAttr()) {
|
||
|
|
+ for (auto attr : data.getEBodyAttr()) {
|
||
|
|
item["ebody"][index] = std::to_string(attr.dyn_cast<IntegerAttr>().getInt());
|
||
|
|
}
|
||
|
|
return item;
|
||
|
|
@@ -863,16 +863,16 @@ Json::Value PluginJson::EHElseOpJsonSerialize(EHElseOp& data)
|
||
|
|
Json::Value PluginJson::ConstructorOpJsonSerialize(ConstructorOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- root["len"] = std::to_string(data.lenAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ root["len"] = std::to_string(data.getLenAttr().getInt());
|
||
|
|
int32_t i = 0;
|
||
|
|
- for (auto idx : data.idx()) {
|
||
|
|
+ for (auto idx : data.getIdx()) {
|
||
|
|
root["idx"][i++] = ValueJsonSerialize(idx);
|
||
|
|
}
|
||
|
|
i = 0;
|
||
|
|
- for (auto val : data.val()) {
|
||
|
|
+ for (auto val : data.getVal()) {
|
||
|
|
root["val"][i] = ValueJsonSerialize(val);
|
||
|
|
}
|
||
|
|
auto retTy = data.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
@@ -883,12 +883,12 @@ Json::Value PluginJson::ConstructorOpJsonSerialize(ConstructorOp& data)
|
||
|
|
Json::Value PluginJson::ListOpJsonSerialize(ListOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- root["hasPurpose"] = std::to_string(data.hasPurposeAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ root["hasPurpose"] = std::to_string(data.getHasPurposeAttr().getValue());
|
||
|
|
size_t opIdx = 0;
|
||
|
|
- for (mlir::Value v : data.operands()) {
|
||
|
|
+ for (mlir::Value v : data.getOperands()) {
|
||
|
|
root["operands"][std::to_string(opIdx++)] = ValueJsonSerialize(v);
|
||
|
|
}
|
||
|
|
auto retTy = data.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
@@ -899,10 +899,10 @@ Json::Value PluginJson::ListOpJsonSerialize(ListOp& data)
|
||
|
|
Json::Value PluginJson::StrOpJsonSerialize(StrOp& data)
|
||
|
|
{
|
||
|
|
Json::Value item;
|
||
|
|
- item["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- item["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- item["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- item["str"] = data.strAttr().getValue().str();
|
||
|
|
+ item["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ item["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ item["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ item["str"] = data.getStrAttr().getValue().str();
|
||
|
|
auto retTy = data.getType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
item["retType"] = TypeJsonSerialize(retTy);
|
||
|
|
return item;
|
||
|
|
@@ -911,9 +911,9 @@ Json::Value PluginJson::StrOpJsonSerialize(StrOp& data)
|
||
|
|
Json::Value PluginJson::ArrayOpJsonSerialize(ArrayOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
mlir::Value base = data.GetBase();
|
||
|
|
mlir::Value offset = data.GetOffset();
|
||
|
|
root["base"] = ValueJsonSerialize(base);
|
||
|
|
@@ -926,9 +926,9 @@ Json::Value PluginJson::ArrayOpJsonSerialize(ArrayOp& data)
|
||
|
|
Json::Value PluginJson::ComponentOpJsonSerialize(ComponentOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
mlir::Value component = data.GetComponent();
|
||
|
|
mlir::Value field = data.GetField();
|
||
|
|
root["component"] = ValueJsonSerialize(component);
|
||
|
|
@@ -941,16 +941,16 @@ Json::Value PluginJson::ComponentOpJsonSerialize(ComponentOp& data)
|
||
|
|
Json::Value PluginJson::DeclBaseOpJsonSerialize(DeclBaseOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- root["addressable"] = std::to_string(data.addressableAttr().getValue());
|
||
|
|
- root["used"] = std::to_string(data.usedAttr().getValue());
|
||
|
|
- root["uid"] = std::to_string(data.uidAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ root["addressable"] = std::to_string(data.getAddressableAttr().getValue());
|
||
|
|
+ root["used"] = std::to_string(data.getUsedAttr().getValue());
|
||
|
|
+ root["uid"] = std::to_string(data.getUidAttr().getInt());
|
||
|
|
mlir::Value initial = data.GetInitial();
|
||
|
|
mlir::Value name = data.GetName();
|
||
|
|
if (data.GetChain()) {
|
||
|
|
- root["chain"] = std::to_string(data.chain().getValue());
|
||
|
|
+ root["chain"] = std::to_string(data.getChain().value());
|
||
|
|
}
|
||
|
|
root["initial"] = ValueJsonSerialize(initial);
|
||
|
|
root["name"] = ValueJsonSerialize(name);
|
||
|
|
@@ -962,14 +962,14 @@ Json::Value PluginJson::DeclBaseOpJsonSerialize(DeclBaseOp& data)
|
||
|
|
Json::Value PluginJson::BlockOpJsonSerialize(BlockOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
if (data.GetVars()) {
|
||
|
|
root["vars"] = ValueJsonSerialize(data.GetVars());
|
||
|
|
}
|
||
|
|
if (data.GetSupercontext()) {
|
||
|
|
- root["supercontext"] = std::to_string(data.GetSupercontext().getValue());
|
||
|
|
+ root["supercontext"] = std::to_string(data.GetSupercontext().value());
|
||
|
|
}
|
||
|
|
if (data.GetSubblocks()) {
|
||
|
|
root["subblocks"] = ValueJsonSerialize(data.GetSubblocks());
|
||
|
|
@@ -988,12 +988,12 @@ Json::Value PluginJson::BlockOpJsonSerialize(BlockOp& data)
|
||
|
|
Json::Value PluginJson::VecOpJsonSerialize(VecOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
- root["len"] = std::to_string(data.lenAttr().getInt());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
+ root["len"] = std::to_string(data.getLenAttr().getInt());
|
||
|
|
int index = 0;
|
||
|
|
- for (auto ele : data.elements()) {
|
||
|
|
+ for (auto ele : data.getElements()) {
|
||
|
|
root["elements"][index] = ValueJsonSerialize(ele);
|
||
|
|
}
|
||
|
|
auto retTy = data.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
@@ -1004,9 +1004,9 @@ Json::Value PluginJson::VecOpJsonSerialize(VecOp& data)
|
||
|
|
Json::Value PluginJson::FieldDeclOpJsonSerialize(FieldDeclOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
mlir::Value initial = data.GetInitial();
|
||
|
|
mlir::Value name = data.GetName();
|
||
|
|
mlir::Value fieldOffset = data.GetFieldOffset();
|
||
|
|
@@ -1014,7 +1014,7 @@ Json::Value PluginJson::FieldDeclOpJsonSerialize(FieldDeclOp& data)
|
||
|
|
root["initial"] = ValueJsonSerialize(initial);
|
||
|
|
root["name"] = ValueJsonSerialize(name);
|
||
|
|
if (data.GetChain()) {
|
||
|
|
- root["chain"] = std::to_string(data.chain().getValue());
|
||
|
|
+ root["chain"] = std::to_string(data.getChain().value());
|
||
|
|
}
|
||
|
|
root["fieldOffset"] = ValueJsonSerialize(fieldOffset);
|
||
|
|
root["fieldBitOffset"] = ValueJsonSerialize(fieldBitOffset);
|
||
|
|
@@ -1026,9 +1026,9 @@ Json::Value PluginJson::FieldDeclOpJsonSerialize(FieldDeclOp& data)
|
||
|
|
Json::Value PluginJson::AddressOpJsonSerialize(AddressOp& data)
|
||
|
|
{
|
||
|
|
Json::Value root;
|
||
|
|
- root["id"] = std::to_string(data.idAttr().getInt());
|
||
|
|
- root["defCode"] = std::to_string(data.defCodeAttr().getInt());
|
||
|
|
- root["readOnly"] = std::to_string(data.readOnlyAttr().getValue());
|
||
|
|
+ root["id"] = std::to_string(data.getIdAttr().getInt());
|
||
|
|
+ root["defCode"] = std::to_string(data.getDefCodeAttr().getInt());
|
||
|
|
+ root["readOnly"] = std::to_string(data.getReadOnlyAttr().getValue());
|
||
|
|
mlir::Value operand = data.GetOperand();
|
||
|
|
root["operand"] = ValueJsonSerialize(operand);
|
||
|
|
auto retTy = data.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||
|
|
diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp
|
||
|
|
index 76c5e31..f697388 100644
|
||
|
|
--- a/lib/Translate/GimpleToPluginOps.cpp
|
||
|
|
+++ b/lib/Translate/GimpleToPluginOps.cpp
|
||
|
|
@@ -443,7 +443,7 @@ vector<DeclBaseOp> GimpleToPluginOps::GetFuncDecls(uint64_t funcID)
|
||
|
|
int32_t uid = DECL_UID(var);
|
||
|
|
mlir::Value initial = TreeToValue((uint64_t)DECL_INITIAL(var));
|
||
|
|
mlir::Value name = TreeToValue((uint64_t)DECL_NAME(var));
|
||
|
|
- llvm::Optional<uint64_t> chain = (uint64_t)DECL_CHAIN(var);
|
||
|
|
+ std::optional<uint64_t> chain = (uint64_t)DECL_CHAIN(var);
|
||
|
|
bool readOnly = false;
|
||
|
|
PluginTypeBase rPluginType = PluginUndefType::get(builder.getContext());
|
||
|
|
GetTreeAttr(id, readOnly, rPluginType);
|
||
|
|
@@ -528,7 +528,7 @@ DeclBaseOp GimpleToPluginOps::BuildDecl(IDefineCode code, string name, PluginTyp
|
||
|
|
int32_t uid = DECL_UID(t);
|
||
|
|
mlir::Value initial = TreeToValue((uint64_t)DECL_INITIAL(t));
|
||
|
|
mlir::Value tname = TreeToValue((uint64_t)DECL_NAME(t));
|
||
|
|
- llvm::Optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
+ std::optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
bool readOnly = false;
|
||
|
|
PluginTypeBase rPluginType = PluginUndefType::get(builder.getContext());
|
||
|
|
GetTreeAttr(id, readOnly, rPluginType);
|
||
|
|
@@ -855,7 +855,7 @@ FunctionOp GimpleToPluginOps::BuildFunctionOp(uint64_t functionId)
|
||
|
|
retOp = builder.create<FunctionOp>(location, functionId,
|
||
|
|
funcName, declaredInline, Ty, validType);
|
||
|
|
}
|
||
|
|
- auto& fr = retOp.bodyRegion();
|
||
|
|
+ auto& fr = retOp.getBodyRegion();
|
||
|
|
if (fn->cfg == nullptr) return retOp;
|
||
|
|
if (!ProcessBasicBlock((intptr_t)ENTRY_BLOCK_PTR_FOR_FN(fn), fr)) {
|
||
|
|
// handle error
|
||
|
|
@@ -1628,7 +1628,7 @@ Value GimpleToPluginOps::TreeToValue(uint64_t treeId)
|
||
|
|
// postgresql-11.3 ICE
|
||
|
|
mlir::Value initial = builder.create<PlaceholderOp>(builder.getUnknownLoc(), 0, IDefineCode::UNDEF, 0, rPluginType);
|
||
|
|
mlir::Value name = TreeToValue((uint64_t)DECL_NAME(t));
|
||
|
|
- llvm::Optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
+ std::optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
GetTreeAttr(treeId, readOnly, rPluginType);
|
||
|
|
opValue = builder.create<DeclBaseOp>(
|
||
|
|
builder.getUnknownLoc(), treeId, IDefineCode::Decl, readOnly, addressable, used, uid, initial, name,
|
||
|
|
@@ -1646,7 +1646,7 @@ Value GimpleToPluginOps::TreeToValue(uint64_t treeId)
|
||
|
|
int32_t uid = DECL_UID(t);
|
||
|
|
mlir::Value initial = TreeToValue((uint64_t)DECL_INITIAL(t));
|
||
|
|
mlir::Value name = TreeToValue((uint64_t)DECL_NAME(t));
|
||
|
|
- llvm::Optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
+ std::optional<uint64_t> chain = (uint64_t)DECL_CHAIN(t);
|
||
|
|
GetTreeAttr(treeId, readOnly, rPluginType);
|
||
|
|
opValue = builder.create<DeclBaseOp>(
|
||
|
|
builder.getUnknownLoc(), treeId, IDefineCode::Decl, readOnly, addressable, used, uid, initial, name,
|
||
|
|
@@ -1712,11 +1712,11 @@ Value GimpleToPluginOps::TreeToValue(uint64_t treeId)
|
||
|
|
treeId, IDefineCode::UNDEF, readOnly, rPluginType);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
- llvm::Optional<mlir::Value> vars = TreeToValue((uint64_t)BLOCK_VARS(t));
|
||
|
|
- llvm::Optional<uint64_t> supercontext = (uint64_t)BLOCK_SUPERCONTEXT(t);
|
||
|
|
- llvm::Optional<mlir::Value> subblocks = TreeToValue((uint64_t)BLOCK_SUBBLOCKS(t));
|
||
|
|
- llvm::Optional<mlir::Value> chain = TreeToValue((uint64_t)BLOCK_CHAIN(t));
|
||
|
|
- llvm::Optional<mlir::Value> abstract_origin = TreeToValue((uint64_t)BLOCK_ABSTRACT_ORIGIN(t));
|
||
|
|
+ std::optional<mlir::Value> vars = TreeToValue((uint64_t)BLOCK_VARS(t));
|
||
|
|
+ std::optional<uint64_t> supercontext = (uint64_t)BLOCK_SUPERCONTEXT(t);
|
||
|
|
+ std::optional<mlir::Value> subblocks = TreeToValue((uint64_t)BLOCK_SUBBLOCKS(t));
|
||
|
|
+ std::optional<mlir::Value> chain = TreeToValue((uint64_t)BLOCK_CHAIN(t));
|
||
|
|
+ std::optional<mlir::Value> abstract_origin = TreeToValue((uint64_t)BLOCK_ABSTRACT_ORIGIN(t));
|
||
|
|
GetTreeAttr(treeId, readOnly, rPluginType);
|
||
|
|
opValue = builder.create<BlockOp>(
|
||
|
|
builder.getUnknownLoc(), treeId, IDefineCode::BLOCK, readOnly, vars, supercontext, subblocks,
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|