scc

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

i386.c (1526B)


      1 #include <scc/scc.h>
      2 
      3 #include "../../as.h"
      4 #include "../x86/proc.h"
      5 
      6 TUINT maxaddr = 0xFFFFFFFF;
      7 int endian = LITTLE_ENDIAN;
      8 
      9 void
     10 iarch(void)
     11 {
     12 	static struct {
     13 		char *name;
     14 		char type;
     15 	} regs[] = {
     16 		"CS", AREG_CS,
     17 		"DS", AREG_DS,
     18 		"SS", AREG_SS,
     19 		"ES", AREG_ES,
     20 		"FS", AREG_FS,
     21 		"GS", AREG_GS,
     22 
     23 		"AX", AREG_AX,
     24 		"AL", AREG_AL,
     25 		"AH", AREG_AH,
     26 		"EAX", AREG_EAX,
     27 
     28 		"BC", AREG_BX,
     29 		"BL", AREG_BL,
     30 		"BH", AREG_BH,
     31 		"EBX", AREG_EBX,
     32 
     33 		"CX", AREG_CX,
     34 		"CL", AREG_CL,
     35 		"CH", AREG_CH,
     36 		"ECX", AREG_ECX,
     37 
     38 		"DX", AREG_DX,
     39 		"DL", AREG_DL,
     40 		"DH", AREG_DH,
     41 		"EDX", AREG_EDX,
     42 
     43 		"SI", AREG_SI,
     44 		"ESI", AREG_ESI,
     45 		"DI", AREG_DI,
     46 		"EDI", AREG_EDI,
     47 
     48 		"SP", AREG_SP,
     49 		"ESP", AREG_ESP,
     50 
     51 		"BP", AREG_BP,
     52 		"EBP", AREG_EBP,
     53 
     54 		"R0", AREG_R0,
     55 		"MM0", AREG_MM0,
     56 		"R1", AREG_R1,
     57 		"MM1", AREG_MM1,
     58 		"R2", AREG_R2,
     59 		"MM2", AREG_MM2,
     60 		"R3", AREG_R3,
     61 		"MM3", AREG_MM3,
     62 		"R4", AREG_R4,
     63 		"MM4", AREG_MM4,
     64 		"R5", AREG_R5,
     65 		"MM5", AREG_MM5,
     66 		"R6", AREG_R6,
     67 		"MM6", AREG_MM6,
     68 		"R7", AREG_R7,
     69 		"MM7", AREG_MM7,
     70 
     71 		"XMM0", AREG_XMM0,
     72 		"XMM1", AREG_XMM1,
     73 		"XMM2", AREG_XMM2,
     74 		"XMM3", AREG_XMM3,
     75 		"XMM4", AREG_XMM4,
     76 		"XMM5", AREG_XMM5,
     77 		"XMM6", AREG_XMM6,
     78 		"XMM7", AREG_XMM7,
     79 
     80 		"YMM0", AREG_YMM0,
     81 		"YMM1", AREG_YMM1,
     82 		"YMM2", AREG_YMM2,
     83 		"YMM3", AREG_YMM3,
     84 		"YMM4", AREG_YMM4,
     85 		"YMM5", AREG_YMM5,
     86 		"YMM6", AREG_YMM6,
     87 		"YMM7", AREG_YMM7,
     88 
     89 		"MXCSR", AREG_MXCSR,
     90 
     91 		NULL
     92 	}, *bp;
     93 
     94 	for (bp = regs; bp->name; ++bp) {
     95 		Symbol *sym = lookup(bp->name);
     96 		sym->flags = FREG;
     97 		sym->value = bp->type;
     98 	}
     99 }