comparison mc-codegen.c @ 320:183726ccd83d

asm minor fix. ia32 table jmp fix.
author kono
date Sat, 19 Jun 2004 00:13:36 +0900
parents 22d92986c7f7
children e5d40f8c4cce
comparison
equal deleted inserted replaced
319:88cf6512fa1b 320:183726ccd83d
17 static void assign(int e1); 17 static void assign(int e1);
18 static void assop(int e1); 18 static void assop(int e1);
19 static int g_expr0(int e1); 19 static int g_expr0(int e1);
20 static int register_to_lvar(int e); 20 static int register_to_lvar(int e);
21 static void bexpr_u(int e1, char cond, int l1); 21 static void bexpr_u(int e1, char cond, int l1);
22 static void code_asm(int asm0,int in,int out,int opt,int e);
22 23
23 #if FLOAT_CODE 24 #if FLOAT_CODE
24 25
25 /* floating point */ 26 /* floating point */
26 27
1796 } 1797 }
1797 } 1798 }
1798 return 0; 1799 return 0;
1799 } 1800 }
1800 1801
1802 #if ASM_CODE
1803
1804
1805 /*
1806 __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (a
1807 ddr));
1808 asm string : output constraint parameter : input constraint parameter : opt
1809
1810 1: asm string %1,%2 will be replaced by register or value
1811 2: constraint gcc constraint sting
1812 prefix
1813 = overwrite by this asm for output
1814 & overwrite by this asm and can't be used as input register
1815 ignored in this compiler
1816 constraints
1817 m value expression is modified (no coresponding register)
1818 information for compiler
1819 r register for input or output
1820 input register, output register can be shared
1821 0-9 same operands as outout register in input constraints
1822 3: opt "cc", "memory"
1823 ignored in this compiler
1824 */
1825
1826 static void
1827 code_asm(int asm0,int in,int out,int opt,int e)
1828 {
1829 int i,e1,n;
1830 int repl = 0;
1831 int repl0;
1832 int assign = 0;
1833 char *p;
1834
1835 printf("# asm\n");
1836 in = reverse0(in);
1837 out = reverse0(out);
1838 e = reverse0(e);
1839 for(i=out;i;i=cadr(i)) {
1840 p = (char*)cadr(car(i));
1841 e1 = car(e); e = cadr(e);
1842 repl = asm_operand(p,e1,ASM_OUTPUT,repl,0,0);
1843 if (car(car(repl))==REGISTER) {
1844 assign = list2(assign_expr0(e1,car(repl),INT,INT),assign);
1845 }
1846 }
1847 repl0 = repl;
1848 n = length(repl0);
1849 for(i=in;i;i=cadr(i)) {
1850 p = (char*)cadr(car(i));
1851 e1 = car(e); e = cadr(e);
1852 repl = asm_operand(p,e1,ASM_INPUT,repl,n,repl0);
1853 if (car(car(repl))==REGISTER) {
1854 g_expr_u(assign_expr0(car(repl),e1,INT,INT));
1855 }
1856 }
1857 repl = reverse0(repl);
1858 replace_asm_string((char*)cadr(asm0),repl);
1859 for(i=assign;i;i=cadr(i)) {
1860 g_expr_u(car(i));
1861 }
1862 free_asm_operand(repl);
1863 // no check for opt
1864 }
1865
1866
1867
1868 #endif
1869
1801 /* end */ 1870 /* end */