summaryrefslogtreecommitdiff
path: root/source/slang/slang-lower-to-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-06-18 15:06:14 -0700
committerGitHub <noreply@github.com>2020-06-18 15:06:14 -0700
commit515d8eb0cd719ae31db2f6e03751011a123bc0ba (patch)
tree3e78893a74af856fb29158078bed7099a567f5dd /source/slang/slang-lower-to-ir.cpp
parente2d21026d115dc61296b47dcc990534f1844bc7f (diff)
parentaa6aca498cd1f7fbbdb143e72dd48b1d714c8fbb (diff)
Merge branch 'master' into feature/prelude-fix
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
-rw-r--r--source/slang/slang-lower-to-ir.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 01bd0e972..ea04ea85c 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -6157,6 +6157,8 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
LoweredValInfo paramVal;
+ IRParam* irParam = nullptr;
+
switch( paramInfo.direction )
{
default:
@@ -6166,15 +6168,15 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
//
// TODO: Is this the best representation we can use?
- IRParam* irParamPtr = subBuilder->emitParam(irParamType);
+ irParam = subBuilder->emitParam(irParamType);
if(auto paramDecl = paramInfo.decl)
{
- addVarDecorations(context, irParamPtr, paramDecl);
- subBuilder->addHighLevelDeclDecoration(irParamPtr, paramDecl);
+ addVarDecorations(context, irParam, paramDecl);
+ subBuilder->addHighLevelDeclDecoration(irParam, paramDecl);
}
- addParamNameHint(irParamPtr, paramInfo);
+ addParamNameHint(irParam, paramInfo);
- paramVal = LoweredValInfo::ptr(irParamPtr);
+ paramVal = LoweredValInfo::ptr(irParam);
// TODO: We might want to copy the pointed-to value into
// a temporary at the start of the function, and then copy
@@ -6194,7 +6196,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
// We start by declaring an IR parameter of the same type.
//
auto paramDecl = paramInfo.decl;
- IRParam* irParam = subBuilder->emitParam(irParamType);
+ irParam = subBuilder->emitParam(irParamType);
if( paramDecl )
{
addVarDecorations(context, irParam, paramDecl);
@@ -6249,6 +6251,14 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
if (paramInfo.isThisParam)
{
subContext->thisVal = paramVal;
+ subBuilder->addThisPointerDecoration(irParam);
+ }
+
+ // Add a [polymorphic] decoration for generic-typed parameters.
+ if (as<IRParam>(irParamType) &&
+ as<IRTypeType>(irParamType->getFullType()))
+ {
+ subBuilder->addPolymorphicDecoration(irParam);
}
}