static_inst.cc revision 9920
11142Shsul@eecs.umich.edu/* 21142Shsul@eecs.umich.edu * Copyright (c) 2009 The University of Edinburgh 31142Shsul@eecs.umich.edu * Copyright (c) 2013 Advanced Micro Devices, Inc. 41142Shsul@eecs.umich.edu * All rights reserved. 51142Shsul@eecs.umich.edu * 61142Shsul@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 71142Shsul@eecs.umich.edu * modification, are permitted provided that the following conditions are 81142Shsul@eecs.umich.edu * met: redistributions of source code must retain the above copyright 91142Shsul@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 101142Shsul@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 111142Shsul@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 121142Shsul@eecs.umich.edu * documentation and/or other materials provided with the distribution; 131142Shsul@eecs.umich.edu * neither the name of the copyright holders nor the names of its 141142Shsul@eecs.umich.edu * contributors may be used to endorse or promote products derived from 151142Shsul@eecs.umich.edu * this software without specific prior written permission. 161142Shsul@eecs.umich.edu * 171142Shsul@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 181142Shsul@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 191142Shsul@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 201142Shsul@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 211175Sbinkertn@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 221142Shsul@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 231142Shsul@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 241142Shsul@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 251142Shsul@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 261175Sbinkertn@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 271142Shsul@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 281142Shsul@eecs.umich.edu * 291142Shsul@eecs.umich.edu * Authors: Timothy M. Jones 301142Shsul@eecs.umich.edu */ 311175Sbinkertn@umich.edu 321142Shsul@eecs.umich.edu#include "arch/power/insts/static_inst.hh" 331142Shsul@eecs.umich.edu#include "cpu/reg_class.hh" 341142Shsul@eecs.umich.edu 351142Shsul@eecs.umich.eduusing namespace PowerISA; 361142Shsul@eecs.umich.edu 371142Shsul@eecs.umich.eduvoid 381142Shsul@eecs.umich.eduPowerStaticInst::printReg(std::ostream &os, int reg) const 391142Shsul@eecs.umich.edu{ 401177Sbinkertn@umich.edu RegIndex rel_reg; 411142Shsul@eecs.umich.edu 421142Shsul@eecs.umich.edu switch (regIdxToClass(reg, &rel_reg)) { 431142Shsul@eecs.umich.edu case IntRegClass: 441142Shsul@eecs.umich.edu ccprintf(os, "r%d", rel_reg); 451142Shsul@eecs.umich.edu break; 461142Shsul@eecs.umich.edu case FloatRegClass: 471142Shsul@eecs.umich.edu ccprintf(os, "f%d", rel_reg); 48 break; 49 case MiscRegClass: 50 switch (rel_reg) { 51 case 0: ccprintf(os, "cr"); break; 52 case 1: ccprintf(os, "xer"); break; 53 case 2: ccprintf(os, "lr"); break; 54 case 3: ccprintf(os, "ctr"); break; 55 default: ccprintf(os, "unknown_reg"); 56 break; 57 } 58 case CCRegClass: 59 panic("printReg: POWER does not implement CCRegClass\n"); 60 } 61} 62 63std::string 64PowerStaticInst::generateDisassembly(Addr pc, 65 const SymbolTable *symtab) const 66{ 67 std::stringstream ss; 68 69 ccprintf(ss, "%-10s ", mnemonic); 70 71 return ss.str(); 72} 73