mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Make DataLayout a plain object, not a pass.
Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM don't don't handle passes to also use DataLayout. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
28713bdebc
commit
57edc9d4ff
@ -1976,7 +1976,7 @@ int main(int argc, char *argv[]) {
|
||||
// Set up the optimizer pipeline.
|
||||
// Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
fpm.add(new llvm::DataLayout(*executionEngine->getDataLayout()));
|
||||
fpm.add(new llvm::DataLayoutPass(*executionEngine->getDataLayout()));
|
||||
|
||||
// Optimizations turned on
|
||||
#ifdef ADD_OPT_PASSES
|
||||
|
@ -586,7 +586,7 @@ int main() {
|
||||
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||
OurFPM.add(new DataLayoutPass(*TheExecutionEngine->getDataLayout()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
|
@ -831,7 +831,7 @@ int main() {
|
||||
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||
OurFPM.add(new DataLayoutPass(*TheExecutionEngine->getDataLayout()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
|
@ -949,7 +949,7 @@ int main() {
|
||||
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||
OurFPM.add(new DataLayoutPass(*TheExecutionEngine->getDataLayout()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||
|
@ -1113,7 +1113,7 @@ int main() {
|
||||
|
||||
// Set up the optimizer pipeline. Start with registering info about how the
|
||||
// target lays out data structures.
|
||||
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||
OurFPM.add(new DataLayoutPass(*TheExecutionEngine->getDataLayout()));
|
||||
// Provide basic AliasAnalysis support for GVN.
|
||||
OurFPM.add(createBasicAliasAnalysisPass());
|
||||
// Promote allocas to registers.
|
||||
|
@ -88,14 +88,11 @@ struct PointerAlignElem {
|
||||
bool operator==(const PointerAlignElem &rhs) const;
|
||||
};
|
||||
|
||||
|
||||
/// DataLayout - This class holds a parsed version of the target data layout
|
||||
/// string in a module and provides methods for querying it. The target data
|
||||
/// layout string is specified *by the target* - a frontend generating LLVM IR
|
||||
/// is required to generate the right target data for the target being codegen'd
|
||||
/// to. If some measure of portability is desired, an empty string may be
|
||||
/// specified in the module.
|
||||
class DataLayout : public ImmutablePass {
|
||||
/// This class holds a parsed version of the target data layout string in a
|
||||
/// module and provides methods for querying it. The target data layout string
|
||||
/// is specified *by the target* - a frontend generating LLVM IR is required to
|
||||
/// generate the right target data for the target being codegen'd to.
|
||||
class DataLayout {
|
||||
private:
|
||||
bool LittleEndian; ///< Defaults to false
|
||||
unsigned StackNaturalAlign; ///< Stack natural alignment
|
||||
@ -165,40 +162,28 @@ private:
|
||||
void parseSpecifier(StringRef LayoutDescription);
|
||||
|
||||
public:
|
||||
/// Default ctor.
|
||||
///
|
||||
/// @note This has to exist, because this is a pass, but it should never be
|
||||
/// used.
|
||||
DataLayout();
|
||||
|
||||
/// Constructs a DataLayout from a specification string. See init().
|
||||
explicit DataLayout(StringRef LayoutDescription)
|
||||
: ImmutablePass(ID) {
|
||||
init(LayoutDescription);
|
||||
}
|
||||
explicit DataLayout(StringRef LayoutDescription) { init(LayoutDescription); }
|
||||
|
||||
/// Initialize target data from properties stored in the module.
|
||||
explicit DataLayout(const Module *M);
|
||||
|
||||
DataLayout(const DataLayout &DL) :
|
||||
ImmutablePass(ID),
|
||||
LittleEndian(DL.isLittleEndian()),
|
||||
StackNaturalAlign(DL.StackNaturalAlign),
|
||||
ManglingMode(DL.ManglingMode),
|
||||
LegalIntWidths(DL.LegalIntWidths),
|
||||
Alignments(DL.Alignments),
|
||||
Pointers(DL.Pointers),
|
||||
LayoutMap(0)
|
||||
{ }
|
||||
DataLayout(const DataLayout &DL) { *this = DL; }
|
||||
|
||||
DataLayout &operator=(const DataLayout &DL) {
|
||||
LittleEndian = DL.isLittleEndian();
|
||||
StackNaturalAlign = DL.StackNaturalAlign;
|
||||
ManglingMode = DL.ManglingMode;
|
||||
LegalIntWidths = DL.LegalIntWidths;
|
||||
Alignments = DL.Alignments;
|
||||
Pointers = DL.Pointers;
|
||||
LayoutMap = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~DataLayout(); // Not virtual, do not subclass this class
|
||||
|
||||
/// DataLayout is an immutable pass, but holds state. This allows the pass
|
||||
/// manager to clear its mutable state.
|
||||
bool doFinalization(Module &M);
|
||||
|
||||
/// Parse a data layout string (with fallback to default values). Ensure that
|
||||
/// the data layout pass is registered.
|
||||
/// Parse a data layout string (with fallback to default values).
|
||||
void init(StringRef LayoutDescription);
|
||||
|
||||
/// Layout endianness...
|
||||
@ -458,6 +443,23 @@ public:
|
||||
assert((Alignment & (Alignment-1)) == 0 && "Alignment must be power of 2!");
|
||||
return (Val + (Alignment-1)) & ~UIntTy(Alignment-1);
|
||||
}
|
||||
};
|
||||
|
||||
class DataLayoutPass : public ImmutablePass {
|
||||
DataLayout DL;
|
||||
|
||||
public:
|
||||
/// This has to exist, because this is a pass, but it should never be used.
|
||||
DataLayoutPass();
|
||||
~DataLayoutPass();
|
||||
|
||||
const DataLayout &getDataLayout() const { return DL; }
|
||||
|
||||
explicit DataLayoutPass(const DataLayout &DL);
|
||||
|
||||
explicit DataLayoutPass(StringRef LayoutDescription);
|
||||
|
||||
explicit DataLayoutPass(const Module *M);
|
||||
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
};
|
||||
|
@ -248,7 +248,7 @@ void initializeStripSymbolsPass(PassRegistry&);
|
||||
void initializeTailCallElimPass(PassRegistry&);
|
||||
void initializeTailDuplicatePassPass(PassRegistry&);
|
||||
void initializeTargetPassConfigPass(PassRegistry&);
|
||||
void initializeDataLayoutPass(PassRegistry&);
|
||||
void initializeDataLayoutPassPass(PassRegistry &);
|
||||
void initializeTargetTransformInfoAnalysisGroup(PassRegistry&);
|
||||
void initializeNoTTIPass(PassRegistry&);
|
||||
void initializeTargetLibraryInfoPass(PassRegistry&);
|
||||
|
@ -472,7 +472,8 @@ AliasAnalysis::~AliasAnalysis() {}
|
||||
/// AliasAnalysis interface before any other methods are called.
|
||||
///
|
||||
void AliasAnalysis::InitializeAliasAnalysis(Pass *P) {
|
||||
DL = P->getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = P->getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = P->getAnalysisIfAvailable<TargetLibraryInfo>();
|
||||
AA = &P->getAnalysis<AliasAnalysis>();
|
||||
}
|
||||
|
@ -1214,7 +1214,8 @@ void InlineCostAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
}
|
||||
|
||||
bool InlineCostAnalysis::runOnSCC(CallGraphSCC &SCC) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TTI = &getAnalysis<TargetTransformInfo>();
|
||||
return false;
|
||||
}
|
||||
|
@ -234,7 +234,8 @@ bool IVUsers::runOnLoop(Loop *l, LPPassManager &LPM) {
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
|
||||
// Find all uses of induction variables in this loop, and categorize
|
||||
// them by stride. Start by finding all of the PHI nodes in the header for
|
||||
|
@ -1013,7 +1013,8 @@ bool LazyValueInfo::runOnFunction(Function &F) {
|
||||
if (PImpl)
|
||||
getCache(PImpl).clear();
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
// Fully lazy.
|
||||
|
@ -176,7 +176,8 @@ bool Lint::runOnFunction(Function &F) {
|
||||
Mod = F.getParent();
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
visit(F);
|
||||
dbgs() << MessagesStr.str();
|
||||
|
@ -87,7 +87,8 @@ void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
||||
bool MemoryDependenceAnalysis::runOnFunction(Function &) {
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
DominatorTreeWrapperPass *DTWP =
|
||||
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
||||
DT = DTWP ? &DTWP->getDomTree() : 0;
|
||||
|
@ -36,7 +36,8 @@ namespace {
|
||||
virtual void initializePass() {
|
||||
// Note: NoAA does not call InitializeAliasAnalysis because it's
|
||||
// special and does not support chaining.
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
}
|
||||
|
||||
virtual AliasResult alias(const Location &LocA, const Location &LocB) {
|
||||
|
@ -7376,7 +7376,8 @@ ScalarEvolution::ScalarEvolution()
|
||||
bool ScalarEvolution::runOnFunction(Function &F) {
|
||||
this->F = &F;
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
return false;
|
||||
|
@ -253,7 +253,8 @@ struct NoTTI LLVM_FINAL : ImmutablePass, TargetTransformInfo {
|
||||
// it does not chain.
|
||||
TopTTI = this;
|
||||
PrevTTI = 0;
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const LLVM_OVERRIDE {
|
||||
|
@ -151,7 +151,7 @@ JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji,
|
||||
// Add target data
|
||||
MutexGuard locked(lock);
|
||||
FunctionPassManager &PM = jitstate->getPM(locked);
|
||||
PM.add(new DataLayout(*TM.getDataLayout()));
|
||||
PM.add(new DataLayoutPass(*TM.getDataLayout()));
|
||||
|
||||
// Turn the machine code intermediate representation into bytes in memory that
|
||||
// may be executed.
|
||||
@ -183,7 +183,7 @@ void JIT::addModule(Module *M) {
|
||||
jitstate = new JITState(M);
|
||||
|
||||
FunctionPassManager &PM = jitstate->getPM(locked);
|
||||
PM.add(new DataLayout(*TM.getDataLayout()));
|
||||
PM.add(new DataLayoutPass(*TM.getDataLayout()));
|
||||
|
||||
// Turn the machine code intermediate representation into bytes in memory
|
||||
// that may be executed.
|
||||
@ -214,7 +214,7 @@ bool JIT::removeModule(Module *M) {
|
||||
jitstate = new JITState(Modules[0]);
|
||||
|
||||
FunctionPassManager &PM = jitstate->getPM(locked);
|
||||
PM.add(new DataLayout(*TM.getDataLayout()));
|
||||
PM.add(new DataLayoutPass(*TM.getDataLayout()));
|
||||
|
||||
// Turn the machine code intermediate representation into bytes in memory
|
||||
// that may be executed.
|
||||
|
@ -142,7 +142,7 @@ ObjectBufferStream* MCJIT::emitObject(Module *M) {
|
||||
|
||||
PassManager PM;
|
||||
|
||||
PM.add(new DataLayout(*TM->getDataLayout()));
|
||||
PM.add(new DataLayoutPass(*TM->getDataLayout()));
|
||||
|
||||
// The RuntimeDyld will take ownership of this shortly
|
||||
OwningPtr<ObjectBufferStream> CompiledObject(new ObjectBufferStream());
|
||||
|
@ -35,9 +35,8 @@ using namespace llvm;
|
||||
|
||||
// Handle the Pass registration stuff necessary to use DataLayout's.
|
||||
|
||||
// Register the default SparcV9 implementation...
|
||||
INITIALIZE_PASS(DataLayout, "datalayout", "Data Layout", false, true)
|
||||
char DataLayout::ID = 0;
|
||||
INITIALIZE_PASS(DataLayoutPass, "datalayout", "Data Layout", false, true)
|
||||
char DataLayoutPass::ID = 0;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Support for StructLayout
|
||||
@ -178,8 +177,6 @@ static const LayoutAlignElem DefaultAlignments[] = {
|
||||
};
|
||||
|
||||
void DataLayout::init(StringRef Desc) {
|
||||
initializeDataLayoutPass(*PassRegistry::getPassRegistry());
|
||||
|
||||
LayoutMap = 0;
|
||||
LittleEndian = false;
|
||||
StackNaturalAlign = 0;
|
||||
@ -347,19 +344,7 @@ void DataLayout::parseSpecifier(StringRef Desc) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Default ctor.
|
||||
///
|
||||
/// @note This has to exist, because this is a pass, but it should never be
|
||||
/// used.
|
||||
DataLayout::DataLayout() : ImmutablePass(ID) {
|
||||
report_fatal_error("Bad DataLayout ctor used. "
|
||||
"Tool did not specify a DataLayout to use?");
|
||||
}
|
||||
|
||||
DataLayout::DataLayout(const Module *M)
|
||||
: ImmutablePass(ID) {
|
||||
init(M->getDataLayout());
|
||||
}
|
||||
DataLayout::DataLayout(const Module *M) { init(M->getDataLayout()); }
|
||||
|
||||
void
|
||||
DataLayout::setAlignment(AlignTypeEnum align_type, unsigned abi_align,
|
||||
@ -482,12 +467,6 @@ DataLayout::~DataLayout() {
|
||||
delete static_cast<StructLayoutMap*>(LayoutMap);
|
||||
}
|
||||
|
||||
bool DataLayout::doFinalization(Module &M) {
|
||||
delete static_cast<StructLayoutMap*>(LayoutMap);
|
||||
LayoutMap = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
const StructLayout *DataLayout::getStructLayout(StructType *Ty) const {
|
||||
if (!LayoutMap)
|
||||
LayoutMap = new StructLayoutMap();
|
||||
@ -778,3 +757,23 @@ unsigned DataLayout::getPreferredAlignment(const GlobalVariable *GV) const {
|
||||
unsigned DataLayout::getPreferredAlignmentLog(const GlobalVariable *GV) const {
|
||||
return Log2_32(getPreferredAlignment(GV));
|
||||
}
|
||||
|
||||
DataLayoutPass::DataLayoutPass() : ImmutablePass(ID), DL("") {
|
||||
report_fatal_error("Bad DataLayoutPass ctor used. Tool did not specify a "
|
||||
"DataLayout to use?");
|
||||
}
|
||||
|
||||
DataLayoutPass::~DataLayoutPass() {}
|
||||
|
||||
DataLayoutPass::DataLayoutPass(const DataLayout &DL)
|
||||
: ImmutablePass(ID), DL(DL) {
|
||||
initializeDataLayoutPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
DataLayoutPass::DataLayoutPass(StringRef Str) : ImmutablePass(ID), DL(Str) {
|
||||
initializeDataLayoutPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
DataLayoutPass::DataLayoutPass(const Module *M) : ImmutablePass(ID), DL(M) {
|
||||
initializeDataLayoutPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
passes.add(createVerifierPass());
|
||||
|
||||
// Add an appropriate DataLayout instance for this module...
|
||||
passes.add(new DataLayout(*TargetMach->getDataLayout()));
|
||||
passes.add(new DataLayoutPass(*TargetMach->getDataLayout()));
|
||||
|
||||
// Add appropriate TargetLibraryInfo for this module.
|
||||
passes.add(new TargetLibraryInfo(Triple(TargetMach->getTargetTriple())));
|
||||
@ -503,7 +503,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
|
||||
PassManager codeGenPasses;
|
||||
|
||||
codeGenPasses.add(new DataLayout(*TargetMach->getDataLayout()));
|
||||
codeGenPasses.add(new DataLayoutPass(*TargetMach->getDataLayout()));
|
||||
|
||||
formatted_raw_ostream Out(out);
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
NVPTXAllocaHoisting() : FunctionPass(ID) {}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<DataLayout>();
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
AU.addPreserved("stack-protector");
|
||||
AU.addPreserved<MachineFunctionAnalysis>();
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ bool NVPTXLowerAggrCopies::runOnFunction(Function &F) {
|
||||
SmallVector<MemTransferInst *, 4> aggrMemcpys;
|
||||
SmallVector<MemSetInst *, 4> aggrMemsets;
|
||||
|
||||
const DataLayout *DL = &getAnalysis<DataLayout>();
|
||||
const DataLayout *DL = &getAnalysis<DataLayoutPass>().getDataLayout();
|
||||
LLVMContext &Context = F.getParent()->getContext();
|
||||
|
||||
//
|
||||
|
@ -28,7 +28,7 @@ struct NVPTXLowerAggrCopies : public FunctionPass {
|
||||
NVPTXLowerAggrCopies() : FunctionPass(ID) {}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<DataLayout>();
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
AU.addPreserved("stack-protector");
|
||||
AU.addPreserved<MachineFunctionAnalysis>();
|
||||
}
|
||||
|
@ -171,7 +171,8 @@ bool PPCCTRLoops::runOnFunction(Function &F) {
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
LibInfo = getAnalysisIfAvailable<TargetLibraryInfo>();
|
||||
|
||||
bool MadeChange = false;
|
||||
|
@ -42,7 +42,7 @@ inline LLVMTargetLibraryInfoRef wrap(const TargetLibraryInfo *P) {
|
||||
}
|
||||
|
||||
void llvm::initializeTarget(PassRegistry &Registry) {
|
||||
initializeDataLayoutPass(Registry);
|
||||
initializeDataLayoutPassPass(Registry);
|
||||
initializeTargetLibraryInfoPass(Registry);
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep) {
|
||||
}
|
||||
|
||||
void LLVMAddTargetData(LLVMTargetDataRef TD, LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(new DataLayout(*unwrap(TD)));
|
||||
unwrap(PM)->add(new DataLayoutPass(*unwrap(TD)));
|
||||
}
|
||||
|
||||
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI,
|
||||
|
@ -212,7 +212,7 @@ static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
|
||||
*ErrorMessage = strdup(error.c_str());
|
||||
return true;
|
||||
}
|
||||
pass.add(new DataLayout(*td));
|
||||
pass.add(new DataLayoutPass(*td));
|
||||
|
||||
TargetMachine::CodeGenFileType ft;
|
||||
switch (codegen) {
|
||||
|
@ -102,7 +102,8 @@ unsigned ConstantMerge::getAlignment(GlobalVariable *GV) const {
|
||||
}
|
||||
|
||||
bool ConstantMerge::runOnModule(Module &M) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
|
||||
// Find all the globals that are marked "used". These cannot be merged.
|
||||
SmallPtrSet<const GlobalValue*, 8> UsedGlobals;
|
||||
|
@ -1815,11 +1815,13 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
|
||||
++NumMarked;
|
||||
return true;
|
||||
} else if (!GV->getInitializer()->getType()->isSingleValueType()) {
|
||||
if (DataLayout *DL = getAnalysisIfAvailable<DataLayout>())
|
||||
if (GlobalVariable *FirstNewGV = SRAGlobal(GV, *DL)) {
|
||||
if (DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>()) {
|
||||
const DataLayout &DL = DLP->getDataLayout();
|
||||
if (GlobalVariable *FirstNewGV = SRAGlobal(GV, DL)) {
|
||||
GVI = FirstNewGV; // Don't skip the newly produced globals!
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (GS.StoredType == GlobalStatus::StoredOnce) {
|
||||
// If the initial value for the global was an undef value, and if only
|
||||
// one other value was stored into it, we can just change the
|
||||
@ -3161,7 +3163,8 @@ bool GlobalOpt::OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn) {
|
||||
bool GlobalOpt::runOnModule(Module &M) {
|
||||
bool Changed = false;
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
// Try to find the llvm.globalctors list.
|
||||
|
@ -410,7 +410,8 @@ static bool InlineHistoryIncludes(Function *F, int InlineHistoryID,
|
||||
|
||||
bool Inliner::runOnSCC(CallGraphSCC &SCC) {
|
||||
CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
const TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
||||
|
||||
SmallPtrSet<Function*, 8> SCCFunctions;
|
||||
|
@ -623,7 +623,8 @@ ModulePass *llvm::createMergeFunctionsPass() {
|
||||
|
||||
bool MergeFunctions::runOnModule(Module &M) {
|
||||
bool Changed = false;
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||
if (!I->isDeclaration() && !I->hasAvailableExternallyLinkage())
|
||||
|
@ -2518,7 +2518,8 @@ bool InstCombiner::runOnFunction(Function &F) {
|
||||
if (skipOptnoneFunction(F))
|
||||
return false;
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
// Minimizing size?
|
||||
MinimizeSize = F.getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
|
@ -910,9 +910,12 @@ void AddressSanitizerModule::initializeCallbacks(Module &M) {
|
||||
// redzones and inserts this function into llvm.global_ctors.
|
||||
bool AddressSanitizerModule::runOnModule(Module &M) {
|
||||
if (!ClGlobals) return false;
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
if (!DL)
|
||||
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP)
|
||||
return false;
|
||||
DL = &DLP->getDataLayout();
|
||||
|
||||
BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
|
||||
if (BL->isIn(M)) return false;
|
||||
C = &(M.getContext());
|
||||
@ -1086,10 +1089,11 @@ void AddressSanitizer::initializeCallbacks(Module &M) {
|
||||
// virtual
|
||||
bool AddressSanitizer::doInitialization(Module &M) {
|
||||
// Initialize the private fields. No one has accessed them before.
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
|
||||
if (!DL)
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP)
|
||||
return false;
|
||||
DL = &DLP->getDataLayout();
|
||||
|
||||
BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
|
||||
DynamicallyInitializedGlobals.Init(M);
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<DataLayout>();
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
AU.addRequired<TargetLibraryInfo>();
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ bool BoundsChecking::instrument(Value *Ptr, Value *InstVal) {
|
||||
}
|
||||
|
||||
bool BoundsChecking::runOnFunction(Function &F) {
|
||||
DL = &getAnalysis<DataLayout>();
|
||||
DL = &getAnalysis<DataLayoutPass>().getDataLayout();
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
TrapBB = 0;
|
||||
|
@ -343,9 +343,10 @@ FunctionType *DataFlowSanitizer::getCustomFunctionType(FunctionType *T) {
|
||||
}
|
||||
|
||||
bool DataFlowSanitizer::doInitialization(Module &M) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
if (!DL)
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP)
|
||||
return false;
|
||||
DL = &DLP->getDataLayout();
|
||||
|
||||
Mod = &M;
|
||||
Ctx = &M.getContext();
|
||||
|
@ -399,9 +399,11 @@ void MemorySanitizer::initializeCallbacks(Module &M) {
|
||||
///
|
||||
/// inserts a call to __msan_init to the module's constructor list.
|
||||
bool MemorySanitizer::doInitialization(Module &M) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
if (!DL)
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP)
|
||||
return false;
|
||||
DL = &DLP->getDataLayout();
|
||||
|
||||
BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
|
||||
C = &(M.getContext());
|
||||
unsigned PtrSize = DL->getPointerSizeInBits(/* AddressSpace */0);
|
||||
|
@ -224,9 +224,10 @@ void ThreadSanitizer::initializeCallbacks(Module &M) {
|
||||
}
|
||||
|
||||
bool ThreadSanitizer::doInitialization(Module &M) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
if (!DL)
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP)
|
||||
return false;
|
||||
DL = &DLP->getDataLayout();
|
||||
BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
|
||||
|
||||
// Always insert a call to __tsan_init into the module's CTORs.
|
||||
|
@ -67,7 +67,8 @@ bool ConstantPropagation::runOnFunction(Function &F) {
|
||||
WorkList.insert(&*i);
|
||||
}
|
||||
bool Changed = false;
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
while (!WorkList.empty()) {
|
||||
|
@ -557,7 +557,8 @@ bool EarlyCSE::runOnFunction(Function &F) {
|
||||
|
||||
std::vector<StackNode *> nodesToProcess;
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
|
||||
|
@ -2318,7 +2318,8 @@ bool GVN::runOnFunction(Function& F) {
|
||||
if (!NoLoads)
|
||||
MD = &getAnalysis<MemoryDependenceAnalysis>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
VN.setAliasAnalysis(&getAnalysis<AliasAnalysis>());
|
||||
VN.setMemDep(MD);
|
||||
|
@ -1818,7 +1818,8 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = getAnalysisIfAvailable<TargetLibraryInfo>();
|
||||
|
||||
DeadInsts.clear();
|
||||
|
@ -152,7 +152,8 @@ bool JumpThreading::runOnFunction(Function &F) {
|
||||
return false;
|
||||
|
||||
DEBUG(dbgs() << "Jump threading on function '" << F.getName() << "'\n");
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
LVI = &getAnalysis<LazyValueInfo>();
|
||||
|
||||
|
@ -221,7 +221,8 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
|
||||
|
@ -182,7 +182,11 @@ namespace {
|
||||
}
|
||||
|
||||
const DataLayout *getDataLayout() {
|
||||
return DL ? DL : DL=getAnalysisIfAvailable<DataLayout>();
|
||||
if (DL)
|
||||
return DL;
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
return DL;
|
||||
}
|
||||
|
||||
DominatorTree *getDominatorTree() {
|
||||
|
@ -72,7 +72,8 @@ bool LoopInstSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
||||
DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0;
|
||||
LoopInfo *LI = &getAnalysis<LoopInfo>();
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
SmallVector<BasicBlock*, 8> ExitBlocks;
|
||||
|
@ -1141,7 +1141,8 @@ bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
|
||||
BasicBlock *Header = L->getHeader();
|
||||
|
@ -1025,7 +1025,8 @@ bool MemCpyOpt::runOnFunction(Function &F) {
|
||||
|
||||
bool MadeChange = false;
|
||||
MD = &getAnalysis<MemoryDependenceAnalysis>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
|
||||
// If we don't have at least memset and memcpy, there is little point of doing
|
||||
|
@ -1557,7 +1557,8 @@ bool SCCP::runOnFunction(Function &F) {
|
||||
return false;
|
||||
|
||||
DEBUG(dbgs() << "SCCP on function '" << F.getName() << "'\n");
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
const DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
SCCPSolver Solver(DL, TLI);
|
||||
|
||||
@ -1686,7 +1687,8 @@ static bool AddressIsTaken(const GlobalValue *GV) {
|
||||
}
|
||||
|
||||
bool IPSCCP::runOnModule(Module &M) {
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
SCCPSolver Solver(DL, TLI);
|
||||
|
||||
|
@ -3623,11 +3623,12 @@ bool SROA::runOnFunction(Function &F) {
|
||||
|
||||
DEBUG(dbgs() << "SROA function: " << F.getName() << "\n");
|
||||
C = &F.getContext();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
if (!DL) {
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
if (!DLP) {
|
||||
DEBUG(dbgs() << " Skipping SROA -- no target data!\n");
|
||||
return false;
|
||||
}
|
||||
DL = &DLP->getDataLayout();
|
||||
DominatorTreeWrapperPass *DTWP =
|
||||
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
||||
DT = DTWP ? &DTWP->getDomTree() : 0;
|
||||
|
@ -1023,7 +1023,8 @@ bool SROA::runOnFunction(Function &F) {
|
||||
if (skipOptnoneFunction(F))
|
||||
return false;
|
||||
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
|
||||
bool Changed = performPromotion(F);
|
||||
|
||||
|
@ -240,7 +240,8 @@ bool Scalarizer::doInitialization(Module &M) {
|
||||
}
|
||||
|
||||
bool Scalarizer::runOnFunction(Function &F) {
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
|
||||
BasicBlock *BB = BBI;
|
||||
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;) {
|
||||
|
@ -172,7 +172,8 @@ bool CFGSimplifyPass::runOnFunction(Function &F) {
|
||||
return false;
|
||||
|
||||
const TargetTransformInfo &TTI = getAnalysis<TargetTransformInfo>();
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
bool EverChanged = removeUnreachableBlocks(F);
|
||||
EverChanged |= mergeEmptyReturnBlocks(F);
|
||||
EverChanged |= iterativelySimplifyCFG(F, TTI, DL);
|
||||
|
@ -60,9 +60,10 @@ namespace {
|
||||
L(Loop),
|
||||
LI(LPM->getAnalysisIfAvailable<LoopInfo>()),
|
||||
SE(SE),
|
||||
DL(LPM->getAnalysisIfAvailable<DataLayout>()),
|
||||
DeadInsts(Dead),
|
||||
Changed(false) {
|
||||
DataLayoutPass *DLP = LPM->getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
assert(LI && "IV simplification requires LoopInfo");
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ namespace {
|
||||
const DominatorTreeWrapperPass *DTWP =
|
||||
getAnalysisIfAvailable<DominatorTreeWrapperPass>();
|
||||
const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : 0;
|
||||
const DataLayout *DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
|
||||
SmallPtrSet<const Instruction*, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
|
||||
bool Changed = false;
|
||||
|
@ -201,7 +201,8 @@ namespace {
|
||||
AA = &P->getAnalysis<AliasAnalysis>();
|
||||
DT = &P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
SE = &P->getAnalysis<ScalarEvolution>();
|
||||
DL = P->getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = P->getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TTI = IgnoreTargetInfo ? 0 : &P->getAnalysis<TargetTransformInfo>();
|
||||
}
|
||||
|
||||
@ -436,7 +437,8 @@ namespace {
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TTI = IgnoreTargetInfo ? 0 : &getAnalysis<TargetTransformInfo>();
|
||||
|
||||
return vectorizeBB(BB);
|
||||
|
@ -1022,7 +1022,8 @@ struct LoopVectorize : public FunctionPass {
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
TTI = &getAnalysis<TargetTransformInfo>();
|
||||
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
|
@ -1795,7 +1795,8 @@ struct SLPVectorizer : public FunctionPass {
|
||||
return false;
|
||||
|
||||
SE = &getAnalysis<ScalarEvolution>();
|
||||
DL = getAnalysisIfAvailable<DataLayout>();
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
TTI = &getAnalysis<TargetTransformInfo>();
|
||||
AA = &getAnalysis<AliasAnalysis>();
|
||||
LI = &getAnalysis<LoopInfo>();
|
||||
|
@ -299,9 +299,9 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||
|
||||
// Add the target data from the target machine, if it exists, or the module.
|
||||
if (const DataLayout *DL = Target.getDataLayout())
|
||||
PM.add(new DataLayout(*DL));
|
||||
PM.add(new DataLayoutPass(*DL));
|
||||
else
|
||||
PM.add(new DataLayout(mod));
|
||||
PM.add(new DataLayoutPass(mod));
|
||||
|
||||
// Override default to generate verbose assembly.
|
||||
Target.setAsmVerbosityDefault(true);
|
||||
|
@ -254,7 +254,7 @@ int main(int argc, char **argv) {
|
||||
// In addition to deleting all other functions, we also want to spiff it
|
||||
// up a little bit. Do this now.
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(M.get())); // Use correct DataLayout
|
||||
Passes.add(new DataLayoutPass(M.get())); // Use correct DataLayout
|
||||
|
||||
std::vector<GlobalValue*> Gvs(GVs.begin(), GVs.end());
|
||||
|
||||
|
@ -437,7 +437,7 @@ int main(int argc, char **argv) {
|
||||
DL = new DataLayout(DefaultDataLayout);
|
||||
|
||||
if (DL)
|
||||
Passes.add(DL);
|
||||
Passes.add(new DataLayoutPass(*DL));
|
||||
|
||||
Triple ModuleTriple(M->getTargetTriple());
|
||||
TargetMachine *Machine = 0;
|
||||
@ -453,7 +453,7 @@ int main(int argc, char **argv) {
|
||||
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
|
||||
FPasses.reset(new FunctionPassManager(M.get()));
|
||||
if (DL)
|
||||
FPasses->add(new DataLayout(*DL));
|
||||
FPasses->add(new DataLayoutPass(*DL));
|
||||
if (TM.get())
|
||||
TM->addAnalysisPasses(*FPasses);
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace llvm {
|
||||
initializeModuleNDMPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
|
||||
run++;
|
||||
return false;
|
||||
}
|
||||
@ -176,7 +176,7 @@ namespace llvm {
|
||||
initializeCGPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
virtual bool runOnSCC(CallGraphSCC &SCMM) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
@ -215,7 +215,7 @@ namespace llvm {
|
||||
return false;
|
||||
}
|
||||
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
@ -252,7 +252,7 @@ namespace llvm {
|
||||
return false;
|
||||
}
|
||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
@ -277,7 +277,7 @@ namespace llvm {
|
||||
initializeFPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<DataLayoutPass>());
|
||||
for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
|
||||
Function &F = *I;
|
||||
{
|
||||
@ -303,7 +303,7 @@ namespace llvm {
|
||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(&M));
|
||||
Passes.add(new DataLayoutPass(&M));
|
||||
Passes.add(mNDM2);
|
||||
Passes.add(mNDM);
|
||||
Passes.add(mNDNM);
|
||||
@ -327,7 +327,7 @@ namespace llvm {
|
||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(&M));
|
||||
Passes.add(new DataLayoutPass(&M));
|
||||
Passes.add(mNDM);
|
||||
Passes.add(mNDNM);
|
||||
Passes.add(mNDM2);// invalidates mNDM needed by mDNM
|
||||
@ -349,7 +349,7 @@ namespace llvm {
|
||||
OwningPtr<Module> M(makeLLVMModule());
|
||||
T *P = new T();
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(M.get()));
|
||||
Passes.add(new DataLayoutPass(M.get()));
|
||||
Passes.add(P);
|
||||
Passes.run(*M);
|
||||
T::finishedOK(run);
|
||||
@ -360,7 +360,7 @@ namespace llvm {
|
||||
Module *M = makeLLVMModule();
|
||||
T *P = new T();
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(M));
|
||||
Passes.add(new DataLayoutPass(M));
|
||||
Passes.add(P);
|
||||
Passes.run(*M);
|
||||
T::finishedOK(run, N);
|
||||
@ -398,7 +398,7 @@ namespace llvm {
|
||||
SCOPED_TRACE("Running OnTheFlyTest");
|
||||
struct OnTheFlyTest *O = new OnTheFlyTest();
|
||||
PassManager Passes;
|
||||
Passes.add(new DataLayout(M));
|
||||
Passes.add(new DataLayoutPass(M));
|
||||
Passes.add(O);
|
||||
Passes.run(*M);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user