diff --git a/0011-Pin-gcc-client-Adaptation-to-llvm15-mlir15-only-solv.patch b/0011-Pin-gcc-client-Adaptation-to-llvm15-mlir15-only-solv.patch new file mode 100644 index 0000000000000000000000000000000000000000..a1ce7292dd9c682e5cab938be903405abc4499d4 --- /dev/null +++ b/0011-Pin-gcc-client-Adaptation-to-llvm15-mlir15-only-solv.patch @@ -0,0 +1,528 @@ +From d24ccb6c025688bc83dba720ce19fd63db51286e Mon Sep 17 00:00:00 2001 +From: dingguangya +Date: Mon, 31 Jul 2023 19:36:45 +0800 +Subject: [PATCH 1/2] [Pin-gcc-client] Adaptation to llvm15/mlir15 only solves + the build problem + + +diff --git a/include/Dialect/PluginDialect.td b/include/Dialect/PluginDialect.td +index 0edf301..ae8df3f 100644 +--- a/include/Dialect/PluginDialect.td ++++ b/include/Dialect/PluginDialect.td +@@ -26,6 +26,7 @@ + #define PLUGIN_DIALECT_TD + + include "mlir/IR/OpBase.td" ++include "mlir/IR/EnumAttr.td" + + //===----------------------------------------------------------------------===// + // Plugin Dialect Definition. +@@ -38,6 +39,10 @@ def Plugin_Dialect : Dialect { + let summary = "The Plugin Dialect."; + let description = [{}]; + let cppNamespace = "::mlir::Plugin"; ++ ++ let extraClassDeclaration = [{ ++ void registerTypes(); ++ }]; + } + + // Base class for Plugin dialect operations. This operation inherits from the base +@@ -45,7 +50,7 @@ def Plugin_Dialect : Dialect { + // * The parent dialect of the operation. + // * The mnemonic for the operation, or the name without the dialect prefix. + // * A list of traits for the operation. +-class Plugin_Op traits = []> : ++class Plugin_Op traits = []> : + Op; + + //===----------------------------------------------------------------------===// +@@ -114,4 +119,4 @@ def IExprCodeAttr : I32EnumAttr< + let cppNamespace = "::mlir::Plugin"; + } + +-#endif // PLUGIN_DIALECT_TD +\ No newline at end of file ++#endif // PLUGIN_DIALECT_TD +diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td +index ba29f7e..d9b0893 100644 +--- a/include/Dialect/PluginOps.td ++++ b/include/Dialect/PluginOps.td +@@ -40,7 +40,7 @@ def CGnodeOp : Plugin_Op<"callgraphnode", [NoSideEffect]> { + // the `state` that MLIR uses to create operations, i.e. these are used when + // using `builder.create(...)`. + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, ++ OpBuilder<(ins "uint64_t":$id, + "StringRef":$symbolName, + "bool":$definition, + "uint32_t":$order)> +@@ -64,8 +64,8 @@ def FunctionOp : Plugin_Op<"function", [NoSideEffect]> { + // the `state` that MLIR uses to create operations, i.e. these are used when + // using `builder.create(...)`. + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "Type":$type, "bool":$validType)>, +- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "bool":$validType)> ++ OpBuilder<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "Type":$type, "bool":$validType)>, ++ OpBuilder<(ins "uint64_t":$id, "StringRef":$funcName, "bool":$declaredInline, "bool":$validType)> + ]; + let extraClassDeclaration = [{ + Type getResultType(); +@@ -81,7 +81,7 @@ def LocalDeclOp : Plugin_Op<"declaration", [NoSideEffect]> { + OptionalAttr:$typeWidth); + let regions = (region AnyRegion:$bodyRegion); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$symName, ++ OpBuilder<(ins "uint64_t":$id, "StringRef":$symName, + "int64_t":$typeID, "uint64_t":$typeWidth)> + ]; + } +@@ -98,7 +98,7 @@ def LoopOp : Plugin_Op<"loop", [NoSideEffect]> { + OptionalAttr:$numBlock); + let regions = (region AnyRegion:$bodyRegion); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint32_t":$index, ++ OpBuilder<(ins "uint64_t":$id, "uint32_t":$index, + "uint64_t":$innerLoopId, "uint64_t":$outerLoopId, + "uint32_t":$numBlock)> + ]; +@@ -118,9 +118,9 @@ def CallOp : Plugin_Op<"call", [ + Variadic:$inputs); + let results = (outs Optional:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "StringRef":$callee, ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "StringRef":$callee, + "ArrayRef":$arguments, "Type":$retType)>, +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, + "ArrayRef":$arguments, + "Type":$retType)> + ]; +@@ -141,7 +141,7 @@ def PhiOp : Plugin_Op<"phi", [NoSideEffect]> { + Variadic:$operands); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint32_t":$capacity, "uint32_t":$nArgs, ++ OpBuilder<(ins "uint64_t":$id, "uint32_t":$capacity, "uint32_t":$nArgs, + "ArrayRef":$operands, "Type":$resultType)> + ]; + let extraClassDeclaration = [{ +@@ -158,7 +158,7 @@ def AssignOp : Plugin_Op<"assign", [NoSideEffect]> { + Variadic:$operands); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IExprCode":$exprCode, ++ OpBuilder<(ins "uint64_t":$id, "IExprCode":$exprCode, + "ArrayRef":$operands, "Type":$resultType)> + ]; + let extraClassDeclaration = [{ +@@ -175,7 +175,7 @@ def NopOp : Plugin_Op<"nop", [NoSideEffect]> { + let arguments = (ins UI64Attr:$id); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id)>, ++ OpBuilder<(ins "uint64_t":$id)>, + ]; + } + +@@ -185,7 +185,7 @@ def EHElseOp : Plugin_Op<"eh_else", [NoSideEffect]> { + let arguments = (ins UI64Attr:$id, ArrayAttr:$nBody, ArrayAttr:$eBody); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "ArrayRef":$nBody, "ArrayRef":$eBody)>, ++ OpBuilder<(ins "uint64_t":$id, "ArrayRef":$nBody, "ArrayRef":$eBody)>, + ]; + } + +@@ -282,7 +282,7 @@ def PlaceholderOp : Placeholder<"palceholder"> { + let summary = "PlaceHolder"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "Type":$retType)> + ]; + } +@@ -291,7 +291,7 @@ def DeclBaseOp : DeclBase<"decl"> { + let summary = "DeclBaseOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "bool":$addressable, "bool":$used, "int":$uid, "Value":$initial, + "Value":$name, "Optional":$chain, "Type":$retType)> + ]; +@@ -307,7 +307,7 @@ def BlockOp : BLOCK<"block"> { + let summary = "BlockOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "Optional":$vars, "Optional":$supercontext, + "Optional":$subblocks, "Optional":$chain, + "Optional":$abstract_origin, "Type":$retType)> +@@ -326,7 +326,7 @@ def VecOp : Vec<"Vector"> { + let summary = "VectorOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "int":$len, "ArrayRef":$elements, "Type":$retType)> + ]; + } +@@ -336,7 +336,7 @@ def FieldDeclOp : FieldDecl<"field"> { + let description = [{TODO}]; + + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "bool":$addressable, "bool":$used, "int":$uid, "Value":$initial, + "Value":$name, "uint64_t":$chain, "Value":$fieldOffset, "Value":$fieldBitOffset, "Type":$retType)> + ]; +@@ -354,7 +354,7 @@ def AddressOp : Address<"address"> { + let summary = "AddressOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "Value":$operand, "Type":$retType)> + ]; + let extraClassDeclaration = [{ +@@ -367,7 +367,7 @@ def ConstructorOp : Constructor<"constructor"> { + let summary = "ConstructorOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "int32_t":$len, "ArrayRef":$idx, "ArrayRef":$val, + "Type":$retType)> + ]; +@@ -380,7 +380,7 @@ def ComponentOp : ComponentRef<"component"> { + let summary = "Component reference op"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "Value":$component, "Value":$field, "Type":$retType)> + ]; + let results = (outs AnyType); +@@ -395,7 +395,7 @@ def PointerOp : Pointer<"pointer"> { + let summary = "pointer"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, + "bool":$readOnly, "Type":$retType, + "bool":$pointerReadOnly)> + ]; +@@ -405,7 +405,7 @@ def MemOp : MemRef<"MemRef"> { + let summary = "Memory reference op"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "Value":$base, "Value":$offset, "Type":$retType)> + ]; + let results = (outs AnyType); +@@ -420,7 +420,7 @@ def SSAOp : SSA<"SSA"> { + let summary = "SSA"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "uint64_t":$nameVarId, "uint64_t":$ssaParmDecl, "uint64_t":$version, + "uint64_t":$definingId, "Type":$retType)> + ]; +@@ -430,7 +430,7 @@ def ConstOp : Constant<"constant value"> { + let summary = "const value"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "Attribute":$init, "Type":$retType)> + ]; + } +@@ -439,7 +439,7 @@ def ListOp : List<"ListOp"> { + let summary = "ListOp"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "bool":$hasPurpose, "ArrayRef":$operands, "Type":$retType)> + ]; + let results = (outs AnyType); +@@ -452,7 +452,7 @@ def StrOp : StringCST<"string"> { + let summary = "string"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,"StringRef":$str, "Type":$retType)> ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly,"StringRef":$str, "Type":$retType)> + ]; + } + +@@ -460,7 +460,7 @@ def ArrayOp : ArrayRef<"ArrayRef"> { + let summary = "array ref"; + let description = [{TODO}]; + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, ++ OpBuilder<(ins "uint64_t":$id, "IDefineCode":$defCode, "bool":$readOnly, + "Value":$base, "Value":$offset, "Type":$retType)> + ]; + let results = (outs AnyType); +@@ -477,7 +477,7 @@ def BaseOp : Plugin_Op<"statement_base", [NoSideEffect]> { + let arguments = (ins UI64Attr:$id, StrAttr:$opCode); + let results = (outs AnyType); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$opCode)> ++ OpBuilder<(ins "uint64_t":$id, "StringRef":$opCode)> + ]; + } + +@@ -487,7 +487,7 @@ def DebugOp : Plugin_Op<"debug", [NoSideEffect]> { + let arguments = (ins UI64Attr:$id); + let results = (outs AnyType); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id)> ++ OpBuilder<(ins "uint64_t":$id)> + ]; + } + +@@ -498,7 +498,7 @@ def AsmOp : Plugin_Op<"asm", [NoSideEffect]> { + Variadic:$operands); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "StringRef":$statement, "uint32_t":$nInputs, "uint32_t":$nOutputs, ++ OpBuilder<(ins "uint64_t":$id, "StringRef":$statement, "uint32_t":$nInputs, "uint32_t":$nOutputs, + "uint32_t":$nClobbers, "ArrayRef":$operands)> + ]; + +@@ -519,7 +519,7 @@ def LabelOp : Plugin_Op<"label", [NoSideEffect]> { + let results = (outs AnyType:$result); + let arguments = (ins UI64Attr:$id, AnyType:$index); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index)> ++ OpBuilder<(ins "uint64_t":$id, "Value":$index)> + ]; + let extraClassDeclaration = [{ + Value GetLabelLabel() { return this->getOperation()->getOperand(0); }; +@@ -532,7 +532,7 @@ def EHMntOp : Plugin_Op<"eh_mnt", [NoSideEffect]> { + let results = (outs AnyType:$result); + let arguments = (ins UI64Attr:$id, AnyType:$decl); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "Value":$decl)> ++ OpBuilder<(ins "uint64_t":$id, "Value":$decl)> + ]; + let extraClassDeclaration = [{ + Value Getfndecl() { return decl(); }; +@@ -545,7 +545,7 @@ def BindOp : Plugin_Op<"Bind", [NoSideEffect]> { + let results = (outs AnyType:$result); + let arguments = (ins UI64Attr:$id, AnyType:$vars, ArrayAttr:$body, AnyType:$block); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "Value":$vars, "ArrayRef":$body, "Value":$block)> ++ OpBuilder<(ins "uint64_t":$id, "Value":$vars, "ArrayRef":$body, "Value":$block)> + ]; + let extraClassDeclaration = [{ + Value GetVars() { return vars(); }; +@@ -559,7 +559,7 @@ def TryOp : Plugin_Op<"try", [NoSideEffect]> { + let results = (outs AnyType:$result); + let arguments = (ins UI64Attr:$id, ArrayAttr:$eval, ArrayAttr:$cleanup, UI64Attr:$kind); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "ArrayRef":$eval, "ArrayRef":$cleanup, "uint64_t":$kind)> ++ OpBuilder<(ins "uint64_t":$id, "ArrayRef":$eval, "ArrayRef":$cleanup, "uint64_t":$kind)> + ]; + } + +@@ -569,7 +569,7 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> { + let results = (outs AnyType:$result); + let arguments = (ins UI64Attr:$id, AnyType:$types, ArrayAttr:$handler); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "Value":$types, "ArrayRef":$handler)> ++ OpBuilder<(ins "uint64_t":$id, "Value":$types, "ArrayRef":$handler)> + ]; + let extraClassDeclaration = [{ + Value GetTypes() { return types(); }; +@@ -578,7 +578,7 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> { + // Terminators + // Opaque builder used for terminator operations that contain successors. + +-class Plugin_TerminatorOp traits = []> : ++class Plugin_TerminatorOp traits = []> : + Plugin_Op; + + def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> { +@@ -592,7 +592,7 @@ def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> { + UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs); + let results = (outs AnyType:$result); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel, ++ OpBuilder<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel, + "ArrayRef":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr, + "ArrayRef":$caseDestinations, "ArrayRef":$caseaddrs)> + ]; +@@ -612,7 +612,7 @@ def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> { + let arguments = (ins UI64Attr:$address, UI64Attr:$destaddr); + let results = (outs AnyType); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$address, "Block*":$dest, "uint64_t":$destaddr)> ++ OpBuilder<(ins "uint64_t":$address, "Block*":$dest, "uint64_t":$destaddr)> + ]; + } + +@@ -627,7 +627,7 @@ def CondOp : Plugin_TerminatorOp<"condition", [NoSideEffect]> { + OptionalAttr:$falseLabel); + let successors = (successor AnySuccessor:$tb, AnySuccessor:$fb); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "IComparisonCode":$condCode, ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "IComparisonCode":$condCode, + "Value":$lhs, "Value":$rhs, "Block*":$tb, "Block*":$fb, + "uint64_t":$tbaddr, "uint64_t":$fbaddr, "Value":$trueLabel, + "Value":$falseLabel)> +@@ -645,7 +645,7 @@ def RetOp : Plugin_TerminatorOp<"ret", [NoSideEffect]> { + let arguments = (ins UI64Attr:$address); // for bb address + let results = (outs AnyType); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$address)> ++ OpBuilder<(ins "uint64_t":$address)> + ]; + } + +@@ -656,7 +656,7 @@ def GotoOp : Plugin_TerminatorOp<"goto", [NoSideEffect]> { + let results = (outs AnyType); + let successors = (successor AnySuccessor:$success); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "Value":$dest, "Block*":$success, "uint64_t":$successaddr)> ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "Value":$dest, "Block*":$success, "uint64_t":$successaddr)> + ]; + + let extraClassDeclaration = [{ +@@ -672,7 +672,7 @@ def TransactionOp : Plugin_TerminatorOp<"transaction", [NoSideEffect]> { + let results = (outs AnyType); + let successors = (successor AnySuccessor:$fallthrough, AnySuccessor:$abort); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "ArrayRef":$stmtaddr, "Value":$labelNorm, ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "ArrayRef":$stmtaddr, "Value":$labelNorm, + "Value":$labelUninst, "Value":$labelOver, "Block*":$fallthrough, "uint64_t":$fallthroughaddr, + "Block*":$abort, "uint64_t":$abortaddr)> + ]; +@@ -690,7 +690,7 @@ def ResxOp : Plugin_TerminatorOp<"resx", [NoSideEffect]> { + let arguments = (ins UI64Attr:$id, UI64Attr:$address, UI64Attr:$region); + let results = (outs AnyType); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region)> ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region)> + ]; + let extraClassDeclaration = [{ + uint64_t GetTransactionNormal() { return region(); } +@@ -704,11 +704,11 @@ def EHDispatchOp : Plugin_TerminatorOp<"dispatch", [NoSideEffect]> { + let results = (outs AnyType); + let successors = (successor VariadicSuccessor:$ehHandlers); + let builders = [ +- OpBuilderDAG<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region, "ArrayRef":$ehHandlers, ++ OpBuilder<(ins "uint64_t":$id, "uint64_t":$address, "uint64_t":$region, "ArrayRef":$ehHandlers, + "ArrayRef":$ehHandlersaddrs)> + ]; + let extraClassDeclaration = [{ + uint64_t GetTransactionNormal() { return region(); } + }]; + } +-#endif // PLUGIN_OPS_TD +\ No newline at end of file ++#endif // PLUGIN_OPS_TD +diff --git a/include/Dialect/PluginTypes.h b/include/Dialect/PluginTypes.h +index 081b35b..3603798 100644 +--- a/include/Dialect/PluginTypes.h ++++ b/include/Dialect/PluginTypes.h +@@ -29,6 +29,7 @@ + #include "mlir/IR/BuiltinOps.h" + #include "mlir/IR/BuiltinTypes.h" + #include "mlir/IR/MLIRContext.h" ++#include "mlir/IR/TypeSupport.h" + #include "mlir/IR/Types.h" + + namespace PluginIR { +@@ -222,4 +223,4 @@ public: + + } // namespace PluginIR + +-#endif // MLIR_DIALECT_PLUGINIR_PLUGINTYPES_H_ +\ No newline at end of file ++#endif // MLIR_DIALECT_PLUGINIR_PLUGINTYPES_H_ +diff --git a/lib/Dialect/PluginDialect.cpp b/lib/Dialect/PluginDialect.cpp +index 460aa4d..86758e1 100644 +--- a/lib/Dialect/PluginDialect.cpp ++++ b/lib/Dialect/PluginDialect.cpp +@@ -29,25 +29,19 @@ + using namespace mlir; + using namespace mlir::Plugin; + ++#include "Dialect/PluginOpsDialect.cpp.inc" ++#include "Dialect/PluginOpsEnums.cpp.inc" ++ + // ===----------------------------------------------------------------------===// + // Plugin dialect. + // ===----------------------------------------------------------------------===// + + void PluginDialect::initialize() + { +- addTypes(); ++ registerTypes(); + + addOperations< + #define GET_OP_LIST + #include "Dialect/PluginOps.cpp.inc" + >(); +-} +\ No newline at end of file ++} +diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp +index ec8286a..d4eca75 100644 +--- a/lib/Dialect/PluginOps.cpp ++++ b/lib/Dialect/PluginOps.cpp +@@ -356,7 +356,9 @@ void CallOp::build(OpBuilder &builder, OperationState &state, + state.addAttribute("id", builder.getI64IntegerAttr(id)); + state.addAttribute("address", builder.getI64IntegerAttr(address)); + state.addOperands(arguments); +- state.addAttribute("callee", builder.getSymbolRefAttr(callee)); ++ //state.addAttribute("callee", builder.getSymbolRefAttr(callee)); ++ state.addAttribute("callee", ++ mlir::SymbolRefAttr::get(builder.getContext(), callee)); + if (retType != nullptr) state.addTypes(retType); + } + +diff --git a/lib/Dialect/PluginTypes.cpp b/lib/Dialect/PluginTypes.cpp +index 6c5cb0c..5a69c68 100644 +--- a/lib/Dialect/PluginTypes.cpp ++++ b/lib/Dialect/PluginTypes.cpp +@@ -26,6 +26,20 @@ + + using namespace mlir; + using namespace PluginIR; ++using namespace mlir::Plugin; ++ ++void PluginDialect::registerTypes() { ++ addTypes(); ++} + + namespace PluginIR { + namespace Detail { +-- +2.33.0.windows.2 + diff --git a/0012-Pin-gcc-client-Adaptation-to-gcc12-only-solves-the-b.patch b/0012-Pin-gcc-client-Adaptation-to-gcc12-only-solves-the-b.patch new file mode 100644 index 0000000000000000000000000000000000000000..486e1d52fbc44f6fccda63ead994dc53b765960d --- /dev/null +++ b/0012-Pin-gcc-client-Adaptation-to-gcc12-only-solves-the-b.patch @@ -0,0 +1,48 @@ +From a90cb241218f32ec2da8355e74f0736d245d62a8 Mon Sep 17 00:00:00 2001 +From: dingguangya +Date: Fri, 4 Aug 2023 11:15:06 +0800 +Subject: [PATCH 2/2] [Pin-gcc-client] Adaptation to gcc12 only solves the + build problem + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fcd737b..3ed6b28 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,7 +50,7 @@ execute_process(COMMAND gcc -print-file-name=plugin + ERROR_STRIP_TRAILING_WHITESPACE) + include_directories(${output_var}/include) + include_directories(include) +-add_compile_options(-std=c++14 -Wall -fPIC -fno-rtti) ++add_compile_options(-std=c++17 -Wall -fPIC -fno-rtti) + + # Proto file + get_filename_component(plg_proto "protos/plugin.proto" ABSOLUTE) +diff --git a/cmake/common.cmake b/cmake/common.cmake +index 3d2252e..2d97026 100644 +--- a/cmake/common.cmake ++++ b/cmake/common.cmake +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.5.1) + +-set (CMAKE_CXX_STANDARD 14) ++set (CMAKE_CXX_STANDARD 17) + + find_package(Threads REQUIRED) + +diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp +index 80d4e87..c358d17 100644 +--- a/lib/Translate/GimpleToPluginOps.cpp ++++ b/lib/Translate/GimpleToPluginOps.cpp +@@ -640,7 +640,7 @@ vector GimpleToPluginOps::GetAllLoops(uint64_t funcID) + vector loops; + enum li_flags LI = LI_FROM_INNERMOST; + class loop *loop; +- FOR_EACH_LOOP(loop, LI) { ++ for (auto loop : loops_list (cfun, LI)) { + uint64_t id = reinterpret_cast(reinterpret_cast(loop)); + LoopOp pluginLoop; + if (!id) { +-- +2.33.0.windows.2 + diff --git a/pin-gcc-client.spec b/pin-gcc-client.spec index 57b8e2908c1f9a5358fc85d3def219dd0ebc019d..cf6369afa80e8f97f1d7ce87d9e34740d2ccbd95 100644 --- a/pin-gcc-client.spec +++ b/pin-gcc-client.spec @@ -1,13 +1,13 @@ Name: pin-gcc-client Version: 0.4.1 -Release: 8 +Release: 11 Summary: A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gitee.com/src-openeuler/pin-gcc-client Source0: %{name}-%{version}.tar.gz BuildRequires: gcc gcc-c++ gcc-plugin-devel cmake make pkgconfig grpc grpc-plugins grpc-devel protobuf-devel jsoncpp-devel -BuildRequires: llvm-mlir llvm-mlir-static llvm-mlir-devel llvm-devel +BuildRequires: mlir mlir-static mlir-devel llvm-devel llvm-test Requires: gcc grpc protobuf Patch1: 0001-Pin-gcc-client-BugFix-for-SwitchOp-change-it-to-term.patch @@ -19,7 +19,9 @@ Patch6: 0006-Pin-gcc-client-Add-GetDeclType.patch Patch7: 0007-Pin-gcc-client-Fix-VectorType.patch Patch8: 0008-Pin-gcc-client-Fix-struct-self-contained-CallOp-Tree.patch Patch9: 0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch -Patch10: 0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch +Patch10: 0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch +Patch11: 0011-Pin-gcc-client-Adaptation-to-llvm15-mlir15-only-solv.patch +Patch12: 0012-Pin-gcc-client-Adaptation-to-gcc12-only-solves-the-b.patch %description A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. @@ -43,7 +45,7 @@ cd _build mkdir -p %{buildroot}/etc/ld.so.conf.d echo "{_libdir}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf -find %{_libdir} -type f -name "*.so" -exec strip "{}" ";" +find %{buildroot} -type f -name "*.so" -exec strip "{}" ";" %post /sbin/ldconfig @@ -55,13 +57,31 @@ find %{_libdir} -type f -name "*.so" -exec strip "{}" ";" %license LICENSE %attr(0755,root,root) %{_libdir}/libpin_gcc_client.so %attr(0755,root,root) %{_libdir}/libMLIRClientAPI.so -%attr(0755,root,root) %{_libdir}/libMLIRClientAPI.so.12 +%attr(0755,root,root) %{_libdir}/libMLIRClientAPI.so.15 %attr(0755,root,root) %{_libdir}/libMLIRPlugin.so -%attr(0755,root,root) %{_libdir}/libMLIRPlugin.so.12 +%attr(0755,root,root) %{_libdir}/libMLIRPlugin.so.15 %attr(0644,root,root) %{_bindir}/pin-gcc-client.json %config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf %changelog +* Thu Aug 3 2023 dingguangya - 0.4.1-11 +- Type:FIX +- ID:NA +- SUG:NA +- DESC:FIX STRIP problem + +* Thu Aug 3 2023 dingguangya - 0.4.1-10 +- Type:FIX +- ID:NA +- SUG:NA +- DESC:Adaptation to gcc12 only solves the build problem + +* Thu Aug 3 2023 dingguangya - 0.4.1-9 +- Type:FIX +- ID:NA +- SUG:NA +- DESC:Adaptation to llvm15/mlir15 only solves the build problem + * Tue May 09 2023 shenbowen - 0.4.1-8 - Type:SPEC - ID:NA