19 namespace CodegenUtil {
22 if (llvm::Function* cf = call_inst.getCalledFunction()) {
24 }
else if (llvm::Value* cv = call_inst.getCalledOperand()) {
25 if (llvm::Function* cvf = llvm::dyn_cast<llvm::Function>(cv->stripPointerCasts())) {
36 return std::make_optional<std::string_view>(cf->getName().data(),
37 cf->getName().size());
53 llvm::ConstantInt* ptr_int_val,
55 size_t num_devices_to_hoist_literal) {
57 return {cgen_state->
ir_builder_.CreateIntToPtr(ptr_int_val, type)};
60 d.
bigintval = ptr_int_val->getSExtValue();
61 auto ptr = makeExpr<Analyzer::Constant>(
kBIGINT,
false, d);
62 std::vector<Analyzer::Constant const*> literals(num_devices_to_hoist_literal,
64 auto hoisted_literal_lvs =
66 std::vector<llvm::Value*> hoisted_ptrs;
67 hoisted_ptrs.reserve(num_devices_to_hoist_literal);
68 for (
size_t device_id = 0; device_id < num_devices_to_hoist_literal; device_id++) {
69 hoisted_ptrs[device_id] =
70 cgen_state->
ir_builder_.CreateIntToPtr(hoisted_literal_lvs[device_id], type);
80 size_t num_devices_to_hoist_literal) {
83 auto literal_expr = makeExpr<Analyzer::Constant>(
type,
false, d);
84 std::vector<Analyzer::Constant const*> literals(num_devices_to_hoist_literal,
std::optional< std::string_view > getCalledFunctionName(llvm::CallInst &call_inst)
std::vector< llvm::Value * > hoistLiteral(CodeGenerator *code_generator, CompilationOptions const &co, Datum d, SQLTypeInfo type, size_t num_devices_to_hoist_literal)
llvm::IRBuilder ir_builder_
std::vector< llvm::Value * > codegenHoistedConstants(const std::vector< const Analyzer::Constant * > &constants, const EncodingType enc_type, const shared::StringDictKey &dict_id)
llvm::Function * findCalledFunction(llvm::CallInst &call_inst)
std::vector< llvm::Value * > createPtrWithHoistedMemoryAddr(CgenState *cgen_state, CodeGenerator *code_generator, CompilationOptions const &co, llvm::ConstantInt *ptr_int_val, llvm::Type *type, size_t num_devices_to_hoist_literal)