#ifndef MANDEL_NAIVEIRGENERATOR_H #define MANDEL_NAIVEIRGENERATOR_H #include "IterationIR.h" #include "Generators.h" #include namespace mnd { template class NaiveIRGenerator; namespace eval { struct Load; struct Store; struct Add; struct Sub; struct Mul; struct Div; struct Neg; struct Atan2; struct Pow; struct Cos; struct Sin; struct Exp; struct Ln; using EvalNode = std::variant< Load, Store, Add, Sub, Mul, Div, Neg, Atan2, Pow, Cos, Sin, Exp, Ln >; template struct EvalStruct { std::map variableNames; std::vector variables; void prepare(const T& zre, const T& zim, const T& cre, const T& cim) { auto z_re = variableNames.find("z_re"); auto z_im = variableNames.find("z_im"); auto c_re = variableNames.find("c_re"); auto c_im = variableNames.find("c_im"); if (z_re != variableNames.end()) variables[z_re->second] = zre; if (z_im != variableNames.end()) variables[z_im->second] = zre; if (c_re != variableNames.end()) variables[c_re->second] = zre; if (c_im != variableNames.end()) variables[c_im->second] = zre; } }; } } template class mnd::NaiveIRGenerator : public mnd::MandelGenerator { const ir::Formula& form; eval::EvalStruct es; std::unique_ptr newz_re; std::unique_ptr newz_im; std::unique_ptr start_re; std::unique_ptr start_im; public: NaiveIRGenerator(const ir::Formula& irf, mnd::Precision prec = mnd::getType()); NaiveIRGenerator(NaiveIRGenerator&&) = default; virtual void generate(const MandelInfo& info, float* data); }; #endif // MANDEL_NAIVEIRGENERATOR_H