OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_39/] [or1ksim/] [cuc/] [load.c] - Blame information for rev 1060

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 879 markom
/* load.c -- OpenRISC Custom Unit Compiler, instruction loading and converting
2
 *    Copyright (C) 2002 Marko Mlinar, markom@opencores.org
3
 *
4
 *    This file is part of OpenRISC 1000 Architectural Simulator.
5
 *
6
 *    This program is free software; you can redistribute it and/or modify
7
 *    it under the terms of the GNU General Public License as published by
8
 *    the Free Software Foundation; either version 2 of the License, or
9
 *    (at your option) any later version.
10
 *
11
 *    This program is distributed in the hope that it will be useful,
12
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *    GNU General Public License for more details.
15
 *
16
 *    You should have received a copy of the GNU General Public License
17
 *    along with this program; if not, write to the Free Software
18
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
 
20
#include <stdio.h>
21
#include <stdlib.h>
22
#include <stdarg.h>
23
#include <assert.h>
24 897 markom
#include "sim-config.h"
25 879 markom
#include "cuc.h"
26
#include "opcode/or32.h"
27
#include "insn.h"
28
 
29
static const cuc_conv conv[] = {
30
{"l.add", II_ADD}, {"l.addi", II_ADD},
31 898 markom
{"l.movhi", II_OR},
32 879 markom
{"l.sub", II_SUB}, {"l.subi", II_SUB},
33
{"l.and", II_AND}, {"l.andi", II_AND},
34
{"l.xor", II_XOR}, {"l.xori", II_XOR},
35
{"l.or",  II_OR }, {"l.ori",  II_OR},
36
{"l.mul", II_MUL}, {"l.muli", II_MUL},
37
 
38
{"l.sra", II_SRA}, {"l.srai", II_SRA},
39
{"l.srl", II_SRL}, {"l.srli", II_SRL},
40
{"l.sll", II_SLL}, {"l.slli", II_SLL},
41
 
42
{"l.lbz",II_LB | II_MEM}, {"l.lbs", II_LB | II_MEM | II_SIGNED},
43
{"l.lhz",II_LH | II_MEM}, {"l.lhs", II_LH | II_MEM | II_SIGNED},
44
{"l.lwz",II_LW | II_MEM}, {"l.lws", II_LW | II_MEM | II_SIGNED},
45
{"l.sb", II_SB | II_MEM}, {"l.sh",  II_SH | II_MEM}, {"l.sw", II_SW | II_MEM},
46
{"l.sfeq",  II_SFEQ }, {"l.sfeqi", II_SFEQ},
47
{"l.sfne",  II_SFNE }, {"l.sfnei", II_SFNE},
48
{"l.sflts", II_SFLT | II_SIGNED}, {"l.sfltis", II_SFLT | II_SIGNED},
49
{"l.sfltu", II_SFLT}, {"l.sfltiu", II_SFLT},
50
{"l.sfgts", II_SFGT | II_SIGNED}, {"l.sfgtis", II_SFGT | II_SIGNED},
51
{"l.sfgtu", II_SFGT}, {"l.sfgtiu", II_SFGT},
52
{"l.sfges", II_SFGE | II_SIGNED}, {"l.sfgeis", II_SFGE | II_SIGNED},
53
{"l.sfgeu", II_SFGE}, {"l.sfgeiu", II_SFGE},
54
{"l.sfles", II_SFLE | II_SIGNED}, {"l.sfleis", II_SFLE | II_SIGNED},
55
{"l.sfleu", II_SFLE}, {"l.sfleiu", II_SFLE},
56
{"l.j",     II_BF   },
57
{"l.bf",    II_BF   },
58 906 markom
{"l.jal",   II_CALL },
59 879 markom
{"l.nop",   II_NOP  }
60
};
61
 
62
/* Instructions from function */
63
cuc_insn insn[MAX_INSNS];
64
int num_insn;
65
int reloc[MAX_INSNS];
66
 
67
/* Prints out instructions */
68
void print_cuc_insns (char *s, int verbose)
69
{
70
  int i, j;
71 997 markom
  PRINTF ("****************** %s ******************\n", s);
72 879 markom
  print_insns (insn, num_insn,verbose);
73 997 markom
  PRINTF ("\n\n");
74 879 markom
}
75
 
76
void xchg_insn (int i, int j)
77
{
78
  cuc_insn t;
79
  t = insn[i];
80
  insn[i] = insn[j];
81
  insn[j] = t;
82
}
83
 
84 905 markom
/* Negates conditional instruction */
85
void negate_conditional (cuc_insn *ii)
86
{
87
  assert (ii->type & IT_COND);
88
 
89
  if (ii->index == II_SFEQ) change_insn_type (ii, II_SFNE);
90
  else if (ii->index == II_SFNE) change_insn_type (ii, II_SFEQ);
91
  else if (ii->index == II_SFLT) change_insn_type (ii, II_SFGE);
92
  else if (ii->index == II_SFGT) change_insn_type (ii, II_SFLE);
93
  else if (ii->index == II_SFLE) change_insn_type (ii, II_SFGT);
94
  else if (ii->index == II_SFGE) change_insn_type (ii, II_SFLT);
95
  else assert (0);
96
}
97
 
98 879 markom
/* Remove delay slots */
99
void remove_dslots ()
100
{
101
  int i;
102
  int in_delay = 0;
103
  for (i = 0; i < num_insn; i++) {
104
    if (in_delay) insn[i].type |= IT_INDELAY;
105
    in_delay = 0;
106
    if (insn[i].type & IT_BRANCH) in_delay = 1;
107
    if (insn[i].type & IT_INDELAY) {
108 1043 markom
      cuc_insn *ii;
109
      cuc_insn *bi;
110
      assert (i >= 2);
111
      ii = &insn[i - 2];
112
      bi = &insn[i - 1];
113 879 markom
      /* delay slot should not be a branch target! */
114
      assert ((insn[i].type & IT_BBSTART) == 0);
115 1043 markom
      assert ((bi->type & IT_INDELAY) == 0);
116 879 markom
      insn[i].type &= ~IT_INDELAY; /* no more in delay slot */
117 1043 markom
 
118
      /* Get the value we need before the actual jump */
119
      if (bi->opt[1] & OPT_REGISTER && bi->op[1] >= 0) {
120
        int r = bi->op[1];
121
        assert (ii->index == II_NOP);
122
        change_insn_type (ii, II_ADD);
123
        ii->type = IT_COND;
124
        ii->dep = NULL;
125
        ii->op[0] = r; ii->opt[0] = OPT_REGISTER | OPT_DEST;
126
        ii->op[1] = r; ii->opt[1] = OPT_REGISTER;
127
        ii->op[2] = 0; ii->opt[2] = OPT_CONST;
128
        ii->opt[3] = OPT_NONE;
129
        bi->op[1] = i - 2; bi->opt[1] = OPT_REF;
130
      }
131
      xchg_insn (i, i - 1);
132 879 markom
    }
133
  }
134
  assert (in_delay == 0);
135
}
136
 
137
/* Convert local variables (uses stack frame -- r1) to internal values */
138
void detect_locals ()
139
{
140
  int stack[MAX_STACK];
141
  int i, can_remove_stack = 1;
142
  int real_stack_size = 0;
143
 
144
  for (i = 0; i < MAX_STACK; i++) stack[i] = -1;
145
 
146
  for (i = 0; i < num_insn; i++) {
147
    /* sw off (r1),rx */
148
    if (insn[i].index == II_SW
149
      && (insn[i].opt[0] & OPT_CONST)
150
      && insn[i].op[1] == 1 && (insn[i].opt[1] & OPT_REGISTER)) {
151
 
152 883 markom
      if (insn[i].op[0] < MAX_STACK/* && insn[i].op[1] >= 4*/) { /* Convert to normal move */
153 879 markom
        stack[insn[i].op[0]] = i;
154
        insn[i].type &= IT_INDELAY | IT_BBSTART;
155
        change_insn_type (&insn[i], II_ADD);
156
        insn[i].op[0] = -1; insn[i].opt[0] = OPT_REGISTER | OPT_DEST;
157
        insn[i].op[1] = insn[i].op[2]; insn[i].opt[1] = insn[i].opt[2];
158
        insn[i].op[2] = 0; insn[i].opt[2] = OPT_CONST;
159
      } else can_remove_stack = 0;
160
    /* lw rx,off (r1) */
161
    } else if (insn[i].index == II_LW
162
      && (insn[i].opt[1] & OPT_CONST)
163
      && insn[i].op[2] == 1 && (insn[i].opt[2] & OPT_REGISTER)) {
164
 
165 883 markom
      if (insn[i].op[1] < MAX_STACK && stack[insn[i].op[1]] >= 0) { /* Convert to normal move */
166 879 markom
        insn[i].type &= IT_INDELAY | IT_BBSTART;
167
        change_insn_type (&insn[i], II_ADD);
168
        insn[i].op[1] = stack[insn[i].op[1]]; insn[i].opt[1] = OPT_REF;
169
        insn[i].op[2] = 0; insn[i].opt[2] = OPT_CONST;
170
      } else can_remove_stack = 0;
171
    /* Check for defined stack size */
172
    } else if (insn[i].index == II_ADD && !real_stack_size
173
            && (insn[i].opt[0] & OPT_REGISTER) && insn[i].op[0] == 1
174
            && (insn[i].opt[1] & OPT_REGISTER) && insn[i].op[1] == 1
175
            && (insn[i].opt[2] & OPT_CONST)) {
176
      real_stack_size = -insn[i].op[2];
177
    }
178
  }
179 883 markom
  //assert (can_remove_stack); /* TODO */  
180 879 markom
}
181
 
182
/* Disassemble one instruction from insn index and generate parameters */
183
const char *build_insn (unsigned long data, cuc_insn *insn)
184
{
185
  const char *name;
186
  char *s;
187
  extern char *disassembled;
188
  int index = insn_decode (data);
189
  struct or32_opcode const *opcode;
190
  int i, argc = 0;
191
 
192
  insn->insn = data;
193
  insn->index = -1;
194
  insn->type = 0;
195
  name = insn_name (index);
196
  insn->index = index;
197
  disassemble_index (data, index);
198
  strcpy (insn->disasm, disassembled);
199
  insn->dep = NULL;
200
  for (i = 0; i < MAX_OPERANDS; i++) insn->opt[i] = OPT_NONE;
201
 
202
  if (index < 0) {
203
    fprintf (stderr, "Invalid opcode 0x%08x!\n", data);
204
    exit (1);
205
  }
206
  opcode = &or32_opcodes[index];
207
 
208
  for (s = opcode->args; *s != '\0'; ++s) {
209
    switch (*s) {
210
    case '\0': return name;
211
    case 'r':
212
      insn->opt[argc] = OPT_REGISTER | (argc ? 0 : OPT_DEST);
213
      insn->op[argc++] = or32_extract(*++s, opcode->encoding, data);
214
      break;
215
 
216
    default:
217
      if (strchr (opcode->encoding, *s)) {
218
        unsigned long imm = or32_extract (*s, opcode->encoding, data);
219
        imm = extend_imm(imm, *s);
220
        insn->opt[argc] = OPT_CONST;
221
        insn->op[argc++] = imm;
222
      }
223
    }
224
  }
225
  return name;
226
}
227
 
228 1043 markom
/* inserts nop before branch */
229
void expand_branch ()
230
{
231
  int i, j, num_bra = 0, d;
232
  for (i = 0; i < num_insn; i++) if (insn[i].type & IT_BRANCH) num_bra++;
233
 
234
  d = num_insn + num_bra;
235
  assert (d < MAX_INSNS);
236
 
237
  /* Split memory commands */
238
  for (i = num_insn - 1; i >= 0; i--) if (insn[i].type & IT_BRANCH) {
239
    insn[--d] = insn[i];
240
    insn[--d] = insn[i];
241
    reloc[i] = d;
242
    change_insn_type (&insn[d], II_NOP);
243
  } else {
244
    insn[--d] = insn[i];
245
    reloc[i] = d;
246
  }
247
  num_insn += num_bra;
248
  for (i = 0; i < num_insn; i++)
249
    for (j = 0; j < MAX_OPERANDS; j++)
250
      if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
251
        insn[i].op[j] = reloc[insn[i].op[j]];
252
}
253
 
254 879 markom
/* expands immediate memory instructions to two */
255
void expand_memory ()
256
{
257
  int i, j, num_mem = 0, d;
258
  for (i = 0; i < num_insn; i++) if (insn[i].type & IT_MEMORY) num_mem++;
259
 
260
  d = num_insn + num_mem;
261
  assert (d < MAX_INSNS);
262
 
263
  /* Split memory commands */
264
  for (i = num_insn - 1; i >= 0; i--) if (insn[i].type & IT_MEMORY) {
265
    insn[--d] = insn[i];
266
    insn[--d] = insn[i];
267
    reloc[i] = d;
268
    switch (insn[d].index) {
269
    case II_SW:
270
    case II_SH:
271
    case II_SB:
272 1060 markom
              insn[d + 1].op[1] = d; insn[d + 1].opt[1] = OPT_REF; /* sw rx,(t($-1)) */
273
              insn[d + 1].op[0] = insn[i].op[2]; insn[d + 1].opt[0] = insn[d + 1].opt[2];
274
              insn[d + 1].opt[2] = OPT_NONE;
275
              insn[d + 1].type &= ~IT_BBSTART;
276 879 markom
              insn[d].op[0] = -1; insn[d].opt[0] = OPT_REGISTER | OPT_DEST; /* add rd, ra, rb */
277
              insn[d].op[2] = insn[i].op[0]; insn[d].opt[2] = insn[i].opt[0];
278
              insn[d].opt[3] = OPT_NONE;
279
              insn[d].type &= IT_INDELAY | IT_BBSTART;
280
              insn[d].type |= IT_MEMADD;
281
              change_insn_type (&insn[d], II_ADD);
282
              break;
283
    case II_LW:
284
    case II_LH:
285
    case II_LB:
286
              insn[d].op[0] = -1; insn[d].opt[0] = OPT_REGISTER | OPT_DEST; /* add rd, ra, rb */
287
              insn[d].type &= IT_INDELAY | IT_BBSTART;
288
              insn[d].type |= IT_MEMADD;
289
              change_insn_type (&insn[d], II_ADD);
290
              insn[d + 1].op[1] = d; insn[d + 1].opt[1] = OPT_REF; /* lw (t($-1)),rx */
291
              insn[d + 1].opt[2] = OPT_NONE;
292
              insn[d + 1].opt[3] = OPT_NONE;
293
              insn[d + 1].type &= ~IT_BBSTART;
294
              break;
295
    default:  fprintf (stderr, "%4i, %4i: %s\n", i, d, cuc_insn_name (&insn[d]));
296
              assert (0);
297
    }
298
  } else {
299
    insn[--d] = insn[i];
300
    reloc[i] = d;
301
  }
302
  num_insn += num_mem;
303
  for (i = 0; i < num_insn; i++) if (!(insn[i].type & IT_MEMORY))
304
    for (j = 0; j < MAX_OPERANDS; j++)
305
      if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
306
        insn[i].op[j] = reloc[insn[i].op[j]];
307
}
308
 
309
/* expands signed comparisons to three instructions */
310
void expand_signed ()
311
{
312
  int i, j, num_sig = 0, d;
313 897 markom
  for (i = 0; i < num_insn; i++)
314
    if (insn[i].type & IT_SIGNED && !(insn[i].type & IT_MEMORY)) num_sig++;
315 879 markom
 
316
  d = num_insn + num_sig * 2;
317
  assert (d < MAX_INSNS);
318
 
319
  /* Split signed instructions */
320 897 markom
  for (i = num_insn - 1; i >= 0; i--)
321 879 markom
    /* We will expand signed memory later */
322 897 markom
    if (insn[i].type & IT_SIGNED && !(insn[i].type & IT_MEMORY)) {
323
      insn[--d] = insn[i];
324
      insn[d].op[1] = d - 2; insn[d].opt[1] = OPT_REF;
325
      insn[d].op[2] = d - 1; insn[d].opt[2] = OPT_REF;
326 879 markom
 
327 897 markom
      insn[--d] = insn[i];
328
      change_insn_type (&insn[d], II_ADD);
329
      insn[d].type = 0;
330
      insn[d].op[0] = -1; insn[d].opt[0] = OPT_REGISTER | OPT_DEST;
331
      insn[d].op[1] = insn[d].op[2]; insn[d].opt[1] = insn[d].opt[2];
332 905 markom
      insn[d].op[2] = 0x80000000; insn[d].opt[2] = OPT_CONST;
333 897 markom
      insn[d].opt[3] = OPT_NONE;
334 879 markom
 
335 897 markom
      insn[--d] = insn[i];
336
      change_insn_type (&insn[d], II_ADD);
337
      insn[d].type = 0;
338
      insn[d].op[0] = -1; insn[d].opt[0] = OPT_REGISTER | OPT_DEST;
339
      insn[d].op[1] = insn[d].op[1]; insn[d].opt[1] = insn[d].opt[1];
340 905 markom
      insn[d].op[2] = 0x80000000; insn[d].opt[2] = OPT_CONST;
341 897 markom
      insn[d].opt[3] = OPT_NONE;
342 879 markom
 
343 897 markom
      reloc[i] = d;
344
    } else {
345
      insn[--d] = insn[i];
346
      reloc[i] = d;
347
    }
348 879 markom
  num_insn += num_sig * 2;
349
  for (i = 0; i < num_insn; i++) if (insn[i].type & IT_MEMORY || !(insn[i].type & IT_SIGNED)) {
350
    for (j = 0; j < MAX_OPERANDS; j++)
351
      if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
352
        insn[i].op[j] = reloc[insn[i].op[j]];
353
  } else insn[i].type &= ~IT_SIGNED;
354
}
355
 
356 906 markom
/* expands calls to 7 instructions */
357
void expand_calls ()
358
{
359
  int i, j, num_call = 0, d;
360
  for (i = 0; i < num_insn; i++)
361
    if (insn[i].index == II_CALL) num_call++;
362
 
363
  d = num_insn + num_call * 6; /* 6 parameters */
364
  assert (d < MAX_INSNS);
365
 
366
  /* Split call instructions */
367
  for (i = num_insn - 1; i >= 0; i--)
368
    /* We will expand signed memory later */
369
    if (insn[i].index == II_CALL) {
370
      insn[--d] = insn[i];
371
      insn[d].op[0] = insn[d].op[1]; insn[d].opt[0] = OPT_CONST;
372
      insn[d].opt[1] = OPT_NONE;
373
      insn[d].type |= IT_VOLATILE;
374
 
375
      for (j = 0; j < 6; j++) {
376
        insn[--d] = insn[i];
377
        change_insn_type (&insn[d], II_ADD);
378
        insn[d].type = IT_VOLATILE;
379
        insn[d].op[0] = 3 + j; insn[d].opt[0] = OPT_REGISTER | OPT_DEST;
380
        insn[d].op[1] = 3 + j; insn[d].opt[1] = OPT_REGISTER;
381
        insn[d].op[2] = 0x80000000; insn[d].opt[2] = OPT_CONST;
382
        insn[d].opt[3] = OPT_NONE;
383
      }
384
 
385
      reloc[i] = d;
386
    } else {
387
      insn[--d] = insn[i];
388
      reloc[i] = d;
389
    }
390
  num_insn += num_call * 6;
391
  for (i = 0; i < num_insn; i++)
392
    for (j = 0; j < MAX_OPERANDS; j++)
393
      if (insn[i].opt[j] & OPT_REF || insn[i].opt[j] & OPT_JUMP)
394
        insn[i].op[j] = reloc[insn[i].op[j]];
395
}
396
 
397 897 markom
/* Loads function from file into global array insn.
398
   Function returns nonzero if function cannot be converted. */
399
int cuc_load (char *in_fn)
400 879 markom
{
401
  int i, j, in_delay;
402
  FILE *fi;
403
  int func_return = 0;
404
  num_insn = 0;
405
 
406
  log ("Loading filename %s\n", in_fn);
407
  if ((fi = fopen (in_fn, "rt")) == NULL) {
408
    fprintf (stderr, "Cannot open '%s'\n", in_fn);
409
    exit (1);
410
  }
411
  /* Read in the function and decode the instructions */
412
  for (i = 0;; i++) {
413
    unsigned long data;
414
    extern char *disassembled;
415
    const char *name;
416
 
417
    if (fscanf (fi, "%08x\n", &data) != 1) break;
418
 
419
    /* build params */
420
    name = build_insn (data, &insn[i]);
421
    if (func_return) func_return++;
422 997 markom
    //PRINTF ("%s\n", name);
423 879 markom
 
424
    if (or32_opcodes[insn[i].index].flags & OR32_IF_DELAY) {
425
      int f;
426
      if (strcmp (name, "l.bnf") == 0) f = 1;
427
      else if (strcmp (name, "l.bf") == 0) f = 0;
428
      else if (strcmp (name, "l.j") == 0) {
429
        f = -1;
430
      } else if (strcmp (name, "l.jr") == 0 && func_return == 0) {
431
        func_return = 1;
432
        change_insn_type (&insn[i], II_NOP);
433
        continue;
434
      } else {
435 897 markom
        cucdebug (1, "Instruction #%i: \"%s\" not supported.\n", i, name);
436
        log ("Instruction #%i: \"%s\" not supported.\n", i, name);
437
        return 1;
438 879 markom
      }
439
      if (f < 0) { /* l.j */
440
        /* repair params */
441
        change_insn_type (&insn[i], II_BF);
442
        insn[i].op[0] = i + insn[i].op[0]; insn[i].opt[0] = OPT_JUMP;
443
        insn[i].op[1] = 1; insn[i].opt[1] = OPT_CONST;
444
        insn[i].type |= IT_BRANCH | IT_VOLATILE;
445
      } else {
446
        i--;
447
        /* repair params */
448
        insn[i].op[2] = insn[i].op[1]; insn[i].opt[2] = insn[i].opt[1] & ~OPT_DEST;
449
        insn[i].op[1] = insn[i].op[0]; insn[i].opt[1] = insn[i].opt[0] & ~OPT_DEST;
450
        insn[i].op[0] = FLAG_REG; insn[i].opt[0] = OPT_DEST | OPT_REGISTER;
451
        insn[i].opt[3] = OPT_NONE;
452
        insn[i].type |= IT_COND;
453 905 markom
        if (f) negate_conditional (&insn[i]);
454 879 markom
        i++;
455
        change_insn_type (&insn[i], II_BF);
456
        insn[i].op[0] = i + insn[i].op[0]; insn[i].opt[0] = OPT_JUMP;
457
        insn[i].op[1] = FLAG_REG; insn[i].opt[1] = OPT_REGISTER;
458
        insn[i].type |= IT_BRANCH | IT_VOLATILE;
459
      }
460
    } else {
461
      insn[i].index = -1;
462
      for (j = 0; j < sizeof (conv) / sizeof (cuc_conv); j++)
463
        if (strcmp (conv[j].from, name) == 0) {
464
          const int x = conv[j].to;
465
          if (conv[j].to & II_SIGNED) insn[i].type |= IT_SIGNED;
466
          if (conv[j].to & II_MEM) insn[i].type |= IT_MEMORY | IT_VOLATILE;
467
          change_insn_type (&insn[i], conv[j].to & II_MASK);
468
          break;
469
        }
470 898 markom
      if (strcmp (name, "l.movhi") == 0) {
471
        insn[i].op[1] <<= 16;
472
        insn[i].op[2] = 0;
473
        insn[i].opt[2] = OPT_CONST;
474
      }
475 897 markom
      if (insn[i].index < 0 || insn[i].index == II_NOP && insn[i].op[0] != 0) {
476
        cucdebug (1, "Instruction #%i: \"%s\" not supported (2).\n", i, name);
477
        log ("Instruction #%i: \"%s\" not supported (2).\n", i, name);
478
        return 1;
479 879 markom
      }
480
    }
481
  }
482
  num_insn = i;
483
  fclose (fi);
484
  if (func_return != 2) {
485 897 markom
    cucdebug (1, "Unsupported function structure.\n");
486
    log ("Unsupported function structure.\n");
487
    return 1;
488 879 markom
  }
489
 
490
  log ("Number of instructions loaded = %i\n", num_insn);
491 883 markom
  if (cuc_debug >= 3) print_cuc_insns ("INITIAL", 1);
492 879 markom
 
493
  log ("Converting.\n");
494 1043 markom
  expand_branch ();
495
  if (cuc_debug >= 6) print_cuc_insns ("AFTER_EXP_BRANCH", 0);
496
 
497 879 markom
  remove_dslots ();
498 883 markom
  if (cuc_debug >= 6) print_cuc_insns ("NO_DELAY_SLOTS", 0);
499 879 markom
 
500 897 markom
  if (config.cuc.calling_convention) {
501 879 markom
    detect_locals ();
502 883 markom
    if (cuc_debug >= 7) print_cuc_insns ("AFTER_LOCALS", 0);
503 879 markom
  }
504
  expand_memory ();
505 883 markom
  if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_MEM", 0);
506 879 markom
 
507
  expand_signed ();
508 883 markom
  if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_SIG", 0);
509 906 markom
 
510
  expand_calls ();
511
  if (cuc_debug >= 3) print_cuc_insns ("AFTER_EXP_CALLS", 0);
512 1043 markom
 
513 897 markom
  return 0;
514 879 markom
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.