DenialAdams / roland

Roland programming language
https://www.brick.codes/roland
Apache License 2.0
46 stars 0 forks source link

String literals removed due to optimizations still end up in the binary #82

Closed DenialAdams closed 1 year ago

DenialAdams commented 1 year ago

String literals that end up in the binary are determined during semantic validation, but could be calculated later for more precision

DenialAdams commented 1 year ago

Higher priority to me now that we have DCE. An empty program looks like this:

(module
  (type (;0;) (func))
  (func (;0;) (type 0))
  (table (;0;) 0 0 funcref)
  (memory (;0;) 1)
  (global (;0;) (mut i32) (i32.const 11736))
  (global (;1;) (mut i32) (i32.const 11736))
  (global (;2;) (mut i32) (i32.const 0))
  (export "memory" (memory 0))
  (export "_start" (func 0))
  (elem (;0;) (i32.const 0) func)
  (data (;0;) (i32.const 0) "\0a")
  (data (;1;) (i32.const 1) "-")
  (data (;2;) (i32.const 2) "0")
  (data (;3;) (i32.const 3) ".")
  (data (;4;) (i32.const 4) "E")
  (data (;5;) (i32.const 5) "NaN")
  (data (;6;) (i32.const 8) "Infinity")
  (data (;7;) (i32.const 16) "0E0")
  (data (;8;) (i32.const 19) "true")
  (data (;9;) (i32.const 23) "false"))

which is just a little bit sad!

DenialAdams commented 1 year ago

Moved this pass to DCE in ead5eae730440928b950478307f4bc18d8661f61