Research Article

A Migration Method of MPI Program Combining Local Library Replacement and Instruction Translation

Algorithm 3

Opcode interception algorithm.
//function: intercept opcode to redirect program flow
//input: the code segment of executable file (.text), list of
library function, current environment (env)
//output: instructions calling local library function
Foreach insn in  .text
 switch insn
 case: call insn
  if (the address of calling instruction is in the func_info)
 generate instructions of moving local argument
 generate instructions of calling local library function
 generate ret instruction of storing library function
   break;
  case
   ⋯
  default
   ⋯
  break
Endfor