scc

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

i386.c (1557B)


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