Skip to content

Add Target.cppTypeMangle hook for vendor types.#6887

Merged
WalterBright merged 3 commits intodlang:masterfrom
ibuclaw:cppmangletype
Jun 13, 2017
Merged

Add Target.cppTypeMangle hook for vendor types.#6887
WalterBright merged 3 commits intodlang:masterfrom
ibuclaw:cppmangletype

Conversation

@ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 11, 2017

This patch adds Target.cppMangleType, which returns a pointer to statically allocated string containing the target/vendor-specific mangling for the given type.

While this could apply for any type, have only added it to the basic, vector, and struct type visitor passes for now. DMD does nothing with this, however these specific places should catch all of the following:

  • real may be a __float128 type mangled as g (alpha, ia64, ppc, systemz, sparc, x86)
  • real may be mangled as a vendor type U10__float128 (ppc) or u9__float80 (ia64)
  • va_list may be mangled as if it is in the "std" namespace St9__va_list (arm, aarch64)
  • __vector() may differ depending on the default C++ ABI Dv (abi >= 4)

This replaces Target.realislongdouble.

See https://github.com/dlang/dmd/pull/6887/files?w=1 to read diff without whitespace changes.

Fixes the frontend part of bug reported against gdc: https://bugzilla.gdcproject.org/show_bug.cgi?id=247

FYI: @redstar / @klickverbot - this would affect you.

@UplinkCoder
Copy link
Member

@ibuclaw vendor-type is a wired name.
How about platform-exclusiv-type ?

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 11, 2017

@ibuclaw vendor-type is a wired name.

It's a perfectly reasonable name.

How about platform-exclusiv-type ?

Sounds too german. ☺️

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 11, 2017

I forgot to mention that this also allows compilers to use internal information they have on the default C++ ABI. So if -fabi-version=4 or greater is the default, then you can return Dv instead of the current U8__vector. The reverse also applies when the frontend decides to switch C++ ABI to support >= 4.

@WalterBright WalterBright merged commit 4bf8fb1 into dlang:master Jun 13, 2017
@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 13, 2017

@redstar / @klickverbot - SYN.

@ibuclaw ibuclaw deleted the cppmangletype branch June 13, 2017 23:03
@dnadlinger
Copy link
Contributor

dnadlinger commented Jun 14, 2017

@ibuclaw: ACK. (… SYN ACK?)

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 16, 2017

@klickverbot - ACK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants