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 */
013 package org.jikesrvm.ia32;
014
015 import org.jikesrvm.Constants;
016 import org.vmmagic.unboxed.Offset;
017 import org.jikesrvm.VM;
018
019 /**
020 * Registers used by baseline compiler implementation of virtual machine.
021 */
022 public interface BaselineConstants extends Constants, ArchConstants {
023
024 int WORDSIZE = VM.BuildFor64Addr ? 8 : 4; // bytes
025 int LG_WORDSIZE = VM.BuildFor64Addr ? 3 : 2;
026
027 // Dedicated registers.
028 //
029 RegisterConstants.GPR SP = ESP;
030 RegisterConstants.GPR TR = THREAD_REGISTER;
031
032 // Volatile (parameter) registers.
033 //
034 RegisterConstants.GPR T0 = EAX; // DO NOT CHANGE THIS ASSIGNMENT
035 RegisterConstants.GPR T1 = EDX;
036
037 // scratch register
038 RegisterConstants.GPR S0 = ECX;
039 RegisterConstants.GPR S1 = EDI;
040
041 // Constants describing baseline compiler conventions for
042 // saving registers in stackframes.
043 //
044 int STACKFRAME_REG_SAVE_OFFSET = STACKFRAME_BODY_OFFSET;
045 // offset from FP of the saved registers.
046 // Some registers are saved in all baseline
047 // frames, and most register as saved in the
048 // dynamic bridge frames.
049 int STACKFRAME_FIRST_PARAMETER_OFFSET = STACKFRAME_REG_SAVE_OFFSET - (2 * WORDSIZE);
050 // bridge frames save 2 additional GPRs
051 int BRIDGE_FRAME_EXTRA_SIZE = (SSE2_FULL ? XMM_STATE_SIZE : FPU_STATE_SIZE) + (2 * WORDSIZE);
052
053 int SAVED_GPRS = 2; // EDI and EBX are nonvolatile registers used by baseline compiler
054 int SAVED_GPRS_FOR_SAVE_LS_REGISTERS = 3; // save all non-volatiles
055 Offset EDI_SAVE_OFFSET = Offset.fromIntSignExtend(STACKFRAME_REG_SAVE_OFFSET);
056 Offset EBX_SAVE_OFFSET = Offset.fromIntSignExtend(STACKFRAME_REG_SAVE_OFFSET).minus(WORDSIZE);
057 Offset EBP_SAVE_OFFSET = Offset.fromIntSignExtend(STACKFRAME_REG_SAVE_OFFSET).minus(WORDSIZE*2);
058 Offset T0_SAVE_OFFSET = Offset.fromIntSignExtend(STACKFRAME_FIRST_PARAMETER_OFFSET);
059 Offset T1_SAVE_OFFSET = Offset.fromIntSignExtend(STACKFRAME_FIRST_PARAMETER_OFFSET).minus(WORDSIZE);
060 Offset FPU_SAVE_OFFSET = T1_SAVE_OFFSET.minus(FPU_STATE_SIZE);
061 Offset XMM_SAVE_OFFSET = T1_SAVE_OFFSET.minus(XMM_STATE_SIZE);
062 }
063