a pointer to make it explicit. The Module owns the datalayout and it has to
match the one attached to the TargetMachine for generating code.
+ In 3.6, a pass was inserted in the pipeline to make the DataLayout accessible:
+ MyPassManager->add(new DataLayoutPass(MyTargetMachine->getDataLayout()));
+ In 3.7, you don't need a pass, you set the DataLayout on the Module:
+ MyModule->setDataLayout(MyTargetMachine->createDataLayout());
+
+ The LLVM C API `LLVMGetTargetMachineData` is deprecated to reflect the fact
+ that it won't be available anymore from TargetMachine in 3.8.
+
* Comdats are now ortogonal to the linkage. LLVM will not create
comdats for weak linkage globals and the frontends are responsible
for explicitly adding them.
LLVMDisposeMessage. */
char *LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T);
-/** Returns the llvm::DataLayout used for this llvm:TargetMachine. */
+/** Deprecated: use LLVMGetDataLayout(LLVMModuleRef M) instead. */
LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T);
/** Set the target machine's ASM verbosity. */
return *static_cast<const STC*>(getSubtargetImpl(F));
}
+ /// Deprecated in 3.7, will be removed in 3.8. Use createDataLayout() instead.
+ ///
/// This method returns a pointer to the DataLayout for the target. It should
/// be unchanging for every subtarget.
const DataLayout *getDataLayout() const { return &DL; }
+ /// Create a DataLayout.
+ const DataLayout createDataLayout() const { return DL; }
+
/// \brief Reset the target options based on the function's attributes.
// FIXME: Remove TargetOptions that affect per-function code generation
// from TargetMachine.