Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • S sysycreforged7
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 弘深保研队
  • sysycreforged7
  • Merge requests
  • !3
You need to sign in or sign up before continuing.

A mile stone

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged 弘深保研队 requested to merge a_mile_stone into main Jul 05, 2025
  • Overview 6
  • Commits 5
  • Pipelines 0
  • Changes 23

Created by: HugoPhi

This pull request introduces updates to the compiler's codebase to improve functionality, enhance parameter handling, and refine backend code generation. Key changes include adjustments to command-line argument parsing, improved handling of immediate values, better alignment for stack parameters, and fixes to function call generation.

Command-line argument parsing improvements:

  • main.cpp: Expanded accepted command-line arguments to include flags for displaying tokens, AST, IR, and executing IR. Added logic to parse and handle these flags. [1] [2] [3] [4]

Immediate value handling fixes:

  • src/backend/generator.cpp: Corrected the range checks for immediate values to include -2048 to 2047 instead of -2048 to 2048. This ensures compatibility with RISC-V instruction encoding. [1] [2] [3] [4]

Stack parameter alignment improvements:

  • src/backend/generator.cpp: Enhanced stack parameter layout calculations to ensure proper alignment based on parameter types (integer, pointer, float). Introduced logic to dynamically calculate offsets for stack parameters and align them to appropriate boundaries.

Function call generation fixes:

  • src/backend/generator.cpp: Improved function call handling by aligning stack space to a 16-byte boundary for ABI compliance and fixing the placement of arguments in registers and on the stack. Added logic to calculate stack offsets for parameters exceeding register limits. [1] [2]

Miscellaneous updates:

  • Makefile: Changed the C compiler to riscv64-linux-gnu-gcc and removed unnecessary architecture-specific flags.
  • src/backend/generator.cpp: Updated function prologue alignment from 2 to 4 for improved safety.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: a_mile_stone