| 1062 | |
| 1063 | template <typename Type> |
| 1064 | void LLVMGenerator::Visitor::VisitInExpression(const InExprDexBase<Type>& dex) { |
| 1065 | ADD_VISITOR_TRACE("visit In Expression"); |
| 1066 | LLVMTypes* types = generator_->types(); |
| 1067 | std::vector<llvm::Value*> params; |
| 1068 | |
| 1069 | const InExprDex<Type>& dex_instance = dynamic_cast<const InExprDex<Type>&>(dex); |
| 1070 | |
| 1071 | /* add the holder at the beginning */ |
| 1072 | |
| 1073 | // Switch to the entry block and load the holder pointer |
| 1074 | auto builder = ir_builder(); |
| 1075 | llvm::BasicBlock* saved_block = builder->GetInsertBlock(); |
| 1076 | builder->SetInsertPoint(entry_block_); |
| 1077 | |
| 1078 | llvm::Value* in_holder = generator_->LoadVectorAtIndex( |
| 1079 | arg_holder_ptrs_, types->i64_type(), dex_instance.get_holder_idx(), "in_holder"); |
| 1080 | |
| 1081 | builder->SetInsertPoint(saved_block); |
| 1082 | params.push_back(in_holder); |
| 1083 | |
| 1084 | /* eval expr result */ |
| 1085 | for (auto& pair : dex.args()) { |
| 1086 | DexPtr value_expr = pair->value_expr(); |
| 1087 | value_expr->Accept(*this); |
| 1088 | LValue& result_ref = *result(); |
| 1089 | params.push_back(result_ref.data()); |
| 1090 | |
| 1091 | /* length if the result is a string */ |
| 1092 | if (result_ref.length() != nullptr) { |
| 1093 | params.push_back(result_ref.length()); |
| 1094 | } |
| 1095 | |
| 1096 | /* push the validity of eval expr result */ |
| 1097 | llvm::Value* validity_expr = BuildCombinedValidity(pair->validity_exprs()); |
| 1098 | params.push_back(validity_expr); |
| 1099 | } |
| 1100 | |
| 1101 | llvm::Type* ret_type = types->IRType(arrow::Type::type::BOOL); |
| 1102 | |
| 1103 | llvm::Value* value; |
| 1104 | |
| 1105 | value = generator_->AddFunctionCall(dex.runtime_function(), ret_type, params); |
| 1106 | |
| 1107 | result_.reset(new LValue(value)); |
| 1108 | } |
| 1109 | |
| 1110 | template <> |
| 1111 | void LLVMGenerator::Visitor::VisitInExpression<gandiva::DecimalScalar128>( |
nothing calls this directly
no test coverage detected