[PATCH] D11654: Add a TargetMachine hook that verifies DataLayout compatibility
Mehdi AMINI
mehdi.amini at apple.com
Thu Jul 30 11:52:21 PDT 2015
joker.eph updated this revision to Diff 31062.
joker.eph added a comment.
Remove the virtual keyword, we can bring it back when we'll have a use-case
http://reviews.llvm.org/D11654
Files:
include/llvm/Target/TargetMachine.h
lib/CodeGen/MachineFunction.cpp
Index: lib/CodeGen/MachineFunction.cpp
===================================================================
--- lib/CodeGen/MachineFunction.cpp
+++ lib/CodeGen/MachineFunction.cpp
@@ -85,6 +85,10 @@
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() {
Index: include/llvm/Target/TargetMachine.h
===================================================================
--- include/llvm/Target/TargetMachine.h
+++ include/llvm/Target/TargetMachine.h
@@ -133,6 +133,15 @@
/// 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11654.31062.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150730/3b526dcc/attachment.bin>
More information about the llvm-commits
mailing list