Exemplo n.º 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;
        }
Exemplo n.º 2
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;
        }