[llvm-branch-commits] [llvm-branch] r245948 - Deprecate the DataLayout on the TargetMachine, and backport the 3.8 API to ease transition

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 25 09:25:47 PDT 2015


Author: hans
Date: Tue Aug 25 11:25:46 2015
New Revision: 245948

URL: http://llvm.org/viewvc/llvm-project?rev=245948&view=rev
Log:
Deprecate the DataLayout on the TargetMachine, and backport the 3.8 API to ease transition

By Mehdi Amini.

Modified:
    llvm/branches/release_37/docs/ReleaseNotes.rst
    llvm/branches/release_37/include/llvm-c/TargetMachine.h
    llvm/branches/release_37/include/llvm/Target/TargetMachine.h

Modified: llvm/branches/release_37/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/docs/ReleaseNotes.rst?rev=245948&r1=245947&r2=245948&view=diff
==============================================================================
--- llvm/branches/release_37/docs/ReleaseNotes.rst (original)
+++ llvm/branches/release_37/docs/ReleaseNotes.rst Tue Aug 25 11:25:46 2015
@@ -53,6 +53,14 @@ Non-comprehensive list of changes in thi
   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.

Modified: llvm/branches/release_37/include/llvm-c/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/include/llvm-c/TargetMachine.h?rev=245948&r1=245947&r2=245948&view=diff
==============================================================================
--- llvm/branches/release_37/include/llvm-c/TargetMachine.h (original)
+++ llvm/branches/release_37/include/llvm-c/TargetMachine.h Tue Aug 25 11:25:46 2015
@@ -115,7 +115,7 @@ char *LLVMGetTargetMachineCPU(LLVMTarget
   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. */

Modified: llvm/branches/release_37/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/include/llvm/Target/TargetMachine.h?rev=245948&r1=245947&r2=245948&view=diff
==============================================================================
--- llvm/branches/release_37/include/llvm/Target/TargetMachine.h (original)
+++ llvm/branches/release_37/include/llvm/Target/TargetMachine.h Tue Aug 25 11:25:46 2015
@@ -125,10 +125,15 @@ public:
     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.




More information about the llvm-branch-commits mailing list