Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 364cf3e

Browse files
committed
Use braced constructor initialization
1 parent 26c2231 commit 364cf3e

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

src/codegen/buffer_accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void BufferAccessor::Iterate(CodeGen &codegen, llvm::Value *buffer_ptr,
5050
BufferAccessor::IterateCallback &callback) const {
5151
auto *start = codegen.Load(BufferProxy::buffer_start, buffer_ptr);
5252
auto *end = codegen.Load(BufferProxy::buffer_pos, buffer_ptr);
53-
lang::Loop loop(codegen, codegen->CreateICmpNE(start, end), {{"pos", start}});
53+
lang::Loop loop{codegen, codegen->CreateICmpNE(start, end), {{"pos", start}}};
5454
{
5555
auto *pos = loop.GetLoopVar(0);
5656

src/codegen/oa_hash_table.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ OAHashTable::ProbeResult OAHashTable::TranslateProbing(
268268
// Return the result of comparison (if ptr is 0 then the slot is free)
269269
llvm::Value *status_neq_zero = IsPtrUnEqualTo(codegen, kv_p, 0UL);
270270

271-
lang::Loop probe_loop(
271+
lang::Loop probe_loop{
272272
codegen, status_neq_zero,
273-
{{"probeEntry", entry_ptr}, {"probeIndex", index}, {"probeKvl", kv_p}});
273+
{{"probeEntry", entry_ptr}, {"probeIndex", index}, {"probeKvl", kv_p}}};
274274
{
275275
entry_ptr = probe_loop.GetLoopVar(0);
276276
index = probe_loop.GetLoopVar(1);
@@ -321,9 +321,9 @@ OAHashTable::ProbeResult OAHashTable::TranslateProbing(
321321

322322
// Start a loop. Since we know at least one value exits, we build
323323
// a do-while loop.
324-
lang::Loop value_loop(
324+
lang::Loop value_loop{
325325
codegen, codegen.ConstBool(true),
326-
{{"probeCounter", loop_counter}, {"probeDataPtr", data_ptr}});
326+
{{"probeCounter", loop_counter}, {"probeDataPtr", data_ptr}}};
327327
{
328328
// Loop variables
329329
loop_counter = value_loop.GetLoopVar(0);
@@ -551,9 +551,9 @@ void OAHashTable::Iterate(CodeGen &codegen, llvm::Value *hash_table,
551551
llvm::Value *bucket_cond = codegen->CreateICmpULT(entry_index, num_buckets);
552552

553553
// (1) loop var = bucket_index; loop cond = bucket_cond
554-
lang::Loop bucket_loop(
554+
lang::Loop bucket_loop{
555555
codegen, bucket_cond,
556-
{{"iterateEntryIndex", entry_index}, {"iterateEntryPtr", entry_ptr}});
556+
{{"iterateEntryIndex", entry_index}, {"iterateEntryPtr", entry_ptr}}};
557557
{
558558
entry_index = bucket_loop.GetLoopVar(0);
559559
entry_ptr = bucket_loop.GetLoopVar(1);
@@ -581,10 +581,10 @@ void OAHashTable::Iterate(CodeGen &codegen, llvm::Value *hash_table,
581581
data_ptr = data_count_ptr_pair.second;
582582
llvm::Value *val_index = codegen.Const64(0);
583583

584-
lang::Loop read_value_loop(
584+
lang::Loop read_value_loop{
585585
codegen,
586586
codegen.ConstBool(true), // Always pass
587-
{{"iterateCounter", val_index}, {"iterateDataPtr", data_ptr}});
587+
{{"iterateCounter", val_index}, {"iterateDataPtr", data_ptr}}};
588588
{
589589
val_index = read_value_loop.GetLoopVar(0);
590590
data_ptr = read_value_loop.GetLoopVar(1);
@@ -640,7 +640,7 @@ void OAHashTable::VectorizedIterate(
640640
{"vectorizedIteratePos", start},
641641
{"vectorizedIterateSelPos", codegen.Const32(0)},
642642
{"vectorizedIterateCurrEntryPtr", entry_ptr}};
643-
lang::Loop filter_loop(codegen, codegen.ConstBool(true), loop_vars);
643+
lang::Loop filter_loop{codegen, codegen.ConstBool(true), loop_vars};
644644
{
645645
llvm::Value *pos = filter_loop.GetLoopVar(0);
646646
llvm::Value *sel_pos = filter_loop.GetLoopVar(1);

src/codegen/operator/hash_group_by_translator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ void HashGroupByTranslator::Consume(ConsumerContext &context,
142142
codegen->CreateSub(iter_instance.end, iter_instance.start);
143143

144144
// The first loop does hash computation and prefetching
145-
lang::Loop prefetch_loop(
146-
codegen, codegen->CreateICmpULT(p, end), {{"p", p}});
145+
lang::Loop prefetch_loop{
146+
codegen, codegen->CreateICmpULT(p, end), {{"p", p}}};
147147
{
148148
p = prefetch_loop.GetLoopVar(0);
149149
RowBatch::Row row =
@@ -172,7 +172,7 @@ void HashGroupByTranslator::Consume(ConsumerContext &context,
172172
p = codegen.Const32(0);
173173
std::vector<lang::Loop::LoopVariable> loop_vars = {
174174
{"p", p}, {"writeIdx", iter_instance.write_pos}};
175-
lang::Loop process_loop(codegen, codegen->CreateICmpULT(p, end), loop_vars);
175+
lang::Loop process_loop{codegen, codegen->CreateICmpULT(p, end), loop_vars};
176176
{
177177
p = process_loop.GetLoopVar(0);
178178
llvm::Value *write_pos = process_loop.GetLoopVar(1);

src/codegen/operator/hash_join_translator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ void HashJoinTranslator::Consume(ConsumerContext &context,
175175
codegen->CreateSub(iter_instance.end, iter_instance.start);
176176

177177
// The first loop does hash computation and prefetching
178-
lang::Loop prefetch_loop(
179-
codegen, codegen->CreateICmpULT(p, end), {{"p", p}});
178+
lang::Loop prefetch_loop{
179+
codegen, codegen->CreateICmpULT(p, end), {{"p", p}}};
180180
{
181181
p = prefetch_loop.GetLoopVar(0);
182182
RowBatch::Row row =
@@ -209,7 +209,7 @@ void HashJoinTranslator::Consume(ConsumerContext &context,
209209
p = codegen.Const32(0);
210210
std::vector<lang::Loop::LoopVariable> loop_vars = {
211211
{"p", p}, {"writeIdx", iter_instance.write_pos}};
212-
lang::Loop process_loop(codegen, codegen->CreateICmpULT(p, end), loop_vars);
212+
lang::Loop process_loop{codegen, codegen->CreateICmpULT(p, end), loop_vars};
213213
{
214214
p = process_loop.GetLoopVar(0);
215215
llvm::Value *write_pos = process_loop.GetLoopVar(1);

src/codegen/pipeline.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void PipelineContext::LoopOverStates::Do(
5050
states, {codegen->CreateMul(num_threads, state_size)});
5151

5252
llvm::Value *loop_cond = codegen->CreateICmpNE(states, state_end);
53-
lang::Loop state_loop(codegen, loop_cond, {{"threadState", states}});
53+
lang::Loop state_loop{codegen, loop_cond, {{"threadState", states}}};
5454
{
5555
// Pull out state in this iteration
5656
llvm::Value *curr_state = state_loop.GetLoopVar(0);
@@ -285,8 +285,8 @@ uint32_t Pipeline::GetTranslatorStage(
285285

286286
namespace {
287287

288-
std::string ConstructFunctionName(Pipeline &pipeline,
289-
const std::string &prefix) {
288+
std::string CreateUniqueFunctionName(Pipeline &pipeline,
289+
const std::string &prefix) {
290290
CompilationContext &compilation_ctx = pipeline.GetCompilationContext();
291291
CodeContext &cc = compilation_ctx.GetCodeGen().GetCodeContext();
292292
return StringUtil::Format("_%" PRId64 "_pipeline_%u_%s_%s", cc.GetID(),
@@ -347,7 +347,7 @@ void Pipeline::InitializePipeline(PipelineContext &pipeline_context) {
347347
QueryState &query_state = compilation_ctx_.GetQueryState();
348348
CodeContext &cc = codegen.GetCodeContext();
349349

350-
auto func_name = ConstructFunctionName(*this, "initializeWorkerState");
350+
auto func_name = CreateUniqueFunctionName(*this, "initializeWorkerState");
351351
auto visibility = FunctionDeclaration::Visibility::Internal;
352352
auto *ret_type = codegen.VoidType();
353353
std::vector<FunctionDeclaration::ArgumentInfo> args = {
@@ -445,7 +445,7 @@ void Pipeline::DoRun(
445445
CodeContext &cc = codegen.GetCodeContext();
446446

447447
// Function signature
448-
std::string func_name = ConstructFunctionName(
448+
std::string func_name = CreateUniqueFunctionName(
449449
*this, IsParallel() ? "parallelWork" : "serialWork");
450450
auto visibility = FunctionDeclaration::Visibility::Internal;
451451
auto *ret_type = codegen.VoidType();

src/codegen/sorter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ void Sorter::Iterate(CodeGen &codegen, llvm::Value *sorter_ptr,
7979

8080
void ProcessEntries(CodeGen &codegen, llvm::Value *start_index,
8181
llvm::Value *end_index, SorterAccess &access) const {
82-
lang::Loop loop(codegen, codegen->CreateICmpULT(start_index, end_index),
83-
{{"start", start_index}});
82+
lang::Loop loop{codegen,
83+
codegen->CreateICmpULT(start_index, end_index),
84+
{{"start", start_index}}};
8485
{
8586
llvm::Value *curr_index = loop.GetLoopVar(0);
8687

0 commit comments

Comments
 (0)