-
Notifications
You must be signed in to change notification settings - Fork 166
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
Do not load CPtr #2440
Do not load CPtr #2440
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1245,8 +1245,32 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor> | |
llvm::Value* const_list = builder->CreateAlloca(const_list_type, nullptr, "const_list"); | ||
list_api->list_init(type_code, const_list, *module, x.n_args, x.n_args); | ||
int64_t ptr_loads_copy = ptr_loads; | ||
ptr_loads = 1; | ||
for( size_t i = 0; i < x.n_args; i++ ) { | ||
if (ASR::is_a<ASR::CPtr_t>(*ASRUtils::expr_type(x.m_args[i]))) { | ||
bool is_argument = false; | ||
ASR::expr_t *var = x.m_args[i]; | ||
if (is_a<ASR::Var_t>(*var)) { | ||
ASR::symbol_t *var_sym = ASR::down_cast<ASR::Var_t>(var) | ||
->m_v; | ||
if (is_a<ASR::Variable_t>(*var_sym)) { | ||
ASR::Variable_t *v = down_cast<ASR::Variable_t>(var_sym); | ||
if (v->m_intent == intent_local || | ||
v->m_intent == intent_return_var || | ||
!v->m_intent) { | ||
is_argument = false; | ||
} else { | ||
is_argument = true; | ||
} | ||
} | ||
} | ||
if (is_argument) { | ||
ptr_loads = 0; | ||
} else { | ||
ptr_loads = 1; | ||
} | ||
} else { | ||
ptr_loads = 1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the issue here is that if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to keep |
||
this->visit_expr(*x.m_args[i]); | ||
llvm::Value* item = tmp; | ||
llvm::Value* pos = llvm::ConstantInt::get(context, llvm::APInt(32, i)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole code here should be refactored into a function that should be put into ASRUtils. We might already have a function for this.