コード例 #1
0
void SolveFeedbackVariablesPass3::SetupAnnotations(VariableSymbol* toAnnote,
						   VariableSymbol* source,
						   VariableSymbol* destination)
{

  // Clean up any annotation that previously existed
  if (toAnnote->lookup_annote_by_name("FeedbackVariable") != NULL)
  {
    // Do I need to remove the bricks associated with this as well, or
    //  does the destructor handle that?
    delete toAnnote->remove_annote_by_name("FeedbackVariable") ;
  }

  // Now create the annotation we will use
  BrickAnnote* feedbackAnnote = 
    to<BrickAnnote>(create_brick_annote(theEnv, "FeedbackVariable")) ;

  // Create the bricks and add them to the annotation
  feedbackAnnote->append_brick(create_suif_object_brick(theEnv, destination)) ;
  feedbackAnnote->append_brick(create_suif_object_brick(theEnv, source)) ;

  // And finally attach the annotation to the variable
  toAnnote->append_annote(feedbackAnnote) ;  
  
  // Mark this as non systolic if appropriate
  if (!isSystolic)
  {
    toAnnote->append_annote(create_brick_annote(theEnv,"NonSystolic")) ;
  }
}
コード例 #2
0
Walker::ApplyStatus hsbm_call_statement_walker::operator () (SuifObject *x) {
	SuifEnv *env = get_env();
	CallStatement *call_stmt = to<CallStatement>(x);

	SymbolAddressExpression *callee_address = to<SymbolAddressExpression>(call_stmt->get_callee_address());
	ProcedureSymbol *proc_symbol = to<ProcedureSymbol>(callee_address->get_addressed_symbol());
	String called_proc_name = proc_symbol->get_name();

	MarkStatement *mark_stmt = NULL;

        ProcedureDefinition* proc_def = get_procedure_definition(call_stmt);
           
	if(called_proc_name == String("begin_hw")){
	   mark_stmt = create_mark_statement(env);
           BrickAnnote *ba = to<BrickAnnote>(proc_def->lookup_annote_by_name("begin_hw"));
	   ba->append_brick(create_suif_object_brick(env, mark_stmt));
	}else if(called_proc_name == String("end_hw")){
	   mark_stmt = create_mark_statement(env);
           BrickAnnote *ba = to<BrickAnnote>(proc_def->lookup_annote_by_name("end_hw"));
	   ba->append_brick(create_suif_object_brick(env, mark_stmt));
	}

	if(mark_stmt){
	   call_stmt->get_parent()->replace(call_stmt, mark_stmt);
	   set_address(mark_stmt);
    	   return Walker::Replaced;
	}

        return Walker::Continue;
}
コード例 #3
0
void MarkRedundantPass::do_procedure_definition(ProcedureDefinition* proc_def)
{
  procDef = proc_def ;
  assert(procDef != NULL) ;

  OutputInformation("Marking a redundant label") ;
  list<LabelLocationStatement*>* allLabels = 
    collect_objects<LabelLocationStatement>(procDef->get_body()) ;
  
  list<LabelLocationStatement*>::iterator labelIter = allLabels->begin() ;
  while (labelIter != allLabels->end())
  {
    if ((*labelIter)->get_defined_label()->get_name() == redundantLabel)
    {
      BrickAnnote* labelBrick = create_brick_annote(theEnv, "Redundant") ;
      IntegerBrick* doubleBrick = 
	create_integer_brick(theEnv, IInteger(doubleOrTriple)) ;
      labelBrick->append_brick(doubleBrick) ;
      (*labelIter)->append_annote(labelBrick) ;
    }
    ++labelIter ;
  }

  delete allLabels ;
  OutputInformation("Done marking a redundant label") ;
}
コード例 #4
0
Walker::ApplyStatus mdbm_c_for_statement_walker::operator () (SuifObject *x) {
    SuifEnv *env = get_env();
    CForStatement *c_for_stmt = to<CForStatement>(x);
                
    //    if(!is_stmt_within_begin_end_hw_marks(c_for_stmt))
    //   return Walker::Continue;

    Statement *body = c_for_stmt->get_body();
             
    if (body){

        Iter<CForStatement> iter_c_for = object_iterator<CForStatement>(body);
        if(iter_c_for.is_valid())
           return Walker::Continue;
             
	StatementList *stmt_list_body = NULL;

	if(is_a<StatementList>(body))
           stmt_list_body = to<StatementList>(body); 
	else{
           stmt_list_body = create_statement_list(env);
	   c_for_stmt->set_body(0);
	   stmt_list_body->append_statement(body);
	   c_for_stmt->set_body(stmt_list_body);
        }

        Iter<Statement*> iter = stmt_list_body->get_statement_iterator();
        for( ; iter.is_valid(); iter.next()){
            Statement *child_stmt = iter.current();
            if(is_a<StoreVariableStatement>(child_stmt)){
               Iter<LoadExpression> iter2 = object_iterator<LoadExpression>(child_stmt);
               if(!iter2.is_valid())
                  break;
            }else break;
        }

        MarkStatement *end_of_mem_reads_mark = create_mark_statement(env);
	if(iter.is_valid())
           insert_statement_before(iter.current(), end_of_mem_reads_mark);
        else
           stmt_list_body->insert_statement(0, end_of_mem_reads_mark);
        BrickAnnote *ba = create_brick_annote(env, "end_of_mem_reads");
        ba->append_brick(create_suif_object_brick(env, end_of_mem_reads_mark));
        c_for_stmt->append_annote(ba);
  
        for( ; iter.is_valid(); iter.next()){
            Statement *child_stmt = iter.current();
            if(is_a<StoreStatement>(child_stmt))
               break;
        }

        MarkStatement *beg_of_mem_writes_mark = create_mark_statement(env);
	if(iter.is_valid())
           insert_statement_before(iter.current(), beg_of_mem_writes_mark);
        else
           stmt_list_body->append_statement(beg_of_mem_writes_mark);
        ba = create_brick_annote(env, "beg_of_mem_writes");
        ba->append_brick(create_suif_object_brick(env, beg_of_mem_writes_mark));
        c_for_stmt->append_annote(ba);
    }        
    
    return Walker::Continue;
}