MCPcopy Create free account
hub / github.com/apache/arrow / Visit

Method Visit

cpp/src/gandiva/llvm_generator.cc:594–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594void LLVMGenerator::Visitor::Visit(const VectorReadFixedLenValueDex& dex) {
595 llvm::IRBuilder<>* builder = ir_builder();
596 auto types = generator_->types();
597 llvm::Value* slot_ref = GetBufferReference(dex.DataIdx(), kBufferTypeData, dex.Field());
598 llvm::Value* slot_index = builder->CreateAdd(loop_var_, GetSliceOffset(dex.DataIdx()));
599 llvm::Value* slot_value;
600 std::shared_ptr<LValue> lvalue;
601
602 switch (dex.FieldType()->id()) {
603 case arrow::Type::BOOL:
604 slot_value = generator_->GetPackedBitValue(slot_ref, slot_index);
605 lvalue = std::make_shared<LValue>(slot_value);
606 break;
607
608 case arrow::Type::DECIMAL: {
609 auto slot_offset = builder->CreateGEP(types->i128_type(), slot_ref, slot_index);
610 // Arrow decimal128 data is only 8-byte aligned, not 16-byte aligned.
611 // Using CreateLoad with default alignment (16 for i128) causes crashes on
612 // misaligned data. Use CreateAlignedLoad with 8-byte alignment to match Arrow's
613 // actual alignment.
614 slot_value = builder->CreateAlignedLoad(
615 types->i128_type(), slot_offset, llvm::MaybeAlign(8), false, dex.FieldName());
616 lvalue = generator_->BuildDecimalLValue(slot_value, dex.FieldType());
617 break;
618 }
619
620 default: {
621 auto type = types->IRType(dex.FieldType()->id());
622 auto slot_offset = builder->CreateGEP(type, slot_ref, slot_index);
623 slot_value = builder->CreateLoad(type, slot_offset, dex.FieldName());
624 lvalue = std::make_shared<LValue>(slot_value);
625 break;
626 }
627 }
628 ADD_VISITOR_TRACE("visit fixed-len data vector " + dex.FieldName() + " value %T",
629 slot_value);
630 result_ = lvalue;
631}
632
633void LLVMGenerator::Visitor::Visit(const VectorReadVarLenValueDex& dex) {
634 llvm::IRBuilder<>* builder = ir_builder();

Callers 8

AcceptFunction · 0.45
node.hFile · 0.45
AcceptMethod · 0.45
AcceptMethod · 0.45
AcceptFunction · 0.45
dex.hFile · 0.45
AcceptMethod · 0.45
AcceptMethod · 0.45

Calls 15

to_stringFunction · 0.85
CreateGlobalStringPtrFunction · 0.85
is_binary_likeFunction · 0.85
resultFunction · 0.85
typesMethod · 0.80
GetPackedBitValueMethod · 0.80
BuildDecimalLValueMethod · 0.80
contextMethod · 0.80
ToIntegerStringMethod · 0.80
push_backMethod · 0.80
ir_builderFunction · 0.70

Tested by

no test coverage detected