Program Diagnostic in SILOptimizer

Program Diagnostic in SILOptimizer

at swift zoomin'
でた資料 SILの公式ドキュメント: https://github.com/apple/swift/blob/master/docs/SIL.rst
でた資料 SILOptimizer 入門: https://qiita.com/freddi_/items/d2c2b2db223dc4a50494

1405a601755e5fcbfdc93a2560368bb1?s=128

freddi(Yuki Aki)

March 21, 2020
Tweet

Transcript

  1. Program Diagnostic by SILOptimizer freddi at Swift Zoomin’ (21st March,

    2020) ਍அ
  2. SIL

  3. Swift Intermediate Language

  4. Swift Intermediate Language

  5. Swift Intermediate Language

  6. Swift Intermediate Language ίϯύΠϧ࣌ʹੜ੒͢ΔSwiftͷதؒݴޠ (௨শ: SIL) - ܕνΣοΫͨ͠AST͔Βੜ੒͞ΕΔ - SIL

    ͰϓϩάϥϜͷ࠷దԽ͕ߦΘΕΔ - SwiftίʔυΑΓ΋۩ମతͳڍಈ͕දݱ͞ΕΔ
  7. Swift Intermediate Language

  8. SIL

  9. SILOptimizer

  10. SILOptimizer

  11. SILGenͷޙͷSILOptimizerʹΑΔ࠷దԽͱ਍அ - ࠷దԽ … Dead Codeͷ࡟আ, ϝϞϦͷ࠷దԽ etc … -

    ਍அ … ? ? ? SILOptimizer
  12. Diagnostic in SILOptimizer

  13. Diagnostic in SILOptimizer SIL in the Swift Compiler - A

    series of Guaranteed Optimization Passes and Diagnostic Passes are run over the raw SIL both to perform optimizations and to emit language-specific diagnostics. These are always run, even at -Onone, and produce canonical SIL. - The SILGen module generates raw SIL from an AST.
  14. Diagnostic in SILOptimizer SIL in the Swift Compiler - A

    series of Guaranteed Optimization Passes and Diagnostic Passes are run over the raw SIL both to perform optimizations and to emit language-specific diagnostics. These are always run, even at -Onone, and produce canonical SIL. - The SILGen module generates raw SIL from an AST.
  15. Diagnostic in SILOptimizer raw SIL SILOptimizer can SIL

  16. ਍அ͸ԿΛ͍ͯ͠Δͷ͔ ݴޠ࢓༷ʹ߹ͬͨϓϩάϥϜͷνΣοΫΛߦ͏ - ਺஋Ϧςϥϧม׵࣌ͷΦʔόʔϑϩʔͷνΣοΫ etc … - ౸ୡ͠ͳ͍ॲཧ͕͋Δͱ͖ͷܯࠂ If all

    diagnostic passes succeed, the final result is the canonical SIL for the program. ʢ༁ʣ΋͠ɺ͢΂ͯͷ਍அ͕੒ޭͨ͠৔߹ɺcanonical SIL͕ੜ੒͞Ε·͢
  17. Conclusion

  18. Swift Intermediate Language ίϯύΠϧ࣌ʹੜ੒͢ΔSwiftͷதؒݴޠ (௨শ: SIL) SILOptimizer SILGenͷޙͷSILOptimizerʹΑΔ࠷దԽͱ਍அ ਍அ͸ԿΛ͍ͯ͠Δͷ͔ ݴޠ࢓༷ʹ߹ͬͨϓϩάϥϜͷνΣοΫΛߦ͏

  19. Thank you! Twitter: @_ _ _ freddi _ _ _

    HAKATA.swift will hold meetup on Twitter! Qiita SILOptimizer : https://bit.ly/3a9ro7u