当前位置: 首页>>代码示例>>C++>>正文


C++ VariableSymbol::lookup_annote_by_name方法代码示例

本文整理汇总了C++中VariableSymbol::lookup_annote_by_name方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableSymbol::lookup_annote_by_name方法的具体用法?C++ VariableSymbol::lookup_annote_by_name怎么用?C++ VariableSymbol::lookup_annote_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VariableSymbol的用法示例。


在下文中一共展示了VariableSymbol::lookup_annote_by_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_procedure_definition

void LUTDetectionPass::do_procedure_definition(ProcedureDefinition* p)
{
  procDef = p ;
  assert(procDef != NULL) ;
  OutputInformation("LUT Detection Pass begins") ;

  // LUTs can only exist in New Style Systems or Modules
  if (isLegacy(procDef))
  {    
    OutputInformation("Legacy code - No LUTs supported") ;
    return ;
  }    
  
  // LUTs are defined to be arrays that are not parameter symbols
  SymbolTable* symTab = procDef->get_symbol_table() ;
  for (int i = 0 ; i < symTab->get_symbol_table_object_count() ; ++i)
  {
    SymbolTableObject* currentObject = symTab->get_symbol_table_object(i) ;
    VariableSymbol* currentVar = 
      dynamic_cast<VariableSymbol*>(currentObject) ;
    ParameterSymbol* currentParam =
      dynamic_cast<ParameterSymbol*>(currentObject) ;
    if (currentVar != NULL &&
	dynamic_cast<ArrayType*>(currentVar->get_type()->get_base_type()) != NULL &&
	currentParam == NULL &&
	currentVar->lookup_annote_by_name("ConstPropArray") == NULL)
    {
      // Found one!  Let's mark it!
      currentObject->append_annote(create_brick_annote(theEnv, "LUT")) ;
    }
  }

  OutputInformation("LUT Detection Pass ends") ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:34,代码来源:lutDetectionPass.cpp

示例2: while

void CopyPropagationPass2::Initialize()
{
  // I don't want to delete any of the statements, but I must clear
  //  out the list I was using to contain the statements
  if (!toBeRemoved.empty())
  {
    while (toBeRemoved.begin() != toBeRemoved.end())
    {
      toBeRemoved.pop_front() ;
    }
  }

  assert(procDef != NULL) ;

  InitializeMap() ;

  // Also, collect all of the feedback variables for later
  
  SymbolTable* procSymTable = procDef->get_symbol_table() ;
  assert(procSymTable != NULL) ;

  for (int i = 0 ; i < procSymTable->get_symbol_table_object_count() ; ++i)
  {
    if(dynamic_cast<VariableSymbol*>(procSymTable->get_symbol_table_object(i)) != NULL)
    {
      VariableSymbol* nextSymbol = 
	dynamic_cast<VariableSymbol*>(procSymTable->get_symbol_table_object(i));
      if (nextSymbol->lookup_annote_by_name("FeedbackVariable") != NULL)
      {
	feedbackVariables.push_back(nextSymbol) ;
      }
    }
  }

}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:35,代码来源:copy_propagation_pass2.cpp

示例3: ConstructModuleSymbols

void ExportPass::ConstructModuleSymbols()
{
  CProcedureType* originalType = dynamic_cast<CProcedureType*>(originalProcedure->get_procedure_symbol()->get_type()) ;
  assert(originalType != NULL) ;

  // The original type takes and returns a struct.  We need to change this
  //  to a list of arguments.

  VoidType* newReturnType = create_void_type(theEnv, IInteger(0), 0) ;
  constructedType = create_c_procedure_type(theEnv,
					    newReturnType,
					    false, // has varargs
					    true, // arguments_known
					    0, // bit alignment
					    LString("ConstructedType")) ;

  StructType* returnType = 
    dynamic_cast<StructType*>(originalType->get_result_type()) ;
  assert(returnType != NULL) ;

  SymbolTable* structSymTab = returnType->get_group_symbol_table() ;
  assert(structSymTab != NULL) ;

  for (int i = 0 ; i < structSymTab->get_symbol_table_object_count() ; ++i)
  {
    VariableSymbol* nextVariable = 
      dynamic_cast<VariableSymbol*>(structSymTab->get_symbol_table_object(i));
    if (nextVariable != NULL)
    {
      // Check to see if this is an output or not
      QualifiedType* cloneType ;
      DataType* cloneBase = 
	dynamic_cast<DataType*>(nextVariable->get_type()->get_base_type()->deep_clone()) ;
      assert(cloneBase != NULL) ;
      cloneType = create_qualified_type(theEnv, cloneBase) ;
 
      if (nextVariable->lookup_annote_by_name("Output") != NULL)
      {
	cloneType->append_annote(create_brick_annote(theEnv, "Output")) ;
	// Why doesn't this stick around?
      }
      constructedType->append_argument(cloneType) ;
    }
  }

  constructedSymbol = create_procedure_symbol(theEnv,
					      constructedType,
					      originalProcedure->get_procedure_symbol()->get_name()) ;
  constructedSymbol->set_definition(NULL) ;

}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:51,代码来源:exportPass.cpp

示例4: TransformNDIntoNMinusOneD

void TransformUnrolledArraysPass::TransformNDIntoNMinusOneD(int N)
{
  // Get all unique N-dimensional arrays
  CollectArrays(N) ;

  // For every array access that has a constant as one of its offsets,
  //  we have to create a new array

  list<VariableSymbol*> arraysToRemove ;
  list<EquivalentReferences*>::iterator refIter = currentReferences.begin() ;
  while (refIter != currentReferences.end())
  {
    VariableSymbol* originalSymbol = GetArrayVariable((*refIter)->original) ;
    // Lookup tables should not be transformed
    if (originalSymbol->lookup_annote_by_name("LUT") == NULL)
    {
      bool replaced = ReplaceNDReference(*refIter) ;
      if (replaced)
      {
	if (!InList(arraysToRemove, originalSymbol))
	{
	  arraysToRemove.push_back(originalSymbol) ;
	}
      }
    }
    ++refIter ;
  }

  // Remove all of the arrays that need to be removed
  list<VariableSymbol*>::iterator arrayIter = arraysToRemove.begin() ;
  while (arrayIter != arraysToRemove.end())
  {
    procDef->get_symbol_table()->remove_symbol_table_object(*arrayIter) ;
    ++arrayIter ;
  }

}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:37,代码来源:transform_unrolled_arrays.cpp

示例5: ConstructSystemSymbols

void ExportPass::ConstructSystemSymbols()
{
  ProcedureSymbol* originalSymbol = originalProcedure->get_procedure_symbol() ;
  assert(originalSymbol != NULL) ;
  CProcedureType* originalType = 
    dynamic_cast<CProcedureType*>(originalSymbol->get_type()) ;
  assert(originalType != NULL) ;

  constructedType = create_c_procedure_type(theEnv,
    dynamic_cast<DataType*>(originalType->get_result_type()->deep_clone()),
					    false, // has variable arguments
					    false, // arguments known
					    0) ; // bit alignment

  // The system has been written in one of two ways, either the old
  //  way where there are no arguments, or the new way where everything
  //  is put into the arguments.
  
  if (originalType->get_argument_count() > 0)
  {
    for (int i = 0 ; i < originalType->get_argument_count() ; ++i)
    {
      QualifiedType* originalArgument = originalType->get_argument(i) ;
      DataType* originalBase = originalArgument->get_base_type() ;
      DataType* constructedBase = CloneDataType(originalBase) ;
      QualifiedType* constructedArgument = 
	create_qualified_type(theEnv, constructedBase) ;
      constructedType->append_argument(constructedArgument) ;

      // Go through the symbol table and find the parameter symbol 
      //  that matches the parameter number, and check to see if it
      //  is an output or not...
      SymbolTable* symTab = originalProcedure->get_symbol_table() ;
      ParameterSymbol* correspondingSymbol = NULL ;
      for (int j = 0 ; j < symTab->get_symbol_table_object_count() ; ++j)
      {
	ParameterSymbol* currentSym = 
	  dynamic_cast<ParameterSymbol*>(symTab->get_symbol_table_object(j)) ;
	if (currentSym != NULL)
	{
	  BrickAnnote* orderAnnote = dynamic_cast<BrickAnnote*>(currentSym->lookup_annote_by_name("ParameterOrder")) ;
	  assert(orderAnnote != NULL) ;
	  IntegerBrick* orderBrick = 
	    dynamic_cast<IntegerBrick*>(orderAnnote->get_brick(0)) ;
	  assert(orderBrick != NULL) ;
	  if (orderBrick->get_value().c_int() == i)
	  {
	    correspondingSymbol = currentSym ;
	    break ;
	  }
	}
      }
      if (correspondingSymbol != NULL)
      {
        if (correspondingSymbol->lookup_annote_by_name("OutputScalar") != NULL ||
	    correspondingSymbol->lookup_annote_by_name("OutputVariable") != NULL ||
	    correspondingSymbol->lookup_annote_by_name("OutputFifo") != NULL)
        {
	  constructedArgument->append_annote(create_brick_annote(theEnv,
								 "Output")) ;
        }
      }
      //      if (dynamic_cast<ReferenceType*>(originalBase) != NULL)
      //{
      //	constructedArgument->append_annote(create_brick_annote(theEnv,
      //						       "Output")) ;
      //      }
    }
  }
  else
  {   
    SymbolTable* symTab = originalProcedure->get_symbol_table() ;
    assert(symTab != NULL) ;
    list<VariableSymbol*> inputScalars ;
    list<VariableSymbol*> inputFifos ; 
    list<VariableSymbol*> outputScalars ;
    list<VariableSymbol*> outputFifos ;

    for (int i = 0 ; i < symTab->get_symbol_table_object_count() ; ++i)
    {
      VariableSymbol* currentVar = 
	dynamic_cast<VariableSymbol*>(symTab->get_symbol_table_object(i)) ;
      if (currentVar != NULL &&
	  currentVar->lookup_annote_by_name("InputScalar") != NULL &&
	  currentVar->lookup_annote_by_name("TemporalFeedback") == NULL &&
	  currentVar->lookup_annote_by_name("NormalFeedback") == NULL &&
	  currentVar->lookup_annote_by_name("DebugRegister") == NULL)
      {
	inputScalars.push_back(currentVar) ;
      }
      if (currentVar != NULL &&
	  currentVar->lookup_annote_by_name("InputFifo") != NULL)
      {
	inputFifos.push_back(currentVar) ;
      }
      if (currentVar != NULL &&
	  currentVar->lookup_annote_by_name("OutputVariable") != NULL &&
	  currentVar->lookup_annote_by_name("Dummy") == NULL &&
	  currentVar->lookup_annote_by_name("FeedbackSource") == NULL)
      {
//.........这里部分代码省略.........
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:101,代码来源:exportPass.cpp


注:本文中的VariableSymbol::lookup_annote_by_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。