Ignore:
Timestamp:
Sep 30, 2014, 2:44:40 PM (5 years ago)
Author:
nmedfort
Message:

Replaced dynamic_cast with llvm::dyn_cast in pablo code; implemented make functions for pablo constructors. Disabled RTTI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/printer_pablos.cpp

    r4199 r4200  
    7474    std::string retVal = "";
    7575
    76     if (const Assign * an = dynamic_cast<const Assign*>(stmt))
     76    if (const Assign * an = dyn_cast<const Assign>(stmt))
    7777    {
    7878        retVal = "Assign('" + an->getM() + "', " + ShowPabloE(an->getExpr()) + "),";
    7979    }
    80     else if (const If * ifstmt = dynamic_cast<const If *>(stmt))
     80    else if (const If * ifstmt = dyn_cast<const If>(stmt))
    8181    {
    8282        retVal = "If(" + ShowPabloE(ifstmt->getExpr()) + ", " + Print_PB_PabloStmts(ifstmt->getPSList(), retVal) + ")";
    8383    }
    84     else if (const While * whl = dynamic_cast<const While *>(stmt))
     84    else if (const While * whl = dyn_cast<const While>(stmt))
    8585    {
    8686        retVal = "While(" + ShowPabloE(whl->getExpr()) + ", " + Print_PB_PabloStmts(whl->getPSList(), retVal) + ")";
     
    9494    std::string retVal = "";
    9595
    96     if (const All * all = dynamic_cast<const All*>(expr))
     96    if (const All * all = dyn_cast<const All>(expr))
    9797    {
    9898        retVal = "All " + std::to_string(all->getValue()) + " ";
    9999    }
    100     else if (const Call * pablo_call = dynamic_cast<const Call*>(expr))
     100    else if (const Call * pablo_call = dyn_cast<const Call>(expr))
    101101    {
    102102        retVal = "Call '" + pablo_call->getCallee() + "'";
    103103    }
    104     else if (const Var * pablo_var = dynamic_cast<const Var*>(expr))
     104    else if (const Var * pablo_var = dyn_cast<const Var>(expr))
    105105    {
    106106        retVal = "Var '" + pablo_var->getVar() + "' ";
    107107    }
    108     else if (const And * pablo_and = dynamic_cast<const And*>(expr))
     108    else if (const And * pablo_and = dyn_cast<const And>(expr))
    109109    {
    110110        retVal = "And(" + ShowPabloE(pablo_and->getExpr1()) +", " + ShowPabloE(pablo_and->getExpr2()) + ")";
    111111    }
    112     else if (const Or * pablo_or = dynamic_cast<const Or*>(expr))
     112    else if (const Or * pablo_or = dyn_cast<const Or>(expr))
    113113    {
    114114        retVal = "Or(" + ShowPabloE(pablo_or->getExpr1()) + ", " + ShowPabloE(pablo_or->getExpr2()) + ")";
    115115    }
    116     else if (const Sel * pablo_sel = dynamic_cast<const Sel*>(expr))
     116    else if (const Sel * pablo_sel = dyn_cast<const Sel>(expr))
    117117    {
    118118        retVal = "((" + ShowPabloE(pablo_sel->getIf_expr()) + "And " + ShowPabloE(pablo_sel->getT_expr()) +
    119119                ")|(Not(" + ShowPabloE(pablo_sel->getIf_expr()) + ") And " + ShowPabloE(pablo_sel->getF_expr()) + ")";
    120120    }
    121     else if (const Not * pablo_not = dynamic_cast<const Not*>(expr))
     121    else if (const Not * pablo_not = dyn_cast<const Not>(expr))
    122122    {
    123123        retVal = "Not (" + ShowPabloE(pablo_not->getExpr()) + ")";
    124124    }
    125     else if (const CharClass * cc = dynamic_cast<const CharClass*>(expr))
     125    else if (const CharClass * cc = dyn_cast<const CharClass>(expr))
    126126    {
    127127        retVal = "CharClass '" + cc->getCharClass() + "'";
    128128    }
    129     else if (const re::Name * name = dynamic_cast<const re::Name *>(expr))
    130     {
    131         retVal = "Name '" + name->getName() + "'";
    132     }
    133     else if (const Advance * adv = dynamic_cast<const Advance*>(expr))
     129    else if (const Advance * adv = dyn_cast<const Advance>(expr))
    134130    {
    135131        retVal = "Advance(" + ShowPabloE(adv->getExpr()) + ")";
    136132    }
    137     else if (const MatchStar * mstar = dynamic_cast<const MatchStar*>(expr))
     133    else if (const MatchStar * mstar = dyn_cast<const MatchStar>(expr))
    138134    {
    139135        retVal = "MatchStar (" + ShowPabloE(mstar->getExpr1()) + ", " + ShowPabloE(mstar->getExpr2()) + ")";
    140136    }
    141     else if (const ScanThru * sthru = dynamic_cast<const ScanThru*>(expr))
     137    else if (const ScanThru * sthru = dyn_cast<const ScanThru>(expr))
    142138    {
    143139        retVal = "ScanThru (" + ShowPabloE(sthru->getScanFrom()) + ", " + ShowPabloE(sthru->getScanThru()) + ")";
Note: See TracChangeset for help on using the changeset viewer.