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

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

Minor changes towards maintaining UseDef? information.

File size: 735 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
10
11namespace pablo {
12
13Not::Not(PabloAST * expr, PabloBlock * parent)
14: Statement(ClassTypeId::Not, {expr}, parent->makeName("not"), parent)
15{
16
17}
18
19PabloAST * OptimizeNot::operator ()(PabloAST * expr, PabloBlock * pb) {
20    if (isa<Ones>(expr)) {
21        return pb->createZeroes();
22    }
23    else if (isa<Zeroes>(expr)){
24        return pb->createOnes();
25    }
26    else if (Not * not1 = dyn_cast<Not>(expr)) {
27        return not1->getExpr();
28    }
29    return pb->createNotImm(expr);
30}
31
32}
Note: See TracBrowser for help on using the repository browser.