Changeset 4658 for icGREP


Ignore:
Timestamp:
Jul 10, 2015, 11:13:41 PM (4 years ago)
Author:
nmedfort
Message:

Removed 'superfluous()' function from Assign nodes.

Location:
icGREP/icgrep-devel/icgrep
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4657 r4658  
    6060endif()
    6161
    62 SET(PABLO_SRC pablo/pabloAST.cpp pablo/ps_assign.cpp pablo/ps_if.cpp pablo/ps_while.cpp pablo/function.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp pablo/pablo_compiler.cpp pablo/optimizers/pablo_simplifier.cpp pablo/optimizers/pablo_codesinking.cpp pablo/carry_data.cpp pablo/carry_manager.cpp IDISA/idisa_builder.cpp)
     62SET(PABLO_SRC pablo/pabloAST.cpp pablo/ps_if.cpp pablo/ps_while.cpp pablo/function.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp pablo/pablo_compiler.cpp pablo/optimizers/pablo_simplifier.cpp pablo/optimizers/pablo_codesinking.cpp pablo/carry_data.cpp pablo/carry_manager.cpp IDISA/idisa_builder.cpp)
    6363IF (ENABLE_MULTIPLEXING)
    6464SET(PABLO_SRC ${PABLO_SRC} pablo/optimizers/pablo_automultiplexing.cpp)
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r4656 r4658  
    166166pablo/pe_xor.cpp
    167167pablo/pe_xor.h
    168 pablo/ps_assign.cpp
    169168pablo/ps_assign.h
    170169pablo/ps_if.h
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.cpp

    r4657 r4658  
    4141#endif
    4242
     43inline bool Simplifier::isSuperfluous(const Assign * const assign) {
     44    for (const PabloAST * inst : assign->users()) {
     45        if (isa<Next>(inst) || isa<PabloFunction>(inst) || isa<If>(inst)) {
     46            return false;
     47        }
     48    }
     49    return true;
     50}
     51
    4352void Simplifier::eliminateRedundantCode(PabloBlock & block, ExpressionTable * predecessor) {
    4453    ExpressionTable encountered(predecessor);
     
    5463            // If we have an Assign whose users do not contain an If or Next node, we can replace its users with
    5564            // the Assign's expression directly.
    56             if (assign->superfluous()) {
    57                 if (stmt->getNumUses() == 0) {
     65            if (isSuperfluous(assign)) {
     66                if (assign->getNumUses() == 0) {
    5867                    stmt = assign->eraseFromParent();
    5968                }
     
    6776            // Check to see if the Cond is Zero and delete the loop.
    6877            if (LLVM_UNLIKELY(isa<Zeroes>(ifNode->getCondition()))) {
    69                 for (PabloAST * defVar : ifNode->getDefined()) {
    70                     cast<Assign>(defVar)->replaceWith(block.createZeroes(), false, true);
     78                for (Assign * defVar : ifNode->getDefined()) {
     79                    defVar->replaceWith(block.createZeroes(), false, true);
    7180                }
    7281                stmt = stmt->eraseFromParent(true);
     
    174183        }
    175184        else if (stmt->getNumUses() == 0){
    176             assert ("Any Assign passed to this function ought to have users or be an output var!" && (!isa<Assign>(stmt) || cast<Assign>(stmt)->isOutputAssignment()));
    177             if (!isa<Assign>(stmt)) {
    178                 stmt = stmt->eraseFromParent(true);
    179                 continue;
    180             }
     185            stmt = stmt->eraseFromParent(true);
     186            continue;
    181187        }
    182188        stmt = stmt->getNextNode();
    183189    }
    184     block.setInsertPoint(block.back());
    185190}
    186191
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_simplifier.hpp

    r4657 r4658  
    1818    static void deadCodeElimination(PabloBlock & block);
    1919    static void eliminateRedundantComplexStatements(PabloBlock & block);
     20    static bool isSuperfluous(const Assign * const assign);
    2021private:
    2122
  • icGREP/icgrep-devel/icgrep/pablo/ps_assign.h

    r4657 r4658  
    3131        return setOperand(0, value);
    3232    }
    33     bool superfluous() const;
    3433protected:
    3534    explicit Assign(PabloAST * expr, String * name)
Note: See TracChangeset for help on using the changeset viewer.