1 /* 2 * Copyright (c) 2006 - 2010, Nils R. Weller 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 #ifndef AMD64_GEN_H 28 #define AMD64_GEN_H 29 30 struct backend; 31 struct vreg; 32 struct icode_instr; 33 34 struct init_with_name; 35 36 #include "reg.h" 37 38 struct amd64_va_patches { 39 int *gp_offset; 40 int *fp_offset; 41 struct stack_block *overflow_arg_area; 42 struct stack_block *reg_save_area; 43 44 /* 45 * 08/07/08: Allow for multiple va_start() per function... DUH!!!! 46 */ 47 struct amd64_va_patches *next; 48 }; 49 50 typedef void (*emit_amd64_cvtsi2sd_func_t)(struct icode_instr *); 51 typedef void (*emit_amd64_cvtsi2ss_func_t)(struct icode_instr *); 52 typedef void (*emit_amd64_cvtsi2sdq_func_t)(struct icode_instr *); 53 typedef void (*emit_amd64_cvtsi2ssq_func_t)(struct icode_instr *); 54 typedef void (*emit_amd64_cvttsd2si_func_t)(struct icode_instr *); 55 typedef void (*emit_amd64_cvttsd2siq_func_t)(struct icode_instr *); 56 typedef void (*emit_amd64_cvttss2si_func_t)(struct icode_instr *); 57 typedef void (*emit_amd64_cvttss2siq_func_t)(struct icode_instr *); 58 typedef void (*emit_amd64_cvtsd2ss_func_t)(struct icode_instr *); 59 typedef void (*emit_amd64_cvtss2sd_func_t)(struct icode_instr *); 60 typedef void (*emit_amd64_load_negmask_func_t)(struct icode_instr *); 61 typedef void (*emit_amd64_xorps_func_t)(struct icode_instr *); 62 typedef void (*emit_amd64_xorpd_func_t)(struct icode_instr *); 63 typedef void (*emit_amd64_ulong_to_float_func_t)(struct icode_instr *); 64 65 struct emitter_amd64 { 66 emit_amd64_cvtsi2sd_func_t cvtsi2sd; 67 emit_amd64_cvtsi2ss_func_t cvtsi2ss; 68 emit_amd64_cvtsi2sdq_func_t cvtsi2sdq; 69 emit_amd64_cvtsi2ssq_func_t cvtsi2ssq; 70 emit_amd64_cvttsd2si_func_t cvttsd2si; 71 emit_amd64_cvttsd2siq_func_t cvttsd2siq; 72 emit_amd64_cvttss2si_func_t cvttss2si; 73 emit_amd64_cvttss2siq_func_t cvttss2siq; 74 emit_amd64_cvtsd2ss_func_t cvtsd2ss; 75 emit_amd64_cvtss2sd_func_t cvtss2sd; 76 emit_amd64_load_negmask_func_t load_negmask; 77 emit_amd64_xorps_func_t xorps; 78 emit_amd64_xorpd_func_t xorpd; 79 emit_amd64_ulong_to_float_func_t ulong_to_float; 80 }; 81 82 extern int amd64_need_negmask; /* XXX this sucks */ 83 extern int amd64_need_ulong_float_mask; /* 08/04/08: ... this too :-) */ 84 85 extern struct emitter_amd64 *emit_amd64; 86 87 struct reg *find_top_reg(struct reg *r); 88 extern struct reg *amd64_argregs[]; 89 90 extern struct backend amd64_backend; 91 extern struct reg amd64_x86_gprs[7]; 92 extern struct reg amd64_gprs[16]; 93 extern struct stack_block *saved_ret_addr; 94 extern struct emitter_x86 *emit_x86; 95 96 extern struct init_with_name *init_list_head; 97 extern struct init_with_name *init_list_tail; 98 99 #endif 100 101