// // Filename: loop1.nac // Purpose : N-address code (NAC) implementation for a simple synthetic loop. // Author : Nikolaos Kavvadias (C) 2009, 2010 // Date : 30-Sep-2009 // Revision: 0.2.0 (04/09/09) // Initial version. // 0.2.1 (30/09/09) // Added input and output arguments. // //constant s16 0, 1; procedure loop1 (in s16 inp, out s16 outp) { localvar s16 ix, temp; S_1: ix <= ldc 0; S_2 <= jmpun; S_2: temp <= setlt ix, inp; S_3, S_EXIT <= jmpeq temp, 1; S_3: ix <= add ix, 1; S_2 <= jmpun; S_EXIT: outp <= mov ix; }