Example #1
0
    void _doLoad(const std::string& name, AST_Name* node) {
        int id = analysis->getStringIndex(name);

        Status& status = statuses[id];
        status.addUsage(Status::USED);

        last_uses[id] = node;
    }
Example #2
0
    void _doStore(const std::string& name) {
        int id = analysis->getStringIndex(name);

        Status& status = statuses[id];
        status.addUsage(Status::DEFINED);

        auto it = last_uses.find(id);
        if (it != last_uses.end()) {
            kills.insert(it->second);
            last_uses.erase(it);
        }
    }
Example #3
0
    bool isKilledAt(AST_Name* node, bool is_live_at_end) {
        if (kills.count(node))
            return true;

        // If it's not live at the end, then the last use is a kill
        // even though we weren't able to determine that in a single
        // pass
        if (!is_live_at_end) {
            auto it = last_uses.find(analysis->getStringIndex(node->id));
            if (it != last_uses.end() && node == it->second)
                return true;
        }

        return false;
    }
Example #4
0
 void _doStore(const std::string& name) {
     Status& status = statuses[analysis->getStringIndex(name)];
     if (status == NONE)
         status = KILLED;
 }
Example #5
0
 void _doLoad(const std::string& name) {
     Status& status = statuses[analysis->getStringIndex(name)];
     if (status == NONE)
         status = USED;
 }