// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/liveness.c
// Function: track_instruction_usage
static void track_instruction_usage(struct basic_block *bb, struct instruction *insn,
	void (*def)(struct basic_block *, pseudo_t),
	void (*use)(struct basic_block *, pseudo_t))
{
	pseudo_t pseudo;

	#define USES(x)		use(bb, insn->x)
	#define DEFINES(x)	def(bb, insn->x)

	switch (insn->opcode) {
	case OP_RET:
	case OP_COMPUTEDGOTO:
		USES(src);
		break;

	case OP_CBR:
	case OP_SWITCH:
		USES(cond);
		break;

	/* Binary */
	case OP_BINARY ... OP_BINARY_END:
	case OP_FPCMP ... OP_FPCMP_END:
	case OP_BINCMP ... OP_BINCMP_END:
		USES(src1); USES(src2); DEFINES(target);
		break;

	/* Uni */
	case OP_UNOP ... OP_UNOP_END:
	case OP_SYMADDR:
	case OP_SLICE:
		USES(src); DEFINES(target);
		break;

	case OP_SEL:
		USES(src1); USES(src2); USES(src3); DEFINES(target);
		break;
	
	/* Memory */
	case OP_LOAD:
		USES(src); DEFINES(target);
		break;

	case OP_STORE:
		USES(src); USES(target);
		break;

	case OP_LABEL:
	case OP_SETVAL:
	case OP_SETFVAL:
		DEFINES(target);
		break;

	/* Other */
	case OP_PHI:
		/* Phi-nodes are "backwards" nodes. Their def doesn't matter */
		phi_defines(insn, insn->target, def);
		break;

	case OP_PHISOURCE:
		/*
		 * We don't care about the phi-source define, they get set
		 * up and expanded by the OP_PHI
		 */
		USES(phi_src);
		break;

	case OP_CALL:
		USES(func);
		if (insn->target != VOID)
			DEFINES(target);
		FOR_EACH_PTR(insn->arguments, pseudo) {
			use(bb, pseudo);
		} END_FOR_EACH_PTR(pseudo);
		break;

	case OP_ASM:
		asm_liveness(bb, insn, def, use);
		break;

	case OP_RANGE:
		USES(src1); USES(src2); USES(src3);
		break;

	case OP_BADOP:
	case OP_NOP:
	case OP_CONTEXT:
		break;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl (%rsi), %eax
andl $0x7f, %eax
addl $-0x2, %eax
cmpl $0x4e, %eax
ja 0x3ec46
movq %rcx, %r13
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xd9e6(%rip), %rcx      # 0x4c554
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%r14), %rsi
movq %rbx, %rdi
movq %rdx, %r15
callq *%r13
movq 0x38(%r14), %rsi
movq %rbx, %rdi
jmp 0x3eb97
movq 0x30(%r14), %rsi
movq %rbx, %rdi
movq %rdx, %r15
callq *%r13
movq 0x20(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *%rax
movq 0x30(%r14), %rsi
movq %rbx, %rdi
movq %r13, %rax
jmp 0x3eba4
movq 0x20(%r14), %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *%rdx
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq *%r13
movq 0x20(%r14), %rsi
jmp 0x3ebb3
movq %rdx, %r15
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq *%r13
movq 0x20(%r14), %rsi
cmpq 0x2239b(%rip), %rsi     # 0x60f90
je 0x3ebfd
movq %rbx, %rdi
callq *%r15
movq 0x38(%r14), %r14
testq %r14, %r14
je 0x3ec46
movq %r14, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0x3ec3d
xorl %r12d, %r12d
movq 0x18(%r15,%r12,8), %rsi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x3ec28
testq %rsi, %rsi
je 0x3ec2e
movq %rbx, %rdi
callq *%r13
incq %r12
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0x3ec14
movq 0x10(%r15), %r15
cmpq %r14, %r15
jne 0x3ec09
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x30(%r14), %rsi
movq %rbx, %rdi
movq %rdx, %r15
callq *%r13
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq *%r13
movq 0x40(%r14), %rsi
jmp 0x3eb88
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq *%r13
movq 0x38(%r14), %rsi
movq %rbx, %rdi
callq *%r13
movq 0x40(%r14), %rsi
jmp 0x3ebb3
movq 0x20(%r14), %rsi
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3f18a
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3f217