From 653fe976af88fcf86162ca5bb1b46d4378864572 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 19 Sep 2018 15:27:50 -0400 Subject: Support for IRStringLit (#645) * * Added support for strings in IR with IRStringLit - with storage of chars after it * Added kIRDecorationOp_Transitory - can be used for detecting instructions constructed on stack * Made IRConstant hashing work off type * Fix comment that is out of date about how an instruction is determines to hold a transitory string. --- source/slang/emit.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/slang/emit.cpp') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 2d774d8d8..74678ef94 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -1015,7 +1015,7 @@ struct EmitVisitor } const IRConstant* irConst = (const IRConstant*)elementCountInst; - const IRIntegerValue elementCount = irConst->u.intVal; + const IRIntegerValue elementCount = irConst->value.intVal; if (elementCount <= 0) { SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "Vector size must be greater than 0"); @@ -2277,16 +2277,16 @@ struct EmitVisitor switch(inst->op) { case kIROp_IntLit: - emit(((IRConstant*) inst)->u.intVal); + emit(((IRConstant*) inst)->value.intVal); break; case kIROp_FloatLit: - Emit(((IRConstant*) inst)->u.floatVal); + Emit(((IRConstant*) inst)->value.floatVal); break; case kIROp_boolConst: { - bool val = ((IRConstant*)inst)->u.intVal != 0; + bool val = ((IRConstant*)inst)->value.intVal != 0; emit(val ? "true" : "false"); } break; @@ -3611,7 +3611,7 @@ struct EmitVisitor SLANG_RELEASE_ASSERT(irElementIndex->op == kIROp_IntLit); IRConstant* irConst = (IRConstant*)irElementIndex; - UInt elementIndex = (UInt)irConst->u.intVal; + UInt elementIndex = (UInt)irConst->value.intVal; SLANG_RELEASE_ASSERT(elementIndex < 4); char const* kComponents[] = { "x", "y", "z", "w" }; @@ -3767,7 +3767,7 @@ struct EmitVisitor SLANG_RELEASE_ASSERT(irElementIndex->op == kIROp_IntLit); IRConstant* irConst = (IRConstant*)irElementIndex; - UInt elementIndex = (UInt)irConst->u.intVal; + UInt elementIndex = (UInt)irConst->value.intVal; SLANG_RELEASE_ASSERT(elementIndex < 4); char const* kComponents[] = { "x", "y", "z", "w" }; @@ -3792,7 +3792,7 @@ struct EmitVisitor SLANG_RELEASE_ASSERT(irElementIndex->op == kIROp_IntLit); IRConstant* irConst = (IRConstant*)irElementIndex; - UInt elementIndex = (UInt)irConst->u.intVal; + UInt elementIndex = (UInt)irConst->value.intVal; SLANG_RELEASE_ASSERT(elementIndex < 4); char const* kComponents[] = { "x", "y", "z", "w" }; -- cgit v1.2.3