Skip to content

Commit 0fa8423

Browse files
committed
LLVM: Implement ListCompare
1 parent db3f178 commit 0fa8423

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,21 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
15891589
}
15901590
}
15911591

1592+
void visit_ListCompare(const ASR::ListCompare_t x) {
1593+
int64_t ptr_loads_copy = ptr_loads;
1594+
ptr_loads = 0;
1595+
this->visit_expr(*x.m_left);
1596+
llvm::Value* left = tmp;
1597+
this->visit_expr(*x.m_right);
1598+
llvm::Value* right = tmp;
1599+
ptr_loads = ptr_loads_copy;
1600+
tmp = llvm_utils->is_equal_by_value(left, right, *module,
1601+
ASRUtils::expr_type(x.m_left));
1602+
if (x.m_op == ASR::cmpopType::NotEq) {
1603+
tmp = builder->CreateNot(tmp);
1604+
}
1605+
}
1606+
15921607
void visit_DictLen(const ASR::DictLen_t& x) {
15931608
if (x.m_value) {
15941609
this->visit_expr(*x.m_value);

0 commit comments

Comments
 (0)