Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/doc/mangling_rules.txt  view on Meta::CPAN


GCC 2.95.3 name mangling grammar (intuited from gcc sources):
------------------------------------------------------------

<global-function>   ::= <name> '__F' <func-params>

<member-function>   ::= <name> '__' <class-name> <func-params>

<ctor-function>		::= '__' <class-name> <func-params>

<dtor-function>		::= '_' <joiner> '_' <class-name> <func-params>

<joiner>			::= '.' | '$'			  # system-dependent joiner

<class-name>		::= <qualified-name>

<qualified-name>	::= <component>
					::= 'Q' <digit> <component>+
					::= 'Q' '_' <digit>+ '_' <component>+

<component>			::= <digit>+ <identifier> # length-prefixed name

<overload-item>     ::= 'R' <type>            # reference
                    ::= 'P' <type>            # array or pointer type
					::= 'O' <type> '_' <type> # offset type
					::= 'M' <type> <modifiers> <function-type>   # methods
					::= <function-type>
					::= <builtin-type>
					::= <qualified-name>

<type>              ::= <modifiers> <overload-item>

<function-type>     ::= 'F' <func-params> '_' <return-type>

<func-params>       ::= 'e'                   # () parameters
                    ::= 'v'                   # (void) parameters
					::= <parameter>+
					::= <parameter>+ 'e'	  # ends in "..."

<return-type>       ::= <type>

<modifiers>         ::= [C] [U] [V] [u]  # const, unsigned, volatile, restrict

<builtin-type>      ::= 'i'					  # int
					::= 'l'					  # long
					::= 's'					  # short
					::= 'Sc'				  # signed char
					::= 'c'					  # char
					::= 'w'                   # wchar/java-char
					::= 'x'                   # long long
					::= 'b'                   # bool
					::= 'r'                   # long double
					::= 'd'                   # double
					::= 'f'                   # float
					::= 'J' <type>            # complex <type>
					::= 'v'                   # void
					::= 'I' <bit-size>        # integer of <bit-size> bits

<bit-size>          ::= <hex> <hex>           # sizes < 256
                    ::= _ <hex>+ _            # sizes >= 256

<parameter>         ::= <type>
                    ::= <repeat-count> <backref>

<repeat-count>      ::= 'T'                   # single repeat

libjit/doc/mangling_rules.txt  view on Meta::CPAN

                    ::= n   # __int128
                    ::= o   # unsigned __int128
                    ::= f   # float
                    ::= d   # double
                    ::= e   # long double, __float80
                    ::= g   # __float128          [not supported]
                    ::= u <source-name>  # vendor extended type */

<function-type>     ::= F [Y] <bare-function-type> E

<bare-function-type> ::= </signature/ type>+

<class-enum-type>   ::= <name>

<template-args>     ::= I <template-arg>+ E

<expression>        ::= <unary operator-name> <expression>
                    ::= <binary operator-name> <expression> <expression>
                    ::= <expr-primary>

<expr-primary>      ::= <template-param>
                    ::= L <type> <value number> E  # literal
                    ::= L <mangled-name> E         # external name

<template-arg>      ::= <type>                        # type
                    ::= L <type> </value/ number> E   # literal
                    ::= LZ <name> E                   # external name
                    ::= X <expression> E              # expression
   
     Literal subcase of non-terminal <template-arg>.

     "Literal arguments, e.g. "A<42L>", are encoded with their type
     and value. Negative integer values are preceded with "n"; for
     example, "A<-42L>" becomes "1AILln42EE". The bool value false is
     encoded as 0, true as 1. If floating-point arguments are accepted
     as an extension, their values should be encoded using a
     fixed-length lowercase hexadecimal string corresponding to the
     internal representation (IEEE on IA-64), high-order bytes first,
     without leading zeroes. For example: "Lfbff000000E" is -1.0f."

<template-template-arg> ::= <name>
                        ::= <substitution>

<array-type>        ::= A [</dimension/ number>] _ </element/ type>
                    ::= A <expression> _ </element/ type>

     "Array types encode the dimension (number of elements) and the
     element type. For variable length arrays, the dimension (but not
     the '_' separator) is omitted."

<pointer-to-member-type> ::= M </class/ type> </member/ type>

<template-param>    ::= T </parameter/ number> _

<template-template-param> ::= <template-param>
                          ::= <substitution>

MSVC 6.0 name mangling rules (determined by trial and error):
------------------------------------------------------------

<global-function>	::= '?' <name> '@@Y' <callconv> <return-type> <parameters>

<member-function>	::= '?' <name> '@' <class-name> '@@' <access>
							[<const>] <callconv> <return-type> <parameters>

<ctor-function>		::= '??0' <class-name> '@@' <access> <const> <callconv>
							'@' <parameters>

<dtor-function>		::= '??1' <class-name> '@@' <access> <const> <callconv>
							'@' <parameters>

<access>			::= 'Q'				# public instance
					::= 'I'				# protected instance
					::= 'A'				# private instance
					::= 'S'				# public static
					::= 'K'				# protected static
					::= 'C'				# private static
					::= 'U'				# public virtual
					::= 'M'				# protected virtual
					::= 'E'				# private virtual

<callconv>			::= 'A'				# cdecl
					::= 'E'				# thiscall
					::= 'G'				# stdcall
					::= 'I'				# fastcall

<const>				::= 'A'				# non-const method (instance only)
					::= 'B'				# const method (instance only)

<return-type>		::= 'X'				# void
					::= <type>

<parameters>		::= 'XZ'			# () or (void)
					::= <type>+ '@Z'	# 1 or more parameters
					::= <type>+ 'ZZ'	# 1 or more, followed by ...

<func-ptr>			::= <callconv> <return-type> <parameters>

<type>				::= <builtin-type>
					::= 'PA' <type>		# pointer to <type>
					::= 'PB' <type>		# const pointer to <type>
					::= 'PC' <type>		# volatile pointer to <type>
					::= 'PD' <type>		# const volatile pointer to <type>
					::= 'P6' <func-ptr>	# function pointer type
					::= 'AA' <type>		# reference to <type>
					::= 'AB' <type>		# const reference to <type>
					::= 'AC' <type>		# volatile reference to <type>
					::= 'AD' <type>		# const volatile reference to <type>
					::= 'T' <name> '@@'	# union name
					::= 'U' <name> '@@'	# struct name
					::= 'V' <name> '@@'	# class name
					::= 'W' <digit> <name> '@@' # enum of a given byte size
					::= <digit>			# backref to identifier 'n' in name

<builtin-type>		::= 'D'				# char
					::= 'C'				# signed char
					::= 'E'				# unsigned char
					::= 'F'				# short
					::= 'G'				# unsigned short
					::= 'H'				# int
					::= 'I'				# unsigned int



( run in 0.918 second using v1.01-cache-2.11-cpan-f0fbb3f571b )