Select Git revision
arch_i386_gen.c
arch_i386_gen.c 118.21 KiB
/*
* $Id: arch_i386_gen.c,v 1.320 2012/02/24 07:14:31 vrsieh Exp $
*
* Copyright (C) 2008-2009 FAUcc Team <info@faumachine.org>.
* This program is free software. You can redistribute it and/or modify it
* under the terms of the GNU General Public License, either version 2 of
* the License, or (at your option) any later version. See COPYING.
*/
/*
* For gcc inline assembler see e.g.
* http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
*/
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include "identifier.h"
#include "declaration.h"
#include "scope.h"
#include "stmt.h"
#include "simplify.h"
#include "arch_i386_gen.h"
#include "regalloc.h"
#include "cc1.h"
static struct declaration *arch_mul_int64;
static struct declaration *arch_mul_uint64;
static struct declaration *arch_div_int64;
static struct declaration *arch_div_uint64;
static struct declaration *arch_mod_int64;
static struct declaration *arch_mod_uint64;
enum reg {
/*0*/ AL, DL, CL, BL,
/*4*/ AH, DH, CH, BH,
/*8*/ AX, DX, CX, BX, DI, SI,
/*14*/ EAX, EDX, ECX, EBX, EDI, ESI,
/*20*/ EAX_EBX, EAX_ECX, EAX_EDX, EAX_EDI, EAX_ESI,
/*25*/ EBX_EAX, EBX_ECX, EBX_EDX, EBX_EDI, EBX_ESI,
/*30*/ ECX_EAX, ECX_EBX, ECX_EDX, ECX_EDI, ECX_ESI,
/*35*/ EDX_EAX, EDX_EBX, EDX_ECX, EDX_EDI, EDX_ESI,
/*40*/ EDI_EAX, EDI_EBX, EDI_ECX, EDI_EDX, EDI_ESI,
/*45*/ ESI_EAX, ESI_EBX, ESI_ECX, ESI_EDX, ESI_EDI,
/*50*/ ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7,
/*58*/ REG_COUNT
};
enum class {
CLASS_NONE,
CLASS_A,
CLASS_D,
CLASS_S,
CLASS_a,
CLASS_b,
CLASS_c,
CLASS_d,
CLASS_f,
CLASS_q,
CLASS_r,
CLASS_t,
CLASS_u,
CLASS_st2,
CLASS_st3,
CLASS_st4,