static bool FreeUselessIns( block *tail, bool just_the_loop, bool in_regalloc ) /*********************************************************************** Free any instructions which have not been marked with the INS_VISITED bit. See below for the setting of this bit. */ { block *blk; instruction *ins; instruction *prev; bool change; change = FALSE; for( blk = tail; blk != NULL; blk = blk->prev_block ) { if( just_the_loop && !( blk->class & IN_LOOP ) ) { for( ins = blk->ins.hd.prev; ins->head.opcode != OP_BLOCK; ins = ins->head.prev ) { ins->ins_flags &= ~INS_VISITED; } } else { for( ins = blk->ins.hd.prev; ins->head.opcode != OP_BLOCK; ins = prev ) { prev = ins->head.prev; if( ( ins->ins_flags & INS_VISITED ) == 0 ) { change = TRUE; if( in_regalloc ) { DoNothing( ins ); } else { FreeIns( ins ); } } else { ins->ins_flags &= ~INS_VISITED; } } } }
/*! \brief Sets the function, which will be used, when the right mouse button is pressed The function can be: \arg ActorRotate() \arg ActorTranslate() \arg ActorZoom() \arg ActorRoll() \arg ActorPlaneMove() \arg ActorPlaneRoll() \arg CameraRotate() \arg CameraTranslate() \arg CameraZoom() \arg CameraRoll() \arg DoNothing() \param function the name of the function, wrapped in a slot, e.g. SLOT(CameraRotate()). If function is NULL, DoNothing() will be used. */ void RenderWindowInteractor::SetRightButtonFunction( const char* function ) { if( function == NULL ) { strncpy( this->rightButtonFunction, SLOT(DoNothing()), 100 ); } else { strncpy( this->rightButtonFunction, function, 100 ); } }
template <class T,int Overhead> T *LIST<T,Overhead>::Add(int pos){ if(Items>=ItemsAlloced){ const int overhead=CalcOverhead(); ResizePtr((void **)&Ptr,(Items+overhead)*sizeof(T)); ItemsAlloced+=overhead; } memcpy(Ptr+pos+1,Ptr+pos,(Items-pos)*sizeof(T)); Items++; T tmp; DoNothing(&tmp); memcpy(Ptr+pos,&tmp,sizeof(T)); //Ptr[pos](tmp); return &Ptr[pos]; }
int singleStep (VM32Cpu * cpu) { unsigned char inst; unsigned char * ptr; /* Get an instruction */ ptr = (char *) cpu->pc; inst = *ptr; switch (inst) { /* Standard Op Codes */ case 0x00: DoBreak(cpu); break; case 0x01: DoNothing(cpu); break; case 0x02: DoCall(cpu); break; case 0x03: DoPushZero(cpu); break; case 0x04: DoPushImmediateNative(cpu); break; case 0x05: DoReturn(cpu); break; case 0x06: DoPop(cpu); break; case 0x07: DoSwap(cpu); break; case 0x08: DoSetupFrame(cpu); break; case 0x09: DoRestoreFrame(cpu); break; case 0x0a: CallNative(cpu); break; case 0x0b: DoPushSelf(cpu); break; case 0x0c: DoCheckArgCount(cpu); break; case 0x0d: DoBranch(cpu); break; case 0x0e: DoBranchIfTrue(cpu); break; case 0x0f: DoBranchIfFalse(cpu); break; default: DoInvalidInstruction(cpu); break; } return 0; }
static void AssignPushLocals( void ) { /*********************************** Scan through HeadBlock to see if there are any leading instructions of the form MOV REG => temp, where temp is on the stack. We can eliminate the instruction (call DoNothing to mark it as unnecessary to generate) and then the guy that generates the prolog can come along later and generate PUSH REG, and adjust the SUB SP,n instruction appropriately. this replaces a move with a less expensive push, and if all locals turn out to be push locals, eliminates the SUP SP,n instruction as well */ instruction *move; name *src; name *dst; type_length curr_offset; move = HeadBlock->ins.hd.next; curr_offset = 0; for(;;) { if( CurrProc->prolog_state & GENERATED_PROLOG ) break; if( DoesSomething( move ) ) { if( move->head.opcode != OP_MOV ) break; if( UnChangeable( move ) ) break; src = move->operands[ 0 ]; dst = move->result; if( src->n.class != N_REGISTER ) break; if( _IsFloating( src->n.name_class ) ) break; /*90-Dec-17*/ if( dst->n.class != N_TEMP ) break; #if _TARGET & _TARG_80386 if( dst->n.size != 4 ) break; #else if( dst->n.size != 2 && dst->n.size != 4 ) break; #endif curr_offset -= PushSize( dst->n.size );/* assume it will be pushed*/ if( DeAlias( dst ) != dst ) break; if( dst->v.usage & HAS_MEMORY ) { if( dst->t.location != curr_offset ) break; } else { CurrProc->targ.push_local_size += PushSize( dst->n.size ); dst->t.location = - CurrProc->targ.push_local_size; dst->v.usage |= HAS_MEMORY; PropLocal( dst ); } move->head.state = OPERANDS_NEED_WORK; DoNothing( move ); } move = move->head.next; } }
static instruction *KillCompare( instruction *ins, name *result ) { /******************************************************************/ instruction *new_ins; if( ins->result != NULL ) { new_ins = MakeMove( result, ins->result, ins->result->n.type_class ); DupSeg( ins, new_ins ); SetCSEBits( ins, new_ins ); ReplIns( ins, new_ins ); } else { new_ins = ins; DoNothing( ins ); } return( new_ins ); }
static fp_attr ResultToReg( instruction *ins, temp_entry *temp, fp_attr attr ) { /******************************************************************************/ if( ins == temp->first && !temp->whole_block ) { DoNothing( ins ); temp->actual_locn = InsLoc( ins, VIRTUAL_0 ); PopVirtualStack( ins ); attr &= ~POPS; } else { GetToTopOfStack( ins, VIRTUAL_0 ); if( ins->u.gen_table->generate == G_MFST ) { ins->u.gen_table = &RFST; } else { ins->u.gen_table = &RFSTNP; } ins->result = ST( temp->actual_locn ); } return( attr ); }
extern void EatParmConv( void ) { /**************************************************** Eat any converts of parms that stayed in stack. */ block *blk; instruction *ins; name *result; name *parmin; blk = HeadBlock; if( blk != NULL ) { ins = blk->ins.hd.next; while( ins->head.opcode != OP_BLOCK ) { if( ins->head.opcode == OP_CONVERT && ins->ins_flags|INS_PARAMETER ){ result = ins->result; parmin = ins->operands[0]; if( parmin->n.class == N_TEMP && result->n.class == N_TEMP ) { DoNothing( ins ); } } ins = ins->head.next; }
static bool Traverse( block *blk, name *zero ) /************************************************* Given a starting condition code setting for "blk" (blk->cc), traverse the block, modifying the condition codes accordingly, and see if the will suffice for a conditional instruction that we encounter, thus eliminating the compare. */ { instruction *ins; cc_control *cc; operand_types cc_affect; bool change; int jumps; change = false; cc = blk->cc; cc->ins = NULL; jumps = 0; for( ins = blk->ins.hd.next; ins->head.opcode != OP_BLOCK; ins = ins->head.next ) { if( _OpIsJump( ins->head.opcode ) ) { ++jumps; } cc_affect = ins->u.gen_table->op_type & MASK_CC; // Compares and setcc instructions go through the same // tables - compares set condition code, but setcc does not // so we kludge it right here. BBB - June 28, 1995 if( _OpIsCompare( ins->head.opcode ) && ins->result != NULL ) { // we still want to kill off compare for this set instruction if // possible if( UselessCompare( ins, cc, zero ) ) { if( G( ins ) != G_NO ) { change = true; DoNothing( ins ); MarkUsedCC( blk ); } } cc_affect = NO_CC; } if( VolatileIns( ins ) || cc_affect == NO_CC ) { cc->state = UNKNOWN_STATE; } else if( cc_affect == SETS_SC ) { /* sets SIGNED conditions */ #if _TARGET & _TARG_370 /* SETS_SC means ok for ==, != on 370 */ cc->state = EQUALITY_CONDITIONS_SET; #else if( !_OpIsBit( ins->head.opcode ) && ( ins->ins_flags & INS_DEMOTED ) ) { cc->state = EQUALITY_CONDITIONS_SET; } else { cc->state = SIGNED_CONDITIONS_SET; } #endif cc->result_op = ins->result; cc->op_type = ins->type_class; if( ins->head.opcode == OP_SUB ) { cc->left_op = ins->operands[0]; cc->right_op = ins->operands[1]; } else { cc->left_op = NULL; cc->right_op = NULL; } cc->ins = ins; } else if( cc_affect == SETS_CC ) { /* includes compares*/ if( _OpIsCompare( ins->head.opcode ) ) { if( UselessCompare( ins, cc, zero ) ) { DoNothing( ins ); change = true; MarkUsedCC( blk ); } else if( G( ins ) != G_NO ) { cc->state = CONDITIONS_SET; cc->result_op = NULL; cc->op_type = ins->type_class; cc->left_op = ins->operands[0]; cc->right_op = ins->operands[1]; cc->ins = ins; } } else { if( !_OpIsBit( ins->head.opcode ) && ( ins->ins_flags & INS_DEMOTED ) ) { cc->state = EQUALITY_CONDITIONS_SET; } else { cc->state = CONDITIONS_SET; } if( ins->head.opcode != OP_BIT_TEST_TRUE && ins->head.opcode != OP_BIT_TEST_FALSE ) { cc->result_op = ins->result; } else { cc->result_op = NULL; } cc->op_type = ins->type_class; if( ins->head.opcode == OP_SUB ) { cc->left_op = ins->operands[0]; cc->right_op = ins->operands[1]; } else { cc->left_op = NULL; cc->right_op = NULL; } cc->ins = ins; } } /* for PRESERVE, do nothing*/ if( ins->result != NULL ) { if( CondOverlaps( ins->result, cc->left_op ) || CondOverlaps( ins->result, cc->right_op ) ) { cc->left_op = NULL; cc->right_op = NULL; } if( cc_affect != SETS_CC && cc_affect != SETS_SC ) { if( CondOverlaps( ins->result, cc->result_op ) ) { cc->result_op = NULL; } } } } if( jumps > 1 ) { cc->state = UNKNOWN_STATE; } return( change ); }
void skip_codepoint(Iterator& cur, Sentinel end, EncodingErrorFn error_fn) const { transcode_codepoint(cur, end, DoNothing(), error_fn); }
void SpeechRecognition::Transition(SpeechEvent* aEvent) { switch (mCurrentState) { case STATE_IDLE: switch (aEvent->mType) { case EVENT_START: // TODO: may want to time out if we wait too long // for user to approve WaitForAudioData(aEvent); break; case EVENT_STOP: case EVENT_ABORT: case EVENT_AUDIO_DATA: case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: DoNothing(aEvent); break; case EVENT_AUDIO_ERROR: case EVENT_RECOGNITIONSERVICE_ERROR: AbortError(aEvent); break; case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_STARTING: switch (aEvent->mType) { case EVENT_AUDIO_DATA: StartedAudioCapture(aEvent); break; case EVENT_AUDIO_ERROR: case EVENT_RECOGNITIONSERVICE_ERROR: AbortError(aEvent); break; case EVENT_ABORT: AbortSilently(aEvent); break; case EVENT_STOP: Reset(); break; case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: DoNothing(aEvent); break; case EVENT_START: SR_LOG("STATE_STARTING: Unhandled event %s", GetName(aEvent)); MOZ_CRASH(); case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_ESTIMATING: switch (aEvent->mType) { case EVENT_AUDIO_DATA: WaitForEstimation(aEvent); break; case EVENT_STOP: StopRecordingAndRecognize(aEvent); break; case EVENT_ABORT: AbortSilently(aEvent); break; case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: case EVENT_RECOGNITIONSERVICE_ERROR: DoNothing(aEvent); break; case EVENT_AUDIO_ERROR: AbortError(aEvent); break; case EVENT_START: SR_LOG("STATE_ESTIMATING: Unhandled event %d", aEvent->mType); MOZ_CRASH(); case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_WAITING_FOR_SPEECH: switch (aEvent->mType) { case EVENT_AUDIO_DATA: DetectSpeech(aEvent); break; case EVENT_STOP: StopRecordingAndRecognize(aEvent); break; case EVENT_ABORT: AbortSilently(aEvent); break; case EVENT_AUDIO_ERROR: AbortError(aEvent); break; case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: case EVENT_RECOGNITIONSERVICE_ERROR: DoNothing(aEvent); break; case EVENT_START: SR_LOG("STATE_STARTING: Unhandled event %s", GetName(aEvent)); MOZ_CRASH(); case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_RECOGNIZING: switch (aEvent->mType) { case EVENT_AUDIO_DATA: WaitForSpeechEnd(aEvent); break; case EVENT_STOP: StopRecordingAndRecognize(aEvent); break; case EVENT_AUDIO_ERROR: case EVENT_RECOGNITIONSERVICE_ERROR: AbortError(aEvent); break; case EVENT_ABORT: AbortSilently(aEvent); break; case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: DoNothing(aEvent); break; case EVENT_START: SR_LOG("STATE_RECOGNIZING: Unhandled aEvent %s", GetName(aEvent)); MOZ_CRASH(); case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_WAITING_FOR_RESULT: switch (aEvent->mType) { case EVENT_STOP: DoNothing(aEvent); break; case EVENT_AUDIO_ERROR: case EVENT_RECOGNITIONSERVICE_ERROR: AbortError(aEvent); break; case EVENT_RECOGNITIONSERVICE_FINAL_RESULT: NotifyFinalResult(aEvent); break; case EVENT_AUDIO_DATA: DoNothing(aEvent); break; case EVENT_ABORT: AbortSilently(aEvent); break; case EVENT_START: case EVENT_RECOGNITIONSERVICE_INTERMEDIATE_RESULT: SR_LOG("STATE_WAITING_FOR_RESULT: Unhandled aEvent %s", GetName(aEvent)); MOZ_CRASH(); case EVENT_COUNT: MOZ_CRASH("Invalid event EVENT_COUNT"); } break; case STATE_COUNT: MOZ_CRASH("Invalid state STATE_COUNT"); } return; }
static instruction *OpToReg( instruction *ins, temp_entry *temp, fp_attr attr ) { /*****************************************************************************/ if( ins == temp->last && !temp->whole_block ) { switch( ins->u.gen_table->generate ) { case G_MFLD: PushVirtualStack( ins ); InsLoc( ins, VIRTUAL_0 ) = temp->actual_locn; DoNothing( ins ); break; case G_MCOMP: // if( temp->actual_locn != ACTUAL_1 ) _Zoiks( ZOIKS_076 ); ins->operands[ 0 ] = ST( ACTUAL_1 ); ins->operands[ 1 ] = ST( 0 ); if( temp->actual_locn != ACTUAL_1 ) { byte *actual_owner; actual_owner = ActualStackOwner( ACTUAL_1 ); *actual_owner = temp->actual_locn; PrefFXCH( ins, ACTUAL_1 ); PrefFXCH( ins, temp->actual_locn ); RevCond( ins ); } ins->u.gen_table = &FCOMPP; PopStack( ins ); PopStack( ins ); break; case G_MNFBIN: case G_MRFBIN: if( ins->u.gen_table->generate == G_MRFBIN ) { ins->u.gen_table = &RNFBINP; } else { ins->u.gen_table = &RRFBINP; } ins->operands[ 0 ] = ST( temp->actual_locn ); ins->result = ins->operands[ 0 ]; ins->operands[ 1 ] = ST( 0 ); InsLoc( ins, VIRTUAL_0 ) = temp->actual_locn; DecrementAll(); break; } temp->actual_locn = ACTUAL_NONE; } else { if( ( ins == temp->first ) && !temp->defined && !temp->whole_block ) { PrefFLDOp( ins, OP_MEM, temp->actual_op ); IncrementAll(); temp->actual_locn = ACTUAL_0; if( ins->u.gen_table->generate == G_MFLD ) { // PushStack( ins ); ins->operands[ 0 ] = ST( ACTUAL_0 ); } else { GetToTopOfStack( ins, VIRTUAL_0 ); ins->operands[ 0 ] = ST( temp->actual_locn ); } } else { ins->operands[ 0 ] = ST( temp->actual_locn ); // if( attr & PUSHES ) { // PushStack( ins ); // } } if( attr & PUSHES ) { PushStack( ins ); } else if( attr & POPS2 ) { PopStack( ins ); PopStack( ins ); } else if( attr & POPS ) { PopStack( ins ); } ins->u.gen_table = RegAction( ins ); } return( ins ); }
template<> void Config<const char *>::SetMax(const char *newmax){ DoNothing(); }
template<> void Config<const char *>::SetMin(const char *newmin){ DoNothing(); }
instruction *rMAKECALL( instruction *ins ) /********************************************* Using the table RTInfo[], do all the necessary stuff to turn instruction "ins" into a call to a runtime support routine. Move the parms into registers, and move the return register of the runtime routine into the result. Used for 386 and 370 versions */ { rtn_info *info; label_handle lbl; instruction *left_ins; instruction *new_ins; instruction *last_ins; name *reg_name; hw_reg_set regs; hw_reg_set all_regs; hw_reg_set tmp; rt_class rtindex; if( !_IsConvert( ins ) ) { rtindex = LookupRoutine( ins ); } else { /* look it up again in case we ran out of memory during expansion*/ rtindex = LookupConvertRoutine( ins ); } info = &RTInfo[rtindex]; regs = _ParmReg( info->left ); all_regs = regs; left_ins = MakeMove( ins->operands[0], AllocRegName( regs ), info->operand_class ); ins->operands[0] = left_ins->result; MoveSegOp( ins, left_ins, 0 ); PrefixIns( ins, left_ins ); regs = _ParmReg( info->right ); if( !HW_CEqual( regs, HW_EMPTY ) ) { new_ins = MakeMove( ins->operands[1], AllocRegName( regs ), info->operand_class ); ins->operands[1] = new_ins->result; MoveSegOp( ins, new_ins, 0 ); HW_TurnOn( all_regs, regs ); PrefixIns( ins, new_ins ); } #if _TARGET & _TARG_370 tmp = RAReg(); HW_TurnOn( all_regs, tmp ); tmp = LNReg(); HW_TurnOn( all_regs, tmp ); #elif _TARGET & _TARG_80386 { tmp = ReturnReg( WD, false ); HW_TurnOn( all_regs, tmp ); } #endif reg_name = AllocRegName( all_regs ); lbl = RTLabel( rtindex ); new_ins = NewIns( 3 ); new_ins->head.opcode = OP_CALL; new_ins->type_class = ins->type_class; new_ins->operands[CALL_OP_USED] = reg_name; new_ins->operands[CALL_OP_USED2] = reg_name; new_ins->operands[CALL_OP_ADDR] = AllocMemory( lbl, 0, CG_LBL, ins->type_class ); new_ins->result = NULL; new_ins->num_operands = 2; /* special case for OP_CALL*/ #if _TARGET & _TARG_AXP { HW_CTurnOn( all_regs, HW_FULL ); HW_TurnOff( all_regs, SavedRegs() ); HW_CTurnOff( all_regs, HW_UNUSED ); HW_TurnOn( all_regs, ReturnAddrReg() ); } #endif new_ins->zap = (register_name *)AllocRegName( all_regs ); /* all parm regs could be zapped*/ last_ins = new_ins; if( ins->result == NULL || _OpIsCondition( ins->head.opcode ) ) { /* comparison, still need conditional jumps*/ ins->operands[0] = AllocIntConst( 0 ); ins->operands[1] = AllocIntConst( 1 ); DelSeg( ins ); DoNothing( ins ); /* just conditional jumps for ins*/ PrefixIns( ins, new_ins ); new_ins->ins_flags |= INS_CC_USED; last_ins = ins; } else { regs = _ParmReg( info->result ); tmp = regs; HW_TurnOn( tmp, new_ins->zap->reg ); new_ins->zap = (register_name *)AllocRegName( tmp ); reg_name = AllocRegName( regs ); new_ins->result = reg_name; last_ins = MakeMove( reg_name, ins->result, ins->type_class ); ins->result = last_ins->operands[0]; MoveSegRes( ins, last_ins ); SuffixIns( ins, last_ins ); ReplIns( ins, new_ins ); } FixCallIns( new_ins ); UpdateLive( left_ins, last_ins ); return( left_ins ); }