You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.2 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. #nullable enable
  2. // Copyright (c) 2014 Daniel Grunwald
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy of this
  5. // software and associated documentation files (the "Software"), to deal in the Software
  6. // without restriction, including without limitation the rights to use, copy, modify, merge,
  7. // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  8. // to whom the Software is furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in all copies or
  11. // substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  14. // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15. // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  16. // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  17. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  18. // DEALINGS IN THE SOFTWARE.
  19. using System;
  20. namespace ICSharpCode.Decompiler.IL
  21. {
  22. [Flags]
  23. public enum InstructionFlags
  24. {
  25. None = 0,
  26. /// <summary>
  27. /// The instruction may read from local variables.
  28. /// </summary>
  29. MayReadLocals = 0x10,
  30. /// <summary>
  31. /// The instruction may write to local variables.
  32. /// </summary>
  33. /// <remarks>
  34. /// This flag is not set for indirect writes to local variables through pointers.
  35. /// Ensure you also check the SideEffect flag when checking for instructions that might write to locals.
  36. /// </remarks>
  37. MayWriteLocals = 0x20,
  38. /// <summary>
  39. /// The instruction may have side effects, such as accessing heap memory,
  40. /// performing system calls, writing to local variables through pointers, etc.
  41. /// </summary>
  42. /// <remarks>
  43. /// Throwing an exception or directly writing to local variables
  44. /// is not considered a side effect, and is modeled by separate flags.
  45. /// </remarks>
  46. SideEffect = 0x40,
  47. /// <summary>
  48. /// The instruction may throw an exception.
  49. /// </summary>
  50. MayThrow = 0x100,
  51. /// <summary>
  52. /// The instruction may exit with a branch or leave.
  53. /// </summary>
  54. MayBranch = 0x200,
  55. /// <summary>
  56. /// The instruction may jump to the closest containing <c>nullable.rewrap</c> instruction.
  57. /// </summary>
  58. MayUnwrapNull = 0x400,
  59. /// <summary>
  60. /// The instruction performs unconditional control flow, so that its endpoint is unreachable.
  61. /// </summary>
  62. /// <remarks>
  63. /// If EndPointUnreachable is set, either MayThrow or MayBranch should also be set
  64. /// (unless the instruction represents an infinite loop).
  65. /// </remarks>
  66. EndPointUnreachable = 0x800,
  67. /// <summary>
  68. /// The instruction contains some kind of internal control flow.
  69. /// </summary>
  70. /// <remarks>
  71. /// If this flag is not set, all descendants of the instruction are fully evaluated (modulo MayThrow/MayBranch/MayUnwrapNull)
  72. /// in left-to-right pre-order.
  73. ///
  74. /// Note that branch instructions don't have this flag set, because their control flow is not internal
  75. /// (and they don't have any unusual argument evaluation rules).
  76. /// </remarks>
  77. ControlFlow = 0x1000,
  78. }
  79. }