001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.compilers.opt.regalloc.ia32;
014
015import static org.jikesrvm.ia32.RegisterConstants.NUM_FPRS;
016import static org.jikesrvm.ia32.RegisterConstants.NUM_GPRS;
017
018/**
019 * This class holds constants that describe IA32 physical register set.
020 */
021public final class PhysicalRegisterConstants {
022
023  /*
024   * There are different types of hardware registers, so we define
025   * the following register classes:
026   * NOTE: they must be in consecutive ordering
027   * TODO: Kill this?
028   */
029  public static final byte INT_REG = 0;
030  public static final byte DOUBLE_REG = 1;
031  public static final byte SPECIAL_REG = 2;
032  public static final byte NUMBER_TYPE = 3;
033
034  /*
035   * Derived constants for use by the register pool.
036   * In the register pool, the physical registers are assigned integers
037   * based on these constants.
038   */
039  public static final int FIRST_INT = 0;
040  public static final int FIRST_DOUBLE = NUM_GPRS;
041  public static final int FIRST_SPECIAL = NUM_GPRS + NUM_FPRS;
042
043  /** special intel registers or register sub-fields. */
044  public static final int NUM_SPECIALS = 12;
045  /** AF bit of EFLAGS */
046  public static final int AF = FIRST_SPECIAL + 0;
047  /** CF bit of EFLAGS */
048  public static final int CF = FIRST_SPECIAL + 1;
049  /** OF bit of EFLAGS */
050  public static final int OF = FIRST_SPECIAL + 2;
051  /** PF bit of EFLAGS */
052  public static final int PF = FIRST_SPECIAL + 3;
053  /** SF bit of EFLAGS */
054  public static final int SF = FIRST_SPECIAL + 4;
055  /** ZF bit of EFLAGS */
056  public static final int ZF = FIRST_SPECIAL + 5;
057  /** C0 bit of EFLAGS */
058  public static final int C0 = FIRST_SPECIAL + 6;
059  /** C1 bit of EFLAGS */
060  public static final int C1 = FIRST_SPECIAL + 7;
061  /** C2 bit of EFLAGS */
062  public static final int C2 = FIRST_SPECIAL + 8;
063  /** C3 bit of EFLAGS */
064  public static final int C3 = FIRST_SPECIAL + 9;
065  /** ST0 - top of FP stack (for SSE2) */
066  public static final int ST0 = FIRST_SPECIAL + 10;
067  /** ST1 - below top of FP stack (for SSE2) */
068  public static final int ST1 = FIRST_SPECIAL + 11;
069
070  private PhysicalRegisterConstants() {
071    // prevent instantiation
072  }
073}