diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-12-19 16:40:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-19 16:40:33 -0500 |
| commit | 9f0e9d6ba431d8deb000b4fe6ff03c879d662f45 (patch) | |
| tree | a5097a8367a767fcf8caf6476de1bebe57066b0c /source/slang/slang-emit-cpp.h | |
| parent | e3fe0319467546bae070137c58dcf8f9fbe93c79 (diff) | |
Split out IRTypeSet (#1158)
* CPPCompiler -> DownstreamCompiler
* Added DownstreamCompileResult to start abstraction such that we don't need files.
* * Split out slang-blob.cpp
* Made CompileResult hold a DownstreamCompileResult - for access to binary or ISlangSharedLibrary
* Keep temporary files in scope.
* Add a hash to the hex dump stream.
* Move all file tracking into DownstreamCompiler.
* WIP support for nvrtc.
* WIP: Adding support for nvrtc compiler.
Adding enum types, wiring up the nvrtc into slang.
* Fix remaining CPPCompiler references.
* Fix order issue on target string matching.
* Use ISlangSharedLibrary for nvrtc.
* Use DownstreamCompiler for nvrtc.
* WIP first pass at compilation win nvrtc.
* Added testing if file is on file system into CommandLineDownstreamCompiler.
Added sourceContentsPath.
* Make test cuda-compile.cu work by just compiling not comparing output.
* Genearlize DownstreamCompiler usage.
* Fix warning on clang.
* Remove CompilerType from DownstreamCompiler.
* Use DownstreamCompiler interface for all compilers.
NOTE for FXC, DXC and GLSLANG this doesn't mean using 'compile' - it's still extracting functions from shared library.
* Replace DownstreamCompiler::SourceType -> SlangSourceLanguage
* Replace _canCompile with something data driven.
* Fix compiling on gcc/clang for DownstreamCompiler.
* Moved some text conversions into DownstreamCompiler.
* Fix problem on non-vc builds with not having return on locateCompilers for VS.
* Change so no warning for code not reachable on locateCompilers for vs.
* WIP: CUDA code generation - currently just using CPU layout and HLSL.
* emitXXXForEntryPoint -> emitEntryPointSource
emitSourceForEntryPoint -> emitEntryPointSourceFromIR
Fix up generating cuda to get PTX.
* WIP emitting cuda for IR.
* Small improvements to CUDA ouput.
* Disable the CUDA emit test, as output not currently compilable.
* Split out IRTypeSet to simplify CPPSourceEmitter and other Emitters that rely on determining unique use of type and/or need to generate types in order to output code.
Diffstat (limited to 'source/slang/slang-emit-cpp.h')
| -rw-r--r-- | source/slang/slang-emit-cpp.h | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/source/slang/slang-emit-cpp.h b/source/slang/slang-emit-cpp.h index fdc283574..ffe4a1544 100644 --- a/source/slang/slang-emit-cpp.h +++ b/source/slang/slang-emit-cpp.h @@ -5,6 +5,8 @@ #include "slang-emit-c-like.h" #include "slang-ir-clone.h" +#include "slang-ir-type-set.h" + #include "../core/slang-string-slice-pool.h" namespace Slang @@ -254,11 +256,6 @@ protected: static TypeDimension _getTypeDimension(IRType* type, bool vecSwap); static void _emitAccess(const UnownedStringSlice& name, const TypeDimension& dimension, int row, int col, SourceWriter* writer); - IRType* _getVecType(IRType* elementType, int elementCount); - - IRInst* _clone(IRInst* inst); - IRType* _cloneType(IRType* type) { return (IRType*)_clone((IRInst*)type); } - StringSlicePool::Handle _calcScalarFuncName(IntrinsicOp op, IRBasicType* type); UnownedStringSlice _getScalarFuncName(IntrinsicOp operation, IRBasicType* scalarType); @@ -282,30 +279,8 @@ protected: Dictionary<SpecializedIntrinsic, StringSlicePool::Handle> m_intrinsicNameMap; Dictionary<IRType*, StringSlicePool::Handle> m_typeNameMap; - /* This is used so as to try and use slangs type system to uniquely identify types and specializations on intrinsic. - That we want to have a pointer to a type be unique, and slang supports this through the m_sharedIRBuilder. BUT for this to - work all work on the module must use the same sharedIRBuilder, and that appears to not be the case in terms - of other passes. - Even if it was the case when we may want to add types as part of emitting, we can't use the previously used - shared builder, so again we end up with pointers to the same things not being the same thing. - - To work around this we clone types we want to use as keys into the 'unique module'. - This is not necessary for all types though - as we assume nominal types *must* have unique pointers (that is the - definition of nominal). - - This could be handled in other ways (for example not testing equality on pointer equality). Anyway for now this - works, but probably needs to be handled in a better way. The better way may involve having guarantees about equality - enabled in other code generation and making de-duping possible in emit code. - - Note that one pro for this approach is that it does not alter the source module. That as it stands it's not necessary - for the source module to be immutable, because it is created for emitting and then discarded. - */ - RefPtr<IRModule> m_uniqueModule; - SharedIRBuilder m_sharedIRBuilder; - IRBuilder m_irBuilder; - - Dictionary<IRInst*, IRInst*> m_cloneMap; - + IRTypeSet m_typeSet; + Dictionary<IRType*, bool> m_typeEmittedMap; Dictionary<SpecializedIntrinsic, bool> m_intrinsicEmittedMap; |
