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
TargetData needs to be parameterized better in the .bc/.ll files #1133
Comments
Oh yeah, TargetData should have a ctor that takes the string form, and should have a method that Among other things (e.g. correctness on new targets), this would allow (for example) the TargetMachine -Chris |
Owen, is this done or nearly done? |
After mistakenly trying to implement bc read/write for this, I had to back it
|
One more thing: The setDataLayout function should be changed like this:
|
I've attached the necessary patches for this bug. These can't go in, however, until #1017 is resolved so |
This has now been implemented. The patches for the code have been applied. The |
Owen, You're still on the hook for the bytecode format changes in the documentation. Reid. |
mentioned in issue llvm/llvm-bugzilla-archive#762 |
Extended Description
Currently, when 'opt' is run, it configures and adds a TargetData to the pass manager based on the
settings of the "target" flags in the Module. These flags indicate whether the target is 32/64 bit, and
whether it is big or little endian.
This has two problems:
#2 is true because a TargetData has many more fields than just ptrsize and endianness, thus the
mapping from these two fields to a full TargetData is inherently a few-to-many mapping, which is
impossible to be right in the general case (we have it carefully rigged to work for our current targets
though).
Instead of encoding ptrsize/endianness into the module, it would be far better to encode a whole target
data into it. I propose that we do this defining a "default" target data, then encoding any diffs from this
into the module as a string. For example, if the default was a 64-bit, big endian, target with 8-byte
aligned doubles, a target like X86 could be described as "p3eLd4".
As TargetData is extended in the future, more letters could be gracefully added without breaking
old .bc files.
-Chris
The text was updated successfully, but these errors were encountered: