Deleted Added
sdiff udiff text old ( 212793 ) new ( 218885 )
full compact
1//===- llvm-extract.cpp - LLVM function extraction utility ----------------===//
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 unchanged lines hidden (view full) ---

18#include "llvm/Assembly/PrintModulePass.h"
19#include "llvm/Bitcode/ReaderWriter.h"
20#include "llvm/Transforms/IPO.h"
21#include "llvm/Target/TargetData.h"
22#include "llvm/Support/CommandLine.h"
23#include "llvm/Support/IRReader.h"
24#include "llvm/Support/ManagedStatic.h"
25#include "llvm/Support/PrettyStackTrace.h"
26#include "llvm/Support/raw_ostream.h"
27#include "llvm/Support/SystemUtils.h"
28#include "llvm/System/Signals.h"
29#include <memory>
30using namespace llvm;
31
32// InputFilename - The filename to read from.
33static cl::opt<std::string>
34InputFilename(cl::Positional, cl::desc("<input bitcode file>"),
35 cl::init("-"), cl::value_desc("filename"));
36

--- 60 unchanged lines hidden (view full) ---

97 errs() << argv[0] << ": program doesn't contain function named '"
98 << ExtractFuncs[i] << "'!\n";
99 return 1;
100 }
101 GVs.push_back(GV);
102 }
103
104 // Materialize requisite global values.
105 for (size_t i = 0, e = GVs.size(); i != e; ++i) {
106 GlobalValue *GV = GVs[i];
107 if (GV->isMaterializable()) {
108 std::string ErrInfo;
109 if (GV->Materialize(&ErrInfo)) {
110 errs() << argv[0] << ": error reading input: " << ErrInfo << "\n";
111 return 1;
112 }
113 }
114 }
115
116 // In addition to deleting all other functions, we also want to spiff it
117 // up a little bit. Do this now.
118 PassManager Passes;
119 Passes.add(new TargetData(M.get())); // Use correct TargetData
120
121 Passes.add(createGVExtractionPass(GVs, DeleteFn));

--- 26 unchanged lines hidden ---