Skip to content

BinaryOp handling "=" overlaps with VariableAssignment #265

@m-akhil-reddy

Description

@m-akhil-reddy

Summary

Title: BinaryOp handling "=" overlaps with VariableAssignment

Description:

While exploring assignment handling in IRx, I found that the "=" operator is currently handled inside BinaryOp:

  • llvmliteir.py

This logic:

  • evaluates RHS expression
  • looks up the variable from named_values
  • emits a store instruction
  • pushes the result to result_stack

A very similar flow exists in visit(VariableAssignment):

  • llvmliteir.py

This results in duplicated assignment logic across two different paths.

From the recent discussion, it seems BinaryOp is not expected to handle "=". If that is the case, this behavior may need to be adjusted so that assignment is handled only through VariableAssignment.

Questions:

  • Should assignment logic be removed from BinaryOp entirely?
  • Should the common assignment logic be centralized/shared?

I’d be happy to work on aligning this with the intended design.

OS / Environment

.

Steps to Reproduce

.

File Upload (optional)

.

Expected Results

.

Actual Results

.

IRx version

.

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions