16691Stjones1@inf.ed.ac.uk/* 26691Stjones1@inf.ed.ac.uk * Copyright (c) 2009 The University of Edinburgh 39913Ssteve.reinhardt@amd.com * Copyright (c) 2013 Advanced Micro Devices, Inc. 46691Stjones1@inf.ed.ac.uk * All rights reserved. 56691Stjones1@inf.ed.ac.uk * 66691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without 76691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are 86691Stjones1@inf.ed.ac.uk * met: redistributions of source code must retain the above copyright 96691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer; 106691Stjones1@inf.ed.ac.uk * redistributions in binary form must reproduce the above copyright 116691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer in the 126691Stjones1@inf.ed.ac.uk * documentation and/or other materials provided with the distribution; 136691Stjones1@inf.ed.ac.uk * neither the name of the copyright holders nor the names of its 146691Stjones1@inf.ed.ac.uk * contributors may be used to endorse or promote products derived from 156691Stjones1@inf.ed.ac.uk * this software without specific prior written permission. 166691Stjones1@inf.ed.ac.uk * 176691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 186691Stjones1@inf.ed.ac.uk * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 196691Stjones1@inf.ed.ac.uk * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 206691Stjones1@inf.ed.ac.uk * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 216691Stjones1@inf.ed.ac.uk * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 226691Stjones1@inf.ed.ac.uk * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 236691Stjones1@inf.ed.ac.uk * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 246691Stjones1@inf.ed.ac.uk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 256691Stjones1@inf.ed.ac.uk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 266691Stjones1@inf.ed.ac.uk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 276691Stjones1@inf.ed.ac.uk * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 286691Stjones1@inf.ed.ac.uk * 296691Stjones1@inf.ed.ac.uk * Authors: Timothy M. Jones 306691Stjones1@inf.ed.ac.uk */ 316691Stjones1@inf.ed.ac.uk 326691Stjones1@inf.ed.ac.uk#include "arch/power/insts/static_inst.hh" 3311793Sbrandon.potter@amd.com 349913Ssteve.reinhardt@amd.com#include "cpu/reg_class.hh" 356691Stjones1@inf.ed.ac.uk 366691Stjones1@inf.ed.ac.ukusing namespace PowerISA; 376691Stjones1@inf.ed.ac.uk 386691Stjones1@inf.ed.ac.ukvoid 3912104Snathanael.premillieu@arm.comPowerStaticInst::printReg(std::ostream &os, RegId reg) const 406691Stjones1@inf.ed.ac.uk{ 4112106SRekai.GonzalezAlberquilla@arm.com if (reg.isIntReg()) 4212106SRekai.GonzalezAlberquilla@arm.com ccprintf(os, "r%d", reg.index()); 4312106SRekai.GonzalezAlberquilla@arm.com else if (reg.isFloatReg()) 4412106SRekai.GonzalezAlberquilla@arm.com ccprintf(os, "f%d", reg.index()); 4512106SRekai.GonzalezAlberquilla@arm.com else if (reg.isMiscReg()) 4612106SRekai.GonzalezAlberquilla@arm.com switch (reg.index()) { 479913Ssteve.reinhardt@amd.com case 0: ccprintf(os, "cr"); break; 489913Ssteve.reinhardt@amd.com case 1: ccprintf(os, "xer"); break; 499913Ssteve.reinhardt@amd.com case 2: ccprintf(os, "lr"); break; 509913Ssteve.reinhardt@amd.com case 3: ccprintf(os, "ctr"); break; 519913Ssteve.reinhardt@amd.com default: ccprintf(os, "unknown_reg"); 529913Ssteve.reinhardt@amd.com break; 536691Stjones1@inf.ed.ac.uk } 5412106SRekai.GonzalezAlberquilla@arm.com else if (reg.isCCReg()) 559920Syasuko.eckert@amd.com panic("printReg: POWER does not implement CCRegClass\n"); 566691Stjones1@inf.ed.ac.uk} 576691Stjones1@inf.ed.ac.uk 586691Stjones1@inf.ed.ac.ukstd::string 596691Stjones1@inf.ed.ac.ukPowerStaticInst::generateDisassembly(Addr pc, 606691Stjones1@inf.ed.ac.uk const SymbolTable *symtab) const 616691Stjones1@inf.ed.ac.uk{ 626691Stjones1@inf.ed.ac.uk std::stringstream ss; 636691Stjones1@inf.ed.ac.uk 646691Stjones1@inf.ed.ac.uk ccprintf(ss, "%-10s ", mnemonic); 656691Stjones1@inf.ed.ac.uk 666691Stjones1@inf.ed.ac.uk return ss.str(); 676691Stjones1@inf.ed.ac.uk} 68