00001 /*************************************************************************** 00002 * Copyright (C) 2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef OPTIMIZER_H 00012 #define OPTIMIZER_H 00013 00014 #include "instruction.h" 00015 00016 00018 QString binary( uchar val ); 00019 00020 00024 class Optimizer 00025 { 00026 public: 00027 Optimizer(); 00028 ~Optimizer(); 00029 00030 void optimize( Code * code ); 00031 00032 protected: 00038 void propagateLinksAndStates(); 00045 bool giveInputStates(); 00051 bool pruneInstructions(); 00057 bool optimizeInstructions(); 00063 bool redirectGotos( Instruction * current, const QString & label ); 00068 uchar generateRegisterDepends( Instruction * current, const Register & reg ); 00074 uchar registerDepends( Instruction * current, const Register & reg ); 00082 bool canRemove( Instruction * ins, const Register & reg, uchar bitMask = 0xff ); 00083 00084 Code * m_pCode; 00085 }; 00086 00087 #endif
1.5.1