1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/tools/llvm-mca/InstructionTables.h
Matt Davis 7599dd7f50 [llvm-mca] Turn InstructionTables into a Stage.
Summary:
This patch converts the InstructionTables class into a subclass of mca::Stage.  This change allows us to use the Stage's inherited Listeners for event notifications.  This also allows us to create a simple pipeline for viewing the InstructionTables report.

I have been working on a follow on patch that should cleanup addView in InstructionTables.  Right now, addView adds the view to both the Listener list and Views list.  The follow-on patch addresses the fact that we don't really need two lists in this case.  That change is not specific to just InstructionTables, so it will be a separate patch. 

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Differential Revision: https://reviews.llvm.org/D49329

llvm-svn: 337113
2018-07-14 23:52:50 +00:00

44 lines
1.3 KiB
C++

//===--------------------- InstructionTables.h ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
///
/// This file implements a custom stage to generate instruction tables.
/// See the description of command-line flag -instruction-tables in
/// docs/CommandGuide/lvm-mca.rst
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
#define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
#include "InstrBuilder.h"
#include "Scheduler.h"
#include "Stage.h"
#include "View.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCSchedule.h"
namespace mca {
class InstructionTables : public Stage {
const llvm::MCSchedModel &SM;
InstrBuilder &IB;
llvm::SmallVector<std::pair<ResourceRef, double>, 4> UsedResources;
public:
InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder)
: Stage(), SM(Model), IB(Builder) {}
bool hasWorkToComplete() const override final { return false; }
bool execute(InstRef &IR) override final;
};
} // namespace mca
#endif