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.compilers.opt.ir.ia32; 014 015 import org.jikesrvm.classloader.RVMMethod; 016 import org.jikesrvm.compilers.opt.ir.GenericRegisterPool; 017 import org.jikesrvm.compilers.opt.ir.IR; 018 import org.jikesrvm.compilers.opt.ir.Instruction; 019 import org.jikesrvm.compilers.opt.ir.Operators; 020 import org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand; 021 import org.jikesrvm.compilers.opt.ir.operand.Operand; 022 import org.jikesrvm.runtime.Magic; 023 import org.vmmagic.unboxed.Address; 024 025 /** 026 * Pool of symbolic registers.<p> 027 * 028 * Intel specific implementation where JTOC is stored in the processor object 029 * and accessed through the processor register. 030 * 031 * @see org.jikesrvm.compilers.opt.ir.Register 032 */ 033 public abstract class RegisterPool extends GenericRegisterPool implements Operators { 034 035 /** 036 * Initializes a new register pool for the method meth. 037 * 038 * @param meth the RVMMethod of the outermost method 039 */ 040 protected RegisterPool(RVMMethod meth) { 041 super(meth); 042 } 043 044 /** 045 * Return a constant operand that is the base address of the JTOC. 046 * <p> 047 * TODO: This really should be returning an AddressConstantOperand, 048 * but that causes rippling changes in BURS that are larger 049 * than we want to deal with right now. 050 * 051 * @param ir the containing IR 052 * @param s the instruction to insert the load operand before 053 * @return a register operand that holds the JTOC 054 */ 055 public Operand makeJTOCOp(IR ir, Instruction s) { 056 Address jtoc = Magic.getTocPointer(); 057 return new IntConstantOperand(jtoc.toInt()); 058 } 059 }