예제 #1
0
bool ValidateLimitations::visitUnary(Visit, TIntermUnary *node)
{
    // Check if loop index is modified in the loop body.
    validateOperation(node, node->getOperand());

    return true;
}
예제 #2
0
void FreeFormatReader::parse(string line) {
    autalities::dos2unix(line);
    smatch sm;
    if (regex_match(line, sm, FREEFORMAT_REGEX0)) {
        label = sm[2];
        operation = sm[3];
    } else if (regex_match(line, sm, FREEFORMAT_REGEX1)) {
        label = sm[2];
        operation = sm[3];
        operand = sm[4];
        autalities::removeTrailingSpaces(operand);
        operand = autalities::removeLeadingSpaces(operand);
    } else {
        valid = false;
        addToErrorMessage("can not match line with any valid format");
    }
    OpTable *opTable = new OpTable();
    DirectivseTable *dir = new DirectivseTable();
    label = autalities::tolow(label);
    if (opTable->hasOperation(label) || dir->contains(label)) {
        if (operand.empty()) {
            operand = operation;
        } else if (!operation.empty()) {
            operand = operation + " " + operand;
        }
        operation = label;
        label = "";
    }
    validateLabel();
    validateOperation();
    args = OperandValidator::getOperands(operand);
    cout << "\"" << label << "\", \"" << operation << "\", \"" << operand << "\"" << endl;
}
예제 #3
0
bool ValidateLimitations::visitBinary(Visit, TIntermBinary *node)
{
    // Check if loop index is modified in the loop body.
    validateOperation(node, node->getLeft());

    // Check indexing.
    switch (node->getOp())
    {
      case EOpIndexDirect:
      case EOpIndexIndirect:
        validateIndexing(node);
        break;
      default:
        break;
    }
    return true;
}
bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
{
    // Check if loop index is modified in the loop body.
    validateOperation(node, node->getLeft());

    // Check indexing.
    switch (node->getOp()) {
      case EOpIndexDirect:
        validateIndexing(node);
        break;
      case EOpIndexIndirect:
#if defined(__APPLE__)
        // Loop unrolling is a work-around for a Mac Cg compiler bug where it
        // crashes when a sampler array's index is also the loop index.
        // Once Apple fixes this bug, we should remove the code in this CL.
        // See http://codereview.appspot.com/4331048/.
        if ((node->getLeft() != NULL) && (node->getRight() != NULL) &&
            (node->getLeft()->getAsSymbolNode())) {
            TIntermSymbol* symbol = node->getLeft()->getAsSymbolNode();
            if (IsSampler(symbol->getBasicType()) && symbol->isArray()) {
                ValidateLoopIndexExpr validate(mLoopStack);
                node->getRight()->traverse(&validate);
                if (validate.usesFloatLoopIndex()) {
                    error(node->getLine(),
                          "sampler array index is float loop index",
                          "for");
                }
            }
        }
#endif
        validateIndexing(node);
        break;
      default: break;
    }
    return true;
}