MCPcopy Create free account
hub / github.com/apache/impala / CodegenInnerLoop

Function CodegenInnerLoop

be/src/codegen/llvm-codegen-test.cc:203–223  ·  view source on GitHub ↗

IR for the generated linner loop: define void @JittedInnerLoop(i64* %counter) { entry: %0 = call i32 (i8*, ...) @printf( i8* getelementptr inbounds ([19 x i8], [19 x i8]* @0, i32 0, i32 0)) %1 = load i64, i64* %counter %2 = add i64 %1, 1 store i64 %2, i64* %counter ret void }

Source from the content-addressed store, hash-verified

201// ret void
202// }
203llvm::Function* CodegenInnerLoop(
204 LlvmCodeGen* codegen, int delta) {
205 llvm::LLVMContext& context = codegen->context();
206 LlvmBuilder builder(context);
207
208 LlvmCodeGen::FnPrototype fn_prototype(codegen, "JittedInnerLoop", codegen->void_type());
209 fn_prototype.AddArgument(
210 LlvmCodeGen::NamedVariable("counter", codegen->i64_ptr_type()));
211 llvm::Value* counter;
212 llvm::Function* jitted_loop_call = fn_prototype.GeneratePrototype(&builder, &counter);
213 codegen->CodegenDebugTrace(&builder, "Jitted\n");
214
215 // Store &jitted_counter as a constant.
216 llvm::Value* const_delta = codegen->GetI64Constant(delta);
217 llvm::Value* loaded_counter = builder.CreateLoad(counter);
218 llvm::Value* incremented_value = builder.CreateAdd(loaded_counter, const_delta);
219 builder.CreateStore(incremented_value, counter);
220 builder.CreateRetVoid();
221
222 return codegen->FinalizeFunction(jitted_loop_call);
223}
224
225// This test loads a precompiled IR file (compiled from testdata/llvm/test-loop.cc).
226// The test contains two functions, an outer loop function and an inner loop function.

Callers 1

TEST_FFunction · 0.85

Calls 9

NamedVariableClass · 0.85
contextMethod · 0.80
void_typeMethod · 0.80
AddArgumentMethod · 0.80
i64_ptr_typeMethod · 0.80
GeneratePrototypeMethod · 0.80
CodegenDebugTraceMethod · 0.80
GetI64ConstantMethod · 0.80
FinalizeFunctionMethod · 0.80

Tested by

no test coverage detected