MCPcopy Create free account
hub / github.com/apache/kudu / MakeProjection

Function MakeProjection

src/kudu/codegen/row_projector.cc:88–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86// kudu::RowProjector::Init() to return an error status instead.
87template<bool READ>
88llvm::Function* MakeProjection(const string& name,
89 ModuleBuilder* mbuilder,
90 const kudu::RowProjector& proj) {
91 // Get the IRBuilder
92 ModuleBuilder::LLVMBuilder* builder = mbuilder->builder();
93 LLVMContext& context = builder->getContext();
94
95 // Extract schema information from projector
96 const Schema& base_schema = *proj.base_schema();
97 const Schema& projection = *proj.projection();
98
99 // Create the function after providing a declaration
100 vector<Type*> argtypes = { Type::getInt8PtrTy(context),
101 PointerType::getUnqual(mbuilder->GetType("class.kudu::RowBlockRow")),
102 PointerType::getUnqual(mbuilder->GetType("class.kudu::Arena")) };
103 FunctionType* fty =
104 FunctionType::get(Type::getInt1Ty(context), argtypes, false);
105 Function* f = mbuilder->Create(fty, name);
106
107 // Get the function's Arguments
108 Function::arg_iterator it = f->arg_begin();
109 Argument* src = &*it++;
110 Argument* rbrow = &*it++;
111 Argument* arena = &*it++;
112 DCHECK(it == f->arg_end());
113
114 // Give names to the arguments for debugging IR.
115 src->setName("src");
116 rbrow->setName("rbrow");
117 arena->setName("arena");
118
119 // Mark our arguments as not aliasing. This eliminates a redundant
120 // load of rbrow->row_block_ and rbrow->row_index_ for each column.
121 f->addParamAttr(0, llvm::Attribute::NoAlias);
122 f->addParamAttr(1, llvm::Attribute::NoAlias);
123 f->addParamAttr(2, llvm::Attribute::NoAlias);
124
125 // Project row function in IR (note: values in angle brackets are
126 // constants whose values are determined right now, at JIT time).
127 //
128 // define i1 @name(i8* noalias %src, RowBlockRow* noalias %rbrow, Arena* noalias %arena)
129 // entry:
130 // %src_bitmap = getelementptr i8* %src, i64 <offset to bitmap>
131 // <for each base column to projection column mapping>
132 // %src_cell = getelementptr i8* %src, i64 <base offset>
133 // %result = call i1 @CopyCellToRowBlock(
134 // i64 <type size>, i8* %src_cell, RowBlockRow* %rbrow,
135 // i64 <column index>, i1 <is binary>, Arena* %arena)**
136 // %success = and %success, %result***
137 // <end implicit for each>
138 // <for each projection column that needs defaults>
139 // <if default column is nullable>
140 // call void @CopyCellToRowBlockNullDefault(
141 // RowBlockRow* %rbrow, i64 <column index>, i1 <is null>)
142 // <end implicit if>
143 // <if default value was not null>
144 // %src_cell = inttoptr i64 <default value location> to i8*
145 // %result = call i1 @CopyCellToRowBlock(

Callers

nothing calls this directly

Calls 15

builderMethod · 0.80
getContextMethod · 0.80
GetTypeMethod · 0.80
GetFunctionMethod · 0.80
byte_sizeMethod · 0.80
column_offsetMethod · 0.80
physical_typeMethod · 0.80
push_backMethod · 0.80
read_default_valueMethod · 0.80
write_default_valueMethod · 0.80
GetPointerValueMethod · 0.80
StrCatFunction · 0.50

Tested by

no test coverage detected