mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 02:36:06 +00:00
701f5ac73c
The code is organized into 3 parts (2 passes) 1) a linked set of profiling passes, which implement an analysis group (linked, like alias analysis are). These insert profiling into the program, and remember what they inserted, so that at a later time they can be queried about any instruction. 2) a pass that handles inserting the random sampling framework. This also has options to control how random samples are choosen. Currently implemented are Global counters, register allocated global counters, and read cycle counter (see? there was a reason for it). The profiling passes are almost identical to the existing ones (block, function, and null profiling is supported right now), and they are valid passes without the sampling framework (hence the existing passes can be unified with the new ones, not done yet). Some things are a bit ugly still, but that should be fixed up soon enough. Other todo? making the counter values not "magic 2^16 -1" values, but dynamically choosable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24493 91177308-0d34-0410-b5e6-96231b3b80d8
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
//===- RSProfiling.cpp - Various profiling using random sampling ----------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// See notes in RSProfiling.cpp
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace llvm {
|
|
// By default, we provide some convienence stuff to clients, so they
|
|
// can just store the instructions they create to do profiling.
|
|
// also, handle all chaining issues.
|
|
// a client is free to overwrite these, as long as it implements the
|
|
// chaining itself.
|
|
struct RSProfilers : public ModulePass {
|
|
std::set<Value*> profcode;
|
|
virtual bool isProfiling(Value* v);
|
|
virtual ~RSProfilers() {}
|
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
|
void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
|
|
GlobalValue *CounterArray);
|
|
};
|
|
};
|