黄熙哲
bef03ec220
chore: update instruction count baseline after Module D rewrite\n\n54/60 performance tests reduced. Key improvements:\n- conv2d: -95 lines (12.6%)\n- huffman: -44 lines (4.9%)\n- fft: -39 lines (5.9%)\n- crc: -38 lines (11.6%)\n- 03_sort: -28 lines (4.2%)\n- 01_mm: -22 lines (6.6%)\n\nAlso fix count_asm.sh sed to match any current value.
1 week ago
黄熙哲
570253f1f2
feat(backend): relax Briggs threshold to 2*K and fix move_adj self-loop\n\nUsing >= 2*K instead of >= K for high-degree neighbor count allows\nmore node pairs to be safely merged. Fixed a bug in MergeInto where\nmove_adj[u] could contain u (self-loop) when v's move set included u,\ncausing iterator invalidation during move_adj cleanup.
1 week ago
黄熙哲
3691da34ee
feat(backend): rewrite main loop with held_nodes release and ReactivatePairs
1 week ago
黄熙哲
0881889ec1
feat(backend): add ReactivatePairs and stale_pairs for coalescing
1 week ago
黄熙哲
07048a123b
feat(backend): separate move-related low-degree nodes into held_nodes
1 week ago
黄熙哲
99fe17fc3f
feat(backend): propagate coalesced node colors in AssignColors\n\nAfter active coalescing, merged_set nodes inherit their representative's\ncolor, ensuring move-related vregs share the same physical register.
1 week ago
黄熙哲
081580ac0a
feat(backend): integrate active coalescing into ColorGraph main loop\n\nReplaces inner simplify while-loop with if-else chain:\nSimplify -> MergePhase -> GiveUpPhase -> Spill.\nLambdas moved outside while loop for clarity.
1 week ago
黄熙哲
0e4f9f1910
feat(backend): add MergePhase and GiveUpPhase for active coalescing\n\nMergePhase uses the Briggs conservative test to safely merge move-related\nnode pairs before coloring. GiveUpPhase abandons moves for low-degree\nnodes when merging is no longer beneficial.
1 week ago
黄熙哲
ca6c2a18c9
feat(backend): add coalesce data structures and helpers to ColorGraph\n\nIntroduces MovePair, move_adj, FindRep, GetRep, HasMovePair as\ninfrastructure for the upcoming Coalesce and Freeze phases.\nModifies simplify loop to skip already-merged nodes via GetRep.
1 week ago
黄熙哲
560f565a51
chore: update instruction count baseline after Module B stp/ldp\n\nAlso modify count_asm.sh to auto-update baseline when instruction\ncounts decrease below the recorded values.
1 week ago
黄熙哲
af71513361
feat(backend): use stp/ldp for callee-saved registers in prologue/epilogue\n\nGroups callee-saved X and S registers and emits paired stp/ldp\ninstructions, reducing save/restore overhead by ~50%. Odd remainders\nstill use str/ldr. Adds fallback else branch for future register types.
1 week ago
黄熙哲
e26fd3f520
fix(peephole): remove dead conditional branch inversion code\n\nThe CondBr+Branch inversion pattern was unreachable because the\nsimple Br fallthrough check runs first and removes the Br. Removed\nthe dead code and the unused NegateCondCode helper.
1 week ago
黄熙哲
7490fd3a49
feat(peephole): add branch fallthrough and conditional branch inversion\n\nEliminates unconditional Br when target is the next block in layout.\nInverts CondBr condition when the following Br targets the fallthrough\nblock, eliminating the extra jump.
1 week ago
黄熙哲
1701b2cf51
feat(peephole): merge adjacent zero-value stack stores\n\nWhen str WZR, fi#N and str WZR, fi#N+1 appear consecutively,\nreplaces them with a single str XZR, fi#N (64-bit zero store).
1 week ago
黄熙哲
e44ba819ec
feat(peephole): add store-load forwarding pattern\n\nWhen StoreStack regA, fi#N is immediately followed by LoadStack regB, fi#N\nwith regA != regB, replaces the load with MovReg regB, regA, eliminating\nthe redundant memory access.
1 week ago
黄熙哲
083616e50d
fix(backend): add redundant MovReg elimination on no-spill early-return path\n\nThe MovReg cleanup was only running after the final RewriteWithAllocation\nat the end of the spill loop, missing the early-return path when\nallocation succeeded without spilling. This left behind no-op moves\nlike 'mov x0, x0' that coalescing created.
1 week ago
黄熙哲
6f829c30f9
feat(backend): eliminate redundant MovReg after register allocation\n\nScans all blocks after RewriteWithAllocation and removes MovReg\ninstructions where source and destination are the same physical\nregister. This cleans up cases where move coalescing successfully\nassigned the same register to both sides.
1 week ago
黄熙哲
4bdca3f722
feat(backend): move coalescing via color preference and phi cycle breaking\n\nCollects move_preferences from MovReg instructions and uses them\nduring color selection to prefer the same physical register for\nmove-related virtual registers. Detects and breaks cycles in move\npreference chains to ensure correctness.
1 week ago
黄熙哲
535a3c0122
feat(backend): exclude MovReg use from interference during graph build\n\nWhen building the interference graph, temporarily remove the use\noperand of MovReg instructions from the live set before processing\ndefs. This prevents the source and destination of a move from\ninterfering, enabling them to be assigned the same physical register.
1 week ago
黄熙哲
4fad027da8
feat(backend): interval-length weighted spill cost model for graph coloring\n\nReplace degree-only spill selection with weighted cost model:\ncost = interval_length * 5 + ref_count * 15 - degree * 25\nLower cost spills first. Rematerializable constants get -100000 bonus.
1 week ago
黄熙哲
c84458daed
feat(backend): compute interval length and ref count during liveness analysis
1 week ago
黄熙哲
774a2688a3
feat(remat): add rematerializable annotation for MovImm instructions
...
- Add IsRematerializable/SetRematImm APIs to MachineInstr
- Mark all MovImm in Lowering as rematerializable with immediate value
- Add _sysy_starttime/_sysy_stoptime runtime functions for SysY timing
1 week ago
黄熙哲
4812329aa4
refactor(backend): remove redundant live-out pairwise interference edges
1 week ago
黄熙哲
6b39d2d397
fix: add missing FP threshold in second ColorGraph call site
...
The loop-exit ColorGraph calls at line 1102-1103 were missing the
caller_saved_threshold parameter, causing FP to use default 19 instead
of correct 16.
1 week ago
黄熙哲
26d89b2fbd
fix: parameterize caller-saved threshold for GP/FP in ColorGraph
...
Address code review feedback:
- Add caller_saved_threshold parameter to ColorGraph (GP: 19, FP: 16)
- Replace std::vector heap allocation with two-pass scan for zero overhead
- Fix semantic error: c<19 was incorrect for FP (s16-s18 are callee-saved)
1 week ago
黄熙哲
4d95f33dc2
refactor: make caller-saved color preference explicit in ColorGraph Select phase
...
Split color selection in ColorGraph's Select phase to explicitly
distinguish caller-saved (c<19) and callee-saved (c>=19) registers,
preferring caller-saved colors. Behavior is equivalent to the previous
implementation since GP_ALLOCATABLE already lists caller-saved registers
first, but the new logic is more explicit and provides an extension
point for future callee-save optimization.
1 week ago
zhm
e3e01256cd
Merge master into zhm: apply all fixes for evaluation system
2 weeks ago
zhm
8bbd8f96bb
Fix starttime/stoptime function name and add line number parameter
2 weeks ago
zhm
aca995140a
Fix merge conflict in README.md
2 weeks ago
zhm
7ab465d25b
Add missing PassManager.h and fix .gitignore to not ignore src/include/
2 weeks ago
zhm
e9adbe38c7
Fix undefined behavior: signed overflow, negative left shift, float-to-int overflow
2 weeks ago
zhm
b62d2fcac2
CMakeLists: auto-detect local antlr4 runtime, gitignore local-only files
2 weeks ago
zhm
87fa235dc1
Remove include symlink to fix duplicate symbol linking
2 weeks ago
zhm
8088eb74a2
Remove ANTLR runtime headers from include, add SysY generated files
2 weeks ago
zhm
098ea35408
Remove antlr4-runtime source, keep only jar for code generation
2 weeks ago
zhm
5d4acae726
Remove extlibs to avoid duplicate definition with grader's /extlibs
2 weeks ago
zhm
8e4cbbfd87
移除src/include中的ANTLR重复头文件,使用/extlibs
2 weeks ago
zhm
af5657dac7
添加 ANTLR4 runtime 源码
2 weeks ago
zhm
352f007dc4
添加 ANTLR jar 和 zip
2 weeks ago
zhm
96927a32d7
移除third_party目录,添加ANTLR runtime头文件和评测平台适配
...
- 创建include和extlibs符号链接指向src/include
- 修改CMakeLists.txt使用正确的include路径
- 添加ANTLR runtime头文件到src/include/
2 weeks ago
zhm
e95a0f576f
”适配评测平台编译环境“
2 weeks ago
安峻邑
ab305cfdb1
Init
2 weeks ago
安峻邑
ca2f3b6d79
Init
2 weeks ago
安峻邑
04371dd7fa
Init
2 weeks ago
安峻邑
b0afe34cf4
Init
2 weeks ago
安峻邑
925ec553e5
fix: 确保 extlibs 目录包含完整的头文件
...
- 重新整理 extlibs 目录结构,确保所有头文件都正确复制
- 修复头文件路径问题,使 -I/extlibs 能正确找到所有头文件
2 weeks ago
安峻邑
f634e399ee
fix: 适配评测平台编译环境
...
- 将项目头文件复制到 extlibs 目录,使 -I/extlibs 能找到项目头文件
- 修正 ANTLR4 库链接设置,使用 -lantlr4-runtime 与评测平台匹配
- 避免包含与系统库重复的第三方库源码,防止重复定义错误
2 weeks ago
安峻邑
351c1128fc
Init
2 weeks ago
安峻邑
55d92cda42
fix: 补全缺失的头文件目录
...
- 同步完整的 include 目录 (frontend, ir, irgen, sem, mir, utils)
- 同步必要的 third_party 依赖 (antlr4)
- 同步 .gitignore 和文档
- 修复编译时找不到头文件的问题
2 weeks ago
安峻邑
3d7943d3f0
Update main.cpp header includes
2 weeks ago