source: icGREP/icgrep-devel/icgrep/pablo/pe_not.cpp @ 4416

Last change on this file since 4416 was 4416, checked in by nmedfort, 5 years ago

Many use def info changes; removed dependency on boost system library. More work still needed on CSE.

File size: 817 bytes
Line 
1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include <pablo/pe_not.h>
8#include <pablo/codegenstate.h>
9#include <pablo/pe_ones.h>
10#include <pablo/pe_zeroes.h>
11
12namespace pablo {
13
14Not::Not(PabloAST * expr, PabloBlock * parent)
15: Statement(ClassTypeId::Not, {expr}, parent->makeName("not"), parent)
16{
17
18}
19
20PabloAST * OptimizeNot::operator ()(PabloAST * expr, PabloBlock * pb) {
21
22    assert (expr && pb);
23
24    if (isa<Ones>(expr)) {
25        return pb->createZeroes();
26    }
27    else if (isa<Zeroes>(expr)){
28        return pb->createOnes();
29    }
30    else if (Not * not1 = dyn_cast<Not>(expr)) {
31        return not1->getExpr();
32    }
33    return pb->createNotImm(expr);
34}
35
36}
Note: See TracBrowser for help on using the repository browser.