Add codegen hook point.

This commit is contained in:
TotaJ
2022-07-13 18:59:21 +08:00
parent 8198a77bda
commit bd8d3424f8
2 changed files with 11 additions and 1 deletions

View File

@ -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 {

View File

@ -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;