forked from OSchip/llvm-project
Make sure to create a target data that matches the Module's target properties.
llvm-svn: 5904
This commit is contained in:
parent
42516baf76
commit
d571e2aa91
|
@ -15,6 +15,7 @@
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Assembly/Parser.h"
|
#include "llvm/Assembly/Parser.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/PassNameParser.h"
|
#include "llvm/Support/PassNameParser.h"
|
||||||
#include "Support/Timer.h"
|
#include "Support/Timer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -126,6 +127,9 @@ int main(int argc, char **argv) {
|
||||||
//
|
//
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
|
// Add an appropriate TargetData instance for this module...
|
||||||
|
Passes.add(new TargetData("analyze", CurMod));
|
||||||
|
|
||||||
// Make sure the input LLVM is well formed.
|
// Make sure the input LLVM is well formed.
|
||||||
Passes.add(createVerifierPass());
|
Passes.add(createVerifierPass());
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,9 @@ static void RunChild(Module *Program,const std::vector<const PassInfo*> &Passes,
|
||||||
}
|
}
|
||||||
|
|
||||||
PassManager PM;
|
PassManager PM;
|
||||||
|
// Make sure that the appropriate target data is always used...
|
||||||
|
PM.add(new TargetData("bugpoint", Program));
|
||||||
|
|
||||||
for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
|
||||||
if (Passes[i]->getNormalCtor())
|
if (Passes[i]->getNormalCtor())
|
||||||
PM.add(Passes[i]->getNormalCtor()());
|
PM.add(Passes[i]->getNormalCtor()());
|
||||||
|
|
|
@ -66,8 +66,8 @@ void AddConfiguredTransformationPasses(PassManager &PM) {
|
||||||
addPass(PM, createGlobalDCEPass()); // Kill unused uinit g-vars
|
addPass(PM, createGlobalDCEPass()); // Kill unused uinit g-vars
|
||||||
addPass(PM, createDeadTypeEliminationPass()); // Eliminate dead types
|
addPass(PM, createDeadTypeEliminationPass()); // Eliminate dead types
|
||||||
addPass(PM, createConstantMergePass()); // Merge dup global constants
|
addPass(PM, createConstantMergePass()); // Merge dup global constants
|
||||||
addPass(PM, createVerifierPass()); // Verify that input is correct
|
|
||||||
addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
|
addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
|
||||||
|
addPass(PM, createVerifierPass()); // Verify that input is correct
|
||||||
addPass(PM, createDeadInstEliminationPass()); // Remove Dead code/vars
|
addPass(PM, createDeadInstEliminationPass()); // Remove Dead code/vars
|
||||||
addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst
|
addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst
|
||||||
addPass(PM, createIndVarSimplifyPass()); // Simplify indvars
|
addPass(PM, createIndVarSimplifyPass()); // Simplify indvars
|
||||||
|
@ -145,6 +145,9 @@ int main(int argc, char **argv) {
|
||||||
//
|
//
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
|
// Add an appropriate TargetData instance for this module...
|
||||||
|
Passes.add(new TargetData("gccas", M.get()));
|
||||||
|
|
||||||
// Add all of the transformation passes to the pass manager to do the cleanup
|
// Add all of the transformation passes to the pass manager to do the cleanup
|
||||||
// and optimization of the GCC output.
|
// and optimization of the GCC output.
|
||||||
//
|
//
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Bytecode/WriteBytecodePass.h"
|
#include "llvm/Bytecode/WriteBytecodePass.h"
|
||||||
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
|
@ -326,6 +327,9 @@ int main(int argc, char **argv) {
|
||||||
//
|
//
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
|
// Add an appropriate TargetData instance for this module...
|
||||||
|
Passes.add(new TargetData("gccas", Composite.get()));
|
||||||
|
|
||||||
// Linking modules together can lead to duplicated global constants, only keep
|
// Linking modules together can lead to duplicated global constants, only keep
|
||||||
// one copy of each constant...
|
// one copy of each constant...
|
||||||
//
|
//
|
||||||
|
|
|
@ -113,6 +113,9 @@ int main(int argc, char **argv) {
|
||||||
//
|
//
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
|
// Add an appropriate TargetData instance for this module...
|
||||||
|
Passes.add(new TargetData("opt", M.get()));
|
||||||
|
|
||||||
// Create a new optimization pass for each one specified on the command line
|
// Create a new optimization pass for each one specified on the command line
|
||||||
for (unsigned i = 0; i < OptimizationList.size(); ++i) {
|
for (unsigned i = 0; i < OptimizationList.size(); ++i) {
|
||||||
const PassInfo *Opt = OptimizationList[i];
|
const PassInfo *Opt = OptimizationList[i];
|
||||||
|
|
Loading…
Reference in New Issue