1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/register.hpp"
  27 #include "c1/c1_FrameMap.hpp"
  28 #include "c1/c1_LIR.hpp"
  29 
  30 
  31 FloatRegister LIR_OprDesc::as_float_reg() const {
  32   ShouldNotReachHere();
  33   return fnoreg;
  34 }
  35 
  36 FloatRegister LIR_OprDesc::as_double_reg() const {
  37   ShouldNotReachHere();
  38   return fnoreg;
  39 }
  40 
  41 XMMRegister LIR_OprDesc::as_xmm_float_reg() const {
  42   return FrameMap::nr2xmmreg(xmm_regnr());
  43 }
  44 
  45 XMMRegister LIR_OprDesc::as_xmm_double_reg() const {
  46   assert(xmm_regnrLo() == xmm_regnrHi(), "assumed in calculation");
  47   return FrameMap::nr2xmmreg(xmm_regnrLo());
  48 }
  49 
  50 // Reg2 unused.
  51 LIR_Opr LIR_OprFact::double_fpu(int reg1, int reg2) {
  52   assert(as_FloatRegister(reg2) == fnoreg, "Not used on this platform");
  53   return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
  54                              (reg1 << LIR_OprDesc::reg2_shift) |
  55                              LIR_OprDesc::double_type          |
  56                              LIR_OprDesc::fpu_register         |
  57                              LIR_OprDesc::double_size);
  58 }
  59 
  60 #ifndef PRODUCT
  61 void LIR_Address::verify() const {
  62 #ifdef _LP64
  63   assert(base()->is_cpu_register(), "wrong base operand");
  64   assert(index()->is_illegal() || index()->is_double_cpu(), "wrong index operand");
  65   assert(base()->type() == T_OBJECT || base()->type() == T_LONG || base()->type() == T_METADATA,
  66          "wrong type for addresses");
  67 #else
  68   assert(base()->is_single_cpu(), "wrong base operand");
  69   assert(index()->is_illegal() || index()->is_single_cpu(), "wrong index operand");
  70   assert(base()->type() == T_OBJECT || base()->type() == T_INT || base()->type() == T_METADATA,
  71          "wrong type for addresses");
  72 #endif
  73 }
  74 #endif // PRODUCT