Skip to content

Commit f395d8c

Browse files
author
Derek Hower
committed
Merge remote-tracking branch 'origin/cpp_hart' into cpp_hart
2 parents ceb2d60 + ea6a818 commit f395d8c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

backends/cpp_hart_gen/lib/constexpr_pass.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ def constexpr?(symtab)
1313
class IdAst
1414
def constexpr?(symtab)
1515
sym = symtab.get(name)
16-
return true if sym.nil? # assuming undefined syms are local (be sure to type check first!!)
16+
return true if sym.nil?
1717
return true if sym.is_a?(Type)
18+
return false if sym.value.nil? # assuming undefined syms are local (be sure to type check first!!)
1819

1920
if sym.param?
2021
symtab.cfg_arch.params_with_value.any? { |p| p.name == text_value }

backends/cpp_hart_gen/lib/gen_cpp.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ def gen_cpp(symtab, indent = 0, indent_spaces: 2)
399399
lines = []
400400
symtab.push(nil)
401401
init.add_symbol(symtab)
402+
symtab.get(init.lhs.text_value).value = nil
403+
402404
stmts.each do |s|
403405
lines << s.gen_cpp(symtab, indent_spaces, indent_spaces:)
404406
end

lib/idl/passes/prune.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def prune(symtab)
9999
init.prune(symtab),
100100
condition.prune(symtab),
101101
update.prune(symtab),
102-
stmts.map { |s| s.prune(symtab) }
102+
#stmts.map { |s| s.prune(symtab) } #TODO need to not prune a = a + 1 since is known for each loop iter but should accumulate
103+
stmts.map { |s| s.dup() }
103104
)
104105
ensure
105106
symtab.pop

0 commit comments

Comments
 (0)