summaryrefslogtreecommitdiffstats
path: root/source/slang/mangle.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-12-13 12:26:36 -0800
committerGitHub <noreply@github.com>2018-12-13 12:26:36 -0800
commit970b58a209e06afc7bd104e4701abfbb055f7c4d (patch)
treecf57d89d6292d2f471c286b1b1c8d62d6b68bf84 /source/slang/mangle.cpp
parent8d13c06ab51f4993f5c56772e83fba3c384674df (diff)
parent822ed708364b257b7d2f61ecb8a51a4c96f7edaa (diff)
Merge branch 'master' into dictfix
Diffstat (limited to 'source/slang/mangle.cpp')
-rw-r--r--source/slang/mangle.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp
index c2645929f..d78f3321a 100644
--- a/source/slang/mangle.cpp
+++ b/source/slang/mangle.cpp
@@ -1,7 +1,6 @@
#include "mangle.h"
#include "name.h"
-#include "ir-insts.h"
#include "syntax.h"
#include "../core/slang-cpu-defines.h"
@@ -200,82 +199,6 @@ namespace Slang
}
}
- void emitIRVal(
- ManglingContext* context,
- IRInst* inst);
-
- void emitIRSimpleIntVal(
- ManglingContext* context,
- IRInst* inst)
- {
- if (auto intLit = as<IRIntLit>(inst))
- {
- auto cVal = intLit->getValue();
- if(cVal >= 0 && cVal <= 9 )
- {
- emit(context, (UInt)cVal);
- return;
- }
- }
-
- // Fallback:
- emitIRVal(context, inst);
- }
-
- void emitIRVal(
- ManglingContext* context,
- IRInst* inst)
- {
- if(auto basicType = as<IRBasicType>(inst) )
- {
- emitBaseType(context, basicType->getBaseType());
- return;
- }
-
- if (auto globalVal = as<IRGlobalValue>(inst))
- {
- // If it is a global value, it has its own mangled name.
- emit(context, getText(globalVal->mangledName));
- }
- // TODO: need to handle various type cases here
- else if (auto intLit = as<IRIntLit>(inst))
- {
- // TODO: need to figure out what prefix/suffix is needed
- // to allow demangling later.
- emitRaw(context, "k");
- emit(context, (UInt) intLit->getValue());
- }
- // Note: the cases here handling types really should match
- // the cases above that handle AST-level `Type`s. This
- // seems to be a weakness in the way we mangle names, because
- // we may mangle in both IR-level and AST-level types.
- else if (auto vecType = as<IRVectorType>(inst))
- {
- emitRaw(context, "v");
- emitIRSimpleIntVal(context, vecType->getElementCount());
- emitIRVal(context, vecType->getElementType());
-
- }
- else if( auto matType = as<IRMatrixType>(inst) )
- {
- emitRaw(context, "m");
- emitIRSimpleIntVal(context, matType->getRowCount());
- emitRaw(context, "x");
- emitIRSimpleIntVal(context, matType->getColumnCount());
- emitIRVal(context, matType->getElementType());
- }
- else if (auto arrType = as<IRArrayType>(inst))
- {
- emitRaw(context, "a");
- emitIRSimpleIntVal(context, arrType->getElementCount());
- emitIRVal(context, arrType->getElementCount());
- }
- else
- {
- SLANG_UNEXPECTED("unimplemented case in mangling");
- }
- }
-
void emitQualifiedName(
ManglingContext* context,
DeclRef<Decl> declRef)
@@ -487,21 +410,6 @@ namespace Slang
DeclRef<Decl>(declRef.decl, declRef.substitutions));
}
- String mangleSpecializedFuncName(String baseName, IRSpecialize* specializeInst)
- {
- ManglingContext context;
- emitRaw(&context, baseName.Buffer());
- emitRaw(&context, "_G");
-
- UInt argCount = specializeInst->getArgCount();
- for (UInt aa = 0; aa < argCount; ++aa)
- {
- emitIRVal(&context, specializeInst->getArg(aa));
- }
-
- return context.sb.ProduceString();
- }
-
String getMangledName(Decl* decl)
{
return getMangledName(makeDeclRef(decl));