157b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe/*
257b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * Copyright (C) 2014 The Android Open Source Project
357b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe *
457b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License");
557b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * you may not use this file except in compliance with the License.
657b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * You may obtain a copy of the License at
757b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe *
857b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe *      http://www.apache.org/licenses/LICENSE-2.0
957b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe *
1057b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * Unless required by applicable law or agreed to in writing, software
1157b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS,
1257b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1357b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * See the License for the specific language governing permissions and
1457b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe * limitations under the License.
1557b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe */
1657b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
1757b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe#include "managed_register_mips64.h"
1857b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
1957b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe#include "globals.h"
2057b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
2157b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampenamespace art {
2257b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampenamespace mips64 {
2357b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
2457b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampebool Mips64ManagedRegister::Overlaps(const Mips64ManagedRegister& other) const {
2557b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  if (IsNoRegister() || other.IsNoRegister()) return false;
2657b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  CHECK(IsValidManagedRegister());
2757b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  CHECK(other.IsValidManagedRegister());
2857b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  if (Equals(other)) return true;
2957b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  return false;
3057b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe}
3157b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
3257b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampevoid Mips64ManagedRegister::Print(std::ostream& os) const {
3357b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  if (!IsValidManagedRegister()) {
3457b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe    os << "No Register";
3557b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  } else if (IsGpuRegister()) {
3657b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe    os << "GPU: " << static_cast<int>(AsGpuRegister());
3757b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  } else if (IsFpuRegister()) {
3857b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe     os << "FpuRegister: " << static_cast<int>(AsFpuRegister());
3957b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  } else {
4057b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe    os << "??: " << RegId();
4157b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  }
4257b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe}
4357b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
4457b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampestd::ostream& operator<<(std::ostream& os, const Mips64ManagedRegister& reg) {
4557b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  reg.Print(os);
4657b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe  return os;
4757b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe}
4857b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe
4957b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe}  // namespace mips64
5057b34294758e9c00993913ebe43c7ee4698a5cc6Andreas Gampe}  // namespace art
51