exetrace.hh revision 4776:8c8407243a2c
12379SN/A/*
210298Salexandru.dutu@amd.com * Copyright (c) 2001-2005 The Regents of The University of Michigan
32379SN/A * All rights reserved.
42379SN/A *
52379SN/A * Redistribution and use in source and binary forms, with or without
62379SN/A * modification, are permitted provided that the following conditions are
72379SN/A * met: redistributions of source code must retain the above copyright
82379SN/A * notice, this list of conditions and the following disclaimer;
92379SN/A * redistributions in binary form must reproduce the above copyright
102379SN/A * notice, this list of conditions and the following disclaimer in the
112379SN/A * documentation and/or other materials provided with the distribution;
122379SN/A * neither the name of the copyright holders nor the names of its
132379SN/A * contributors may be used to endorse or promote products derived from
142379SN/A * this software without specific prior written permission.
152379SN/A *
162379SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172379SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182379SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192379SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202379SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212379SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222379SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232379SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242379SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252379SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262379SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272379SN/A *
282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
302665Ssaidi@eecs.umich.edu */
313311Ssaidi@eecs.umich.edu
322379SN/A#ifndef __EXETRACE_HH__
332379SN/A#define __EXETRACE_HH__
342379SN/A
352379SN/A#include "base/trace.hh"
3610298Salexandru.dutu@amd.com#include "cpu/static_inst.hh"
372379SN/A#include "sim/host.hh"
3811793Sbrandon.potter@amd.com#include "sim/insttracer.hh"
3911793Sbrandon.potter@amd.com
402379SN/Aclass ThreadContext;
412379SN/A
422379SN/A
438232Snate@binkert.orgnamespace Trace {
447678Sgblack@eecs.umich.edu
4511800Sbrandon.potter@amd.comclass ExeTracerRecord : public InstRecord
462379SN/A{
472399SN/A  public:
482379SN/A    ExeTracerRecord(Tick _when, ThreadContext *_thread,
492399SN/A               const StaticInstPtr &_staticInst, Addr _pc, bool spec)
5012448Sgabeblack@google.com        : InstRecord(_when, _thread, _staticInst, _pc, spec)
512399SN/A    {
5210558Salexandru.dutu@amd.com    }
532399SN/A
542399SN/A    void dump();
552399SN/A};
5612448Sgabeblack@google.com
573311Ssaidi@eecs.umich.educlass ExeTracer : public InstTracer
5812448Sgabeblack@google.com{
5912442Sgabeblack@google.com  public:
6012442Sgabeblack@google.com
6112461Sgabeblack@google.com    ExeTracer(const std::string & name) : InstTracer(name)
6212461Sgabeblack@google.com    {}
6312461Sgabeblack@google.com
6412461Sgabeblack@google.com    InstRecord *
6512461Sgabeblack@google.com    getInstRecord(Tick when, ThreadContext *tc,
6612442Sgabeblack@google.com            const StaticInstPtr staticInst, Addr pc)
6712461Sgabeblack@google.com    {
682399SN/A        if (!IsOn(ExecEnable))
692399SN/A            return NULL;
7012448Sgabeblack@google.com
7112448Sgabeblack@google.com        if (!Trace::enabled)
7212448Sgabeblack@google.com            return NULL;
732399SN/A
742399SN/A        if (!IsOn(ExecSpeculative) && tc->misspeculating())
752399SN/A            return NULL;
765877Shsul@eecs.umich.edu
7712448Sgabeblack@google.com        return new ExeTracerRecord(when, tc,
785877Shsul@eecs.umich.edu                staticInst, pc, tc->misspeculating());
795877Shsul@eecs.umich.edu    }
805877Shsul@eecs.umich.edu};
815877Shsul@eecs.umich.edu
825877Shsul@eecs.umich.edu/* namespace Trace */ }
835877Shsul@eecs.umich.edu
845877Shsul@eecs.umich.edu#endif // __EXETRACE_HH__
8512448Sgabeblack@google.com