Logo Search packages:      
Sourcecode: fauhdlc version File versions

void ast::GenCode::getConstraints ( const ValDeclaration vd  )  [private]

pickup the constraints for an unconstraint SimpleName

Definition at line 2465 of file GenCode.cpp.

References intermediate::CodeContainer::addCode(), container, ast::ResolveTypes::findBaseType(), ast::SymbolDeclaration::getICName(), intermediate::RegisterFactory::getRegister(), ast::UnconstrainedArrayType::numIndices, ast::RegisterSet::setUnconstraintBounds(), sourceRegs, ast::ValDeclaration::subtypeIndic, and util::MiscUtil::toString().

Referenced by visit().

{
      const UnconstrainedArrayType *ua = 
            dynamic_cast<const UnconstrainedArrayType *>(
                  ResolveTypes::findBaseType(node.subtypeIndic));
      assert(ua != NULL);

      std::string prefix = node.getICName();

      std::list<Operand *> lbs;
      std::list<Operand *> ubs;

      for (size_t dim = 0; dim < ua->numIndices; dim++) {
            std::string lname = prefix + "_lb_" 
                          + util::MiscUtil::toString(dim);
            std::string uname = prefix + "_ub_" 
                          + util::MiscUtil::toString(dim);

            Register *lb = RegisterFactory::getRegister(OP_TYPE_POINTER);
            Register *ub = RegisterFactory::getRegister(OP_TYPE_POINTER);

            Mov *lm = new Mov(new Reference(lname), lb);
            Mov *um = new Mov(new Reference(uname), ub);
            this->container->addCode(lm);
            this->container->addCode(um);

            IndirectOperand *lbv = 
                  new IndirectOperand(lb, OP_TYPE_INTEGER);
            IndirectOperand *ubv = 
                  new IndirectOperand(ub, OP_TYPE_INTEGER);

            lbs.push_back(lbv);
            ubs.push_back(ubv);
      }

      this->sourceRegs.setUnconstraintBounds(lbs, ubs);
}


Generated by  Doxygen 1.6.0   Back to index