本文整理汇总了C++中CodeGen::CreateConstInBoundsGEP2_32方法的典型用法代码示例。如果您正苦于以下问题:C++ CodeGen::CreateConstInBoundsGEP2_32方法的具体用法?C++ CodeGen::CreateConstInBoundsGEP2_32怎么用?C++ CodeGen::CreateConstInBoundsGEP2_32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGen
的用法示例。
在下文中一共展示了CodeGen::CreateConstInBoundsGEP2_32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//===----------------------------------------------------------------------===//
// Here, we discover the layout of every column that will be accessed. A
// column's layout includes three pieces of information:
//
// 1. The starting memory address (where the first value of the column is)
// 2. The stride length
// 3. Whether the column is in columnar layout
//===----------------------------------------------------------------------===//
std::vector<TileGroup::ColumnLayout> TileGroup::GetColumnLayouts(
CodeGen &codegen, llvm::Value *tile_group_ptr,
llvm::Value *column_layout_infos) const {
// Call RuntimeFunctions::GetTileGroupLayout()
uint32_t num_cols = schema_.GetColumnCount();
codegen.Call(
RuntimeFunctionsProxy::GetTileGroupLayout,
{tile_group_ptr, column_layout_infos, codegen.Const32(num_cols)});
// Collect <start, stride, is_columnar> triplets of all columns
std::vector<TileGroup::ColumnLayout> layouts;
auto *layout_type = ColumnLayoutInfoProxy::GetType(codegen);
for (uint32_t col_id = 0; col_id < num_cols; col_id++) {
auto *start = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32(
layout_type, column_layout_infos, col_id, 0));
auto *stride = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32(
layout_type, column_layout_infos, col_id, 1));
auto *columnar = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32(
layout_type, column_layout_infos, col_id, 2));
layouts.push_back(ColumnLayout{col_id, start, stride, columnar});
}
return layouts;
}
示例2:
// Pull out the 'start_pos_' instance member from the provided Sorter instance
llvm::Value *Sorter::GetStartPosition(CodeGen &codegen,
llvm::Value *sorter_ptr) const {
auto *sorter_type = SorterProxy::GetType(codegen);
return codegen->CreateLoad(
codegen->CreateConstInBoundsGEP2_32(sorter_type, sorter_ptr, 0, 0));
}