/* file "x86/reg_info.h" */

/*
    Copyright (c) 2000 The President and Fellows of Harvard College

    All rights reserved.

    This software is provided under the terms described in
    the "machine/copyright.h" include file.
*/

#ifndef X86_REG_INFO_H
#define X86_REG_INFO_H

#include <machine/copyright.h>

#ifndef SUPPRESS_PRAGMA_INTERFACE
#pragma interface "x86/reg_info.h"
#endif

/*
 * Define identifiers for x86 registers.
 *
 * To add new registers, add a new enum whose identifier values begin
 * beyond the end of the current enum (specified by LAST_X86_REG), then
 * redefine LAST_X86_REG.  Also, enroll new data into the register-
 * indexed data tables.
 */
namespace x86 {
enum {
    CONST0,             // fictitious CONST0 reg
    ESP,
    EBP,

    AL, AH, AX, EAX,
    CL, CH, CX, ECX,
    DL, DH, DX, EDX,
    BL, BH, BX, EBX,

    SI, ESI,
    DI, EDI,

    ES,                 // segment registers
    CS,
    SS,
    DS,
    FS,
    GS,

    EFLAGS,
    EIP,                // instruction pointer
    FPCR,               // FP control register
    FPFLAGS,            // FP status  register
    FPTW,               // FP tag word

    FP0,                // FP stack: %st, %st(1) - %st(7)
    FP7 = FP0 + 7,
};
} // namespace x86

#define LAST_X86_REG (x86::FP7)

const Vector<const char*>& reg_names_x86();
const Vector<int>& reg_widths_x86();
const Vector<RegCells>& reg_models_x86();
const NatSet* reg_allocatables_x86(bool maximals = false);
const NatSet* reg_caller_saves_x86(bool maximals = false);
const NatSet* reg_callee_saves_x86(bool maximals = false);
int reg_maximal_x86(int reg);
int reg_freedom_x86(RegClassMask);
void reg_classify_x86(Instr*, OpndCatalog*, RegClassMap*);
int reg_choice_x86(const NatSet *pool, RegClassMask, const RegCells &excluded,
		   int width, bool rotate);

void init_x86_reg_tables();

#endif /* X86_REG_INFO_H */
