mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 04:24:22 +00:00
Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -15,12 +15,55 @@
|
||||
#include "llvm/Method.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#include "Support/StringExtras.h"
|
||||
#include <sstream>
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
class InsertTraceCode : public MethodPass {
|
||||
bool TraceBasicBlockExits, TraceMethodExits;
|
||||
Method *PrintfMeth;
|
||||
public:
|
||||
InsertTraceCode(bool traceBasicBlockExits, bool traceMethodExits)
|
||||
: TraceBasicBlockExits(traceBasicBlockExits),
|
||||
TraceMethodExits(traceMethodExits) {}
|
||||
|
||||
// Add a prototype for printf if it is not already in the program.
|
||||
//
|
||||
bool doInitialization(Module *M);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function InsertCodeToTraceValues
|
||||
//
|
||||
// Inserts tracing code for all live values at basic block and/or method
|
||||
// exits as specified by `traceBasicBlockExits' and `traceMethodExits'.
|
||||
//
|
||||
static bool doit(Method *M, bool traceBasicBlockExits,
|
||||
bool traceMethodExits, Method *Printf);
|
||||
|
||||
// runOnMethod - This method does the work. Always successful.
|
||||
//
|
||||
bool runOnMethod(Method *M) {
|
||||
return doit(M, TraceBasicBlockExits, TraceMethodExits, PrintfMeth);
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
||||
Pass *createTraceValuesPassForMethod() { // Just trace methods
|
||||
return new InsertTraceCode(false, true);
|
||||
}
|
||||
|
||||
Pass *createTraceValuesPassForBasicBlocks() { // Trace BB's and methods
|
||||
return new InsertTraceCode(true, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Add a prototype for printf if it is not already in the program.
|
||||
//
|
||||
bool InsertTraceCode::doInitialization(Module *M) {
|
||||
|
Reference in New Issue
Block a user