本文整理汇总了C++中CodeGen::CreateAlloca方法的典型用法代码示例。如果您正苦于以下问题:C++ CodeGen::CreateAlloca方法的具体用法?C++ CodeGen::CreateAlloca怎么用?C++ CodeGen::CreateAlloca使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGen
的用法示例。
在下文中一共展示了CodeGen::CreateAlloca方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateScan
// Generate a scan over all tile groups.
//
// @code
// column_layouts := alloca<peloton::ColumnLayoutInfo>(
// table.GetSchema().GetColumnCount())
//
// oid_t tile_group_idx := 0
// num_tile_groups = GetTileGroupCount(table_ptr)
//
// for (; tile_group_idx < num_tile_groups; ++tile_group_idx) {
// tile_group_ptr := GetTileGroup(table_ptr, tile_group_idx)
// consumer.TileGroupStart(tile_group_ptr);
// tile_group.TidScan(tile_group_ptr, column_layouts, vector_size, consumer);
// consumer.TileGroupEnd(tile_group_ptr);
// }
//
// @endcode
void Table::GenerateScan(CodeGen &codegen, llvm::Value *table_ptr,
uint32_t batch_size, ScanCallback &consumer) const {
// First get the columns from the table the consumer needs. For every column,
// we'll need to have a ColumnInfoLayout struct
const uint32_t num_columns =
static_cast<uint32_t>(table_.GetSchema()->GetColumnCount());
llvm::Value *column_layouts = codegen->CreateAlloca(
RuntimeFunctionsProxy::_ColumnLayoutInfo::GetType(codegen),
codegen.Const32(num_columns));
// Get the number of tile groups in the given table
llvm::Value *tile_group_idx = codegen.Const64(0);
llvm::Value *num_tile_groups = GetTileGroupCount(codegen, table_ptr);
// Iterate over all tile groups in the table
lang::Loop loop{codegen,
codegen->CreateICmpULT(tile_group_idx, num_tile_groups),
{{"tileGroupIdx", tile_group_idx}}};
{
// Get the tile group with the given tile group ID
tile_group_idx = loop.GetLoopVar(0);
llvm::Value *tile_group_ptr =
GetTileGroup(codegen, table_ptr, tile_group_idx);
llvm::Value *tile_group_id =
tile_group_.GetTileGroupId(codegen, tile_group_ptr);
// Invoke the consumer to let her know that we're starting to iterate over
// the tile group now
consumer.TileGroupStart(codegen, tile_group_id, tile_group_ptr);
// Generate the scan cover over the given tile group
tile_group_.GenerateTidScan(codegen, tile_group_ptr, column_layouts,
batch_size, consumer);
// Invoke the consumer to let her know that we're done with this tile group
consumer.TileGroupFinish(codegen, tile_group_ptr);
// Move to next tile group in the table
tile_group_idx = codegen->CreateAdd(tile_group_idx, codegen.Const64(1));
loop.LoopEnd(codegen->CreateICmpULT(tile_group_idx, num_tile_groups),
{tile_group_idx});
}
}