mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Make sure to create a target data that matches the Module's target properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
53a0c38b5f
commit
9c3b55ea9f
@ -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());
|
||||
|
||||
|
@ -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()());
|
||||
|
@ -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.
|
||||
//
|
||||
|
@ -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...
|
||||
//
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user