gpu_static_inst.cc revision 11308
16691Stjones1@inf.ed.ac.uk/*
26691Stjones1@inf.ed.ac.uk * Copyright (c) 2015 Advanced Micro Devices, Inc.
36691Stjones1@inf.ed.ac.uk * All rights reserved.
46691Stjones1@inf.ed.ac.uk *
56691Stjones1@inf.ed.ac.uk * For use for simulation and test purposes only
66691Stjones1@inf.ed.ac.uk *
76691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without
86691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are met:
96691Stjones1@inf.ed.ac.uk *
106691Stjones1@inf.ed.ac.uk * 1. Redistributions of source code must retain the above copyright notice,
116691Stjones1@inf.ed.ac.uk * this list of conditions and the following disclaimer.
126691Stjones1@inf.ed.ac.uk *
136691Stjones1@inf.ed.ac.uk * 2. Redistributions in binary form must reproduce the above copyright notice,
146691Stjones1@inf.ed.ac.uk * this list of conditions and the following disclaimer in the documentation
156691Stjones1@inf.ed.ac.uk * and/or other materials provided with the distribution.
166691Stjones1@inf.ed.ac.uk *
176691Stjones1@inf.ed.ac.uk * 3. Neither the name of the copyright holder nor the names of its contributors
186691Stjones1@inf.ed.ac.uk * may be used to endorse or promote products derived from this software
196691Stjones1@inf.ed.ac.uk * without specific prior written permission.
206691Stjones1@inf.ed.ac.uk *
216691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
226691Stjones1@inf.ed.ac.uk * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236691Stjones1@inf.ed.ac.uk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
246691Stjones1@inf.ed.ac.uk * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
256691Stjones1@inf.ed.ac.uk * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
266691Stjones1@inf.ed.ac.uk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
276691Stjones1@inf.ed.ac.uk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
286691Stjones1@inf.ed.ac.uk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
296691Stjones1@inf.ed.ac.uk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
306691Stjones1@inf.ed.ac.uk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
316691Stjones1@inf.ed.ac.uk * POSSIBILITY OF SUCH DAMAGE.
326691Stjones1@inf.ed.ac.uk *
336691Stjones1@inf.ed.ac.uk * Author: Anthony Gutierrez
346691Stjones1@inf.ed.ac.uk */
356691Stjones1@inf.ed.ac.uk
366691Stjones1@inf.ed.ac.uk#include "arch/hsail/insts/gpu_static_inst.hh"
376691Stjones1@inf.ed.ac.uk
386691Stjones1@inf.ed.ac.uk#include "gpu-compute/brig_object.hh"
396691Stjones1@inf.ed.ac.uk
406691Stjones1@inf.ed.ac.uknamespace HsailISA
416691Stjones1@inf.ed.ac.uk{
426691Stjones1@inf.ed.ac.uk    HsailGPUStaticInst::HsailGPUStaticInst(const BrigObject *obj,
436691Stjones1@inf.ed.ac.uk                                           const std::string &opcode)
446691Stjones1@inf.ed.ac.uk        : GPUStaticInst(opcode), hsailCode(obj->currentCode)
456691Stjones1@inf.ed.ac.uk    {
466691Stjones1@inf.ed.ac.uk    }
476691Stjones1@inf.ed.ac.uk
486691Stjones1@inf.ed.ac.uk    void
496691Stjones1@inf.ed.ac.uk    HsailGPUStaticInst::generateDisassembly()
506691Stjones1@inf.ed.ac.uk    {
516691Stjones1@inf.ed.ac.uk        disassembly = opcode;
526691Stjones1@inf.ed.ac.uk    }
536701Sgblack@eecs.umich.edu
546701Sgblack@eecs.umich.edu    const std::string&
556691Stjones1@inf.ed.ac.uk    HsailGPUStaticInst::disassemble()
566691Stjones1@inf.ed.ac.uk    {
576691Stjones1@inf.ed.ac.uk        if (disassembly.empty()) {
586691Stjones1@inf.ed.ac.uk            generateDisassembly();
596691Stjones1@inf.ed.ac.uk            assert(!disassembly.empty());
606691Stjones1@inf.ed.ac.uk        }
616691Stjones1@inf.ed.ac.uk
628706Sandreas.hansson@arm.com        return disassembly;
636691Stjones1@inf.ed.ac.uk    }
646691Stjones1@inf.ed.ac.uk} // namespace HsailISA
656691Stjones1@inf.ed.ac.uk