Summary: Also provide the associated assertion when CodeGen starts.
Reviewers: echristo
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11654
From: Mehdi Amini <mehdi.amini@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243682
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Create a DataLayout.
const DataLayout createDataLayout() const { return DL; }
+ /// Test if a DataLayout if compatible with the CodeGen for this target.
+ ///
+ /// The LLVM Module owns a DataLayout that is used for the target independent
+ /// optimizations and code generation. This hook provides a target specific
+ /// check on the validity of this DataLayout.
+ bool isCompatibleDataLayout(const DataLayout &Candidate) const {
+ return DL == Candidate;
+ }
+
/// Get the pointer size for this target.
///
/// This is the only time the DataLayout in the TargetMachine is used.
FunctionNumber = FunctionNum;
JumpTableInfo = nullptr;
+
+ assert(TM.isCompatibleDataLayout(getDataLayout()) &&
+ "Can't create a MachineFunction using a Module with a "
+ "Target-incompatible DataLayout attached\n");
}
MachineFunction::~MachineFunction() {