-
Notifications
You must be signed in to change notification settings - Fork 15.3k
opt: Stop creating TargetMachine to infer the datalayout #169585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opt: Stop creating TargetMachine to infer the datalayout #169585
Conversation
The Triple directly has the datalayout string in it, so just use that. The logical flow here is kind of a mess. We were constructing a temporary target machine in the asm parser to infer the datalayout, throwing it away, and then creating another target machine for the actual compilation. The flow of the Triple construction is still convoluted, but we can at least drop the TargetMachine.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
s-barannikov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
arichardson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| Triple TT(TripleStr); | ||
|
|
||
| std::string Str = TT.computeDataLayout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also pass the value of the --target-abi= command line option here? Since depending on the ABI, there could be a different data layouts.
For testing this we could instantiate opt with e.g. MIPS n32 ABI or one of the ARM ABI variants that affect the data layout string.
I know this is a functional change rather than NFC, so also fine to defer until later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also apparently a target-abi module flag, and this doesn't seem like it's all handled correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Triple directly has the datalayout string in it, so just use that. The logical flow here is kind of a mess. We were constructing a temporary target machine in the asm parser to infer the datalayout, throwing it away, and then creating another target machine for the actual compilation. The flow of the Triple construction is still convoluted, but we can at least drop the TargetMachine.

The Triple directly has the datalayout string in it, so just
use that.
The logical flow here is kind of a mess. We were constructing
a temporary target machine in the asm parser to infer the datalayout,
throwing it away, and then creating another target machine for the
actual compilation. The flow of the Triple construction is still
convoluted, but we can at least drop the TargetMachine.