CPAnalysis.cpp 1.51 KB
//===- CPAnalysis.cpp
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the constant propagation analysis.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instruction.h"
#include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/InstIterator.h"
using namespace llvm;
namespace {
struct CPAnalysis : public ModulePass {
static char ID;
CPAnalysis() : ModulePass(ID) {}
virtual bool runOnModule(Module &M) {
unsigned opcode;
IRBuilder<> builder(M.getContext());
// Iterating over all the functions in the module
for (Module::iterator FB = M.begin(), FE = M.end(); FB != FE; ++FB) {
// get the list to work
// Worklist(LatticeDefinition, FB, LatticeDefinition.Top());
}
// we are not modifying the code so return False
return false;
}
};
}
char CPAnalysis::ID = 0;
static RegisterPass<CPAnalysis> X("constant-propagation-analysis", "Analyze all the functions in a module with a constant propagation lattice");