From: Johan K. <joh...@id...> - 2001-07-31 09:58:55
|
----- Original Message ----- From: Royce & Sharal Pereira <be...@im...> To: <sdc...@li...> Sent: Tuesday, July 31, 2001 10:08 AM Subject: Fw: [Sdcc-user] any better way- how to implement? > Hi, all, > > I optimised the inefficient code by using a peephole optimiser:- > Make a text file say, peep.opt, & insert the following text > rule:= replace > { > clr a > mov c,%1 > rlc a > cpl a > mov r2,a > clr c > jz %2 > cpl c > %2: > mov %1,c > } > by > { > cpl %1 ;optm. by Author > } > Save the file in the same dir as your sourcefile. > > Then compile, adding the command line option --peep-file peep.opt > This worked for my application. Has any one tried this? Wonder if there > could be any side effects... There certainly are. Depending on how where what and why, "r2" could be anything like r2-r7 and even a DSEG _sloc. Further more, "r2" could be the result of a subexpression that will be used later, like in: bit0 = ~bit1; bit1= ~bit1; You will gain a lot by declaring bit vars as volatile. I wonder if they shouldn't be by default, it would be much more efficient than keeping them registered. Also, shouldn't bitvar _sloc's be in BSEG instead of DSEG? Sandeep? Johan Johan |