register_x86.cpp revision 3447:8c92982cbbc4
152419Sjulian/* 252419Sjulian * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 352419Sjulian * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 452419Sjulian * 552419Sjulian * This code is free software; you can redistribute it and/or modify it 652419Sjulian * under the terms of the GNU General Public License version 2 only, as 770784Sjulian * published by the Free Software Foundation. 852419Sjulian * 952419Sjulian * This code is distributed in the hope that it will be useful, but WITHOUT 1052419Sjulian * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1152419Sjulian * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1252419Sjulian * version 2 for more details (a copy is included in the LICENSE file that 1352419Sjulian * accompanied this code). 1452419Sjulian * 1552419Sjulian * You should have received a copy of the GNU General Public License version 1652419Sjulian * 2 along with this work; if not, write to the Free Software Foundation, 1752419Sjulian * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1870784Sjulian * 1952419Sjulian * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2052419Sjulian * or visit www.oracle.com if you need additional information or have any 2152419Sjulian * questions. 2252419Sjulian * 2352419Sjulian */ 2452419Sjulian 2552419Sjulian#include "precompiled.hpp" 2652419Sjulian#include "register_x86.hpp" 2752419Sjulian 2852419Sjulian#ifndef AMD64 2952419Sjulianconst int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers; 3052419Sjulian#else 3152419Sjulianconst int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers << 1; 3252419Sjulian#endif // AMD64 3352419Sjulian 3452419Sjulian 3552419Sjulianconst int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::max_gpr + 3652419Sjulian 2 * FloatRegisterImpl::number_of_registers; 3767506Sjulianconst int ConcreteRegisterImpl::max_xmm = ConcreteRegisterImpl::max_fpr + 3852419Sjulian 8 * XMMRegisterImpl::number_of_registers; 3952419Sjulianconst char* RegisterImpl::name() const { 4052752Sjulian const char* names[number_of_registers] = { 4152419Sjulian#ifndef AMD64 4252419Sjulian "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" 4352419Sjulian#else 4452419Sjulian "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", 4552419Sjulian "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" 4652419Sjulian#endif // AMD64 4752419Sjulian }; 4852419Sjulian return is_valid() ? names[encoding()] : "noreg"; 4952419Sjulian} 5052419Sjulian 5152419Sjulianconst char* FloatRegisterImpl::name() const { 5252419Sjulian const char* names[number_of_registers] = { 5352419Sjulian "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" 5452419Sjulian }; 5552419Sjulian return is_valid() ? names[encoding()] : "noreg"; 5652419Sjulian} 5752419Sjulian 5852419Sjulianconst char* XMMRegisterImpl::name() const { 5952419Sjulian const char* names[number_of_registers] = { 6052419Sjulian "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7" 6152419Sjulian#ifdef AMD64 6252419Sjulian ,"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" 6352419Sjulian#endif // AMD64 6452419Sjulian }; 6552419Sjulian return is_valid() ? names[encoding()] : "xnoreg"; 6652419Sjulian} 6752419Sjulian