代码拉取完成,页面将自动刷新
From f327f70f1a6b9e6872a9a95b5c4d987dd28ecab2 Mon Sep 17 00:00:00 2001
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
Date: Mon, 8 Apr 2024 21:19:03 +0800
Subject: [PATCH] [MLIR17] Adaptation to llvm17/mlir17
---
CMakeLists.txt | 7 +-
cmake/common.cmake | 10 ++
include/Dialect/PluginOps.td | 127 +++++++++++-----------
include/Dialect/PluginTypes.h | 2 +
lib/Dialect/PluginOps.cpp | 175 +++++++++++++++---------------
lib/PluginAPI/ControlFlowAPI.cpp | 44 ++++----
lib/PluginAPI/DataFlowAPI.cpp | 28 ++---
lib/PluginAPI/PluginServerAPI.cpp | 38 +++----
lib/PluginServer/PluginJson.cpp | 11 +-
user/ArrayWidenPass.cpp | 50 ++++-----
user/InlineFunctionPass.cpp | 2 +-
user/LocalVarSummeryPass.cpp | 12 +-
user/SimpleLICMPass.cpp | 42 +++----
13 files changed, 283 insertions(+), 265 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 925f80e..b6dc0a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,7 +118,12 @@ target_link_libraries(pin_server
${GRPC_PP_REFLECTION_LIBRARY}
${GRPC_PP_LIBRARY}
${PROTOBUF_LIBRARY}
- ${ABSEIL_SYNC_LIBRARY})
+ ${ABSEIL_SYNC_LIBRARY}
+ ${ABSEIL_CORD_LIBRARY}
+ ${ABSEIL_CORDZ_INFO_LIBRARY}
+ ${ABSEIL_CORDZ_FUNCTION_LIBRARY}
+ ${ABSEIL_LOG_INTERNAL_CHECK_OP_LIBRARY}
+ ${ABSEIL_LOG_INTERNAL_MESSAGE_LIBRARY})
# install
install(TARGETS pin_server RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/cmake/common.cmake b/cmake/common.cmake
index 033d8c3..ae27777 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -41,6 +41,16 @@ _CHECK(GPR_LIBRARY "GPR_LIBRARY-NOTFOUND" "libgpr.so")
# check abseil_synchronization
find_library(ABSEIL_SYNC_LIBRARY absl_synchronization)
_CHECK(ABSEIL_SYNC_LIBRARY "ABSEIL_SYNC_LIBRARY-NOTFOUND" "libabsl_synchronization.so")
+find_library(ABSEIL_CORD_LIBRARY absl_cord)
+_CHECK(ABSEIL_CORD_LIBRARY "ABSEIL_CORD_LIBRARY-NOTFOUND" "libabsl_cord.so")
+find_library(ABSEIL_CORDZ_INFO_LIBRARY absl_cordz_info)
+_CHECK(ABSEIL_CORDZ_INFO_LIBRARY "ABSEIL_CORDZ_INFO_LIBRARY-NOTFOUND" "libabsl_cordz_info.so")
+find_library(ABSEIL_CORDZ_FUNCTION_LIBRARY absl_cordz_functions)
+_CHECK(ABSEIL_CORDZ_FUNCTION_LIBRARY "ABSEIL_CORDZ_FUNCTION_LIBRARY-NOTFOUND" "libabsl_cordz_functions.so")
+find_library(ABSEIL_LOG_INTERNAL_CHECK_OP_LIBRARY absl_log_internal_check_op)
+_CHECK(ABSEIL_LOG_INTERNAL_CHECK_OP_LIBRARY "ABSEIL_LOG_INTERNAL_CHECK_OP_LIBRARY-NOTFOUND" "libabsl_log_internal_check_op.so")
+find_library(ABSEIL_LOG_INTERNAL_MESSAGE_LIBRARY absl_log_internal_message)
+_CHECK(ABSEIL_LOG_INTERNAL_MESSAGE_LIBRARY "ABSEIL_LOG_INTERNAL_MESSAGE_LIBRARY-NOTFOUND" "libabsl_log_internal_message.so")
# check jsoncpp
find_library(JSONCPP_LIBRARY jsoncpp)
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
index 51a2b10..37b20c9 100644
--- a/include/Dialect/PluginOps.td
+++ b/include/Dialect/PluginOps.td
@@ -22,7 +22,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.
@@ -50,7 +50,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.
@@ -82,7 +82,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,
@@ -96,7 +96,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.
@@ -156,7 +156,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,
@@ -178,7 +178,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,
@@ -198,7 +198,7 @@ def AssignOp : Plugin_Op<"assign", [NoSideEffect]> {
}];
}
-def NopOp : Plugin_Op<"nop", [NoSideEffect]> {
+def NopOp : Plugin_Op<"nop", [NoMemoryEffect]> {
let summary = "nop";
let description = [{TODO}];
let arguments = (ins UI64Attr:$id);
@@ -208,7 +208,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);
@@ -322,13 +322,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(); }
}];
}
@@ -337,17 +337,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(); }
}];
}
@@ -371,11 +371,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(); }
void SetName(FieldDeclOp);
void SetType(FieldDeclOp);
@@ -401,7 +401,7 @@ def AddressOp : Address<"address"> {
];
let extraClassDeclaration = [{
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
- Value GetOperand() { return operand(); }
+ Value GetOperand() { return getOperand(); }
}];
}
@@ -410,9 +410,9 @@ def ConstructorOp : Constructor<"constructor"> {
let description = [{TODO}];
let builders = [
OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode,
- "bool":$readOnly, "int32_t":$len, "ArrayRef<Value>":$idx, "ArrayRef<Value>":$val,
- "Type":$retType)>
-];
+ "bool":$readOnly, "int32_t":$len, "ArrayRef<Value>":$idx,
+ "ArrayRef<Value>":$val, "Type":$retType)>
+ ];
let extraClassDeclaration = [{
Type getResultType() { return this->getOperation()->getResult(0).getType(); }
}];
@@ -525,7 +525,7 @@ def ArrayOp : ArrayRef<"array ref"> {
}];
}
-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);
@@ -535,7 +535,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);
@@ -544,7 +544,7 @@ def DebugOp : Plugin_Op<"debug", [NoSideEffect]> {
OpBuilder<(ins "uint64_t":$id)>
];
}
-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,
@@ -556,17 +556,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);
@@ -579,7 +579,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);
@@ -588,11 +588,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);
@@ -601,12 +601,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);
@@ -616,7 +616,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);
@@ -625,7 +625,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
@@ -634,30 +634,29 @@ 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,
+ 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);
@@ -671,7 +670,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,
@@ -698,7 +697,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
@@ -708,7 +707,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);
@@ -723,7 +722,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,
@@ -737,13 +736,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);
@@ -752,11 +751,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);
@@ -767,7 +766,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
\ No newline at end of file
diff --git a/include/Dialect/PluginTypes.h b/include/Dialect/PluginTypes.h
index 5c5f54a..01df63a 100644
--- a/include/Dialect/PluginTypes.h
+++ b/include/Dialect/PluginTypes.h
@@ -61,6 +61,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 d4b061f..8ba6d83 100644
--- a/lib/Dialect/PluginOps.cpp
+++ b/lib/Dialect/PluginOps.cpp
@@ -40,33 +40,33 @@ static uint64_t GetValueId(Value v)
{
Operation *op = v.getDefiningOp();
if (auto mOp = dyn_cast<MemOp>(op)) {
- return mOp.id();
+ return mOp.getId();
} else if (auto ssaOp = dyn_cast<SSAOp>(op)) {
- return ssaOp.id();
+ return ssaOp.getId();
} else if (auto cstOp = dyn_cast<ConstOp>(op)) {
- return cstOp.id();
+ return cstOp.getId();
} else if (auto treelistop = dyn_cast<ListOp>(op)) {
- return treelistop.id();
+ return treelistop.getId();
} else if (auto strop = dyn_cast<StrOp>(op)) {
- return strop.id();
+ return strop.getId();
} else if (auto arrayop = dyn_cast<ArrayOp>(op)) {
- return arrayop.id();
+ return arrayop.getId();
} else if (auto declop = dyn_cast<DeclBaseOp>(op)) {
- return declop.id();
+ return declop.getId();
} else if (auto fieldop = dyn_cast<FieldDeclOp>(op)) {
- return fieldop.id();
+ return fieldop.getId();
} else if (auto addressop = dyn_cast<AddressOp>(op)) {
- return addressop.id();
+ return addressop.getId();
} else if (auto constructorop = dyn_cast<ConstructorOp>(op)) {
- return constructorop.id();
+ return constructorop.getId();
} else if (auto vecop = dyn_cast<VecOp>(op)) {
- return vecop.id();
+ return vecop.getId();
} else if (auto blockop = dyn_cast<BlockOp>(op)) {
- return blockop.id();
+ return blockop.getId();
} else if (auto compOp = dyn_cast<ComponentOp>(op)) {
- return compOp.id();
+ return compOp.getId();
} else if (auto phOp = dyn_cast<PlaceholderOp>(op)) {
- return phOp.id();
+ return phOp.getId();
}
return 0;
}
@@ -74,15 +74,15 @@ static uint64_t GetValueId(Value v)
static uint64_t getBlockAddress(mlir::Block* b)
{
if (mlir::Plugin::CondOp oops = dyn_cast<mlir::Plugin::CondOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::FallThroughOp oops = dyn_cast<mlir::Plugin::FallThroughOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::RetOp oops = dyn_cast<mlir::Plugin::RetOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::GotoOp oops = dyn_cast<mlir::Plugin::GotoOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::TransactionOp oops = dyn_cast<mlir::Plugin::TransactionOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else {
assert(false);
}
@@ -105,14 +105,14 @@ void CGnodeOp::build(OpBuilder &builder, OperationState &state,
// Value CGnodeOp::GetDecl()
// {
// PluginAPI::PluginServerAPI pluginAPI;
-// uint64_t nodeId = idAttr().getInt();
+// uint64_t nodeId = getIdAttr().getInt();
// return pluginAPI.GetDeclFromCGnode(nodeId);
// }
bool CGnodeOp::IsRealSymbol()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t nodeId = idAttr().getInt();
+ uint64_t nodeId = getIdAttr().getInt();
return pluginAPI.IsRealSymbolOfCGnode(nodeId);
}
@@ -141,21 +141,21 @@ 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;
}
vector<LoopOp> FunctionOp::GetAllLoops()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t funcId = idAttr().getInt();
+ uint64_t funcId = getIdAttr().getInt();
return pluginAPI.GetLoopsFromFunc(funcId);
}
LoopOp FunctionOp::AllocateNewLoop()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t funcId = idAttr().getInt();
+ uint64_t funcId = getIdAttr().getInt();
return pluginAPI.AllocateNewLoop(funcId);
}
@@ -191,14 +191,14 @@ void LoopOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
Block* LoopOp::GetHeader()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
return pluginAPI.GetHeader(loopId);
}
Block* LoopOp::GetLatch()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
return pluginAPI.GetLatch(loopId);
}
@@ -217,42 +217,42 @@ void LoopOp::SetLatch(mlir::Block* b)
vector<mlir::Block*> LoopOp::GetLoopBody()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
return pluginAPI.GetLoopBody(loopId);
}
pair<mlir::Block*, mlir::Block*> LoopOp::GetSingleExit()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
return pluginAPI.LoopSingleExit(loopId);
}
void LoopOp::Delete()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
pluginAPI.DeleteLoop(loopId);
}
LoopOp LoopOp::GetInnerLoop()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = innerLoopIdAttr().getInt();
+ uint64_t loopId = getInnerLoopIdAttr().getInt();
return pluginAPI.GetLoopById(loopId);
}
LoopOp LoopOp::GetOuterLoop()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = outerLoopIdAttr().getInt();
+ uint64_t loopId = getOuterLoopIdAttr().getInt();
return pluginAPI.GetLoopById(loopId);
}
bool LoopOp::IsBlockInside(mlir::Block* b)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
uint64_t blockId = pluginAPI.FindBasicBlock(b);
return pluginAPI.IsBlockInLoop(loopId, blockId);
}
@@ -260,32 +260,25 @@ bool LoopOp::IsBlockInside(mlir::Block* b)
bool LoopOp::IsLoopFather(mlir::Block* b)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
LoopOp loopFather = pluginAPI.GetBlockLoopFather(b);
- uint64_t id = loopFather.idAttr().getInt();
+ uint64_t id = loopFather.getIdAttr().getInt();
return id == loopId;
}
-LoopOp LoopOp::FindCommonLoop(LoopOp* loop_1, LoopOp* loop_2)
-{
- PluginAPI::PluginServerAPI pluginAPI;
- LoopOp commonLoop = pluginAPI.FindCommonLoop(loop_1, loop_2);
- return commonLoop;
-}
-
vector<pair<mlir::Block*, mlir::Block*> > LoopOp::GetExitEdges()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
+ uint64_t loopId = getIdAttr().getInt();
return pluginAPI.GetLoopExitEdges(loopId);
}
void LoopOp::AddLoop(LoopOp* outerLoop, FunctionOp* funcOp)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t loopId = idAttr().getInt();
- return pluginAPI.AddLoop(loopId, outerLoop->idAttr().getInt(),
- funcOp->idAttr().getInt());
+ uint64_t loopId = getIdAttr().getInt();
+ return pluginAPI.AddLoop(loopId, outerLoop->getIdAttr().getInt(),
+ funcOp->getIdAttr().getInt());
}
void LoopOp::AddBlock(mlir::Block* block)
@@ -328,7 +321,7 @@ void MemOp::build(OpBuilder &builder, OperationState &state,
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",
@@ -339,7 +332,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);
@@ -349,27 +342,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);
}
@@ -448,78 +441,78 @@ void FieldDeclOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
void FieldDeclOp::SetName(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
+ uint64_t fieldId = field.getIdAttr().getInt();
unsigned idx = 1;
this->setOperand(idx ,field.GetName());
- return pluginAPI.SetDeclName(this->idAttr().getInt(), fieldId);
+ return pluginAPI.SetDeclName(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetType(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetDeclType(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetDeclType(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetDeclAlign(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetDeclAlign(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetDeclAlign(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetUserAlign(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetUserAlign(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetUserAlign(this->getIdAttr().getInt(), fieldId);
}
unsigned FieldDeclOp::GetTypeSize()
{
PluginAPI::PluginServerAPI pluginAPI;
- return pluginAPI.GetDeclTypeSize(this->idAttr().getInt());
+ return pluginAPI.GetDeclTypeSize(this->getIdAttr().getInt());
}
void FieldDeclOp::SetSourceLocation(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetSourceLocation(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetSourceLocation(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetAddressable(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetAddressable(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetAddressable(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetNonAddressablep(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetNonAddressablep(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetNonAddressablep(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetVolatile(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetVolatile(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetVolatile(this->getIdAttr().getInt(), fieldId);
}
void FieldDeclOp::SetDeclContext(uint64_t declId)
{
PluginAPI::PluginServerAPI pluginAPI;
- return pluginAPI.SetDeclContext(this->idAttr().getInt(), declId);
+ return pluginAPI.SetDeclContext(this->getIdAttr().getInt(), declId);
}
void FieldDeclOp::SetDeclChain(FieldDeclOp field)
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t fieldId = field.idAttr().getInt();
- return pluginAPI.SetDeclChain(this->idAttr().getInt(), fieldId);
+ uint64_t fieldId = field.getIdAttr().getInt();
+ return pluginAPI.SetDeclChain(this->getIdAttr().getInt(), fieldId);
}
//===----------------------------------------------------------------------===//
// AddressOp
@@ -566,7 +559,7 @@ Value SSAOp::Copy()
PluginAPI::PluginServerAPI pluginAPI;
static OpBuilder builder(this->getOperation());
PinServer::PluginServer::GetInstance()->SetOpBuilder(&builder);
- return pluginAPI.CopySSAOp(this->idAttr().getInt());
+ return pluginAPI.CopySSAOp(this->getIdAttr().getInt());
}
Value SSAOp::GetCurrentDef()
@@ -574,14 +567,14 @@ Value SSAOp::GetCurrentDef()
PluginAPI::PluginServerAPI pluginAPI;
static OpBuilder builder(this->getOperation());
PinServer::PluginServer::GetInstance()->SetOpBuilder(&builder);
- return pluginAPI.GetCurrentDefFromSSA(this->idAttr().getInt());
+ return pluginAPI.GetCurrentDefFromSSA(this->getIdAttr().getInt());
}
bool SSAOp::SetCurrentDef(Value def)
{
uint64_t defId = GetValueId(def);
PluginAPI::PluginServerAPI pluginAPI;
- if (pluginAPI.SetCurrentDefInSSA(this->idAttr().getInt(), defId)) {
+ if (pluginAPI.SetCurrentDefInSSA(this->getIdAttr().getInt(), defId)) {
return true;
}
return false;
@@ -590,7 +583,7 @@ bool SSAOp::SetCurrentDef(Value def)
Operation* SSAOp::GetSSADefOperation()
{
PluginAPI::PluginServerAPI pluginAPI;
- uint64_t definingId = definingIdAttr().getInt();
+ uint64_t definingId = this->getDefiningIdAttr().getInt();
return pluginAPI.GetSSADefOperation(definingId);
}
@@ -700,15 +693,21 @@ 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(); }
+Operation::operand_range CallOp::getArgOperands() { return getInputs(); }
bool CallOp::SetLHS(Value lhs)
{
uint64_t lhsId = GetValueId(lhs);
PluginAPI::PluginServerAPI pluginAPI;
- if (pluginAPI.SetLhsInCallOp(this->idAttr().getInt(), lhsId)) {
+ if (pluginAPI.SetLhsInCallOp(this->getIdAttr().getInt(), lhsId)) {
(*this)->setOperand(0, lhs);
return true;
}
@@ -723,7 +722,7 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
PluginAPI::PluginServerAPI pluginAPI;
uint64_t blockId = pluginAPI.FindBasicBlock(insertionBlock);
PlaceholderOp funcOp = func.getDefiningOp<PlaceholderOp>();
- uint64_t funcId = funcOp.idAttr().getInt();
+ uint64_t funcId = funcOp.getIdAttr().getInt();
vector<uint64_t> argIds;
for (auto v : arguments) {
uint64_t argId = GetValueId(v);
@@ -821,7 +820,7 @@ Value PhiOp::GetResult()
PluginAPI::PluginServerAPI pluginAPI;
static OpBuilder builder(this->getOperation());
PinServer::PluginServer::GetInstance()->SetOpBuilder(&builder);
- return pluginAPI.GetResultFromPhi(this->idAttr().getInt());
+ return pluginAPI.GetResultFromPhi(this->getIdAttr().getInt());
}
PhiOp PhiOp::CreatePhi(Value arg, Block *block)
@@ -841,7 +840,7 @@ bool PhiOp::AddArg(Value arg, Block *pred, Block *succ)
PluginAPI::PluginServerAPI pluginAPI;
uint64_t predId = pluginAPI.FindBasicBlock(pred);
uint64_t succId = pluginAPI.FindBasicBlock(succ);
- uint32_t nArg = pluginAPI.AddArgInPhiOp(this->idAttr().getInt(), argId, predId, succId);
+ uint32_t nArg = pluginAPI.AddArgInPhiOp(this->getIdAttr().getInt(), argId, predId, succId);
OpBuilder builder(this->getOperation());
(*this)->insertOperands((*this)->getNumOperands(), {arg});
(*this)->setAttr("nArgs", builder.getI32IntegerAttr(nArg));
@@ -947,9 +946,11 @@ 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));
@@ -961,7 +962,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/PluginAPI/ControlFlowAPI.cpp b/lib/PluginAPI/ControlFlowAPI.cpp
index 3cf72f6..18d32b8 100644
--- a/lib/PluginAPI/ControlFlowAPI.cpp
+++ b/lib/PluginAPI/ControlFlowAPI.cpp
@@ -24,33 +24,33 @@ static uint64_t GetValueId(mlir::Value v)
{
mlir::Operation *op = v.getDefiningOp();
if (auto mOp = llvm::dyn_cast<MemOp>(op)) {
- return mOp.id();
+ return mOp.getId();
} else if (auto ssaOp = llvm::dyn_cast<SSAOp>(op)) {
- return ssaOp.id();
+ return ssaOp.getId();
} else if (auto cstOp = llvm::dyn_cast<ConstOp>(op)) {
- return cstOp.id();
+ return cstOp.getId();
} else if (auto treelistop = llvm::dyn_cast<ListOp>(op)) {
- return treelistop.id();
+ return treelistop.getId();
} else if (auto strop = llvm::dyn_cast<StrOp>(op)) {
- return strop.id();
+ return strop.getId();
} else if (auto arrayop = llvm::dyn_cast<ArrayOp>(op)) {
- return arrayop.id();
+ return arrayop.getId();
} else if (auto declop = llvm::dyn_cast<DeclBaseOp>(op)) {
- return declop.id();
+ return declop.getId();
} else if (auto fieldop = llvm::dyn_cast<FieldDeclOp>(op)) {
- return fieldop.id();
+ return fieldop.getId();
} else if (auto addressop = llvm::dyn_cast<AddressOp>(op)) {
- return addressop.id();
+ return addressop.getId();
} else if (auto constructorop = llvm::dyn_cast<ConstructorOp>(op)) {
- return constructorop.id();
+ return constructorop.getId();
} else if (auto vecop = llvm::dyn_cast<VecOp>(op)) {
- return vecop.id();
+ return vecop.getId();
} else if (auto blockop = llvm::dyn_cast<BlockOp>(op)) {
- return blockop.id();
+ return blockop.getId();
} else if (auto compop = llvm::dyn_cast<ComponentOp>(op)) {
- return compop.id();
+ return compop.getId();
} else if (auto phOp = llvm::dyn_cast<PlaceholderOp>(op)) {
- return phOp.id();
+ return phOp.getId();
}
return 0;
}
@@ -58,15 +58,15 @@ static uint64_t GetValueId(mlir::Value v)
static uint64_t getBlockAddress(mlir::Block* b)
{
if (mlir::Plugin::CondOp oops = llvm::dyn_cast<mlir::Plugin::CondOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::FallThroughOp oops = llvm::dyn_cast<mlir::Plugin::FallThroughOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::RetOp oops = llvm::dyn_cast<mlir::Plugin::RetOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::GotoOp oops = llvm::dyn_cast<mlir::Plugin::GotoOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else if (mlir::Plugin::TransactionOp oops = llvm::dyn_cast<mlir::Plugin::TransactionOp>(b->back())) {
- return oops.addressAttr().getInt();
+ return oops.getAddressAttr().getInt();
} else {
abort();
}
@@ -129,7 +129,7 @@ mlir::Block* ControlFlowAPI::CreateBlock(mlir::Block* b, FunctionOp *funcOp)
{
Json::Value root;
string funName = __func__;
- uint64_t funcAddr = funcOp->idAttr().getInt();
+ uint64_t funcAddr = funcOp->getIdAttr().getInt();
assert(funcAddr);
PluginServer *server = PluginServer::GetInstance();
uint64_t bbAddr = server->FindBasicBlock(b);
@@ -146,7 +146,7 @@ void ControlFlowAPI::DeleteBlock(mlir::Block* b, FunctionOp* funcOp)
{
Json::Value root;
string funName = __func__;
- uint64_t funcAddr = funcOp->idAttr().getInt();
+ uint64_t funcAddr = funcOp->getIdAttr().getInt();
assert(funcAddr);
uint64_t bbAddr = PluginServer::GetInstance()->FindBasicBlock(b);
assert(bbAddr);
@@ -221,7 +221,7 @@ mlir::Value ControlFlowAPI::CreateNewDef(mlir::Value oldValue,
Json::Value root;
string funName = __func__;
// FIXME: use baseOp.
- uint64_t opId = llvm::dyn_cast<PhiOp>(op).idAttr().getInt();
+ uint64_t opId = llvm::dyn_cast<PhiOp>(op).getIdAttr().getInt();
root["opId"] = std::to_string(opId);
uint64_t valueId = GetValueId(oldValue);
root["valueId"] = std::to_string(valueId);
diff --git a/lib/PluginAPI/DataFlowAPI.cpp b/lib/PluginAPI/DataFlowAPI.cpp
index 2fec19f..5bcf9a0 100644
--- a/lib/PluginAPI/DataFlowAPI.cpp
+++ b/lib/PluginAPI/DataFlowAPI.cpp
@@ -23,33 +23,33 @@ static uint64_t GetValueId(mlir::Value v)
{
mlir::Operation*op = v.getDefiningOp();
if (auto mOp = llvm::dyn_cast<MemOp>(op)) {
- return mOp.id();
+ return mOp.getId();
} else if (auto ssaOp = llvm::dyn_cast<SSAOp>(op)) {
- return ssaOp.id();
+ return ssaOp.getId();
} else if (auto cstOp = llvm::dyn_cast<ConstOp>(op)) {
- return cstOp.id();
+ return cstOp.getId();
} else if (auto treelistop = llvm::dyn_cast<ListOp>(op)) {
- return treelistop.id();
+ return treelistop.getId();
} else if (auto strop = llvm::dyn_cast<StrOp>(op)) {
- return strop.id();
+ return strop.getId();
} else if (auto arrayop = llvm::dyn_cast<ArrayOp>(op)) {
- return arrayop.id();
+ return arrayop.getId();
} else if (auto declop = llvm::dyn_cast<DeclBaseOp>(op)) {
- return declop.id();
+ return declop.getId();
} else if (auto fieldop = llvm::dyn_cast<FieldDeclOp>(op)) {
- return fieldop.id();
+ return fieldop.getId();
} else if (auto addressop = llvm::dyn_cast<AddressOp>(op)) {
- return addressop.id();
+ return addressop.getId();
} else if (auto constructorop = llvm::dyn_cast<ConstructorOp>(op)) {
- return constructorop.id();
+ return constructorop.getId();
} else if (auto vecop = llvm::dyn_cast<VecOp>(op)) {
- return vecop.id();
+ return vecop.getId();
} else if (auto blockop = llvm::dyn_cast<BlockOp>(op)) {
- return blockop.id();
+ return blockop.getId();
} else if (auto compop = llvm::dyn_cast<ComponentOp>(op)) {
- return compop.id();
+ return compop.getId();
} else if (auto phOp = llvm::dyn_cast<PlaceholderOp>(op)) {
- return phOp.id();
+ return phOp.getId();
}
return 0;
}
diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp
index 0b7d8ab..fc36b62 100644
--- a/lib/PluginAPI/PluginServerAPI.cpp
+++ b/lib/PluginAPI/PluginServerAPI.cpp
@@ -45,33 +45,33 @@ static uint64_t GetValueId(mlir::Value v)
{
mlir::Operation *op = v.getDefiningOp();
if (auto mOp = llvm::dyn_cast<MemOp>(op)) {
- return mOp.id();
+ return mOp.getId();
} else if (auto ssaOp = llvm::dyn_cast<SSAOp>(op)) {
- return ssaOp.id();
+ return ssaOp.getId();
} else if (auto cstOp = llvm::dyn_cast<ConstOp>(op)) {
- return cstOp.id();
+ return cstOp.getId();
} else if (auto treelistop = llvm::dyn_cast<ListOp>(op)) {
- return treelistop.id();
+ return treelistop.getId();
} else if (auto strop = llvm::dyn_cast<StrOp>(op)) {
- return strop.id();
+ return strop.getId();
} else if (auto arrayop = llvm::dyn_cast<ArrayOp>(op)) {
- return arrayop.id();
+ return arrayop.getId();
} else if (auto declop = llvm::dyn_cast<DeclBaseOp>(op)) {
- return declop.id();
+ return declop.getId();
} else if (auto fieldop = llvm::dyn_cast<FieldDeclOp>(op)) {
- return fieldop.id();
+ return fieldop.getId();
} else if (auto addressop = llvm::dyn_cast<AddressOp>(op)) {
- return addressop.id();
+ return addressop.getId();
} else if (auto constructorop = llvm::dyn_cast<ConstructorOp>(op)) {
- return constructorop.id();
+ return constructorop.getId();
} else if (auto vecop = llvm::dyn_cast<VecOp>(op)) {
- return vecop.id();
+ return vecop.getId();
} else if (auto blockop = llvm::dyn_cast<BlockOp>(op)) {
- return blockop.id();
+ return blockop.getId();
} else if (auto compop = llvm::dyn_cast<ComponentOp>(op)) {
- return compop.id();
+ return compop.getId();
} else if (auto phOp = llvm::dyn_cast<PlaceholderOp>(op)) {
- return phOp.id();
+ return phOp.getId();
}
return 0;
}
@@ -725,7 +725,7 @@ void PluginServerAPI::AddBlockToLoop(mlir::Block* b, LoopOp *loop)
Json::Value root;
string funName("AddBlockToLoop");
root["blockId"] = PluginServer::GetInstance()->FindBasicBlock(b);
- root["loopId"] = loop->idAttr().getInt();
+ root["loopId"] = loop->getIdAttr().getInt();
string params = root.toStyledString();
PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
}
@@ -765,7 +765,7 @@ void PluginServerAPI::SetHeader(LoopOp * loop, mlir::Block* b)
{
Json::Value root;
string funName("SetHeader");
- root["loopId"] = std::to_string(loop->idAttr().getInt());
+ root["loopId"] = std::to_string(loop->getIdAttr().getInt());
root["blockId"] = std::to_string(
PluginServer::GetInstance()->FindBasicBlock(b));
string params = root.toStyledString();
@@ -776,7 +776,7 @@ void PluginServerAPI::SetLatch(LoopOp * loop, mlir::Block* b)
{
Json::Value root;
string funName("SetLatch");
- root["loopId"] = std::to_string(loop->idAttr().getInt());
+ root["loopId"] = std::to_string(loop->getIdAttr().getInt());
root["blockId"] = std::to_string(
PluginServer::GetInstance()->FindBasicBlock(b));
string params = root.toStyledString();
@@ -824,8 +824,8 @@ LoopOp PluginServerAPI::FindCommonLoop(LoopOp* loop_1, LoopOp* loop_2)
{
Json::Value root;
string funName("FindCommonLoop");
- root["loopId_1"] = loop_1->idAttr().getInt();
- root["loopId_2"] = loop_2->idAttr().getInt();
+ root["loopId_1"] = loop_1->getIdAttr().getInt();
+ root["loopId_2"] = loop_2->getIdAttr().getInt();
string params = root.toStyledString();
return PluginServer::GetInstance()->LoopOpResult(funName, params);
}
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
index 864a444..30a8ca6 100755
--- a/lib/PluginServer/PluginJson.cpp
+++ b/lib/PluginServer/PluginJson.cpp
@@ -386,7 +386,7 @@ void PluginJson::FuncOpJsonDeSerialize(
fOp = opBuilder.create<FunctionOp>(location, id, funcAttributes["funcName"], declaredInline, validType);
}
- mlir::Region &bodyRegion = fOp.bodyRegion();
+ mlir::Region &bodyRegion = fOp.getBodyRegion();
Json::Value regionJson = node["region"];
Json::Value::Members bbMember = regionJson.getMemberNames();
// We must create Blocks before process opsG
@@ -861,7 +861,7 @@ mlir::Value PluginJson::DeclBaseOpJsonDeSerialize(const string& data)
int32_t uid = GetID(root["uid"]);
mlir::Value initial = ValueJsonDeSerialize(root["initial"]);
mlir::Value name = ValueJsonDeSerialize(root["name"]);
- llvm::Optional<uint64_t> chain;
+ std::optional<uint64_t> chain;
if (root["chain"]) {
chain = GetID(root["chain"]);
}
@@ -969,7 +969,7 @@ mlir::Value PluginJson::BlockOpJsonDeSerialize(const string& data)
uint64_t id = GetID(root["id"]);
bool readOnly = (bool)atoi(root["readOnly"].asString().c_str());
uint64_t supercontext = GetID(root["supercontext"]);
- llvm::Optional<mlir::Value> vars, subblocks, chain, abstract_origin;
+ std::optional<mlir::Value> vars, subblocks, chain, abstract_origin;
if (root["vars"]) {
vars = ValueJsonDeSerialize(root["vars"]);
}
@@ -1301,8 +1301,9 @@ mlir::Operation *PluginJson::SwitchOpJsonDeserialize(const string& data)
caseDest.push_back(casebb);
}
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
- SwitchOp op = opBuilder->create<SwitchOp>(opBuilder->getUnknownLoc(), id, index, address, defaultLabel, ops, defaultDest,
- defaultDestAddr, caseDest, caseaddr);
+ SwitchOp op = opBuilder->create<SwitchOp>(
+ opBuilder->getUnknownLoc(), id, index, address, defaultLabel,
+ ops, defaultDest, defaultDestAddr, caseDest, caseaddr);
PluginServer::GetInstance()->InsertOperation(id, op.getOperation());
return op.getOperation();
}
diff --git a/user/ArrayWidenPass.cpp b/user/ArrayWidenPass.cpp
index cafb177..dd926aa 100644
--- a/user/ArrayWidenPass.cpp
+++ b/user/ArrayWidenPass.cpp
@@ -158,14 +158,14 @@ static IDefineCode getValueDefCode(Value v)
{
IDefineCode rescode;
if (auto ssaop = dyn_cast<SSAOp>(v.getDefiningOp())) {
- rescode = ssaop.defCode().getValue();
+ rescode = ssaop.getDefCode().value();
} else if (auto memop = dyn_cast<MemOp>(v.getDefiningOp())) {
- rescode = memop.defCode().getValue();
+ rescode = memop.getDefCode().value();
} else if (auto constop = dyn_cast<ConstOp>(v.getDefiningOp())) {
- rescode = constop.defCode().getValue();
+ rescode = constop.getDefCode().value();
} else {
auto holderop = dyn_cast<PlaceholderOp>(v.getDefiningOp());
- rescode = holderop.defCode().getValue();
+ rescode = holderop.getDefCode().value();
}
return rescode;
}
@@ -174,14 +174,14 @@ static uint64_t getValueId(Value v)
{
uint64_t resid;
if (auto ssaop = dyn_cast<SSAOp>(v.getDefiningOp())) {
- resid = ssaop.id();
+ resid = ssaop.getId();
} else if (auto memop = dyn_cast<MemOp>(v.getDefiningOp())) {
- resid = memop.id();
+ resid = memop.getId();
} else if (auto constop = dyn_cast<ConstOp>(v.getDefiningOp())) {
- resid = constop.id();
+ resid = constop.getId();
} else {
auto holderop = dyn_cast<PlaceholderOp>(v.getDefiningOp());
- resid = holderop.id();
+ resid = holderop.getId();
}
return resid;
}
@@ -253,13 +253,13 @@ static IDefineCode getSingleRhsAssignOpCode(Operation *op)
static IExprCode getBinaryRhsAssignOpCode(Operation *op)
{
auto assignOp = dyn_cast<AssignOp>(op);
- return assignOp.exprCode();
+ return assignOp.getExprCode();
}
static int64_t getRealValueIntCST(Value v)
{
auto constOp = dyn_cast<ConstOp>(v.getDefiningOp());
- return constOp.initAttr().cast<mlir::IntegerAttr>().getInt();
+ return constOp.getInitAttr().cast<mlir::IntegerAttr>().getInt();
}
static Operation *getSSADefStmtofValue(Value v)
@@ -387,7 +387,7 @@ static bool checkCondOp(Operation *op)
auto cond = dyn_cast<CondOp>(op);
- if (cond.condCode() != IComparisonCode::ne && cond.condCode() != IComparisonCode::eq) {
+ if (cond.getCondCode() != IComparisonCode::ne && cond.getCondCode() != IComparisonCode::eq) {
return false;
}
@@ -482,7 +482,7 @@ static bool isSSANameVar(Value v)
return false;
}
auto ssaOp = dyn_cast<SSAOp>(v.getDefiningOp());
- uint64_t varid = ssaOp.nameVarId();
+ uint64_t varid = ssaOp.getNameVarId();
if (varid != 0) {
return true;
}
@@ -498,8 +498,8 @@ static bool isSameSSANameVar(Value v1, Value v2)
}
auto ssaOp1 = dyn_cast<SSAOp>(v1.getDefiningOp());
auto ssaOp2 = dyn_cast<SSAOp>(v2.getDefiningOp());
- uint64_t varid1 = ssaOp1.nameVarId();
- uint64_t varid2 = ssaOp2.nameVarId();
+ uint64_t varid1 = ssaOp1.getNameVarId();
+ uint64_t varid2 = ssaOp2.getNameVarId();
if (varid1 == varid2) {
return true;
}
@@ -538,14 +538,14 @@ static bool checkUpdateStmt(Operation *op)
return false;
}
auto assignOp = dyn_cast<AssignOp>(op);
- if (assignOp.exprCode() == IExprCode::Plus) {
+ if (assignOp.getExprCode() == IExprCode::Plus) {
Value rhs1 = assignOp.GetRHS1();
Value rhs2 = assignOp.GetRHS2();
if (getValueDefCode(rhs1) == IDefineCode::SSA
&& getValueDefCode(rhs2) == IDefineCode::IntCST
&& isSameSSANameVar (rhs1, originLoop.base)) {
auto constOp = dyn_cast<ConstOp>(rhs2.getDefiningOp());
- originLoop.step = constOp.initAttr().cast<mlir::IntegerAttr>().getInt();
+ originLoop.step = constOp.getInitAttr().cast<mlir::IntegerAttr>().getInt();
if (originLoop.step == 1) {
return true;
}
@@ -818,7 +818,7 @@ static bool checkExitBB(LoopOp loop)
if (!isSameSSANameVar(result, originLoop.base)) {
continue;
}
- if (phi.nArgs() == 2) {
+ if (phi.getNArgs() == 2) {
Value arg0 = phi.GetArgDef(0);
Value arg1 = phi.GetArgDef(1);
if (isEqualValue (arg0, arg1)) {
@@ -846,7 +846,7 @@ static bool checkOriginLoopInfo(LoopOp loop)
}
auto limitssaop = dyn_cast<SSAOp>(originLoop.limit.getDefiningOp());
- if (!limitssaop.readOnly().getValue()) {
+ if (!limitssaop.getReadOnly().value()) {
return false;
}
@@ -909,7 +909,7 @@ static bool checkRecordLoopForm(LoopOp loop)
static bool determineLoopForm(LoopOp loop)
{
- if (loop.innerLoopIdAttr().getInt() != 0 && loop.numBlockAttr().getInt() != 3) {
+ if (loop.getInnerLoopIdAttr().getInt() != 0 && loop.getNumBlockAttr().getInt() != 3) {
fprintf(stderr, "\nWrong loop form, there is inner loop or redundant bb.\n");
return false;
}
@@ -939,7 +939,7 @@ static bool determineLoopForm(LoopOp loop)
static void update_loop_dominator(uint64_t dir, FunctionOp* funcOp)
{
ControlFlowAPI cfAPI;
- mlir::Region ®ion = funcOp->bodyRegion();
+ mlir::Region ®ion = funcOp->getBodyRegion();
PluginServerAPI pluginAPI;
for (auto &bb : region.getBlocks()) {
@@ -962,7 +962,7 @@ static void remove_originLoop(LoopOp *loop, FunctionOp* funcOp)
ControlFlowAPI controlapi;
PluginServerAPI pluginAPI;
body = loop->GetLoopBody();
- unsigned n = loop->numBlockAttr().getInt();
+ unsigned n = loop->getNumBlockAttr().getInt();
for (unsigned i = 0; i < n; i++) {
controlapi.DeleteBlock(body[i], funcOp);
}
@@ -1166,7 +1166,7 @@ static void create_align_loop_body_bb(Block *align_loop_body_bb, Block* after_bb
cond_stmt = opBuilder->create<CondOp>(
opBuilder->getUnknownLoc(),
- llvm::dyn_cast<CondOp>(originLoop.condOp2).condCode(),
+ llvm::dyn_cast<CondOp>(originLoop.condOp2).getCondCode(),
lhs1, lhs2, tb, fb);
}
@@ -1282,7 +1282,7 @@ static void create_epilogue_loop_header(Block *epilogue_loop_header, Block* afte
cond_stmt = opBuilder->create<CondOp>(
opBuilder->getUnknownLoc(),
- llvm::dyn_cast<CondOp>(originLoop.condOp1).condCode(),
+ llvm::dyn_cast<CondOp>(originLoop.condOp1).getCondCode(),
res, originLoop.limit, tb, fb);
baseSsa.SetCurrentDef(res);
@@ -1352,7 +1352,7 @@ static void create_epilogue_loop_body_bb(Block *epilogue_loop_body_bb, Block* af
Value res = g.GetLHS();
cond_stmt = opBuilder->create<CondOp>(
opBuilder->getUnknownLoc(),
- llvm::dyn_cast<CondOp>(originLoop.condOp1).condCode(),
+ llvm::dyn_cast<CondOp>(originLoop.condOp1).getCondCode(),
lhs2, res, tb, fb);
defs_map.emplace(epilogue_loop_body_bb, baseSsa.GetCurrentDef());
@@ -1489,7 +1489,7 @@ static void ProcessArrayWiden(uint64_t fun)
context = funcOp.getOperation()->getContext();
mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
opBuilder = &opBuilder_temp;
- string name = funcOp.funcNameAttr().getValue().str();
+ string name = funcOp.getFuncNameAttr().getValue().str();
fprintf(stderr, "Now process func : %s \n", name.c_str());
vector<LoopOp> allLoop = funcOp.GetAllLoops();
for (auto &loop : allLoop) {
diff --git a/user/InlineFunctionPass.cpp b/user/InlineFunctionPass.cpp
index cc4c7c4..fd9313a 100755
--- a/user/InlineFunctionPass.cpp
+++ b/user/InlineFunctionPass.cpp
@@ -30,7 +30,7 @@ static void UserOptimizeFunc(void)
vector<FunctionOp> allFunction = pluginAPI.GetAllFunc();
int count = 0;
for (size_t i = 0; i < allFunction.size(); i++) {
- if (allFunction[i] && allFunction[i].declaredInlineAttr().getValue())
+ if (allFunction[i] && allFunction[i].getDeclaredInlineAttr().getValue())
count++;
}
fprintf(stderr, "declaredInline have %d functions were declared.\n", count);
diff --git a/user/LocalVarSummeryPass.cpp b/user/LocalVarSummeryPass.cpp
index 4f72a2a..c802365 100755
--- a/user/LocalVarSummeryPass.cpp
+++ b/user/LocalVarSummeryPass.cpp
@@ -36,7 +36,7 @@ static void LocalVarSummery(void)
map<string, string> args = PluginServer::GetInstance()->GetArgs();
for (size_t i = 0; i < allFunction.size(); i++) {
if (allFunction[i] == nullptr) continue;
- uint64_t funcID = allFunction[i].idAttr().getValue().getZExtValue();
+ uint64_t funcID = allFunction[i].getIdAttr().getValue().getZExtValue();
fprintf(stderr, "In the %ldth function:\n", i);
vector<mlir::Plugin::LocalDeclOp> decls = pluginAPI.GetDecls(funcID);
int64_t typeFilter = -1u;
@@ -44,9 +44,9 @@ static void LocalVarSummery(void)
typeFilter = (int64_t)pluginAPI.GetTypeCodeFromString(args["type_code"]);
}
mlir::Plugin::FunctionOp funcOp = allFunction[i];
- fprintf(stderr, "func name is :%s\n", funcOp.funcNameAttr().getValue().str().c_str());
- if (funcOp.validTypeAttr().getValue()) {
- mlir::Type dgyty = funcOp.type();
+ fprintf(stderr, "func name is :%s\n", funcOp.getFuncNameAttr().getValue().str().c_str());
+ if (funcOp.getValidTypeAttr().getValue()) {
+ mlir::Type dgyty = funcOp.getType();
if (auto ty = dgyty.dyn_cast<PluginIR::PluginFunctionType>()) {
if(auto stTy = ty.getReturnType().dyn_cast<PluginIR::PluginStructType>()) {
fprintf(stderr, "func return type is PluginStructType\n");
@@ -75,8 +75,8 @@ static void LocalVarSummery(void)
for (size_t j = 0; j < decls.size(); j++) {
auto decl = decls[j];
if (decl == nullptr) continue;
- string name = decl.symNameAttr().getValue().str();
- int64_t declTypeID = decl.typeIDAttr().getValue().getZExtValue();
+ string name = decl.getSymNameAttr().getValue().str();
+ int64_t declTypeID = decl.getTypeIDAttr().getValue().getZExtValue();
if (declTypeID == typeFilter) {
fprintf(stderr, "\tFind %ldth target type %s\n", j, name.c_str());
}
diff --git a/user/SimpleLICMPass.cpp b/user/SimpleLICMPass.cpp
index b78f86f..a051a16 100644
--- a/user/SimpleLICMPass.cpp
+++ b/user/SimpleLICMPass.cpp
@@ -95,17 +95,17 @@ static uint64_t getValueId(Value v)
{
uint64_t resid = 0;
if (auto ssaop = dyn_cast<SSAOp>(v.getDefiningOp())) {
- resid = ssaop.id();
+ resid = ssaop.getId();
} else if (auto memop = dyn_cast<MemOp>(v.getDefiningOp())) {
- resid = memop.id();
+ resid = memop.getId();
} else if (auto constop = dyn_cast<ConstOp>(v.getDefiningOp())) {
- resid = constop.id();
+ resid = constop.getId();
} else if (auto holderop = dyn_cast<PlaceholderOp>(v.getDefiningOp())){
- resid = holderop.id();
+ resid = holderop.getId();
} else if (auto componentop = dyn_cast<ComponentOp>(v.getDefiningOp())){
- resid = componentop.id();
+ resid = componentop.getId();
} else if (auto declop = llvm::dyn_cast<DeclBaseOp>(v.getDefiningOp())) {
- return declop.id();
+ return declop.getId();
}
return resid;
}
@@ -114,14 +114,14 @@ static IDefineCode getValueDefCode(Value v)
{
IDefineCode rescode;
if (auto ssaop = dyn_cast<SSAOp>(v.getDefiningOp())) {
- rescode = ssaop.defCode().getValue();
+ rescode = ssaop.getDefCode().value();
} else if (auto memop = dyn_cast<MemOp>(v.getDefiningOp())) {
- rescode = memop.defCode().getValue();
+ rescode = memop.getDefCode().value();
} else if (auto constop = dyn_cast<ConstOp>(v.getDefiningOp())) {
- rescode = constop.defCode().getValue();
+ rescode = constop.getDefCode().value();
} else {
auto holderop = dyn_cast<PlaceholderOp>(v.getDefiningOp());
- rescode = holderop.defCode().getValue();
+ rescode = holderop.getDefCode().value();
}
return rescode;
}
@@ -141,7 +141,7 @@ static bool isSSANameVar(Value v)
return false;
}
auto ssaOp = dyn_cast<SSAOp>(v.getDefiningOp());
- uint64_t varid = ssaOp.nameVarId();
+ uint64_t varid = ssaOp.getNameVarId();
if (varid != 0) {
return true;
}
@@ -154,7 +154,7 @@ static Operation *getSSADefStmtofValue(Value v)
return NULL;
}
auto ssaOp = dyn_cast<SSAOp>(v.getDefiningOp());
- // uint64_t id = ssaOp.id();
+ // uint64_t id = ssaOp.getId();
// pluginAPI.DebugValue(id);
Operation *op = ssaOp.GetSSADefOperation();
if (!op || !isa<AssignOp, PhiOp>(op)) {
@@ -185,7 +185,7 @@ static edge getLoopPreheaderEdge(LoopOp loop)
void compute_invariantness(Block* bb)
{
LoopOp loop_father = pluginAPI.GetBlockLoopFather(bb);
- if (!loop_father.outerLoopId().getValue()){
+ if (!loop_father.getOuterLoopId().value()){
return ;
}
// pluginAPI.DebugBlock(bb);
@@ -195,8 +195,8 @@ void compute_invariantness(Block* bb)
for (auto phi : phis) {
Value result = phi.GetResult();
uint64_t varId = getValueId(result);
- // pluginAPI.DebugOperation(phi.id());
- int n_args = phi.nArgs();
+ // pluginAPI.DebugOperation(phi.getId());
+ int n_args = phi.getNArgs();
if (n_args <= 2 && !pluginAPI.IsVirtualOperand(varId)) {
for (int i = 0 ; i < n_args; i++) {
Value v = phi.GetArgDef(i);
@@ -205,7 +205,7 @@ void compute_invariantness(Block* bb)
if (!def) break;
Block *def_bb = def->getBlock();
if (def_bb == bb && visited.find(def) == visited.end()) {
- pluginAPI.DebugOperation(phi.id());
+ pluginAPI.DebugOperation(phi.getId());
not_move[def] = true;
break;
}
@@ -231,7 +231,7 @@ void compute_invariantness(Block* bb)
Value lhs = assign.GetLHS();
Value rhs1 = assign.GetRHS1();
- Value vdef = dfAPI.GetGimpleVdef(assign.id());
+ Value vdef = dfAPI.GetGimpleVdef(assign.getId());
uint64_t vdef_id = getValueId(vdef);
if(vdef_id) {
variants.push_back(lhs);
@@ -239,7 +239,7 @@ void compute_invariantness(Block* bb)
change = true;
continue;
}
- vector<mlir::Value> vals = dfAPI.GetSsaUseOperand(assign.id());
+ vector<mlir::Value> vals = dfAPI.GetSsaUseOperand(assign.getId());
for (auto val : vals) {
Operation* def = getSSADefStmtofValue(val);
if(!def) continue;
@@ -282,7 +282,7 @@ void compute_invariantness(Block* bb)
if (not_move.find(op) != not_move.end()) continue;
if(!isa<AssignOp>(op)) continue;
auto assign = dyn_cast<AssignOp>(op);
- pluginAPI.DebugOperation(assign.id());
+ pluginAPI.DebugOperation(assign.getId());
move_stmt.push_back(assign);
}
cout<<" "<<endl;
@@ -295,7 +295,7 @@ LoopOp get_outermost_loop(AssignOp assign)
Block *bb = assign->getBlock();
LoopOp loop = pluginAPI.GetBlockLoopFather(bb);
LoopOp maxloop;
- vector<mlir::Value> vals = dfAPI.GetSsaUseOperand(assign.id());
+ vector<mlir::Value> vals = dfAPI.GetSsaUseOperand(assign.getId());
for (auto val: vals)
{
uint64_t id = getValueId(val);
@@ -336,7 +336,7 @@ static void ProcessSimpleLICM(uint64_t fun)
mlir::MLIRContext * context = funcOp.getOperation()->getContext();
mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
mlir::OpBuilder* opBuilder = &opBuilder_temp;
- string name = funcOp.funcNameAttr().getValue().str();
+ string name = funcOp.getFuncNameAttr().getValue().str();
fprintf(stderr, "Now process func : %s \n", name.c_str());
vector<LoopOp> allLoop = funcOp.GetAllLoops();
for (auto &loop : allLoop) {
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。