Compare View
Commits (2)
Diff
Showing 1 changed file Inline Diff
llvm/src/lib/CSE231/CPAnalysis.cpp
View file @
20676aa
File was created | 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"); | |||
53 | ||||
//===- CPAnalysis.cpp | 1 | 54 | ||
// | 2 | |||
// The LLVM Compiler Infrastructure | 3 | |||
// | 4 | |||
// This file is distributed under the University of Illinois Open Source | 5 | |||
// License. See LICENSE.TXT for details. | 6 | |||
// | 7 | |||
//===----------------------------------------------------------------------===// | 8 | |||
// | 9 | |||
// This file implements the constant propagation analysis. | 10 | |||
// | 11 | |||
//===----------------------------------------------------------------------===// | 12 | |||
13 | ||||
#include "llvm/ADT/StringMap.h" | 14 | |||
#include "llvm/ADT/DenseMap.h" | 15 | |||
#include "llvm/IR/Function.h" | 16 | |||
#include "llvm/IR/Module.h" | 17 | |||
#include "llvm/IR/BasicBlock.h" | 18 | |||
#include "llvm/IR/Instruction.h" | 19 | |||
#include "llvm/Pass.h" | 20 | |||
#include "llvm/Support/raw_ostream.h" | 21 | |||
#include "llvm/Support/InstIterator.h" | 22 | |||
using namespace llvm; | 23 | |||
24 | ||||
namespace { | 25 | |||
26 | ||||
struct CPAnalysis : public ModulePass { | 27 | |||
static char ID; | 28 | |||
29 | ||||
CPAnalysis() : ModulePass(ID) {} | 30 | |||
31 | ||||
virtual bool runOnModule(Module &M) { | 32 | |||
unsigned opcode; | 33 | |||
IRBuilder<> builder(M.getContext()); | 34 | |||
35 | ||||
// Iterating over all the functions in the module | 36 | |||
for (Module::iterator FB = M.begin(), FE = M.end(); FB != FE; ++FB) { | 37 | |||
38 | ||||
// get the list to work | 39 | |||
// Worklist(LatticeDefinition, FB, LatticeDefinition.Top()); | 40 | |||
41 |