// File: jstaursky[P]hutch/src/Sleigh/semantics.cc
// Function: PcodeBuilder::build(ConstructTpl*, int)
void PcodeBuilder::build(ConstructTpl *construct,int4 secnum)

{
  if (construct == (ConstructTpl *)0)
    throw UnimplError("",0);	// Pcode is not implemented for this constructor

  uint4 oldbase = labelbase;	// Recursively store old labelbase
  labelbase = labelcount;	// Set the newbase
  labelcount += construct->numLabels();	// Add labels from this template

  vector<OpTpl *>::const_iterator iter;
  OpTpl *op;
  const vector<OpTpl *> &ops(construct->getOpvec());

  for(iter=ops.begin();iter!=ops.end();++iter) {
    op = *iter;
    switch(op->getOpcode()) {
    case BUILD:
      appendBuild( op, secnum );
      break;
    case DELAY_SLOT:
      delaySlot( op );
      break;
    case LABELBUILD:
      setLabel( op );
      break;
    case CROSSBUILD:
      appendCrossBuild(op,secnum);
      break;
    default:
      dump( op );
      break;
    }
  }
  labelbase = oldbase;		// Restore old labelbase
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movl %edx, 0x94(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x98(%rsp)
jne 0x118fa4
movb $0x1, 0x5b(%rsp)
movl $0x28, %edi
callq 0xd2b40
movq %rax, 0x10(%rsp)
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xe0c80
movq 0x18(%rsp), %rdx
leaq 0x70177(%rip), %rsi     # 0x189090
leaq 0x70(%rsp), %rdi
callq 0xe00a0
jmp 0x118f25
movq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rsi
xorl %edx, %edx
callq 0xde210
jmp 0x118f38
movq 0x10(%rsp), %rdi
movb $0x0, 0x5b(%rsp)
movq 0xaefcf(%rip), %rsi     # 0x1c7f18
movq 0xaeeb8(%rip), %rdx     # 0x1c7e08
callq 0xe01f0
jmp 0x119100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
jmp 0x118f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0xd4550
leaq 0x6f(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x5b(%rsp)
jne 0x118f95
jmp 0x118f9f
movq 0x10(%rsp), %rdi
callq 0xd5400
jmp 0x1190f6
movq 0x20(%rsp), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x54(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x8(%rax)
movq 0x98(%rsp), %rdi
callq 0xd01c0
movl %eax, %ecx
movq 0x20(%rsp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
leaq 0x48(%rsp), %rdi
callq 0xd8d80
movq 0x98(%rsp), %rdi
callq 0xe1e50
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0xdc0c0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %rdi
callq 0xd3030
movq %rax, 0x28(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xcfac0
testb $0x1, %al
jne 0x11902c
jmp 0x1190e2
leaq 0x48(%rsp), %rdi
callq 0xdd340
movq (%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0xe2420
addl $-0x3c, %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x6, %eax
ja 0x1190c2
movq 0x8(%rsp), %rax
leaq 0x6f121(%rip), %rcx     # 0x188184
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movl 0x94(%rsp), %edx
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x1190d1
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x1190d1
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq (%rdi), %rax
callq *0x28(%rax)
jmp 0x1190d1
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movl 0x94(%rsp), %edx
movq (%rdi), %rax
callq *0x30(%rax)
jmp 0x1190d1
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq (%rdi), %rax
callq *(%rax)
jmp 0x1190d3
leaq 0x48(%rsp), %rdi
callq 0xd8000
jmp 0x119005
movq 0x20(%rsp), %rax
movl 0x54(%rsp), %ecx
movl %ecx, 0x8(%rax)
addq $0xa8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0xe0be0