The function is to create and return a CodeGenObjectCache which contains a specific compiled codegened function.
| 175 | // The function is to create and return a CodeGenObjectCache which contains a specific |
| 176 | // compiled codegened function. |
| 177 | shared_ptr<CodeGenObjectCache> LlvmCodeGenCacheTest::CreateObjCache( |
| 178 | bool is_double, string* module_id) { |
| 179 | scoped_ptr<LlvmCodeGen> codegen; |
| 180 | shared_ptr<CodeGenObjectCache> engine_cache = make_shared<CodeGenObjectCache>(); |
| 181 | EXPECT_TRUE( |
| 182 | LlvmCodeGen::CreateImpalaCodegen(fragment_state_, nullptr, "test", &codegen).ok()); |
| 183 | string m_id; |
| 184 | if (is_double) { |
| 185 | AddLlvmCodegenDouble(codegen.get(), nullptr, false /*doFinalizeModule*/); |
| 186 | m_id = "module_double"; |
| 187 | } else { |
| 188 | AddLlvmCodegenEcho(codegen.get(), nullptr, false /*doFinalizeModule*/); |
| 189 | m_id = "module_echo"; |
| 190 | } |
| 191 | EXPECT_TRUE(codegen->FinalizeLazyMaterialization().ok()); |
| 192 | codegen->PruneModule(); |
| 193 | EXPECT_TRUE(codegen->OptimizeModule().ok()); |
| 194 | codegen->module_->setModuleIdentifier(m_id); |
| 195 | codegen->engine_cache_ = engine_cache; |
| 196 | codegen->execution_engine()->setObjectCache(engine_cache.get()); |
| 197 | codegen->execution_engine()->finalizeObject(); |
| 198 | CheckObjCacheExists(codegen.get()); |
| 199 | codegen->DestroyModule(); |
| 200 | CheckResult(codegen.get(), is_double); |
| 201 | codegen->Close(); |
| 202 | if (module_id != nullptr) *module_id = m_id; |
| 203 | return engine_cache; |
| 204 | } |
| 205 | |
| 206 | void LlvmCodeGenCacheTest::AddLlvmCodegenEcho( |
| 207 | LlvmCodeGen* codegen, string* module_id = nullptr, bool doFinalizeModule = true) { |
nothing calls this directly
no test coverage detected