In this commit, getDataLayout
has been removed after deprecation. What's the current way of obtaining the DataLayout
?
Asked
Active
Viewed 401 times
0

Bartek Banachewicz
- 38,596
- 7
- 91
- 135
-
Why is this downvoted? Short != Poorly Asked – StoryTeller - Unslander Monica Oct 09 '17 at 11:10
-
2@StoryTeller because it's Bartek. – Martin James Oct 09 '17 at 12:55
-
@MartinJames - I'm obviously not in on why this is a reason. – StoryTeller - Unslander Monica Oct 09 '17 at 12:56
-
@StoryTeller you have to be a Lounger to understand:) – Martin James Oct 09 '17 at 12:58
-
I see this has been VTCed as "Unclear what you're asking". I find the question pretty clear - the API has been replaced with *something*, and I'm asking what that something is. I was unable to find release notes or other information as to what I should use now and whether obtaining DataLayout from the TM is still the way to go. – Bartek Banachewicz Oct 09 '17 at 13:20
2 Answers
1
I suppose TargetMachine::createDataLayout()
can be used.
TargetMachine.h:
const DataLayout createDataLayout() const { return DL; }
This returns a copy of the data layout rather than a const reference.
If anything this can be used more safely because the copy of the data layout remains valid after the TargetMachine object is destroyed.
If I remember correctly DataLyaout is not a particularly large class, so the copying overhead should be acceptable. Should it turn out to be a problem I recommend keeping a copy for very frequent accesses.

PaulR
- 3,587
- 14
- 24
-
Wow if that's really so simple... I have to partially blame *entire* llvm.org going down where I needed it the most. I'd appreciate some more confirmation that this is indeed a drop-in replacement, otherwise you'll need to be patient until I can verify. Thanks anyway! – Bartek Banachewicz Oct 10 '17 at 18:34
1
The DataLayout should be in the module as well which is why getting it off of the TargetMachine isn't allowed anymore. I.e. basically whatever is constructing the module should know enough to construct the DataLayout.

echristo
- 1,687
- 10
- 8