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

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

Changes to support 3-operand form for all instructions. CSE disabled but partially redundant now.

File size: 765 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, parent->makeName("not"), parent)
15, mExpr(expr) {
16    expr->addUser(this);
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 * pe_not = dyn_cast<Not>(expr)) {
27        return pe_not->getExpr();
28    }
29    return pb->createNotImm(expr);
30}
31
32}
Note: See TracBrowser for help on using the repository browser.