Skip to content
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

Extended support for binary ops and refactoring #489

Merged
merged 6 commits into from
Jan 12, 2021

Conversation

georgemitenkov
Copy link
Collaborator

@georgemitenkov georgemitenkov commented Jan 8, 2021

This PR addresses 2 issues:

  • Adds support for more binary/unary operators
    Now, there are code generation functions for all comparison and logical operators. Code generation functions are now split based on the expression "type" (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs expression results can be both double and integer. This is important for control flow code generation and for the new AST node CodegenVarType.

Tests for new operators will be added when the first control flow node (most likely FOR node) will land.

  • Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.

fixes #453

@bbpbuildbot
Copy link
Collaborator

Can one of the admins verify this patch?

src/codegen/llvm/codegen_llvm_visitor.cpp Outdated Show resolved Hide resolved
src/codegen/llvm/codegen_llvm_visitor.cpp Outdated Show resolved Hide resolved
src/codegen/llvm/codegen_llvm_visitor.cpp Show resolved Hide resolved
Copy link
Contributor

@pramodk pramodk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgemitenkov : above suggested change you can do in separate PR if you would like.

Once you fix clang-format, this is good to merge.

error:improper C/C++ file formatting: /jenkins/06/workspace/hpc.nmodl/platform/bb5/src/codegen/llvm/codegen_llvm_visitor.hpp

@georgemitenkov
Copy link
Collaborator Author

@pramodk I made the change here straight away - it is just a couple of lines. Now we can pass an extra flag to the visitor: --single-precision that indicates that we need to use 32-bit types and not the default 64-bit.

I also altered one test to check that IR is generated correctly for floats.

@pramodk pramodk merged commit 01682d1 into llvm Jan 12, 2021
@pramodk pramodk deleted the georgemitenkov/llvm-scaling-bin-ops branch January 12, 2021 09:50
@georgemitenkov georgemitenkov linked an issue Jan 12, 2021 that may be closed by this pull request
pramodk pushed a commit that referenced this pull request Feb 23, 2021
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
pramodk pushed a commit that referenced this pull request May 8, 2021
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
pramodk pushed a commit that referenced this pull request Mar 8, 2022
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
iomaganaris pushed a commit that referenced this pull request May 10, 2022
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
iomaganaris pushed a commit that referenced this pull request May 12, 2022
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
iomaganaris pushed a commit that referenced this pull request Sep 15, 2022
* Added more bin ops and refactored code
   - Now, there are code generation functions for all comparison
      and logical operators.
   - Code generation functions are now split based on the expression "type"
      (assignment, arithmetic, comparison, logical). Moreover, the lhs and rhs
      expression results can be both double and integer. This is important for
      control flow code generation and for the new AST node CodegenVarType.
* Added support for NOT op
* Added default type flag to switch between float and double
* Added tests for single precision
* Renames LLVM test file to codegen_llvm_ir.cpp to follow convention.
* NOTE : Tests for new operators will be added when the first control
                flow node (most likely FOR node) will land.

fixes #453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support remaining binary/unary operators
3 participants