summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2013-03-12 17:37:31 +0000
committerPete Cooper <peter_cooper@apple.com>2013-03-12 17:37:31 +0000
commit8f8af529fc6239985f73a4b3cf3a0b25692824ed (patch)
treead472c51e8b44a3738e0e1768e65d9e83a848c7f /include
parent4323665bd857c0527b50463d415d9e76493ad2fe (diff)
downloadllvm-8f8af529fc6239985f73a4b3cf3a0b25692824ed.tar.gz
llvm-8f8af529fc6239985f73a4b3cf3a0b25692824ed.tar.bz2
llvm-8f8af529fc6239985f73a4b3cf3a0b25692824ed.tar.xz
Add a doFinalization method to the DataLayout pass.
This pass is meant to be immutable, however it holds mutable state to cache StructLayouts. This method will allow the pass manager to clear the mutable state between runs. Note that unfortunately it is still necessary to have the destructor, even though it does the same thing as doFinalization. This is because most TargetMachines embed a DataLayout on which doFinalization isn't run as its never added to the pass manager. I also didn't think it was necessary to complication things with a deInit method for which doFinalization and ~DataLayout both call as there's only one field of mutable state. If we had more fields to finalize i'd have added this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/DataLayout.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index 5eb186d531..4d3016c72f 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -181,6 +181,10 @@ public:
~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.
void init(StringRef LayoutDescription);