Logo Search packages:      
Sourcecode: fauhdlc version File versions

void ast::GenCode::setArgByDriver ( intermediate::Reference callee,
const std::list< Driver * > &  drivers,
ValDeclaration vd,
AssociationElement element,
const char *  foreign,
bool  usePointer 
) [private]

set an argument by passing the base pointer to the driver. (pointer to driver pointer) used for

  • signal (inout, out) (composite [usePointer=true])
  • signal (inout, out) (non-composite [usePointer=false])

For a signal parameter of mode inout, the actual part will be visited twice!

Definition at line 2318 of file GenCode.cpp.

References ast::AstNode::accept(), ast::AssociationElement::actual, intermediate::CodeContainer::addCode(), intermediate::Node::annotate(), ast::Expression::baseType, container, ast::AssociationElement::formal, ast::RegisterSet::getDestination(), ast::RegisterSet::getPointer(), isTarget, and sourceRegs.

Referenced by setArg().

{
      assert(element.formal == NULL);
      // need a driver
      this->isTarget = true;
      element.actual->accept(*this);
      this->isTarget = false;

      std::string name;
      bool found = false;

      for (std::list<Driver *>::const_iterator i = drivers.begin();
            i != drivers.end(); i++) {
            
            if (&(*i)->signal == &vd) {
                  if (foreign != NULL) {
                        name = (*i)->getForeignName();
                  } else {
                        name = (*i)->getICName();
                  }
                  found = true;
                  break;
            }
      }

      assert(found);

      Reference *formal = new Reference(name);
      Operand *drv;
      if (usePointer) {
            drv = this->sourceRegs.getPointer();
      } else {
            drv = this->sourceRegs.getDestination(
                              element.actual->baseType);
      }
      SetParam *sp = new SetParam(drv, callee, formal);
      this->container->addCode(sp);
      if (foreign != NULL) {
            sp->annotate("foreign", foreign);
      }
}


Generated by  Doxygen 1.6.0   Back to index