/* * LIBOIL - Library of Optimized Inner Loops * Copyright (c) 2004 David A. Schleef * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include typedef struct _Insn Insn; struct _Insn { char *line; int index; int n_deps; int deps[10]; int x; }; Insn insns[100]; int state[100]; int max_depth = 1000; int outputting = 1; int n_lines; int start_line = -1; int end_line = -1; int uber_start_line = -1; int uber_end_line = -1; int n_insns = 0; int depth; int n_impls = 0; char **lines; void output_sequence (void); void read_file(void); int main (int argc, char *argv[]) { int i; int j; int n; read_file(); if (outputting) { for(i=0;i= 0) { int insn; insn = state[depth]; /* check if we've exhausted instructions */ if (insn >= max_depth) { depth--; if (depth >= 0) state[depth]++; continue; } /* check if this instruction has been used */ for(i=0;i insn + 1) { state[depth]++; } #endif if (depth < max_depth - 1) { depth++; state[depth]=0; } else { output_sequence (); n_impls++; state[depth]++; } loop: ; } #endif if (outputting) { for(i=end_line+1;i