Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.49 KB | None | 0 0
  1. // first
  2.  
  3.     for x in f.Body.Instructions do
  4.         // Copy to branches
  5.         match x.OpCode.OperandType with
  6.         | OperandType.InlineBrTarget
  7.         | OperandType.ShortInlineBrTarget ->
  8.             let y = x.Operand :?> Instruction
  9.             depths.[y] <- depth
  10.         | OperandType.InlineSwitch ->
  11.             for y in x.Operand :?> Instruction array do
  12.                 depths.[y] <- depth
  13.         | _ ->
  14.             ()
  15.  
  16.         // Empty after unconditional control transfer unless forward branch
  17.         match x.OpCode.FlowControl with
  18.         | FlowControl.Branch
  19.         | FlowControl.Break
  20.         | FlowControl.Return
  21.         | FlowControl.Throw ->
  22.             depth <- 0
  23.         | _ ->
  24.             ()
  25.     depths
  26.  
  27. // second
  28.  
  29.     for x in f.Body.Instructions do
  30.  
  31.         // Copy to branches
  32.         match x.OpCode.OperandType with
  33.         | OperandType.InlineBrTarget
  34.         | OperandType.ShortInlineBrTarget ->
  35.             let y = x.Operand :?> Instruction
  36.             depths.[y] <- depth
  37.         | OperandType.InlineSwitch ->
  38.             for y in x.Operand :?> Instruction array do
  39.                 depths.[y] <- depth
  40.         | _ ->
  41.             ()
  42.  
  43.         // Empty after unconditional control transfer unless forward branch
  44.         match x.OpCode.FlowControl with
  45.         | FlowControl.Branch
  46.         | FlowControl.Break
  47.         | FlowControl.Return
  48.         | FlowControl.Throw ->
  49.             depth <- 0
  50.         | _ ->
  51.             ()
  52.  
  53.     depths
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement