scc

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

i386.c (1581B)


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