Hi Olin, I liked your constructive criticism.But there are two solution for the problem you pointed out. Solution 1: As soon as the whole Hex File has been loaded and Disassembled, the Optimizer could search for a pattern like BSF EECON1,EEPGD ;...(Any or No instructions that Don't modify EECON1)... BSF EECON1,RD If this sequence is detected, The optimizer might set a flag. later on while optimizing, it could ignore instructions which seem absurd to it. Solution 2: There is one more way of detecting it. Its prudent programming practice to have a goto to skip a table or any "data" in instructions. it could be like: goto skip_table table: addwf PCL dt "0123456789" skip: ;..(Any instructions)... Or you might place the table at the end of the program. If anyone does not do this, most probably his program won't work as he wants it to(Unless he is someone like Dimitry). The optimizer could identify these skips and Ignoe the code between them. But, removing tables which are never called *MUST* be done. The end user will always have full control over what Optimizations should be done and what should not be done. And for a novice user, all optimizations will be realtively safe. You can always disable the optimizations which you don't like. Jeethu Rao -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Olin Lathrop Sent: Tuesday, July 03, 2001 5:01 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: Compiler > I'm thinking of writing an Optimizer for PIC Hex Files. > It would take in a hex file, Disassemble it, and then > try various optimizations. This is impossible in the general sense. For example, suppose you encountered MOVLW h'3A' That could be the low or high byte of an address, or just an arbitrary constant. There are lots of other gotchas too. You need to know the original intent of the code to do any meaningful optimizations. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body