Commit 4e14ec8e authored by Paul's avatar Paul
Browse files

Formatting

parent 80ffc159
......@@ -44,10 +44,7 @@ struct instruction
}
}
void recompute_shape()
{
replace(compute_shape(op, arguments));
}
void recompute_shape() { replace(compute_shape(op, arguments)); }
void replace(std::vector<instruction_ref> args)
{
......
......@@ -52,7 +52,8 @@ struct program
instruction_ref
replace_instruction(instruction_ref ins, operation op, std::vector<instruction_ref> args);
instruction_ref replace_instructions(instruction_ref ins, instruction_ref start, instruction_ref last);
instruction_ref
replace_instructions(instruction_ref ins, instruction_ref start, instruction_ref last);
instruction_ref remove_instruction(instruction_ref ins);
instruction_ref remove_instructions(instruction_ref first, instruction_ref last);
......
......@@ -17,24 +17,18 @@ void copy(Range&& r, Iterator it)
std::copy(r.begin(), r.end(), it);
}
template<class Iterator>
template <class Iterator>
struct iterator_range
{
Iterator start;
Iterator last;
Iterator begin() const
{
return start;
}
Iterator begin() const { return start; }
Iterator end() const
{
return last;
}
Iterator end() const { return last; }
};
template<class Iterator>
template <class Iterator>
iterator_range<Iterator> range(Iterator start, Iterator last)
{
return {start, last};
......
......@@ -55,10 +55,11 @@ program::replace_instruction(instruction_ref ins, operation op, std::vector<inst
return ins;
}
instruction_ref program::replace_instructions(instruction_ref ins, instruction_ref start, instruction_ref last)
instruction_ref
program::replace_instructions(instruction_ref ins, instruction_ref start, instruction_ref last)
{
auto rep = std::prev(last);
for(auto&& out:ins->output)
for(auto&& out : ins->output)
{
if(std::find(start, last, out) == last)
......@@ -67,7 +68,7 @@ instruction_ref program::replace_instructions(instruction_ref ins, instruction_r
backreference(out);
}
}
if(ins->output.empty())
if(ins->output.empty())
return remove_instruction(ins);
return ins;
}
......
......@@ -26,16 +26,15 @@ struct auto_print
int index;
auto_print(migraph::program& pp, int i) : p(pp), index(i)
{
handlers()[index] = [this]{ std::cout << p << std::endl; };
handlers()[index] = [this] { std::cout << p << std::endl; };
}
~auto_print()
{
handlers()[index] = []{};
handlers()[index] = [] {};
}
};
template <class V>
migraph::argument run_cpu()
{
......@@ -80,7 +79,8 @@ void verify_program()
{
std::cout << "what(): " << e.what() << std::endl;
}
for(auto&& handle:handlers()) handle();
for(auto&& handle : handlers())
handle();
});
auto cpu_arg = run_cpu<V>();
auto gpu_arg = run_gpu<V>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment