scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

powerpc.c (959B)


      1 #include <stdlib.h>
      2 
      3 #include <scc/scc.h>
      4 
      5 #include "../../as.h"
      6 #include "proc.h"
      7 
      8 TUINT maxaddr = 0xFFFF;
      9 int endian = BIG_ENDIAN;
     10 int left2right = 0;
     11 
     12 void
     13 iarch(void)
     14 {
     15 	static struct {
     16 		char *name;
     17 		char type;
     18 	} regs[] = {
     19 		"R0", AREG_R0,
     20 		"R1", AREG_R1,
     21 		"R2", AREG_R2,
     22 		"R3", AREG_R3,
     23 		"R4", AREG_R4,
     24 		"R5", AREG_R5,
     25 		"R6", AREG_R6,
     26 		"R7", AREG_R7,
     27 		"R8", AREG_R8,
     28 		"R9", AREG_R9,
     29 
     30 		"R10", AREG_R10,
     31 		"R11", AREG_R11,
     32 		"R12", AREG_R12,
     33 		"R13", AREG_R13,
     34 		"R14", AREG_R14,
     35 		"R15", AREG_R15,
     36 		"R16", AREG_R16,
     37 		"R17", AREG_R17,
     38 		"R18", AREG_R18,
     39 		"R19", AREG_R19,
     40 
     41 		"R20", AREG_R20,
     42 		"R21", AREG_R21,
     43 		"R22", AREG_R22,
     44 		"R23", AREG_R23,
     45 		"R24", AREG_R24,
     46 		"R25", AREG_R25,
     47 		"R26", AREG_R26,
     48 		"R27", AREG_R27,
     49 		"R28", AREG_R28,
     50 		"R29", AREG_R29,
     51 		"R30", AREG_R30,
     52 		"R31", AREG_R31,
     53 
     54 		NULL
     55 	}, *bp;
     56 
     57 	for (bp = regs; bp->name; ++bp) {
     58 		Symbol *sym = lookup(bp->name);
     59 		sym->flags = FREG;
     60 		sym->value = bp->type;
     61 	}
     62 }