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


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

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


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

示例1: CollectInitializations

void ConstantArrayPropagationPass::CollectInitializations()
{
  if (!initializations.empty())
  {
    initializations.clear() ;
  }

  DefinitionBlock* procDefBlock = procDef->get_definition_block() ;
  assert(procDefBlock != NULL) ;
  Iter<VariableDefinition*> varDefIter = 
    procDefBlock->get_variable_definition_iterator() ;
  while (varDefIter.is_valid())
  {    
    VariableDefinition* varDef = varDefIter.current() ;
    assert(varDef != NULL) ;

    VariableSymbol* varSym = varDef->get_variable_symbol() ;
    ValueBlock* valBlock = varDef->get_initialization() ;
    assert(varSym != NULL) ;
    assert(valBlock != NULL) ;

    if (ValidSymbol(varSym)) 
    {
      initializations[varSym] = valBlock ;
      varSym->append_annote(create_brick_annote(theEnv, "ConstPropArray")) ;
    }

    varDefIter.next() ;
  }
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:30,代码来源:constantArrayPropagationPass.cpp

示例2: assert

// This is a vastly simpler way to setup annotations that doesn't worry
//  or assume that all feedbacks come from a single store variable statement
void SolveFeedbackVariablesPass3::SetupAnnotations()
{
  assert(theEnv != NULL) ;
  // Go through the list of all feedback instances we have discovered.
  list<PossibleFeedbackPair>::iterator feedbackIter = actualFeedbacks.begin();
  while (feedbackIter != actualFeedbacks.end())
  {
    // For every feedback, we need to create a two variables
    //  The first one is a replacement for the original use.
    //  The second one is the variable used for feedback.

    LString replacementName = (*feedbackIter).varSym->get_name() ;
    replacementName = replacementName + "_replacementTmp" ;

    VariableSymbol* replacementVariable = 
      create_variable_symbol(theEnv,
			     (*feedbackIter).varSym->get_type(),
			     TempName(replacementName)) ;
    procDef->get_symbol_table()->append_symbol_table_object(replacementVariable);

    VariableSymbol* feedbackVariable =
	create_variable_symbol(theEnv,
			       (*feedbackIter).varSym->get_type(),
			       TempName(LString("feedbackTmp"))) ;
    procDef->get_symbol_table()->append_symbol_table_object(feedbackVariable) ;
    
    // Replace the use with this new feedback variable
    (*feedbackIter).use->set_source(replacementVariable) ;

    // I am looking for the variable that originally defined me and 
    //  the variable that will replace me.
    Statement* definition = (*feedbackIter).definition ;
    VariableSymbol* definitionVariable = 
      GetDefinedVariable(definition, (*feedbackIter).definitionLocation) ;
    assert(definitionVariable != NULL) ;

    // Finally, annotate the feedback variable
    SetupAnnotations(feedbackVariable,		     
		     definitionVariable,
		     replacementVariable) ;
    
    replacementVariable->append_annote(create_brick_annote(theEnv,
							   "NonInputScalar"));

    ++feedbackIter ;
  }  
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:49,代码来源:solve_feedback_variables_pass_2.0_new.cpp

示例3: ProcessCall

void CleanupRedundantVotes::ProcessCall(CallStatement* c)
{
  assert(c != NULL) ;
  
  SymbolAddressExpression* symAddress = 
    dynamic_cast<SymbolAddressExpression*>(c->get_callee_address()) ;
  assert(symAddress != NULL) ;
  
  Symbol* sym = symAddress->get_addressed_symbol() ;
  assert(sym != NULL) ;

  if (sym->get_name() == LString("ROCCCTripleVote") || 
      sym->get_name() == LString("ROCCCDoubleVote") )
  {
    LoadVariableExpression* errorVariableExpression = 
      dynamic_cast<LoadVariableExpression*>(c->get_argument(0)) ;
    assert(errorVariableExpression != NULL) ;
    VariableSymbol* currentError = errorVariableExpression->get_source() ;
    assert(currentError != NULL) ;
    if (InList(currentError))
    {
      // Create a new variable
      VariableSymbol* errorDupe = 
	create_variable_symbol(theEnv,
			       currentError->get_type(),
			       TempName(LString("UnrolledRedundantError"))) ;
      errorDupe->append_annote(create_brick_annote(theEnv, "DebugRegister")) ;
      procDef->get_symbol_table()->append_symbol_table_object(errorDupe) ;
      usedVariables.push_back(errorDupe) ;
      errorVariableExpression->set_source(errorDupe) ;
    }
    else
    {
      usedVariables.push_back(currentError) ;
    }
  }

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

示例4: if

void ScalarReplacementPass2::CollectArrayReferences()
{
  assert(procDef != NULL) ;
  list<ArrayReferenceExpression*>* allRefs = 
    collect_objects<ArrayReferenceExpression>(procDef->get_body()) ;
  list<ArrayReferenceExpression*>::iterator refIter = allRefs->begin() ;
  while (refIter != allRefs->end())
  {
    // If this is not the topmost array reference, skip it.
    if (dynamic_cast<ArrayReferenceExpression*>((*refIter)->get_parent()) !=
	NULL)
    {
      ++refIter ;
      continue ;
    }
    
    // Also, skip lookup tables
    if (IsLookupTable(GetArrayVariable(*refIter)))
    {
      ++refIter ;
      continue ;
    }

    bool found = false ;
    std::pair<Expression*, VariableSymbol*> toAdd ;
    list<std::pair<Expression*, VariableSymbol*> >::iterator identIter = 
      Identified.begin() ;
    while (identIter != Identified.end())
    {
      if (EquivalentExpressions((*identIter).first, *refIter))
      {
	found = true ;
	toAdd = (*identIter) ;
	break ;
      }
      ++identIter ;
    }

    if (!found)
    {
      VariableSymbol* replacement =
	create_variable_symbol(theEnv, 
			       GetQualifiedTypeOfElement(*refIter),
			       TempName(LString("suifTmp"))) ;	
      replacement->append_annote(create_brick_annote(theEnv, 
						  "ScalarReplacedVariable")) ;
      procDef->get_symbol_table()->append_symbol_table_object(replacement) ;

      toAdd.first = (*refIter) ;
      toAdd.second = replacement ;
      Identified.push_back(toAdd) ;
    }
    if (dynamic_cast<LoadExpression*>((*refIter)->get_parent()) != NULL)
    {
      found = false ;
      identIter = IdentifiedLoads.begin() ;
      while (identIter != IdentifiedLoads.end())
      {
	if (EquivalentExpressions((*identIter).first, *refIter))
	  {
	    found = true ;
	    break ;
	  }
	++identIter ;
      }
      if (!found)
      {
	IdentifiedLoads.push_back(toAdd) ;
      }      
    }
    else if (dynamic_cast<StoreStatement*>((*refIter)->get_parent()) != NULL)
    {
      found = false ;
      identIter = IdentifiedStores.begin() ;
      while (identIter != IdentifiedStores.end())
      {
	if (EquivalentExpressions((*identIter).first, *refIter))
	{
	  found = true ;
	  break ;
	}
	++identIter ;
      }
      if (!found)
      {
	IdentifiedStores.push_back(toAdd) ;
      }
    }
    else 
    {
      assert(0 && "Improperly formatted array reference!") ;
    }  
    ++refIter ;
  }
  delete allRefs ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:96,代码来源:scalar_replacement_pass2.cpp

示例5: HandleFeedback

void TransformSystemsToModules::HandleFeedback() 
{
  assert(procDef != NULL) ;

  list<VariableSymbol*> toReplace ;

  // This function needs to find all variables that are both input and 
  //  output scalars (they used to be feedbacks, but now there is no loop)

  SymbolTable* procSymTab = procDef->get_symbol_table() ;
  for (int i = 0 ; i < procSymTab->get_symbol_table_object_count() ; ++i)
  {
    SymbolTableObject* nextObject = procSymTab->get_symbol_table_object(i) ;
    if (nextObject->lookup_annote_by_name("InputScalar") != NULL &&
	nextObject->lookup_annote_by_name("OutputVariable") != NULL)
    {
      VariableSymbol* var = dynamic_cast<VariableSymbol*>(nextObject) ;
      assert(var != NULL) ;
      toReplace.push_back(var) ;
    }
  }

  // Now, go through all of the different values that need to be replaced and
  //  find all of the uses and definitions and replace them...

  list<VariableSymbol*>::iterator replaceIter = toReplace.begin() ;
  while (replaceIter != toReplace.end())
  {
    LString inputName = (*replaceIter)->get_name() ;
    inputName = inputName + LString("_in") ;

    LString outputName = (*replaceIter)->get_name() ;
    outputName = outputName + LString("_out") ;

    // Create two variables, one for input and one for output
    VariableSymbol* inputReplacement = 
      create_variable_symbol(theEnv,
			     (*replaceIter)->get_type(),
			     inputName) ;
    VariableSymbol* outputReplacement = 
      create_variable_symbol(theEnv,
			     (*replaceIter)->get_type(),
			     outputName) ;
    procDef->get_symbol_table()->append_symbol_table_object(inputReplacement) ;
    procDef->get_symbol_table()->append_symbol_table_object(outputReplacement);

    inputReplacement->append_annote(create_brick_annote(theEnv,
							"InputScalar")) ;
    outputReplacement->append_annote(create_brick_annote(theEnv,
							 "OutputVariable")) ;

    // Find all uses before the first definition and replace them with the
    //  input variable.
    ReplaceUses((*replaceIter), inputReplacement) ;

    // Find the last definition and replace it with the output variable.
    ReplaceDefinition((*replaceIter), outputReplacement)  ;

    // Remove the annotes that started the whole thing
    delete (*replaceIter)->remove_annote_by_name("InputScalar") ;
    delete (*replaceIter)->remove_annote_by_name("OutputVariable") ;

    ++replaceIter ;
  }

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


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