WeChat: cstutorcs
QQ: 749389476
#include “DataflowAnalysis.h”
using namespace llvm;
namespace dataflow {
DataflowAnalysis::DataflowAnalysis(char ID) : FunctionPass(ID){}
bool DataflowAnalysis::runOnFunction(Function &F){
errs() << "Running " << getAnalysisName() << " on " << F.getName() << "\n";
for (inst_iterator I = inst_begin(F), E= inst_end(F); I != E; ++I){
inMap[&(*I)] = new SetVector
outMap[&(*I)] = new SetVector
doAnalysis(F);
for (inst_iterator I = inst_begin(F), E= inst_end(F); I != E; ++I){
errs() << "Instruction: " << *I << "\n";
errs() << "In set: \n";
SetVector
errs() << "[";
for(SetVector
errs() << **V << "; ";
errs() << "]\n";
errs() << "Out set: \n";
SetVector
errs() << "[";
for(SetVector
errs() << **V << "; ";
errs() << "]\n";
errs() << "\n";
for (inst_iterator I = inst_begin(F), E= inst_end(F); I != E; ++I){
delete inMap[&(*I)];
delete outMap[&(*I)];
return false;