decoder.hh revision 9022
19020Sgblack@eecs.umich.edu/* 29020Sgblack@eecs.umich.edu * Copyright (c) 2012 Google 39020Sgblack@eecs.umich.edu * All rights reserved. 49020Sgblack@eecs.umich.edu * 59020Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 69020Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 79020Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 89020Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 99020Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 109020Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 119020Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 129020Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 139020Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 149020Sgblack@eecs.umich.edu * this software without specific prior written permission. 159020Sgblack@eecs.umich.edu * 169020Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179020Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189020Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199020Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209020Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219020Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229020Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239020Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249020Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259020Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269020Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279020Sgblack@eecs.umich.edu * 289020Sgblack@eecs.umich.edu * Authors: Gabe Black 299020Sgblack@eecs.umich.edu */ 309020Sgblack@eecs.umich.edu 319020Sgblack@eecs.umich.edu#ifndef __ARCH_X86_DECODER_HH__ 329020Sgblack@eecs.umich.edu#define __ARCH_X86_DECODER_HH__ 339020Sgblack@eecs.umich.edu 349022Sgblack@eecs.umich.edu#include "arch/types.hh" 359022Sgblack@eecs.umich.edu#include "cpu/decode_cache.hh" 369022Sgblack@eecs.umich.edu#include "cpu/static_inst_fwd.hh" 379020Sgblack@eecs.umich.edu 389020Sgblack@eecs.umich.edunamespace X86ISA 399020Sgblack@eecs.umich.edu{ 409020Sgblack@eecs.umich.edu 419022Sgblack@eecs.umich.educlass Decoder 429022Sgblack@eecs.umich.edu{ 439022Sgblack@eecs.umich.edu protected: 449022Sgblack@eecs.umich.edu /// A cache of decoded instruction objects. 459022Sgblack@eecs.umich.edu static DecodeCache defaultCache; 469022Sgblack@eecs.umich.edu 479022Sgblack@eecs.umich.edu public: 489022Sgblack@eecs.umich.edu StaticInstPtr decodeInst(ExtMachInst mach_inst); 499022Sgblack@eecs.umich.edu 509022Sgblack@eecs.umich.edu /// Decode a machine instruction. 519022Sgblack@eecs.umich.edu /// @param mach_inst The binary instruction to decode. 529022Sgblack@eecs.umich.edu /// @retval A pointer to the corresponding StaticInst object. 539022Sgblack@eecs.umich.edu StaticInstPtr 549022Sgblack@eecs.umich.edu decode(ExtMachInst mach_inst, Addr addr) 559022Sgblack@eecs.umich.edu { 569022Sgblack@eecs.umich.edu return defaultCache.decode(this, mach_inst, addr); 579022Sgblack@eecs.umich.edu } 589022Sgblack@eecs.umich.edu}; 599020Sgblack@eecs.umich.edu 609020Sgblack@eecs.umich.edu} // namespace X86ISA 619020Sgblack@eecs.umich.edu 629020Sgblack@eecs.umich.edu#endif // __ARCH_X86_DECODER_HH__ 63