894 lines
33 KiB
Diff
894 lines
33 KiB
Diff
From 14bac90b45e248e18262cc2bc1cb4775f2a33643 Mon Sep 17 00:00:00 2001
|
|
From: huitailangzju <804544223@qq.com>
|
|
Date: Mon, 6 Mar 2023 10:14:19 +0800
|
|
Subject: [PATCH 5/6] [Pin-gcc-client] Add support for decl and field:
|
|
SetDeclName,
|
|
SetDeclType,SetDeclAlign,SetUserAlign,SetSourceLocation,SetAddressable,SetNonAddressablep,SetVolatile,SetDeclContext,SetDeclChain
|
|
|
|
|
|
diff --git a/include/Dialect/PluginDialect.td b/include/Dialect/PluginDialect.td
|
|
index 13b9d37..0edf301 100644
|
|
--- a/include/Dialect/PluginDialect.td
|
|
+++ b/include/Dialect/PluginDialect.td
|
|
@@ -80,12 +80,14 @@ def IDefineCodeConstructor : I32EnumAttrCase<"Constructor", 9>;
|
|
def IDefineCodeVec : I32EnumAttrCase<"Vec", 10>;
|
|
def IDefineCodeBLOCK : I32EnumAttrCase<"BLOCK", 11>;
|
|
def IDefineCodeCOMPONENT : I32EnumAttrCase<"COMPONENT", 12>;
|
|
-def IDefineCodeUNDEF : I32EnumAttrCase<"UNDEF", 13>;
|
|
+def IDefineCodeTYPEDECL : I32EnumAttrCase<"TYPEDECL", 13>;
|
|
+def IDefineCodeUNDEF : I32EnumAttrCase<"UNDEF", 14>;
|
|
def IDefineCodeAttr : I32EnumAttr<
|
|
"IDefineCode", "plugin define code",
|
|
[IDefineCodeMemRef, IDefineCodeIntCST, IDefineCodeSSA, IDefineCodeLIST,
|
|
IDefineCodeStrCST, IDefineCodeArrayRef, IDefineCodeDecl, IDefineCodeFieldDecl, IDefineCodeAddrExp,
|
|
- IDefineCodeConstructor, IDefineCodeVec, IDefineCodeBLOCK, IDefineCodeCOMPONENT, IDefineCodeUNDEF]>{
|
|
+ IDefineCodeConstructor, IDefineCodeVec, IDefineCodeBLOCK, IDefineCodeCOMPONENT, IDefineCodeTYPEDECL,
|
|
+ IDefineCodeUNDEF]>{
|
|
let cppNamespace = "::mlir::Plugin";
|
|
}
|
|
|
|
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
|
index 6e66d08..bb1e0b2 100644
|
|
--- a/include/PluginAPI/BasicPluginOpsAPI.h
|
|
+++ b/include/PluginAPI/BasicPluginOpsAPI.h
|
|
@@ -62,6 +62,28 @@ public:
|
|
virtual vector<uint64_t> GetFunctions() = 0;
|
|
virtual FunctionOp GetFunctionOpById(uint64_t) = 0;
|
|
virtual vector<LocalDeclOp> GetDecls(uint64_t funcID) = 0;
|
|
+ virtual vector<DeclBaseOp> GetFuncDecls(uint64_t funcID) = 0;
|
|
+ virtual vector<FieldDeclOp> GetFields(uint64_t declID) = 0;
|
|
+ virtual DeclBaseOp BuildDecl(IDefineCode, string, PluginTypeBase) = 0;
|
|
+
|
|
+ virtual mlir::Value MakeNode(IDefineCode) = 0;
|
|
+ virtual void SetDeclName(uint64_t, uint64_t) = 0;
|
|
+ virtual void SetDeclType(uint64_t, uint64_t) = 0;
|
|
+ virtual void SetDeclAlign(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetUserAlign(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetSourceLocation(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetAddressable(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetVolatile(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+ virtual void SetDeclContext(uint64_t newfieldId, uint64_t declId) = 0;
|
|
+ virtual void SetDeclChain(uint64_t newfieldId, uint64_t fieldId) = 0;
|
|
+
|
|
+ virtual unsigned GetDeclTypeSize(uint64_t declId) = 0;
|
|
+
|
|
+ virtual void SetTypeFields(uint64_t declId, uint64_t fieldId) = 0;
|
|
+ virtual void LayoutType(uint64_t declId) = 0;
|
|
+ virtual void LayoutDecl(uint64_t declId) = 0;
|
|
+
|
|
virtual vector<LoopOp> GetLoopsFromFunc(uint64_t) = 0;
|
|
virtual LoopOp GetLoopById(uint64_t) = 0;
|
|
virtual bool IsBlockInside(uint64_t, uint64_t) = 0;
|
|
diff --git a/include/PluginAPI/PluginClientAPI.h b/include/PluginAPI/PluginClientAPI.h
|
|
index 1970f1e..9b845a8 100644
|
|
--- a/include/PluginAPI/PluginClientAPI.h
|
|
+++ b/include/PluginAPI/PluginClientAPI.h
|
|
@@ -54,6 +54,28 @@ public:
|
|
vector<uint64_t> GetFunctions() override;
|
|
FunctionOp GetFunctionOpById(uint64_t) override;
|
|
vector<LocalDeclOp> GetDecls(uint64_t funcID) override;
|
|
+ vector<DeclBaseOp> GetFuncDecls(uint64_t funcID) override;
|
|
+ vector<FieldDeclOp> GetFields(uint64_t declID) override;
|
|
+ DeclBaseOp BuildDecl(IDefineCode, string, PluginTypeBase) override;
|
|
+
|
|
+ mlir::Value MakeNode(IDefineCode) override;
|
|
+ void SetDeclName(uint64_t, uint64_t) override;
|
|
+ void SetDeclType(uint64_t, uint64_t) override;
|
|
+ void SetDeclAlign(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetUserAlign(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetSourceLocation(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetAddressable(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetVolatile(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+ void SetDeclContext(uint64_t newfieldId, uint64_t declId) override;
|
|
+ void SetDeclChain(uint64_t newfieldId, uint64_t fieldId) override;
|
|
+
|
|
+ unsigned GetDeclTypeSize(uint64_t declId) override;
|
|
+
|
|
+ void SetTypeFields(uint64_t declId, uint64_t fieldId) override;
|
|
+ void LayoutType(uint64_t declId) override;
|
|
+ void LayoutDecl(uint64_t declId) override;
|
|
+
|
|
vector<LoopOp> GetLoopsFromFunc(uint64_t) override;
|
|
LoopOp GetLoopById(uint64_t) override;
|
|
bool IsBlockInside(uint64_t, uint64_t) override;
|
|
diff --git a/include/PluginClient/PluginJson.h b/include/PluginClient/PluginJson.h
|
|
index 3f7813e..f8df011 100755
|
|
--- a/include/PluginClient/PluginJson.h
|
|
+++ b/include/PluginClient/PluginJson.h
|
|
@@ -49,6 +49,8 @@ public:
|
|
void NopJsonSerialize(string&);
|
|
void FunctionOpJsonSerialize(vector<mlir::Plugin::FunctionOp>& data, string& out);
|
|
void LocalDeclsJsonSerialize(vector<mlir::Plugin::LocalDeclOp>& decls, string& out);
|
|
+ void FunctionDeclsJsonSerialize(vector<mlir::Plugin::DeclBaseOp>& decls, string& out);
|
|
+ void FiledOpsJsonSerialize(vector<mlir::Plugin::FieldDeclOp>& decls, string& out);
|
|
void GetPhiOpsJsonSerialize(vector<mlir::Plugin::PhiOp> phiOps, string& out);
|
|
Json::Value OperationJsonSerialize(mlir::Operation *, uint64_t&);
|
|
Json::Value CallOpJsonSerialize(mlir::Plugin::CallOp& data);
|
|
diff --git a/include/Translate/GimpleToPluginOps.h b/include/Translate/GimpleToPluginOps.h
|
|
index 3c7aba2..0565b01 100644
|
|
--- a/include/Translate/GimpleToPluginOps.h
|
|
+++ b/include/Translate/GimpleToPluginOps.h
|
|
@@ -71,6 +71,28 @@ public:
|
|
vector<uint64_t> GetFunctionIDs();
|
|
mlir::Plugin::FunctionOp GetFunctionById(uint64_t);
|
|
vector<mlir::Plugin::LocalDeclOp> GetAllDecls(uint64_t);
|
|
+ vector<mlir::Plugin::DeclBaseOp> GetFuncDecls(uint64_t);
|
|
+ vector<FieldDeclOp> GetFields(uint64_t);
|
|
+ mlir::Plugin::DeclBaseOp BuildDecl(IDefineCode, string, PluginTypeBase);
|
|
+
|
|
+ mlir::Value MakeNode(IDefineCode);
|
|
+ void SetDeclName(uint64_t, uint64_t);
|
|
+ void SetDeclType(uint64_t, uint64_t);
|
|
+ void SetDeclAlign(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetUserAlign(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetSourceLocation(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetAddressable(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetVolatile(uint64_t newfieldId, uint64_t fieldId);
|
|
+ void SetDeclContext(uint64_t newfieldId, uint64_t declId);
|
|
+ void SetDeclChain(uint64_t newfieldId, uint64_t fieldId);
|
|
+
|
|
+ unsigned GetDeclTypeSize(uint64_t declId);
|
|
+
|
|
+ void SetTypeFields(uint64_t declId, uint64_t fieldId);
|
|
+ void LayoutType(uint64_t declId);
|
|
+ void LayoutDecl(uint64_t declId);
|
|
+
|
|
vector<mlir::Plugin::LoopOp> GetAllLoops(uint64_t);
|
|
LoopOp GetLoop(uint64_t);
|
|
bool IsBlockInside(uint64_t, uint64_t);
|
|
diff --git a/lib/PluginAPI/PluginClientAPI.cpp b/lib/PluginAPI/PluginClientAPI.cpp
|
|
index 5194d29..0ee062b 100644
|
|
--- a/lib/PluginAPI/PluginClientAPI.cpp
|
|
+++ b/lib/PluginAPI/PluginClientAPI.cpp
|
|
@@ -107,6 +107,96 @@ vector<LocalDeclOp> PluginClientAPI::GetDecls(uint64_t funcID)
|
|
return gimpleConversion.GetAllDecls(funcID);
|
|
}
|
|
|
|
+vector<DeclBaseOp> PluginClientAPI::GetFuncDecls(uint64_t funcID)
|
|
+{
|
|
+ return gimpleConversion.GetFuncDecls(funcID);
|
|
+}
|
|
+
|
|
+vector<FieldDeclOp> PluginClientAPI::GetFields(uint64_t declID)
|
|
+{
|
|
+ return gimpleConversion.GetFields(declID);
|
|
+}
|
|
+
|
|
+mlir::Value PluginClientAPI::MakeNode(IDefineCode code)
|
|
+{
|
|
+ return gimpleConversion.MakeNode(code);
|
|
+}
|
|
+
|
|
+DeclBaseOp PluginClientAPI::BuildDecl(IDefineCode code, string name, PluginTypeBase type)
|
|
+{
|
|
+ return gimpleConversion.BuildDecl(code, name, type);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetDeclName(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetDeclName(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetDeclType(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetDeclType(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetDeclAlign(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetDeclAlign(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetUserAlign(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetUserAlign(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetDeclChain(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetDeclChain(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+unsigned PluginClientAPI::GetDeclTypeSize(uint64_t declId)
|
|
+{
|
|
+ gimpleConversion.GetDeclTypeSize(declId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetSourceLocation(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetSourceLocation(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetAddressable(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetAddressable(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetNonAddressablep(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetVolatile(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetVolatile(newfieldId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetDeclContext(uint64_t newfieldId, uint64_t declId)
|
|
+{
|
|
+ gimpleConversion.SetDeclContext(newfieldId, declId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::SetTypeFields(uint64_t declId, uint64_t fieldId)
|
|
+{
|
|
+ gimpleConversion.SetTypeFields(declId, fieldId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::LayoutType(uint64_t declId)
|
|
+{
|
|
+ gimpleConversion.LayoutType(declId);
|
|
+}
|
|
+
|
|
+void PluginClientAPI::LayoutDecl(uint64_t declId)
|
|
+{
|
|
+ gimpleConversion.LayoutDecl(declId);
|
|
+}
|
|
+
|
|
vector<LoopOp> PluginClientAPI::GetLoopsFromFunc(uint64_t funcID)
|
|
{
|
|
return gimpleConversion.GetAllLoops(funcID);
|
|
diff --git a/lib/PluginClient/PluginClient.cpp b/lib/PluginClient/PluginClient.cpp
|
|
index 310366d..83e8642 100644
|
|
--- a/lib/PluginClient/PluginClient.cpp
|
|
+++ b/lib/PluginClient/PluginClient.cpp
|
|
@@ -193,6 +193,353 @@ void GetLocalDeclsResult(PluginClient *client, Json::Value& root, string& result
|
|
client->ReceiveSendMsg("LocalDeclOpResult", result);
|
|
}
|
|
|
|
+void GetFuncDeclsResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "funcId":"xxxx"
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string funcIdKey = "funcId";
|
|
+ uint64_t funcID = atol(root[funcIdKey].asString().c_str());
|
|
+ vector<DeclBaseOp> decls = clientAPI.GetFuncDecls(funcID);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.FunctionDeclsJsonSerialize(decls, result);
|
|
+ client->ReceiveSendMsg("FuncDeclsOpResult", result);
|
|
+}
|
|
+
|
|
+void GetMakeNodeResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "defCode":"xxxx"
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string codeKey = "defCode";
|
|
+ IDefineCode code = IDefineCode(atoi((root[codeKey].asString().c_str())));
|
|
+ mlir::Value v = clientAPI.MakeNode(code);
|
|
+ PluginJson json = client->GetJson();
|
|
+ result = json.ValueJsonSerialize(v).toStyledString();
|
|
+ client->ReceiveSendMsg("MakeNodeResult", result);
|
|
+}
|
|
+
|
|
+void GetFieldsResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "declId":"xxxx"
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string declIdKey = "declId";
|
|
+ uint64_t declID = atol(root[declIdKey].asString().c_str());
|
|
+ vector<FieldDeclOp> decls = clientAPI.GetFields(declID);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.FiledOpsJsonSerialize(decls, result);
|
|
+ client->ReceiveSendMsg("GetFieldsOpResult", result);
|
|
+}
|
|
+
|
|
+void GetBuildDeclResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "defCode":"xxxx",
|
|
+ /// "name":"xxxx",
|
|
+ /// "type":"xxxx"
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string defCode = "defCode";
|
|
+ std::string name = "name";
|
|
+ std::string type = "type";
|
|
+ IDefineCode code = IDefineCode(atoi((root[defCode].asString().c_str())));
|
|
+ string tname = root[name].asString();
|
|
+ PluginJson json = client->GetJson();
|
|
+ PluginIR::PluginTypeBase t = json.TypeJsonDeSerialize(root[type].toStyledString(), context);
|
|
+ DeclBaseOp decl = clientAPI.BuildDecl(code, tname, t);
|
|
+
|
|
+ result = json.DeclBaseOpJsonSerialize(decl).toStyledString();
|
|
+ client->ReceiveSendMsg("DeclOpResult", result);
|
|
+}
|
|
+
|
|
+void SetDeclNameResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetDeclName(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetSourceLocationResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetSourceLocation(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetDeclAlignResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetDeclAlign(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetUserAlignResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetUserAlign(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetTypeFieldsResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "declId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string declIdkey = "declId";
|
|
+ uint64_t declId = atol(root[declIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetTypeFields(declId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void LayoutTypeResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "declId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string declIdKey = "declId";
|
|
+ uint64_t declId = atol(root[declIdKey].asString().c_str());
|
|
+ clientAPI.LayoutType(declId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void LayoutDeclResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "declId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string declIdKey = "declId";
|
|
+ uint64_t declId = atol(root[declIdKey].asString().c_str());
|
|
+ clientAPI.LayoutDecl(declId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+
|
|
+void SetDeclChainResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetDeclChain(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void GetDeclTypeSizeResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "declId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string declIdkey = "declId";
|
|
+ uint64_t declId = atol(root[declIdkey].asString().c_str());
|
|
+ unsigned size = clientAPI.GetDeclTypeSize(declId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.IntegerSerialize(size, result);
|
|
+ client->ReceiveSendMsg("IntegerResult", result);
|
|
+}
|
|
+
|
|
+void SetAddressableResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetAddressable(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetNonAddressablepResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetNonAddressablep(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetVolatileResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetVolatile(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetDeclContextResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string declIdKey = "declId";
|
|
+ uint64_t declId = atol(root[declIdKey].asString().c_str());
|
|
+ clientAPI.SetDeclContext(newfieldId, declId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
+void SetDeclTypeResult(PluginClient *client, Json::Value& root, string& result)
|
|
+{
|
|
+ /// Json格式
|
|
+ /// {
|
|
+ /// "newfieldId":"xxxx",
|
|
+ /// "fieldId":"xxxx",
|
|
+ /// }
|
|
+ mlir::MLIRContext context;
|
|
+ context.getOrLoadDialect<PluginDialect>();
|
|
+ PluginAPI::PluginClientAPI clientAPI(context);
|
|
+ std::string newfieldIdkey = "newfieldId";
|
|
+ uint64_t newfieldId = atol(root[newfieldIdkey].asString().c_str());
|
|
+ std::string fieldIdKey = "fieldId";
|
|
+ uint64_t fieldId = atol(root[fieldIdKey].asString().c_str());
|
|
+ clientAPI.SetDeclType(newfieldId, fieldId);
|
|
+ PluginJson json = client->GetJson();
|
|
+ json.NopJsonSerialize(result);
|
|
+ client->ReceiveSendMsg("VoidResult", result);
|
|
+}
|
|
+
|
|
void GetLoopsFromFuncResult(PluginClient *client, Json::Value& root, string& result)
|
|
{
|
|
/// Json格式
|
|
@@ -916,6 +1263,24 @@ std::map<string, GetResultFunc> g_getResultFunc = {
|
|
{"GetFunctionIDs", GetFunctionIDsResult},
|
|
{"GetFunctionOpById", GetFunctionOpByIdResult},
|
|
{"GetLocalDecls", GetLocalDeclsResult},
|
|
+ {"GetFuncDecls", GetFuncDeclsResult},
|
|
+ {"GetFields", GetFieldsResult},
|
|
+ {"BuildDecl", GetBuildDeclResult},
|
|
+ {"MakeNode", GetMakeNodeResult},
|
|
+ {"SetDeclName", SetDeclNameResult},
|
|
+ {"SetDeclType", SetDeclTypeResult},
|
|
+ {"SetSourceLocation", SetSourceLocationResult},
|
|
+ {"SetDeclAlign", SetDeclAlignResult},
|
|
+ {"SetUserAlign", SetUserAlignResult},
|
|
+ {"SetTypeFields", SetTypeFieldsResult},
|
|
+ {"LayoutType", LayoutTypeResult},
|
|
+ {"LayoutDecl", LayoutDeclResult},
|
|
+ {"SetAddressable", SetAddressableResult},
|
|
+ {"GetDeclTypeSize", GetDeclTypeSizeResult},
|
|
+ {"SetDeclChain", SetDeclChainResult},
|
|
+ {"SetNonAddressablep", SetNonAddressablepResult},
|
|
+ {"SetVolatile", SetVolatileResult},
|
|
+ {"SetDeclContext", SetDeclContextResult},
|
|
{"GetLoopsFromFunc", GetLoopsFromFuncResult},
|
|
{"GetLoopById", GetLoopByIdResult},
|
|
{"IsBlockInside", IsBlockInsideResult},
|
|
diff --git a/lib/PluginClient/PluginJson.cpp b/lib/PluginClient/PluginJson.cpp
|
|
index 40590b2..76f13a7 100755
|
|
--- a/lib/PluginClient/PluginJson.cpp
|
|
+++ b/lib/PluginClient/PluginJson.cpp
|
|
@@ -387,6 +387,40 @@ void PluginJson::LocalDeclsJsonSerialize(vector<LocalDeclOp>& decls, string& out
|
|
out = root.toStyledString();
|
|
}
|
|
|
|
+void PluginJson::FunctionDeclsJsonSerialize(vector<mlir::Plugin::DeclBaseOp>& decls, string& out)
|
|
+{
|
|
+ Json::Value root;
|
|
+ Json::Value operationObj;
|
|
+ Json::Value item;
|
|
+ int i = 0;
|
|
+ string operation;
|
|
+
|
|
+ for (auto& decl: decls) {
|
|
+ item = DeclBaseOpJsonSerialize(decl);
|
|
+ operation = std::to_string(i++);
|
|
+ root[operation] = item;
|
|
+ item.clear();
|
|
+ }
|
|
+ out = root.toStyledString();
|
|
+}
|
|
+
|
|
+void PluginJson::FiledOpsJsonSerialize(vector<mlir::Plugin::FieldDeclOp>& decls, string& out)
|
|
+{
|
|
+ Json::Value root;
|
|
+ Json::Value operationObj;
|
|
+ Json::Value item;
|
|
+ int i = 0;
|
|
+ string operation;
|
|
+
|
|
+ for (auto& decl: decls) {
|
|
+ item = FieldDeclOpJsonSerialize(decl);
|
|
+ operation = std::to_string(i++);
|
|
+ root[operation] = item;
|
|
+ item.clear();
|
|
+ }
|
|
+ out = root.toStyledString();
|
|
+}
|
|
+
|
|
void PluginJson::LoopOpsJsonSerialize(vector<mlir::Plugin::LoopOp>& loops, string& out)
|
|
{
|
|
Json::Value root;
|
|
diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp
|
|
index 230fc1e..d1b3298 100644
|
|
--- a/lib/Translate/GimpleToPluginOps.cpp
|
|
+++ b/lib/Translate/GimpleToPluginOps.cpp
|
|
@@ -48,6 +48,7 @@
|
|
#include "tree-into-ssa.h"
|
|
#include "dominance.h"
|
|
#include "print-tree.h"
|
|
+#include "stor-layout.h"
|
|
|
|
namespace PluginIR {
|
|
using namespace mlir::Plugin;
|
|
@@ -424,6 +425,207 @@ vector<LocalDeclOp> GimpleToPluginOps::GetAllDecls(uint64_t funcID)
|
|
return decls;
|
|
}
|
|
|
|
+vector<DeclBaseOp> GimpleToPluginOps::GetFuncDecls(uint64_t funcID)
|
|
+{
|
|
+ function *fn = reinterpret_cast<function *>(funcID);
|
|
+ vector<DeclBaseOp> decls;
|
|
+ if (!vec_safe_is_empty(fn->local_decls)) {
|
|
+ unsigned ix = 0;
|
|
+ tree var = NULL_TREE;
|
|
+ FOR_EACH_LOCAL_DECL (fn, ix, var) {
|
|
+ uint64_t id = reinterpret_cast<uint64_t>(reinterpret_cast<void*>(var));
|
|
+ if (TREE_CODE(var) != VAR_DECL || !DECL_NAME (var)) {
|
|
+ continue;
|
|
+ }
|
|
+ bool addressable = TREE_ADDRESSABLE(var);
|
|
+ bool used = TREE_USED(var);
|
|
+ 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);
|
|
+ bool readOnly = false;
|
|
+ PluginTypeBase rPluginType = PluginUndefType::get(builder.getContext());
|
|
+ GetTreeAttr(id, readOnly, rPluginType);
|
|
+ DeclBaseOp decl = builder.create<DeclBaseOp>(
|
|
+ builder.getUnknownLoc(), id, IDefineCode::Decl, readOnly, addressable, used, uid, initial, name,
|
|
+ chain, rPluginType);
|
|
+
|
|
+ decls.push_back(decl);
|
|
+ }
|
|
+ }
|
|
+ return decls;
|
|
+}
|
|
+
|
|
+mlir::Value GimpleToPluginOps::MakeNode(IDefineCode defcode)
|
|
+{
|
|
+ enum tree_code code;
|
|
+ switch (defcode) {
|
|
+ case IDefineCode::FieldDecl : {
|
|
+ code = FIELD_DECL;
|
|
+ break;
|
|
+ }
|
|
+ default : {
|
|
+ code = FIELD_DECL;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ tree field = make_node(code);
|
|
+ mlir::Value v = TreeToValue(reinterpret_cast<uint64_t>(reinterpret_cast<void*>(field)));
|
|
+ return v;
|
|
+}
|
|
+
|
|
+vector<FieldDeclOp> GimpleToPluginOps::GetFields(uint64_t declID)
|
|
+{
|
|
+ vector<FieldDeclOp> fields;
|
|
+ tree decl = reinterpret_cast<tree>(declID);
|
|
+ tree type = TREE_TYPE(decl);
|
|
+ while (POINTER_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
|
|
+ type = TREE_TYPE (type);
|
|
+
|
|
+ for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) {
|
|
+ if (TREE_CODE (field) != FIELD_DECL) {
|
|
+ continue;
|
|
+ }
|
|
+ uint64_t treeId = reinterpret_cast<uint64_t>(reinterpret_cast<void*>(field));
|
|
+ bool addressable = TREE_ADDRESSABLE(field);
|
|
+ bool used = TREE_USED(field);
|
|
+ int32_t uid = DECL_UID(field);
|
|
+ mlir::Value initial = TreeToValue((uint64_t)DECL_INITIAL(field));
|
|
+ mlir::Value name = TreeToValue((uint64_t)DECL_NAME(field));
|
|
+ uint64_t chain = (uint64_t)DECL_CHAIN(field);
|
|
+ mlir::Value fieldOffset = TreeToValue((uint64_t)DECL_FIELD_OFFSET(field));
|
|
+ mlir::Value fieldBitOffset = TreeToValue((uint64_t)DECL_FIELD_BIT_OFFSET(field));
|
|
+ bool readOnly = false;
|
|
+ PluginTypeBase rPluginType = PluginUndefType::get(builder.getContext());
|
|
+ GetTreeAttr(treeId, readOnly, rPluginType);
|
|
+ FieldDeclOp opValue = builder.create<FieldDeclOp>(
|
|
+ builder.getUnknownLoc(), treeId, IDefineCode::FieldDecl, readOnly, addressable, used, uid, initial, name,
|
|
+ chain, fieldOffset, fieldBitOffset, rPluginType);
|
|
+ fields.push_back(opValue);
|
|
+ }
|
|
+ return fields;
|
|
+}
|
|
+
|
|
+DeclBaseOp GimpleToPluginOps::BuildDecl(IDefineCode code, string name, PluginTypeBase type)
|
|
+{
|
|
+ tree newtype = make_node(RECORD_TYPE);
|
|
+ tree t = build_decl(UNKNOWN_LOCATION, TYPE_DECL, get_identifier(name.c_str()), newtype);
|
|
+ TYPE_NAME(newtype) = t;
|
|
+
|
|
+ uint64_t id = reinterpret_cast<uint64_t>(reinterpret_cast<void*>(t));
|
|
+
|
|
+ bool addressable = TREE_ADDRESSABLE(t);
|
|
+ bool used = TREE_USED(t);
|
|
+ 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);
|
|
+ bool readOnly = false;
|
|
+ PluginTypeBase rPluginType = PluginUndefType::get(builder.getContext());
|
|
+ GetTreeAttr(id, readOnly, rPluginType);
|
|
+ DeclBaseOp decl = builder.create<DeclBaseOp>(
|
|
+ builder.getUnknownLoc(), id, code, readOnly, addressable, used, uid, initial, tname,
|
|
+ chain, rPluginType);
|
|
+ return decl;
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetDeclName(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ DECL_NAME (newfield) = DECL_NAME (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetDeclType(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ TREE_TYPE (newfield) = TREE_TYPE (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetSourceLocation(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ DECL_SOURCE_LOCATION (newfield) = DECL_SOURCE_LOCATION (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetDeclAlign(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ SET_DECL_ALIGN (newfield, DECL_ALIGN (field));
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetUserAlign(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ DECL_USER_ALIGN (newfield) = DECL_USER_ALIGN (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetTypeFields(uint64_t declId, uint64_t fieldId)
|
|
+{
|
|
+ tree decl = reinterpret_cast<tree>(declId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ TYPE_FIELDS (TREE_TYPE(decl)) = field;
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::LayoutType(uint64_t declId)
|
|
+{
|
|
+ tree decl = reinterpret_cast<tree>(declId);
|
|
+ layout_type (TREE_TYPE(decl));
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::LayoutDecl(uint64_t declId)
|
|
+{
|
|
+ tree decl = reinterpret_cast<tree>(declId);
|
|
+ layout_decl (decl, 0);
|
|
+ debug_tree(decl);
|
|
+ debug_tree(TREE_TYPE(decl));
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetDeclChain(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ DECL_CHAIN (newfield) = field;
|
|
+}
|
|
+
|
|
+unsigned GimpleToPluginOps::GetDeclTypeSize(uint64_t declId)
|
|
+{
|
|
+ tree decl = reinterpret_cast<tree>(declId);
|
|
+ return tree_to_uhwi (TYPE_SIZE (TREE_TYPE (decl)));
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetAddressable(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ TREE_ADDRESSABLE (newfield) = TREE_ADDRESSABLE (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ DECL_NONADDRESSABLE_P (newfield) = !TREE_ADDRESSABLE (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetVolatile(uint64_t newfieldId, uint64_t fieldId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree field = reinterpret_cast<tree>(fieldId);
|
|
+ TREE_THIS_VOLATILE (newfield) = TREE_THIS_VOLATILE (field);
|
|
+}
|
|
+
|
|
+void GimpleToPluginOps::SetDeclContext(uint64_t newfieldId, uint64_t declId)
|
|
+{
|
|
+ tree newfield = reinterpret_cast<tree>(newfieldId);
|
|
+ tree decl = reinterpret_cast<tree>(declId);
|
|
+ DECL_CONTEXT (newfield) = TREE_TYPE(decl);
|
|
+}
|
|
+
|
|
vector<LoopOp> GimpleToPluginOps::GetAllLoops(uint64_t funcID)
|
|
{
|
|
function *fn = reinterpret_cast<function *>(funcID);
|
|
--
|
|
2.33.0
|
|
|