pike.git
/
src
/
code
/
sparc.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/code/sparc.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: sparc.c,v 1.
47
2006/
03
/
07
20:
13:22
grubba Exp $
+
|| $Id: sparc.c,v 1.
48
2006/
09
/
08
17:
20:
46
grubba Exp $
*/ /* * Machine code generator for sparc. * * Henrik Grubbström 20010720 */ #include "global.h" #include "svalue.h"
pike.git/src/code/sparc.c:102:
#define SPARC_OP3_LDSB 0x08 #define SPARC_OP3_LDX 0x0b #define SPARC_OP3_STW 0x04 #define SPARC_OP3_STH 0x06 #define SPARC_OP3_STX 0x0e #define SPARC_MEM_OP(OP3, D, S1, S2, I) \ add_to_program(0xc0000000|((D)<<25)|((OP3)<<19)|((S1)<<14)|((I)<<13)| \ ((S2)&0x1fff))
+
#define SPARC_ANDcc(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_ANDcc, D, S1, S2, I)
#define SPARC_OR(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_OR, D, S1, S2, I) #define SPARC_XOR(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_XOR, D, S1, S2, I) #define SPARC_SRA(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_SRA, D, S1, S2, I) #define SPARC_SLL(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_SLL, D, S1, S2, I) #define SPARC_ADD(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_ADD, D, S1, S2, I) #define SPARC_SUBcc(D,S1,S2,I) SPARC_ALU_OP(SPARC_OP3_SUBcc, D, S1, S2, I) #define SPARC_RD(D, RDREG) SPARC_ALU_OP(SPARC_OP3_RD, D, RDREG, 0, 0)
pike.git/src/code/sparc.c:129:
#define SPARC_LDX(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_LDX, D, S1, S2, I) #define SPARC_LDUW(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_LDUW, D, S1, S2, I) #define SPARC_LDUH(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_LDUH, D, S1, S2, I) #define SPARC_STX(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_STX, D, S1, S2, I) #define SPARC_STW(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_STW, D, S1, S2, I) #define SPARC_STH(D,S1,S2,I) SPARC_MEM_OP(SPARC_OP3_STH, D, S1, S2, I) #define SPARC_SETHI(D, VAL) \ add_to_program(0x01000000|((D)<<25)|(((VAL)>>10)&0x3fffff))
+
#define SPARC_NOOP() SPARC_SETHI(SPARC_REG_G0, 0)
-
+
#define SPARC_BA(DISP22, A) \
+
add_to_program(0x10800000|((A)<<29)|(((DISP22)>>2)&0x1fffff))
+
#define SPARC_BE(DISP22, A) \ add_to_program(0x02800000|((A)<<29)|(((DISP22)>>2)&0x1fffff)) #define SPARC_BNE(DISP22, A) \ add_to_program(0x12800000|((A)<<29)|(((DISP22)>>2)&0x1fffff)) #define SPARC_CALL(DISP30) \ add_to_program(0x40000000 | (((DISP30) >> 2) & 0x3fffffff))
pike.git/src/code/sparc.c:745:
delay_ok = 1; addr = (void *)f_get_iterator; } break; case F_ADD - F_OFFSET: SET_REG(SPARC_REG_O0, 2); delay_ok = 1; addr = (void *)f_add; break;
-
+
/* F_ZERO_TYPE? */ } low_ins_call(addr, delay_ok, instrs[b].flags); } void ins_f_byte(unsigned int opcode) { ins_sparc_debug(); low_ins_f_byte(opcode, 0); }
-
void ins_f_byte_with_arg(unsigned int a,
unsigned
INT32 b)
+
void ins_f_byte_with_arg(unsigned int a, INT32 b)
{ ins_sparc_debug(); switch(a) { case F_NUMBER: sparc_push_int(b, 0); return; case F_NEG_NUMBER: sparc_push_int(-(ptrdiff_t)b, 0); return;
pike.git/src/code/sparc.c:786:
sparc_local_lvalue(b); return; case F_POS_INT_INDEX: sparc_push_int(b, 0); low_ins_f_byte(F_INDEX, 1); return; case F_NEG_INT_INDEX: sparc_push_int(-(ptrdiff_t)b, 0); low_ins_f_byte(F_INDEX, 1); return;
-
+
} SET_REG(SPARC_REG_O0, b); low_ins_f_byte(a, 1); return; } void ins_f_byte_with_2_args(unsigned int a,
-
unsigned
INT32 c,
-
unsigned
INT32 b)
+
INT32 c,
+
INT32 b)
{ ins_sparc_debug(); SET_REG(SPARC_REG_O0, c); SET_REG(SPARC_REG_O1, b); low_ins_f_byte(a, 1); return; } #define addstr(s, l) low_my_binary_strcat((s), (l), buf)