exetrace.hh revision 4776
12SN/A/*
21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
302SN/A */
312SN/A
322SN/A#ifndef __EXETRACE_HH__
332SN/A#define __EXETRACE_HH__
342SN/A
354046Sbinkertn@umich.edu#include "base/trace.hh"
364046Sbinkertn@umich.edu#include "cpu/static_inst.hh"
3756SN/A#include "sim/host.hh"
384776Sgblack@eecs.umich.edu#include "sim/insttracer.hh"
392SN/A
403064Sgblack@eecs.umich.educlass ThreadContext;
412SN/A
422SN/A
432SN/Anamespace Trace {
442SN/A
454776Sgblack@eecs.umich.educlass ExeTracerRecord : public InstRecord
462SN/A{
472SN/A  public:
484776Sgblack@eecs.umich.edu    ExeTracerRecord(Tick _when, ThreadContext *_thread,
494776Sgblack@eecs.umich.edu               const StaticInstPtr &_staticInst, Addr _pc, bool spec)
504776Sgblack@eecs.umich.edu        : InstRecord(_when, _thread, _staticInst, _pc, spec)
512SN/A    {
522SN/A    }
532SN/A
544046Sbinkertn@umich.edu    void dump();
552SN/A};
562SN/A
574776Sgblack@eecs.umich.educlass ExeTracer : public InstTracer
584776Sgblack@eecs.umich.edu{
594776Sgblack@eecs.umich.edu  public:
602SN/A
614776Sgblack@eecs.umich.edu    ExeTracer(const std::string & name) : InstTracer(name)
624776Sgblack@eecs.umich.edu    {}
632SN/A
644776Sgblack@eecs.umich.edu    InstRecord *
654776Sgblack@eecs.umich.edu    getInstRecord(Tick when, ThreadContext *tc,
664776Sgblack@eecs.umich.edu            const StaticInstPtr staticInst, Addr pc)
674776Sgblack@eecs.umich.edu    {
684776Sgblack@eecs.umich.edu        if (!IsOn(ExecEnable))
694776Sgblack@eecs.umich.edu            return NULL;
702SN/A
714776Sgblack@eecs.umich.edu        if (!Trace::enabled)
724776Sgblack@eecs.umich.edu            return NULL;
732SN/A
744776Sgblack@eecs.umich.edu        if (!IsOn(ExecSpeculative) && tc->misspeculating())
754776Sgblack@eecs.umich.edu            return NULL;
764074Sbinkertn@umich.edu
774776Sgblack@eecs.umich.edu        return new ExeTracerRecord(when, tc,
784776Sgblack@eecs.umich.edu                staticInst, pc, tc->misspeculating());
794776Sgblack@eecs.umich.edu    }
804776Sgblack@eecs.umich.edu};
812SN/A
824054Sbinkertn@umich.edu/* namespace Trace */ }
832SN/A
842SN/A#endif // __EXETRACE_HH__
85