demo.cpp
/* To determnie whether a instruction is in a loop's constant subloop.
 */
To determnie whether a instruction is in a loop's constant subloop.
To determnie whether a instruction is in a loop ' s constant subloop .
bool Support::IsInsideConstantSubLoop(Loop * pLoop, set<loopinfo>* SkipLoopSet, Instruction *UI, Instruction *DI){
	bool isInsideSubloop = false;
	std::vector<Loop *> &subloopVect = pLoop->getSubLoopsVector();
	if (subloopVect.size() != 0) {
		for (std::vector<Loop *>::const_iterator SI = subloopVect.begin(); SI != subloopVect.end(); SI++) {
			(*SI)->print(errs());
			if (*SI != NULL) {
				loopinfo loop;
				string loop_label = (*SI)->getHeader()->getName();
				int num_loop = 0;
				sscanf(loop_label.c_str(),"loop_label:<%d>",&num_loop);
				loop.id = num_loop;
				loop.dep = (*SI)->getLoopDepth();
				if (SkipLoopSet->find(loop) != SkipLoopSet->end()) {
					if((*SI)->contains(UI) && (*SI)->contains(DI)){
						errs() << "isInsideSubloop\n";
						isInsideSubloop=true;
					}
				}
			}
		}
	}
	return isInsideSubloop;
}
bool Support :: IsInsideConstantSubLoop ( Loop * pLoop , set < loopinfo > * SkipLoopSet , Instruction * UI , Instruction * DI ) { bool isInsideSubloop = false ; std :: vector < Loop * > & subloopVect = pLoop -> getSubLoopsVector ( ) ; if ( subloopVect . size ( ) != 0 ) { for ( std :: vector < Loop * > :: const_iterator SI = subloopVect . begin ( ) ; SI != subloopVect . end ( ) ; SI ++ ) { ( * SI ) -> print ( errs ( ) ) ; if ( * SI != NULL ) { loopinfo loop ; string loop_label = ( * SI ) -> getHeader ( ) -> getName ( ) ; int num_loop = 0 ; sscanf ( loop_label . c_str ( ) , " " , & num_loop ) ; loop . id = num_loop ; loop . dep = ( * SI ) -> getLoopDepth ( ) ; if ( SkipLoopSet -> find ( loop ) != SkipLoopSet -> end ( ) ) { if ( ( * SI ) -> contains ( UI ) && ( * SI ) -> contains ( DI ) ) { errs ( ) << " \n " ; isInsideSubloop = true ; } } } } } return isInsideSubloop ; }
To determnie whether a instruction is in a loop's constant subloop.
To determnie whether a instruction is in a loop ' s constant subloop .
/* Get all subloop.
	 */ /* If the subloop is a skipped constant loop.
				 */ /* If the instruction is in the subloop.
				 	*/