Пример #1
0
        void genFuncs(std::stringstream &kerStream, str_map_t &declStrs)
        {
            if (m_gen_func) return;

            if (!(m_lhs->isGenFunc())) m_lhs->genFuncs(kerStream, declStrs);
            if (!(m_rhs->isGenFunc())) m_rhs->genFuncs(kerStream, declStrs);

            std::stringstream declStream;
            declStream << "declare " << m_type_str << " " << m_op_str
                       << "(" << m_lhs->getTypeStr() << " , " << m_rhs->getTypeStr() << ")\n";

            str_map_iter loc = declStrs.find(declStream.str());
            if (loc == declStrs.end()) {
                declStrs[declStream.str()] = true;
            }

            kerStream << "%val" << m_id << " = call "
                      << m_type_str << " "
                      << m_op_str << "("
                      << m_lhs->getTypeStr() << " "
                      << "%val" << m_lhs->getId() << ", "
                      << m_rhs->getTypeStr() << " "
                      << "%val" << m_rhs->getId() << ")\n";

            m_gen_func = true;
        }
Пример #2
0
        void genKerName(std::stringstream &kerStream)
        {
            m_lhs->genKerName(kerStream);
            m_rhs->genKerName(kerStream);

            if (m_gen_name) return;
            // Make the hex representation of enum part of the Kernel name
            kerStream << "_" << std::setw(2) << std::setfill('0') << std::hex << m_op;
            kerStream << std::setw(2) << std::setfill('0') << std::hex << m_lhs->getId();
            kerStream << std::setw(2) << std::setfill('0') << std::hex << m_rhs->getId();
            kerStream << std::setw(2) << std::setfill('0') << std::hex << m_id << std::dec;
            m_gen_name = true;
        }
Пример #3
0
        void genFuncs(std::stringstream &kerStream)
        {
            if (m_gen_func) return;

            if (!(m_lhs->isGenFunc())) m_lhs->genFuncs(kerStream);
            if (!(m_rhs->isGenFunc())) m_rhs->genFuncs(kerStream);

            kerStream << m_type_str << " val" << m_id << " = "
                      << m_op_str << "(val" << m_lhs->getId()
                      << ", val" << m_rhs->getId() << ");"
                      << "\n";

            m_gen_func = true;
        }
Пример #4
0
        void genKerName(std::stringstream &kerStream)
        {
            m_child->genKerName(kerStream);

            // Make the dec representation of enum part of the Kernel name
            kerStream << "_" << std::setw(3) << std::setfill('0') << std::dec << m_op;
            kerStream << std::setw(3) << std::setfill('0') << std::dec << m_child->getId();
            kerStream << std::setw(3) << std::setfill('0') << std::dec << m_id << std::dec;
            m_gen_name = true;
        }