From bd8d3424f8009a28dc7b9afb0ce886dca718ca4b Mon Sep 17 00:00:00 2001 From: TotaJ Date: Wed, 13 Jul 2022 18:59:21 +0800 Subject: [PATCH] Add codegen hook point. --- src/gausskernel/runtime/codegen/gscodegen.cpp | 11 ++++++++++- src/include/knl/knl_instance.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/runtime/codegen/gscodegen.cpp b/src/gausskernel/runtime/codegen/gscodegen.cpp index 7e7b250fe..33293b6bf 100644 --- a/src/gausskernel/runtime/codegen/gscodegen.cpp +++ b/src/gausskernel/runtime/codegen/gscodegen.cpp @@ -351,7 +351,16 @@ void GsCodeGen::loadIRFile() if (NULL != exec_path && strcmp(exec_path, "\0") != 0) { char* exec_path_r = realpath(exec_path, NULL); if (exec_path_r) { - appendStringInfo(filename, "%s/share/llvmir/GaussDB_expr.ir", exec_path_r); + char *llvmIrFilePath = "share/llvmir/GaussDB_expr.ir"; +#ifndef ENABLE_MULTIPLE_NODES + if (u_sess->attr.attr_sql.whale || u_sess->attr.attr_sql.dolphin) { + int id = GetCustomParserId(); + if (id >= 0 && g_instance.llvmIrFilePath[id] != NULL) { + llvmIrFilePath = g_instance.llvmIrFilePath[id]; + } + } +#endif + appendStringInfo(filename, "%s/%s", exec_path_r, llvmIrFilePath); check_backend_env(exec_path); free(exec_path_r); } else { diff --git a/src/include/knl/knl_instance.h b/src/include/knl/knl_instance.h index 30afb1d99..555e82a8f 100755 --- a/src/include/knl/knl_instance.h +++ b/src/include/knl/knl_instance.h @@ -1231,6 +1231,7 @@ typedef struct knl_instance_context { #ifndef ENABLE_MULTIPLE_NODES void *raw_parser_hook[DB_CMPT_MAX]; void *plsql_parser_hook[DB_CMPT_MAX]; + char *llvmIrFilePath[DB_CMPT_MAX]; #endif pg_atomic_uint32 extensionNum; knl_g_audit_context audit_cxt;