Skip to content

Commit

Permalink
LLVM: Implement TupleCompare
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Dec 21, 2022
1 parent 6b3de15 commit 6bdbeff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,21 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
list_api->list_clear(plist);
}

void visit_TupleCompare(const ASR::TupleCompare_t& x) {
int64_t ptr_loads_copy = ptr_loads;
ptr_loads = 0;
this->visit_expr(*x.m_left);
llvm::Value* left = tmp;
this->visit_expr(*x.m_right);
llvm::Value* right = tmp;
ptr_loads = ptr_loads_copy;
tmp = llvm_utils->is_equal_by_value(left, right, *module,
ASRUtils::expr_type(x.m_left));
if (x.m_op == ASR::cmpopType::NotEq) {
tmp = builder->CreateNot(tmp);
}
}

void visit_TupleLen(const ASR::TupleLen_t& x) {
LFORTRAN_ASSERT(x.m_value);
this->visit_expr(*x.m_value);
Expand Down

0 comments on commit 6bdbeff

Please sign in to comment.