| 530 | } |
| 531 | |
| 532 | llvm::Value* LLVMGenerator::AddFunctionCall(const std::string& full_name, |
| 533 | llvm::Type* ret_type, |
| 534 | const std::vector<llvm::Value*>& args) { |
| 535 | // find the llvm function. |
| 536 | llvm::Function* fn = module()->getFunction(full_name); |
| 537 | DCHECK_NE(fn, nullptr) << "missing function " << full_name; |
| 538 | |
| 539 | if (enable_ir_traces_ && !full_name.compare("printf") && |
| 540 | !full_name.compare("printff")) { |
| 541 | // Trace for debugging |
| 542 | ADD_TRACE("invoke native fn " + full_name); |
| 543 | } |
| 544 | |
| 545 | // build a call to the llvm function. |
| 546 | llvm::Value* value; |
| 547 | if (ret_type->isVoidTy()) { |
| 548 | // void functions can't have a name for the call. |
| 549 | value = ir_builder()->CreateCall(fn, args); |
| 550 | } else { |
| 551 | value = ir_builder()->CreateCall(fn, args, full_name); |
| 552 | DCHECK(value->getType() == ret_type); |
| 553 | } |
| 554 | |
| 555 | return value; |
| 556 | } |
| 557 | |
| 558 | std::shared_ptr<DecimalLValue> LLVMGenerator::BuildDecimalLValue(llvm::Value* value, |
| 559 | DataTypePtr arrow_type) { |
no test coverage detected