-
Notifications
You must be signed in to change notification settings - Fork 62
Implemented LICM. Added get_field_tests. Fixed compile.bash #491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial comments.
aeneas/src/main/Compiler.v3
Outdated
| var LocalRegAlloc = flags.get("LocalRegAlloc", level >= 1) && !CLOptions.DWARF.get(); | ||
| var NormOptimize = flags.get("NormOptimize", level >= 2); | ||
| var MachOptimize = flags.get("MachOptimize", level >= 2); | ||
| var LoopInvariantCodeMotion = flags.get("LoopInvariantCodeMotion", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be false by default.
aeneas/src/ssa/SsaBlockOrder.v3
Outdated
| // and is used in linear scan register allocation and code generation. | ||
| def ON_STACK = -2; | ||
| def DONE = -3; | ||
| def ON_STACK: u31 = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why these values need to be changed.
aeneas/src/ssa/SsaBlockOrder.v3
Outdated
| private var count: int; | ||
| private var list: List<SsaBlock>; | ||
| var loopEdges: List<SsaCfEdge>; | ||
| def marker = SsaExternalMarker.new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an argument to the constructor.
| } | ||
| } | ||
| buf.putc('#').putd(b.uid).putc('m').putd(b.mark); | ||
| // buf.putc('#').putd(b.uid).putc('m').putd(b.mark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this prints the output twice now.
aeneas/src/ssa/SsaOptimizer.v3
Outdated
| // Grab the next link in the current block. `link` could be hoisted elsewhere. | ||
| nextLink = link.next; | ||
| if (link.facts.O_PURE && SsaApplyOp.?(link) && | ||
| instrDominatesExitsAndBackedge(SsaInstr.!(link), curBlock, loopsInScope[loopsInScope.length - 1])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to check every instruction in the block, just that the block dominates.
aeneas/src/ssa/SsaOptimizer.v3
Outdated
| def instrDominatesExitsAndBackedge(instr: SsaInstr, curBlock: SsaBlock, loopInfo: SsaLoopInfo) -> bool { | ||
| var isValid: bool = true; | ||
| def header: SsaBlock = blockOrdering.order[loopInfo.start]; | ||
| def exits: Array<SsaCfEdge> = Lists.toArray(loopInfo.exits); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little inefficient, since it makes a garbage array.
aeneas/src/ssa/SsaOptimizer.v3
Outdated
| continue; | ||
| } | ||
| def dominatesExit: bool = blockOrdering.isDominator(curBlock.info, exit.dest.info); | ||
| if (!dominatesExit && isValid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just early-return false here.
aeneas/src/ssa/SsaOptimizer.v3
Outdated
| if (!loopInfo.contains(predBlock)) { continue; } | ||
| // Check the current block dominates the predecessor | ||
| def dominatesPred: bool = blockOrdering.isDominator(curBlock.info, predBlock.info); | ||
| if (!dominatesPred && isValid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same; you can early return false.
…o set ON_STACK and DONE.
No description provided.