Commit 94f98c64cca336426d67f0000c2c92aef2067b29
Exists in
master
Merge branch 'master' of https://git.ucsd.edu/y1vazque/project2
Showing 1 changed file Side-by-side Diff
llvm/src/lib/CSE231/CPAnalysis.cpp
View file @
94f98c6
1 | +//===- CPAnalysis.cpp | |
2 | +// | |
3 | +// The LLVM Compiler Infrastructure | |
4 | +// | |
5 | +// This file is distributed under the University of Illinois Open Source | |
6 | +// License. See LICENSE.TXT for details. | |
7 | +// | |
8 | +//===----------------------------------------------------------------------===// | |
9 | +// | |
10 | +// This file implements the constant propagation analysis. | |
11 | +// | |
12 | +//===----------------------------------------------------------------------===// | |
13 | + | |
14 | +#include "llvm/ADT/StringMap.h" | |
15 | +#include "llvm/ADT/DenseMap.h" | |
16 | +#include "llvm/IR/Function.h" | |
17 | +#include "llvm/IR/Module.h" | |
18 | +#include "llvm/IR/BasicBlock.h" | |
19 | +#include "llvm/IR/Instruction.h" | |
20 | +#include "llvm/Pass.h" | |
21 | +#include "llvm/Support/raw_ostream.h" | |
22 | +#include "llvm/Support/InstIterator.h" | |
23 | +using namespace llvm; | |
24 | + | |
25 | +namespace { | |
26 | + | |
27 | + struct CPAnalysis : public ModulePass { | |
28 | + static char ID; | |
29 | + | |
30 | + CPAnalysis() : ModulePass(ID) {} | |
31 | + | |
32 | + virtual bool runOnModule(Module &M) { | |
33 | + unsigned opcode; | |
34 | + IRBuilder<> builder(M.getContext()); | |
35 | + | |
36 | + // Iterating over all the functions in the module | |
37 | + for (Module::iterator FB = M.begin(), FE = M.end(); FB != FE; ++FB) { | |
38 | + | |
39 | + // get the list to work | |
40 | + // Worklist(LatticeDefinition, FB, LatticeDefinition.Top()); | |
41 | + | |
42 | + } | |
43 | + | |
44 | + // we are not modifying the code so return False | |
45 | + return false; | |
46 | + } | |
47 | + | |
48 | + }; | |
49 | +} | |
50 | + | |
51 | +char CPAnalysis::ID = 0; | |
52 | +static RegisterPass<CPAnalysis> X("constant-propagation-analysis", "Analyze all the functions in a module with a constant propagation lattice"); |