https://github.com/shader-slang/slang
Revision 5c220292d6ac2674942bb5f1bb09fe1817151c11 authored by Tim Foley on 07 November 2017, 17:25:41 UTC, committed by Tim Foley on 07 November 2017, 18:48:17 UTC
The source of a lot of these changes is that our current strategy for dealing with "builtin" operations when emitting HLSL from the IR is to de-mangle the mangled name of an operation, and then emit HLSL code for a function call to an operation with that de-mangled name.

This change introduces a few fixups for that work:

- It adds support for parsing the mangled names of generics (specialized and unspecialized)

- It adds logic for detecting when the operation being invoked is a member function
  - This is currently a bit ugly, since we compare the number of actual arguments we have in the IR against the number of parameters declared for the callee, and if they don't match we assume we have an extra `this` argument.

On the mangling side, we add (hacky) support for mangling a function name when its types involve generic parameters, e.g.:

```
__generic<T, let N : int> T length(vector<T,N> v);
```

In this case the mangled name of the function needs to include a mangling for the type `vector<T,N>` which means it also needs to include a mangling for `N`.

The reason I describe this support as "hacky" is because we really shouldn't be reproducing the names `T` or `N` in the mangled symbol name. By doing so we make it so that a user changing the name of a generic parameter would break (IR) binary compatibility with existing code that was separately compiled.
I've included comments in the code about a better way to handle this, but it isn't a priorit right now since binary compatibility isn't something meaningful until we start emitting usable bytecode modules.
1 parent 93a444f
History
Tip revision: 5c220292d6ac2674942bb5f1bb09fe1817151c11 authored by Tim Foley on 07 November 2017, 17:25:41 UTC
Fixes for name mangling/demangling
Tip revision: 5c22029
File Mode Size
build
docs
examples
external
source
tests
tools
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 398 bytes
.gitmodules -rw-r--r-- 107 bytes
.travis.yml -rw-r--r-- 1.6 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
LICENSE -rw-r--r-- 1.1 KB
Makefile -rw-r--r-- 6.3 KB
README.md -rw-r--r-- 6.2 KB
appveyor.yml -rw-r--r-- 3.5 KB
slang.h -rw-r--r-- 35.4 KB
slang.sln -rw-r--r-- 9.1 KB
test.bat -rw-r--r-- 1.4 KB

README.md

back to top