<commit_before>/*
This file is part of Bohrium and copyright (c) 2012 the Bohrium
team <http://www.bh107.org>.

Bohrium is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 
of the License, or (at your option) any later version.

Bohrium is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the 
GNU Lesser General Public License along with Bohrium. 

If not, see <http://www.gnu.org/licenses/>.
*/
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bh.h>

using namespace std;

void range_filter(bh_ir* bhir)
{
    bh_intp nodes[] = {0};
    cout << "### Range-filter searching through. ndag="<< bhir->ndag  << "." << endl;
    bh_dag_split(bhir, 1, nodes, 0, -1);  
    cout << "###" << endl;
}<commit_msg>filter-range: nothing really...<commit_after>/*
This file is part of Bohrium and copyright (c) 2012 the Bohrium
team <http://www.bh107.org>.

Bohrium is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 
of the License, or (at your option) any later version.

Bohrium is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the 
GNU Lesser General Public License along with Bohrium. 

If not, see <http://www.gnu.org/licenses/>.
*/
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bh.h>

using namespace std;

typedef enum { NONE, RANGE, FUSABLE, STREAMABLE } tag_t;

bh_error void ref_count(bh_ir* bhir, dag)
{
    for(bh_intp i=0; i< bhir->dag_list[dag].nnode; ++i) {
        bh_intp id = bhir->dag_list[dag].node_map[i];
        if (id < 0) {
            id = -1*id-1;
            bh_error err = ref_count(bhir, );
            if (err != BH_SUCCESS)
                return err;
        } else {
            bh_error err = func(&bhir->instr_list[id]);
            if (err != BH_SUCCESS)
                return err;
        }
    }
    return BH_SUCCESS;
}

void range_filter(bh_ir* bhir)
{
    cout << "### range-filter on bhir->ninstr = " << bhir->ninstr << endl;
    for(bh_intp dag=0; dag<bhir->ndag; ++dag) {

        cout << "Looking at dag[" << dag << "] " << dag+1 << " of "<< bhir->ndag << \
                ", containing " << bhir->dag_list[dag].nnode << " node(s)" << endl;

        if (bhir->dag_list[dag].tag != NONE) {      // Already tagged, skipping it.
            cout << "Skipping it..." << endl;
            continue;
        }

        for(bh_intp max_nodes=bhir->dag_list[dag].nnode; max_nodes>0; max_nodes--) {

            bh_intp nodes[] = {0};
            bh_dag_split(bhir, 1, nodes, dag, -1);  // Sub-graphing
            bh_intp dag_idx = bhir->ndag-1;         // Index of sub-graph
            bhir->dag_list[dag_idx].tag = RANGE;    // Tagging

        }
    }
    cout << "###" << endl;
}
{'fraction_non_alphanumeric': 0.12219598583234947, 'fraction_numerical': 0.009149940968122786, 'mean_word_length': 2.803591470258137, 'pattern_counts': {'":': 0, '<': 68, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3370477', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1068, 'n_words': 383}