Make sure to create a target data that matches the Module's target properties.

llvm-svn: 5904
This commit is contained in:
Chris Lattner 2003-04-24 19:13:02 +00:00
parent 42516baf76
commit d571e2aa91
5 changed files with 18 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include "llvm/Bytecode/Reader.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/PassNameParser.h"
#include "Support/Timer.h"
#include <algorithm>
@ -126,6 +127,9 @@ int main(int argc, char **argv) {
//
PassManager Passes;
// Add an appropriate TargetData instance for this module...
Passes.add(new TargetData("analyze", CurMod));
// Make sure the input LLVM is well formed.
Passes.add(createVerifierPass());

View File

@ -74,6 +74,9 @@ static void RunChild(Module *Program,const std::vector<const PassInfo*> &Passes,
}
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) {
if (Passes[i]->getNormalCtor())
PM.add(Passes[i]->getNormalCtor()());

View File

@ -66,8 +66,8 @@ void AddConfiguredTransformationPasses(PassManager &PM) {
addPass(PM, createGlobalDCEPass()); // Kill unused uinit g-vars
addPass(PM, createDeadTypeEliminationPass()); // Eliminate dead types
addPass(PM, createConstantMergePass()); // Merge dup global constants
addPass(PM, createVerifierPass()); // Verify that input is correct
addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
addPass(PM, createVerifierPass()); // Verify that input is correct
addPass(PM, createDeadInstEliminationPass()); // Remove Dead code/vars
addPass(PM, createRaiseAllocationsPass()); // call %malloc -> malloc inst
addPass(PM, createIndVarSimplifyPass()); // Simplify indvars
@ -145,6 +145,9 @@ int main(int argc, char **argv) {
//
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
// and optimization of the GCC output.
//

View File

@ -18,6 +18,7 @@
#include "llvm/PassManager.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Scalar.h"
#include "Support/CommandLine.h"
@ -326,6 +327,9 @@ int main(int argc, char **argv) {
//
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
// one copy of each constant...
//

View File

@ -113,6 +113,9 @@ int main(int argc, char **argv) {
//
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
for (unsigned i = 0; i < OptimizationList.size(); ++i) {
const PassInfo *Opt = OptimizationList[i];