diff options
| author | Yong He <yonghe@outlook.com> | 2024-05-14 18:01:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-14 18:01:31 -0700 |
| commit | 4edc72e4dea47cf549b4e28940e3509a5ab61439 (patch) | |
| tree | 10475236b4a0e1f8a7a0bafdaa05a09d26f9412f /source/slang/slang-lower-to-ir.cpp | |
| parent | d76bed6c1b03e5d7ef19c947fdd5fcaf33b595f7 (diff) | |
Remove use of `G0` and `__target_intrinsic` in stdlib. (#4170)
* Remove use of `G0` and `__target_intrinsic` in stdlib.
* Fix.
* Fix calling intrinsic in global scope.
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 9de1833a0..debe5078d 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -6422,8 +6422,22 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> void visitIntrinsicAsmStmt(IntrinsicAsmStmt* stmt) { auto builder = getBuilder(); - IRInst* arg = builder->getStringValue(stmt->asmText.getUnownedSlice()); - builder->emitIntrinsicInst(nullptr, kIROp_GenericAsm, 1, &arg); + ShortList<IRInst*> args; + args.add(builder->getStringValue(stmt->asmText.getUnownedSlice())); + for (auto argExpr : stmt->args) + { + if (auto typetype = as<TypeType>(argExpr->type)) + { + auto type = lowerType(context, typetype->getType()); + args.add(type); + } + else + { + auto argVal = lowerRValueExpr(context, argExpr); + args.add(argVal.val); + } + } + builder->emitIntrinsicInst(nullptr, kIROp_GenericAsm, args.getCount(), args.getArrayView().getBuffer()); } void visitSwitchStmt(SwitchStmt* stmt) |
