# Path: soap/datatype.py
# class TypeBase(object):
# class AutoType(TypeBase):
# class BoolType(TypeBase):
# class IntType(TypeBase):
# class FloatingPointType(TypeBase):
# class FloatType(FloatingPointType):
# class DoubleType(FloatingPointType):
# class FunctionType(TypeBase):
# class ArrayType(TypeBase):
# class IntegerArrayType(ArrayType):
# class FloatArrayType(ArrayType):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self, shape):
#     def __str__(self):
#     def __eq__(self, other):
#     def __hash__(self):
# def type_of(value):
# def type_cast(dtype, value=None, top=False, bottom=False):
# 
# Path: soap/context/default.py

# 
# Path: soap/expression/operators.py
# ADD_OP = '+'
# SUBTRACT_OP = '-'
# UNARY_SUBTRACT_OP = '_'
# MULTIPLY_OP = '*'
# DIVIDE_OP = '/'
# EXPONENTIATE_OP = 'exp'
# EQUAL_OP = '=='
# NOT_EQUAL_OP = '!='
# GREATER_OP = '>'
# GREATER_EQUAL_OP = '>='
# LESS_OP = '<'
# LESS_EQUAL_OP = '<='
# UNARY_NEGATION_OP = '!'
# AND_OP = '&&'
# OR_OP = '||'
# VARIABLE_OP = 'v'
# EXTERNAL_OP = 'extern'
# TERNARY_SELECT_OP = '?'
# FIXPOINT_OP = 'fix'
# FOR_OP = 'for'
# STATE_GETTER_OP = '()'
# BARRIER_OP = ','
# INDEX_ACCESS_OP = 'access'
# INDEX_UPDATE_OP = 'update'
# SUBSCRIPT_OP = 'subscript'
# ARITHMETIC_OPERATORS = [
#     ADD_OP, SUBTRACT_OP, UNARY_SUBTRACT_OP, MULTIPLY_OP, DIVIDE_OP,
#     EXPONENTIATE_OP, TERNARY_SELECT_OP, FIXPOINT_OP, FOR_OP, BARRIER_OP,
# ]
# COMPARISON_OPERATORS = [
#     EQUAL_OP, NOT_EQUAL_OP, GREATER_OP, LESS_OP, GREATER_EQUAL_OP,
#     LESS_EQUAL_OP,
# ]
# BOOLEAN_OPERATORS = COMPARISON_OPERATORS + [
#     UNARY_NEGATION_OP, AND_OP, OR_OP
# ]
# TRADITIONAL_OPERATORS = [
#     ADD_OP, SUBTRACT_OP, UNARY_SUBTRACT_OP, MULTIPLY_OP, DIVIDE_OP,
#     EQUAL_OP, NOT_EQUAL_OP, GREATER_OP, LESS_OP, GREATER_EQUAL_OP,
#     LESS_EQUAL_OP, UNARY_NEGATION_OP, AND_OP, OR_OP
# ]
# SPECIAL_OPERATORS = [
#     TERNARY_SELECT_OP, FIXPOINT_OP
# ]
# OPERATORS = BOOLEAN_OPERATORS + ARITHMETIC_OPERATORS + SPECIAL_OPERATORS
# UNARY_OPERATORS = [UNARY_SUBTRACT_OP, UNARY_NEGATION_OP]
# BINARY_OPERATORS = list(set(OPERATORS) - set(UNARY_OPERATORS))
# ASSOCIATIVITY_OPERATORS = [ADD_OP, MULTIPLY_OP, EQUAL_OP, AND_OP, OR_OP]
# COMMUTATIVITY_OPERATORS = ASSOCIATIVITY_OPERATORS
# COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS = [(MULTIPLY_OP, ADD_OP)]
# LEFT_DISTRIBUTIVITY_OPERATOR_PAIRS = \
#     COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS
# RIGHT_DISTRIBUTIVITY_OPERATOR_PAIRS = \
#     COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS
# LEFT_DISTRIBUTIVITY_OPERATORS, LEFT_DISTRIBUTION_OVER_OPERATORS = \
#     list(zip(*LEFT_DISTRIBUTIVITY_OPERATOR_PAIRS))
# RIGHT_DISTRIBUTIVITY_OPERATORS, RIGHT_DISTRIBUTION_OVER_OPERATORS = \
#     list(zip(*RIGHT_DISTRIBUTIVITY_OPERATOR_PAIRS))
# COMPARISON_NEGATE_DICT = {
#     LESS_OP: GREATER_EQUAL_OP,
#     LESS_EQUAL_OP: GREATER_OP,
#     GREATER_OP: LESS_EQUAL_OP,
#     GREATER_EQUAL_OP: LESS_OP,
#     EQUAL_OP: NOT_EQUAL_OP,
#     NOT_EQUAL_OP: EQUAL_OP,
# }
# COMPARISON_MIRROR_DICT = {
#     LESS_OP: GREATER_OP,
#     LESS_EQUAL_OP: GREATER_EQUAL_OP,
#     GREATER_OP: LESS_OP,
#     GREATER_EQUAL_OP: LESS_EQUAL_OP,
#     EQUAL_OP: EQUAL_OP,
#     NOT_EQUAL_OP: NOT_EQUAL_OP,
# }


from collections import namedtuple
from soap.datatype import int_type, float_type, ArrayType
from soap.context import context
from soap.expression import operators
            'comparison': 3,
            'boolean': 0,
            'conversion': 8,
            operators.UNARY_SUBTRACT_OP: 0,
            operators.ADD_OP: 10,
            operators.SUBTRACT_OP: 10,
            operators.MULTIPLY_OP: 7,
            operators.DIVIDE_OP: 30,
            operators.EXPONENTIATE_OP: 20,
            operators.TERNARY_SELECT_OP: 0,
            operators.INDEX_ACCESS_OP: 2,
        },
        ArrayType: {
            operators.TERNARY_SELECT_OP: 0,
            operators.INDEX_UPDATE_OP: 1,
            operators.SUBSCRIPT_OP: 0,
        },
    },
}


NONPIPELINED_OPERATORS = {
    operators.FIXPOINT_OP,
}
PIPELINED_OPERATORS = set(operators.OPERATORS) - NONPIPELINED_OPERATORS
MAX_SHARE_COUNT = 128
MULTIPLEXER_SIZE_PER_INPUT = 10
SHARED_DATATYPE_OPERATORS = {
    (float_type, 'conversion'),
    (float_type, 'comparison'),

# Path: soap/datatype.py
# class TypeBase(object):
# class AutoType(TypeBase):
# class BoolType(TypeBase):
# class IntType(TypeBase):
# class FloatingPointType(TypeBase):
# class FloatType(FloatingPointType):
# class DoubleType(FloatingPointType):
# class FunctionType(TypeBase):
# class ArrayType(TypeBase):
# class IntegerArrayType(ArrayType):
# class FloatArrayType(ArrayType):
#     def __repr__(self):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __init__(self, shape):
#     def __str__(self):
#     def __eq__(self, other):
#     def __hash__(self):
# def type_of(value):
# def type_cast(dtype, value=None, top=False, bottom=False):
# 
# Path: soap/context/default.py

# 
# Path: soap/expression/operators.py
# ADD_OP = '+'
# SUBTRACT_OP = '-'
# UNARY_SUBTRACT_OP = '_'
# MULTIPLY_OP = '*'
# DIVIDE_OP = '/'
# EXPONENTIATE_OP = 'exp'
# EQUAL_OP = '=='
# NOT_EQUAL_OP = '!='
# GREATER_OP = '>'
# GREATER_EQUAL_OP = '>='
# LESS_OP = '<'
# LESS_EQUAL_OP = '<='
# UNARY_NEGATION_OP = '!'
# AND_OP = '&&'
# OR_OP = '||'
# VARIABLE_OP = 'v'
# EXTERNAL_OP = 'extern'
# TERNARY_SELECT_OP = '?'
# FIXPOINT_OP = 'fix'
# FOR_OP = 'for'
# STATE_GETTER_OP = '()'
# BARRIER_OP = ','
# INDEX_ACCESS_OP = 'access'
# INDEX_UPDATE_OP = 'update'
# SUBSCRIPT_OP = 'subscript'
# ARITHMETIC_OPERATORS = [
#     ADD_OP, SUBTRACT_OP, UNARY_SUBTRACT_OP, MULTIPLY_OP, DIVIDE_OP,
#     EXPONENTIATE_OP, TERNARY_SELECT_OP, FIXPOINT_OP, FOR_OP, BARRIER_OP,
# ]
# COMPARISON_OPERATORS = [
#     EQUAL_OP, NOT_EQUAL_OP, GREATER_OP, LESS_OP, GREATER_EQUAL_OP,
#     LESS_EQUAL_OP,
# ]
# BOOLEAN_OPERATORS = COMPARISON_OPERATORS + [
#     UNARY_NEGATION_OP, AND_OP, OR_OP
# ]
# TRADITIONAL_OPERATORS = [
#     ADD_OP, SUBTRACT_OP, UNARY_SUBTRACT_OP, MULTIPLY_OP, DIVIDE_OP,
#     EQUAL_OP, NOT_EQUAL_OP, GREATER_OP, LESS_OP, GREATER_EQUAL_OP,
#     LESS_EQUAL_OP, UNARY_NEGATION_OP, AND_OP, OR_OP
# ]
# SPECIAL_OPERATORS = [
#     TERNARY_SELECT_OP, FIXPOINT_OP
# ]
# OPERATORS = BOOLEAN_OPERATORS + ARITHMETIC_OPERATORS + SPECIAL_OPERATORS
# UNARY_OPERATORS = [UNARY_SUBTRACT_OP, UNARY_NEGATION_OP]
# BINARY_OPERATORS = list(set(OPERATORS) - set(UNARY_OPERATORS))
# ASSOCIATIVITY_OPERATORS = [ADD_OP, MULTIPLY_OP, EQUAL_OP, AND_OP, OR_OP]
# COMMUTATIVITY_OPERATORS = ASSOCIATIVITY_OPERATORS
# COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS = [(MULTIPLY_OP, ADD_OP)]
# LEFT_DISTRIBUTIVITY_OPERATOR_PAIRS = \
#     COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS
# RIGHT_DISTRIBUTIVITY_OPERATOR_PAIRS = \
#     COMMUTATIVE_DISTRIBUTIVITY_OPERATOR_PAIRS
# LEFT_DISTRIBUTIVITY_OPERATORS, LEFT_DISTRIBUTION_OVER_OPERATORS = \
#     list(zip(*LEFT_DISTRIBUTIVITY_OPERATOR_PAIRS))
# RIGHT_DISTRIBUTIVITY_OPERATORS, RIGHT_DISTRIBUTION_OVER_OPERATORS = \
#     list(zip(*RIGHT_DISTRIBUTIVITY_OPERATOR_PAIRS))
# COMPARISON_NEGATE_DICT = {
#     LESS_OP: GREATER_EQUAL_OP,
#     LESS_EQUAL_OP: GREATER_OP,
#     GREATER_OP: LESS_EQUAL_OP,
#     GREATER_EQUAL_OP: LESS_OP,
#     EQUAL_OP: NOT_EQUAL_OP,
#     NOT_EQUAL_OP: EQUAL_OP,
# }
# COMPARISON_MIRROR_DICT = {
#     LESS_OP: GREATER_OP,
#     LESS_EQUAL_OP: GREATER_EQUAL_OP,
#     GREATER_OP: LESS_OP,
#     GREATER_EQUAL_OP: LESS_EQUAL_OP,
#     EQUAL_OP: EQUAL_OP,
#     NOT_EQUAL_OP: NOT_EQUAL_OP,
# }


# Path: soap/semantics/schedule/table.py
from collections import namedtuple
from soap.datatype import int_type, float_type, ArrayType
from soap.context import context
from soap.expression import operators

            'comparison': 3,
            'boolean': 0,
            'conversion': 8,
            operators.UNARY_SUBTRACT_OP: 0,
            operators.ADD_OP: 10,
            operators.SUBTRACT_OP: 10,
            operators.MULTIPLY_OP: 7,
            operators.DIVIDE_OP: 30,
            operators.EXPONENTIATE_OP: 20,
            operators.TERNARY_SELECT_OP: 0,
            operators.INDEX_ACCESS_OP: 2,
        },
        ArrayType: {
            operators.TERNARY_SELECT_OP: 0,
            operators.INDEX_UPDATE_OP: 1,
            operators.SUBSCRIPT_OP: 0,
        },
    },
}


NONPIPELINED_OPERATORS = {
    operators.FIXPOINT_OP,
}
PIPELINED_OPERATORS = set(operators.OPERATORS) - NONPIPELINED_OPERATORS
MAX_SHARE_COUNT = 128
MULTIPLEXER_SIZE_PER_INPUT = 10
SHARED_DATATYPE_OPERATORS = {
    (float_type, 'conversion'),
    (float_type, 'comparison'),

    (float_type, operators.ADD_OP),