/* This section contains mappings that are used at more then one place.*/ MAP 1 ---------- If we are using one of cmp or lcmp, we can map them depending on the branch action following. FOLLOWING BRANCH MAP eq beq ne bgt.un blt lt blt le ble gt bgt.un ge bge.un Arithmetic Instructions: ---------------------------- 1. iadd add 2. ladd add 3. dadd add 4. fadd add --> Sementics differ regarding overflow 5. isub sub 6. lsub sub 7. dsub sub 8. fsub sub --> Sementics differ regarding overflow 9. imul mul 10. lmul mul 11. dmul mul 12. fmul mul --> Sementics differ regarding overflow 13. idiv div --> Sementics differ about exception throwing 14. ldiv div --> Sementics differ about exception throwing 15. ddiv div 16. fdiv div --> Sementics differ regarding overflow 17. irem rem 18. lrem rem 19. drem rem 20. frem rem --> Sementics differ regarding overflow 21. ineg neg 22. lneg neg 23. dneg neg 24. fneg neg Logical Operations : ----------------------- 25. ior or 26. lor or 27. iand and 28. land and 29. ixor xor 30. lxor xor 31. ishl this has to be done in 3 steps push 0x1f and shl 32. ishr this has to be done in 3 steps push 0x1f and shr 33. iushr this has to be done in 3 steps push 0x1f and shr.un 34. lshl this has to be done in 3 steps push 0x3f and shl 35. lshr this has to be done in 3 steps push 0x3f and shr 36. lushr this has to be done in 3 steps push 0x3f and shr.un Comparison Instructions: ---------------------------- 37. dcmpg Following algo will have to be followed : on stack : val1 val2 if(cgt.un returns 1) done else if( clt returns 1) pop 1 and push -1 on stack. Remember to push val1 and val2 again and again if u do further operations. OR if dcmpg is followed by a if instruction then we can use MAP1. 38. dcmpl Following algo will have to be followed : on stack : val1 val2 if(clt.un returns 1) pop 1,push -1 else cgt Remember to push val1 and val2 again and again if u do further operations. OR if dcmpl is followed by a if instruction then we can use MAP1. 39. fcmpg 40.fcmpl Both same as above. 41.lcmp on stack: val1 val2. if(clt returns 1) pop 1, push -1 else cgt Remember to push val1 and val2 again and again if u do further operations. OR if lcmp is followed by a if instruction then we can use MAP1. Increment the local variable : --------------------------------- 42. iinc if( index < 4 ) ldloc.index else ldloc.s index ldc.i4 const add stloc index Here index refers to the index for the local variable array of IL.It will be different from index given with iinc. Type Conversion Instructions: ------------------------------------ 43.