⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i386.c

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/* Subroutines used for code generation on IA-32.   Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,   2002, 2003, 2004, 2005 Free Software Foundation, Inc.This file is part of GCC.GCC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GCC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GCC; see the file COPYING.  If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.  */#include "config.h"#include "system.h"#include "coretypes.h"#include "tm.h"#include "rtl.h"#include "tree.h"#include "tm_p.h"#include "regs.h"#include "hard-reg-set.h"#include "real.h"#include "insn-config.h"#include "conditions.h"#include "output.h"#include "insn-codes.h"#include "insn-attr.h"#include "flags.h"#include "except.h"#include "function.h"#include "recog.h"#include "expr.h"#include "optabs.h"#include "toplev.h"#include "basic-block.h"#include "ggc.h"#include "target.h"#include "target-def.h"#include "langhooks.h"#include "cgraph.h"#include "tree-gimple.h"/* APPLE LOCAL begin pascal strings */#include "../../libcpp/internal.h"extern struct cpp_reader* parse_in;/* APPLE LOCAL end pascal strings *//* APPLE LOCAL begin regparmandstackparm */#include "integrate.h"#include "tree-inline.h"#include "splay-tree.h"#include "tree-pass.h"/* #include "c-tree.h" *//* Ugh.  CTI_MAX brought in with c-common.h collides with optabs.h *//* APPLE LOCAL end regparmandstackparm */#ifndef CHECK_STACK_LIMIT#define CHECK_STACK_LIMIT (-1)#endif/* Return index of given mode in mult and division cost tables.  */#define MODE_INDEX(mode)					\  ((mode) == QImode ? 0						\   : (mode) == HImode ? 1					\   : (mode) == SImode ? 2					\   : (mode) == DImode ? 3					\   : 4)/* Processor costs (relative to an add) *//* APPLE LOCAL begin mainline 2006-04-19 4434601 */static conststruct processor_costs size_cost = {	/* costs for tunning for size */  COSTS_N_INSNS (2),			/* cost of an add instruction */  COSTS_N_INSNS (3),			/* cost of a lea instruction */  COSTS_N_INSNS (2),			/* variable shift costs */  COSTS_N_INSNS (3),			/* constant shift costs */  {COSTS_N_INSNS (3),			/* cost of starting multiply for QI */   COSTS_N_INSNS (3),			/*                               HI */   COSTS_N_INSNS (3),			/*                               SI */   COSTS_N_INSNS (3),			/*                               DI */   COSTS_N_INSNS (5)},			/*                               other */  0,					/* cost of multiply per each bit set */  {COSTS_N_INSNS (3),			/* cost of a divide/mod for QI */   COSTS_N_INSNS (3),			/*                          HI */   COSTS_N_INSNS (3),			/*                          SI */   COSTS_N_INSNS (3),			/*                          DI */   COSTS_N_INSNS (5)},			/*                          other */  COSTS_N_INSNS (3),			/* cost of movsx */  COSTS_N_INSNS (3),			/* cost of movzx */  0,					/* "large" insn */  2,					/* MOVE_RATIO */  2,					/* cost for loading QImode using movzbl */  {2, 2, 2},				/* cost of loading integer registers					   in QImode, HImode and SImode.					   Relative to reg-reg move (2).  */  {2, 2, 2},				/* cost of storing integer registers */  2,					/* cost of reg,reg fld/fst */  {2, 2, 2},				/* cost of loading fp registers					   in SFmode, DFmode and XFmode */  {2, 2, 2},				/* cost of loading integer registers */  3,					/* cost of moving MMX register */  {3, 3},				/* cost of loading MMX registers					   in SImode and DImode */  {3, 3},				/* cost of storing MMX registers					   in SImode and DImode */  3,					/* cost of moving SSE register */  {3, 3, 3},				/* cost of loading SSE registers					   in SImode, DImode and TImode */  {3, 3, 3},				/* cost of storing SSE registers					   in SImode, DImode and TImode */  3,					/* MMX or SSE register to integer */  0,					/* size of prefetch block */  0,					/* number of parallel prefetches */  1,					/* Branch cost */  COSTS_N_INSNS (2),			/* cost of FADD and FSUB insns.  */  COSTS_N_INSNS (2),			/* cost of FMUL instruction.  */  COSTS_N_INSNS (2),			/* cost of FDIV instruction.  */  COSTS_N_INSNS (2),			/* cost of FABS instruction.  */  COSTS_N_INSNS (2),			/* cost of FCHS instruction.  */  COSTS_N_INSNS (2),			/* cost of FSQRT instruction.  */};/* Processor costs (relative to an add) */static conststruct processor_costs i386_cost = {	/* 386 specific costs */  COSTS_N_INSNS (1),			/* cost of an add instruction */  COSTS_N_INSNS (1),			/* cost of a lea instruction */  COSTS_N_INSNS (3),			/* variable shift costs */  COSTS_N_INSNS (2),			/* constant shift costs */  {COSTS_N_INSNS (6),			/* cost of starting multiply for QI */   COSTS_N_INSNS (6),			/*                               HI */   COSTS_N_INSNS (6),			/*                               SI */   COSTS_N_INSNS (6),			/*                               DI */   COSTS_N_INSNS (6)},			/*                               other */  COSTS_N_INSNS (1),			/* cost of multiply per each bit set */  {COSTS_N_INSNS (23),			/* cost of a divide/mod for QI */   COSTS_N_INSNS (23),			/*                          HI */   COSTS_N_INSNS (23),			/*                          SI */   COSTS_N_INSNS (23),			/*                          DI */   COSTS_N_INSNS (23)},			/*                          other */  COSTS_N_INSNS (3),			/* cost of movsx */  COSTS_N_INSNS (2),			/* cost of movzx */  15,					/* "large" insn */  3,					/* MOVE_RATIO */  4,					/* cost for loading QImode using movzbl */  {2, 4, 2},				/* cost of loading integer registers					   in QImode, HImode and SImode.					   Relative to reg-reg move (2).  */  {2, 4, 2},				/* cost of storing integer registers */  2,					/* cost of reg,reg fld/fst */  {8, 8, 8},				/* cost of loading fp registers					   in SFmode, DFmode and XFmode */  {8, 8, 8},				/* cost of loading integer registers */  2,					/* cost of moving MMX register */  {4, 8},				/* cost of loading MMX registers					   in SImode and DImode */  {4, 8},				/* cost of storing MMX registers					   in SImode and DImode */  2,					/* cost of moving SSE register */  {4, 8, 16},				/* cost of loading SSE registers					   in SImode, DImode and TImode */  {4, 8, 16},				/* cost of storing SSE registers					   in SImode, DImode and TImode */  3,					/* MMX or SSE register to integer */  0,					/* size of prefetch block */  0,					/* number of parallel prefetches */  1,					/* Branch cost */  COSTS_N_INSNS (23),			/* cost of FADD and FSUB insns.  */  COSTS_N_INSNS (27),			/* cost of FMUL instruction.  */  COSTS_N_INSNS (88),			/* cost of FDIV instruction.  */  COSTS_N_INSNS (22),			/* cost of FABS instruction.  */  COSTS_N_INSNS (24),			/* cost of FCHS instruction.  */  COSTS_N_INSNS (122),			/* cost of FSQRT instruction.  */};static conststruct processor_costs i486_cost = {	/* 486 specific costs */  COSTS_N_INSNS (1),			/* cost of an add instruction */  COSTS_N_INSNS (1),			/* cost of a lea instruction */  COSTS_N_INSNS (3),			/* variable shift costs */  COSTS_N_INSNS (2),			/* constant shift costs */  {COSTS_N_INSNS (12),			/* cost of starting multiply for QI */   COSTS_N_INSNS (12),			/*                               HI */   COSTS_N_INSNS (12),			/*                               SI */   COSTS_N_INSNS (12),			/*                               DI */   COSTS_N_INSNS (12)},			/*                               other */  1,					/* cost of multiply per each bit set */  {COSTS_N_INSNS (40),			/* cost of a divide/mod for QI */   COSTS_N_INSNS (40),			/*                          HI */   COSTS_N_INSNS (40),			/*                          SI */   COSTS_N_INSNS (40),			/*                          DI */   COSTS_N_INSNS (40)},			/*                          other */  COSTS_N_INSNS (3),			/* cost of movsx */  COSTS_N_INSNS (2),			/* cost of movzx */  15,					/* "large" insn */  3,					/* MOVE_RATIO */  4,					/* cost for loading QImode using movzbl */  {2, 4, 2},				/* cost of loading integer registers					   in QImode, HImode and SImode.					   Relative to reg-reg move (2).  */  {2, 4, 2},				/* cost of storing integer registers */  2,					/* cost of reg,reg fld/fst */  {8, 8, 8},				/* cost of loading fp registers					   in SFmode, DFmode and XFmode */  {8, 8, 8},				/* cost of loading integer registers */  2,					/* cost of moving MMX register */  {4, 8},				/* cost of loading MMX registers					   in SImode and DImode */  {4, 8},				/* cost of storing MMX registers					   in SImode and DImode */  2,					/* cost of moving SSE register */  {4, 8, 16},				/* cost of loading SSE registers					   in SImode, DImode and TImode */  {4, 8, 16},				/* cost of storing SSE registers					   in SImode, DImode and TImode */  3,					/* MMX or SSE register to integer */  0,					/* size of prefetch block */  0,					/* number of parallel prefetches */  1,					/* Branch cost */  COSTS_N_INSNS (8),			/* cost of FADD and FSUB insns.  */  COSTS_N_INSNS (16),			/* cost of FMUL instruction.  */  COSTS_N_INSNS (73),			/* cost of FDIV instruction.  */  COSTS_N_INSNS (3),			/* cost of FABS instruction.  */  COSTS_N_INSNS (3),			/* cost of FCHS instruction.  */  COSTS_N_INSNS (83),			/* cost of FSQRT instruction.  */};static conststruct processor_costs pentium_cost = {  COSTS_N_INSNS (1),			/* cost of an add instruction */  COSTS_N_INSNS (1),			/* cost of a lea instruction */  COSTS_N_INSNS (4),			/* variable shift costs */  COSTS_N_INSNS (1),			/* constant shift costs */  {COSTS_N_INSNS (11),			/* cost of starting multiply for QI */   COSTS_N_INSNS (11),			/*                               HI */   COSTS_N_INSNS (11),			/*                               SI */   COSTS_N_INSNS (11),			/*                               DI */   COSTS_N_INSNS (11)},			/*                               other */  0,					/* cost of multiply per each bit set */  {COSTS_N_INSNS (25),			/* cost of a divide/mod for QI */   COSTS_N_INSNS (25),			/*                          HI */   COSTS_N_INSNS (25),			/*                          SI */   COSTS_N_INSNS (25),			/*                          DI */   COSTS_N_INSNS (25)},			/*                          other */  COSTS_N_INSNS (3),			/* cost of movsx */  COSTS_N_INSNS (2),			/* cost of movzx */  8,					/* "large" insn */  6,					/* MOVE_RATIO */  6,					/* cost for loading QImode using movzbl */  {2, 4, 2},				/* cost of loading integer registers					   in QImode, HImode and SImode.					   Relative to reg-reg move (2).  */  {2, 4, 2},				/* cost of storing integer registers */  2,					/* cost of reg,reg fld/fst */  {2, 2, 6},				/* cost of loading fp registers					   in SFmode, DFmode and XFmode */  {4, 4, 6},				/* cost of loading integer registers */  8,					/* cost of moving MMX register */  {8, 8},				/* cost of loading MMX registers					   in SImode and DImode */  {8, 8},				/* cost of storing MMX registers					   in SImode and DImode */  2,					/* cost of moving SSE register */  {4, 8, 16},				/* cost of loading SSE registers					   in SImode, DImode and TImode */  {4, 8, 16},				/* cost of storing SSE registers					   in SImode, DImode and TImode */  3,					/* MMX or SSE register to integer */  0,					/* size of prefetch block */  0,					/* number of parallel prefetches */  2,					/* Branch cost */  COSTS_N_INSNS (3),			/* cost of FADD and FSUB insns.  */  COSTS_N_INSNS (3),			/* cost of FMUL instruction.  */  COSTS_N_INSNS (39),			/* cost of FDIV instruction.  */  COSTS_N_INSNS (1),			/* cost of FABS instruction.  */  COSTS_N_INSNS (1),			/* cost of FCHS instruction.  */  COSTS_N_INSNS (70),			/* cost of FSQRT instruction.  */};static conststruct processor_costs pentiumpro_cost = {  COSTS_N_INSNS (1),			/* cost of an add instruction */  COSTS_N_INSNS (1),			/* cost of a lea instruction */  COSTS_N_INSNS (1),			/* variable shift costs */  COSTS_N_INSNS (1),			/* constant shift costs */  {COSTS_N_INSNS (4),			/* cost of starting multiply for QI */   COSTS_N_INSNS (4),			/*                               HI */   COSTS_N_INSNS (4),			/*                               SI */   COSTS_N_INSNS (4),			/*                               DI */   COSTS_N_INSNS (4)},			/*                               other */  0,					/* cost of multiply per each bit set */  {COSTS_N_INSNS (17),			/* cost of a divide/mod for QI */   COSTS_N_INSNS (17),			/*                          HI */   COSTS_N_INSNS (17),			/*                          SI */   COSTS_N_INSNS (17),			/*                          DI */   COSTS_N_INSNS (17)},			/*                          other */  COSTS_N_INSNS (1),			/* cost of movsx */  COSTS_N_INSNS (1),			/* cost of movzx */  8,					/* "large" insn */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -