| 350 | } |
| 351 | |
| 352 | void CLikeCodeGen::PrintUnaryInstrExpr(CodeGenContext & ctx, UnaryInstruction * instr) |
| 353 | { |
| 354 | auto op0 = instr->Operand.Ptr(); |
| 355 | if (instr->Is<LoadInstruction>()) |
| 356 | { |
| 357 | PrintOp(ctx, op0); |
| 358 | return; |
| 359 | } |
| 360 | else if (instr->Is<SwizzleInstruction>()) |
| 361 | { |
| 362 | PrintSwizzleInstrExpr(ctx, instr->As<SwizzleInstruction>()); |
| 363 | return; |
| 364 | } |
| 365 | const char * op = ""; |
| 366 | if (instr->Is<BitNotInstruction>()) |
| 367 | op = "~"; |
| 368 | else if (instr->Is<Float2IntInstruction>()) |
| 369 | op = "(int)"; |
| 370 | else if (instr->Is<Int2FloatInstruction>()) |
| 371 | op = "(float)"; |
| 372 | else if (instr->Is<CopyInstruction>()) |
| 373 | op = ""; |
| 374 | else if (instr->Is<NegInstruction>()) |
| 375 | op = "-"; |
| 376 | else if (instr->Is<NotInstruction>()) |
| 377 | op = "!"; |
| 378 | else |
| 379 | throw InvalidProgramException("unsupported unary instruction."); |
| 380 | ctx.Body << "(" << op; |
| 381 | PrintOp(ctx, op0); |
| 382 | ctx.Body << ")"; |
| 383 | } |
| 384 | |
| 385 | void CLikeCodeGen::PrintUnaryInstr(CodeGenContext & ctx, UnaryInstruction * instr) |
| 386 | { |
nothing calls this directly
no test coverage detected