Commit a9325a54 authored by Paul's avatar Paul
Browse files

Formating

parent 767d2885
...@@ -138,12 +138,14 @@ struct instruction ...@@ -138,12 +138,14 @@ struct instruction
ins->recompute_shape(); ins->recompute_shape();
} }
static void replace(instruction_ref ins, operation o, const shape& r, std::vector<instruction_ref> args) static void
replace(instruction_ref ins, operation o, const shape& r, std::vector<instruction_ref> args)
{ {
ins->replace(o, r, std::move(args)); ins->replace(o, r, std::move(args));
backreference(ins); backreference(ins);
} }
private:
private:
// internal // internal
void replace(operation o, const shape& r, std::vector<instruction_ref> args) void replace(operation o, const shape& r, std::vector<instruction_ref> args)
{ {
......
...@@ -290,7 +290,8 @@ argument generic_eval(const program& p, ...@@ -290,7 +290,8 @@ argument generic_eval(const program& p,
else if(ins->name() == "@param") else if(ins->name() == "@param")
{ {
results.emplace(ins, trace(ins, [&] { results.emplace(ins, trace(ins, [&] {
return params.at(any_cast<builtin::param>(ins->get_operator()).parameter); return params.at(
any_cast<builtin::param>(ins->get_operator()).parameter);
})); }));
} }
else if(ins->name() == "@outline") else if(ins->name() == "@outline")
...@@ -305,8 +306,9 @@ argument generic_eval(const program& p, ...@@ -305,8 +306,9 @@ argument generic_eval(const program& p,
assert(results.find(i) != results.end()); assert(results.find(i) != results.end());
return results[i]; return results[i];
}); });
results.emplace( results.emplace(ins, trace(ins, [&] {
ins, trace(ins, [&] { return ins->get_operator().compute(ctx, ins->get_shape(), values); })); return ins->get_operator().compute(ctx, ins->get_shape(), values);
}));
} }
assert(results.find(ins) != results.end()); assert(results.find(ins) != results.end());
} }
......
...@@ -10,33 +10,36 @@ ...@@ -10,33 +10,36 @@
template <class Tag> template <class Tag>
struct stowed struct stowed
{ {
static typename Tag::type value; static typename Tag::type value;
}; };
template <class Tag> template <class Tag>
typename Tag::type stowed<Tag>::value; typename Tag::type stowed<Tag>::value;
template <class Tag, typename Tag::type x> template <class Tag, typename Tag::type x>
struct stow_private struct stow_private
{ {
stow_private() { stowed<Tag>::value = x; } stow_private() { stowed<Tag>::value = x; }
static stow_private instance; static stow_private instance;
}; };
template <class Tag, typename Tag::type x> template <class Tag, typename Tag::type x>
stow_private<Tag,x> stow_private<Tag,x>::instance; stow_private<Tag, x> stow_private<Tag, x>::instance;
template<class C, class T> template <class C, class T>
struct mem_data_ptr { typedef T(C::*type); }; struct mem_data_ptr
{
typedef T(C::*type);
};
#define MIGRAPH_ROB(name, Type, C, mem) \ #define MIGRAPH_ROB(name, Type, C, mem) \
struct name ## _tag \ struct name##_tag : mem_data_ptr<C, Type> \
: mem_data_ptr<C, Type> \ { \
{}; \ }; \
template struct stow_private<name ## _tag,&C::mem>; \ template struct stow_private<name##_tag, &C::mem>; \
template<class T> \ template <class T> \
auto& name(T&& x) \ auto& name(T&& x) \
{ \ { \
return x.*stowed<name ## _tag>::value; \ return x.*stowed<name##_tag>::value; \
} }
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic pop #pragma clang diagnostic pop
......
...@@ -39,7 +39,10 @@ void incomplete_args() ...@@ -39,7 +39,10 @@ void incomplete_args()
EXPECT(bool{p.validate() == ins}); EXPECT(bool{p.validate() == ins});
} }
MIGRAPH_ROB(access_ins_arguments, std::vector<migraph::instruction_ref>, migraph::instruction, arguments) MIGRAPH_ROB(access_ins_arguments,
std::vector<migraph::instruction_ref>,
migraph::instruction,
arguments)
void invalid_args() void invalid_args()
{ {
......
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