Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wsopt.h File Reference

Go to the source code of this file.

Functions

void ws_asm_optimize (WsCompilerPtr compiler)
 

Function Documentation

void ws_asm_optimize ( WsCompilerPtr  compiler)

Definition at line 362 of file wsopt.c.

References WsCompilerParamsRec::no_opt_conv, WsCompilerParamsRec::no_opt_dead_code, WsCompilerParamsRec::no_opt_jumps_to_jumps, WsCompilerParamsRec::no_opt_jumps_to_next_instruction, WsCompilerParamsRec::no_opt_peephole, opt_conv(), opt_dead_code(), opt_jumps_to_jumps(), opt_jumps_to_next_instruction(), opt_peephole(), WsCompilerRec::params, WS_FALSE, and WS_TRUE.

Referenced by compile_stream().

363 {
364  WsBool change = WS_TRUE;
365 
366  /* While we manage to change the assembler, perform the requested
367  optimizations. */
368  while (change) {
369  change = WS_FALSE;
370 
371  /* Useless conversions */
372  if (!compiler->params.no_opt_conv && opt_conv(compiler))
373  change = WS_TRUE;
374 
375  /* Peephole. */
376  if (!compiler->params.no_opt_peephole && opt_peephole(compiler))
377  change = WS_TRUE;
378 
379  /* Jumps to jump instructions. */
380  if (!compiler->params.no_opt_jumps_to_jumps
381  && opt_jumps_to_jumps(compiler))
382  change = WS_TRUE;
383 
384  /* Jumps to the next instruction. */
386  && opt_jumps_to_next_instruction(compiler))
387  change = WS_TRUE;
388 
389  /* Unreachable code. */
390  if (!compiler->params.no_opt_dead_code && opt_dead_code(compiler))
391  change = WS_TRUE;
392  }
393 }
unsigned int no_opt_dead_code
Definition: ws.h:138
Definition: wsint.h:131
unsigned int no_opt_conv
Definition: ws.h:141
static WsBool opt_jumps_to_jumps(WsCompilerPtr compiler)
Definition: wsopt.c:81
unsigned int no_opt_jumps_to_next_instruction
Definition: ws.h:135
static WsBool opt_dead_code(WsCompilerPtr compiler)
Definition: wsopt.c:168
static WsBool opt_peephole(WsCompilerPtr compiler)
Definition: wsopt.c:210
static WsBool opt_jumps_to_next_instruction(WsCompilerPtr compiler)
Definition: wsopt.c:123
unsigned int no_opt_peephole
Definition: ws.h:128
WsBool
Definition: wsint.h:128
static WsBool opt_conv(WsCompilerPtr compiler)
Definition: wsopt.c:308
WsCompilerParams params
Definition: wsint.h:193
unsigned int no_opt_jumps_to_jumps
Definition: ws.h:132
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.