From a9a582fbb6f0c9e24bebda73f0a13e560f2d3c5e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 2 Jul 2004 05:49:11 +0000 Subject: [PATCH] Fix potential problems with unreachable basic blocks. Also, while noone's looking, add support for constant expressions. Wait, I said not to look! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14566 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcTargetMachine.cpp | 10 ++++++++++ lib/Target/SparcV8/SparcV8TargetMachine.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 344b88b8176..ed133489bed 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -56,6 +56,11 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); + PM.add(createLowerConstantExpressionsPass()); + + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createSparcV8SimpleInstructionSelector(*this)); // Print machine instructions as they were initially generated. @@ -102,7 +107,12 @@ void SparcV8JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); + + PM.add(createLowerConstantExpressionsPass()); + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createSparcV8SimpleInstructionSelector(TM)); // Print machine instructions as they were initially generated. diff --git a/lib/Target/SparcV8/SparcV8TargetMachine.cpp b/lib/Target/SparcV8/SparcV8TargetMachine.cpp index 344b88b8176..ed133489bed 100644 --- a/lib/Target/SparcV8/SparcV8TargetMachine.cpp +++ b/lib/Target/SparcV8/SparcV8TargetMachine.cpp @@ -56,6 +56,11 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); + PM.add(createLowerConstantExpressionsPass()); + + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createSparcV8SimpleInstructionSelector(*this)); // Print machine instructions as they were initially generated. @@ -102,7 +107,12 @@ void SparcV8JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { // FIXME: implement the invoke/unwind instructions! PM.add(createLowerInvokePass()); + + PM.add(createLowerConstantExpressionsPass()); + // Make sure that no unreachable blocks are instruction selected. + PM.add(createUnreachableBlockEliminationPass()); + PM.add(createSparcV8SimpleInstructionSelector(TM)); // Print machine instructions as they were initially generated.