- DEBUG(std::cerr << "Emitting a jump to 0x" << std::hex << Target << "\n");
-
- // If the target function is close enough to fit into the 19bit disp of
- // BA, we should use this version, as its much cheaper to generate.
- int64_t BranchTarget = (Target-CodeBegin) >> 2;
- if (BranchTarget >= (1 << 19) || BranchTarget <= -(1 << 19)) {
- TheJITResolver->insertFarJumpAtAddr(Target, CodeBegin);
- } else {
- // ba <target>
- MachineInstr *I = BuildMI(V9::BA, 1).addSImm(BranchTarget);
- *((unsigned*)(intptr_t)CodeBegin) =
- TheJITResolver->getBinaryCodeForInstr(*I);
- CodeBegin += 4;
- delete I;
-
- // nop
- I = BuildMI(V9::NOP, 0);
- *((unsigned*)(intptr_t)CodeBegin) =
- TheJITResolver->getBinaryCodeForInstr(*I);
- delete I;
- }