mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 06:30:19 +00:00
Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28181 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b5d75b8618
commit
8d89e7bdbc
@ -13,6 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Instructions.h"
|
||||
@ -39,6 +40,12 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<TargetData>();
|
||||
AU.setPreservesCFG();
|
||||
|
||||
// This is a cluster of orthogonal Transforms:
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
/// doPassInitialization - For the lower allocations pass, this ensures that
|
||||
|
@ -19,6 +19,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Pass.h"
|
||||
@ -37,7 +38,11 @@ namespace {
|
||||
LowerSelect(bool onlyfp = false) : OnlyFP(onlyfp) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
// Doesn't really preserve anything. It can certainly destroy the CFG.
|
||||
// This certainly destroys the CFG.
|
||||
// This is a cluster of orthogonal Transforms:
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F);
|
||||
|
@ -14,6 +14,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
@ -32,7 +33,15 @@ namespace {
|
||||
/// modifies the CFG!
|
||||
class LowerSwitch : public FunctionPass {
|
||||
public:
|
||||
bool runOnFunction(Function &F);
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
}
|
||||
|
||||
typedef std::pair<Constant*, BasicBlock*> Case;
|
||||
typedef std::vector<Case>::iterator CaseItr;
|
||||
private:
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Function.h"
|
||||
@ -37,6 +38,10 @@ namespace {
|
||||
AU.addRequired<DominanceFrontier>();
|
||||
AU.addRequired<TargetData>();
|
||||
AU.setPreservesCFG();
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,10 @@ Pass *llvm::createUnifyFunctionExitNodesPass() {
|
||||
void UnifyFunctionExitNodes::getAnalysisUsage(AnalysisUsage &AU) const{
|
||||
// We preserve the non-critical-edgeness property
|
||||
AU.addPreservedID(BreakCriticalEdgesID);
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
// UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
|
||||
|
Loading…
Reference in New Issue
Block a user