-
Notifications
You must be signed in to change notification settings - Fork 134
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
flang2: An attempt to introduce opaque pointers to flang #1306
Conversation
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
@pawosm-arm @kiranchandramohan @shivaramaarao Is it important to keep the master branch backward-compatible with LLVM 14 and older releases, perhaps with liberal uses of macros or by duplicating files? IMHO it's probably better to create a new master branch that uses opaque pointers only, and dual-maintain both branches until nobody needs the old master branch any more. What do you think? |
@@ -272,7 +272,7 @@ write_prototypes(FILE *out, LLVMModuleRef module) | |||
|
|||
if (text_calls) { | |||
fprintf(out, "declare i64 @llvm.nvvm.texsurf.handle.p1i64(metadata, i64 " | |||
"addrspace(1)*) nounwind readnone\n"); | |||
"ptr addrspace(1)) nounwind readnone\n"); |
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.
Please delete i64
in the previous line:
i64 addrspace(1)*
-> ptr addrspace(1)
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.
ah, good cacth. Seems this is something that wouldn't ever be executed in our ecosystem.
elem_type, AG_TYPENAME(gblsym), AG_NAME(gblsym)); | ||
"ptr bitcast(ptr getelementptr(" | ||
"%sptr @%s, i32 0) to ptr)", | ||
elem_type, AG_NAME(gblsym)); |
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.
Please delete the bitcast instruction:
"ptr getelementptr(%sptr @%s, i32 0)",
elem_type, AG_NAME(gblsym));
elem_type, n_elts, name, suffix ? suffix : ""); | ||
"ptr bitcast(ptr getelementptr(" | ||
"%sptr @%s%s, i32 0) to ptr)", | ||
elem_type, name, suffix ? suffix : ""); |
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.
Please delete the bitcast instruction:
"ptr getelementptr(%sptr @%s%s, i32 0)",
elem_type, name, suffix ? suffix : "");
initname, initname, ADDRESSG(TYPDEF_INITG(tag))); | ||
" ptr bitcast(ptr getelementptr(i8, ptr " | ||
"@%s, i32 %ld) to ptr),\n", | ||
initname, ADDRESSG(TYPDEF_INITG(tag))); |
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.
Please delete the bitcast instruction:
" ptr getelementptr(i8, ptr @%s, i32 %ld),\n",
initname, ADDRESSG(TYPDEF_INITG(tag)));
",\n", name, name); | ||
" ptr bitcast(ptr getelementptr(i8, ptr " | ||
"@%s$parents, i32 0) to ptr)" | ||
",\n", name); |
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.
Please delete the bitcast instruction:
" ptr getelementptr(i8, ptr @%s$parents, i32 0),\n", name);
@@ -153,7 +153,7 @@ write_proc_pointer(SPTR sptr) | |||
if (abi) { | |||
fntype = ll_abi_function_type(abi)->str; | |||
} | |||
fprintf(ASMFIL, "i8* bitcast(%s* @%s to i8*)", fntype, getsname(sptr)); | |||
fprintf(ASMFIL, "ptr bitcast(ptr @%s to ptr)", getsname(sptr)); |
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.
The variable fntype
is no longer used. Please delete the related code and the bitcast instruction.
fprintf(ASMFIL, " }>\n@%s = alias %s%sbitcast (<{%s}>* @%s.%d to %s*)", | ||
getsname(sptr), alTy, alSep, bare, getsname(sptr), sptr, typed); | ||
fprintf(ASMFIL, " }>\n@%s = alias %s%sbitcast (ptr @%s.%d to ptr)", | ||
getsname(sptr), alTy, alSep, getsname(sptr), sptr); |
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.
Please delete the bitcast instruction:
fprintf(ASMFIL, " }>\n@%s = alias %s%sptr @%s.%d",
getsname(sptr), alTy, alSep, getsname(sptr), sptr);
"\t%%prof.thisfn = bitcast %s* @%s to i8*\n" | ||
"\t%%prof.callsite = call i8*(i32) @" PROF_CALLSITE "(i32 0)\n", | ||
currFnTy->str, currFn); | ||
"\t%%prof.thisfn = bitcast ptr @%s to ptr\n" |
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.
The no-op bitcasts are redundant in the IR, please delete the bitcast instruction:
"\t%%prof.thisfn = ptr @%s\n"
@@ -4100,7 +4100,7 @@ lldbg_function_end(LL_DebugInfo *db, int func) | |||
sname = getsname(i); // temporary pointer | |||
buff = (char *)getitem(LLVM_LONGTERM_AREA, strlen(name) + strlen(sname) + | |||
strlen(type->str) + 25); | |||
sprintf(buff, "bitcast (%%struct%s* @%s to %s)", sname, name, type->str); | |||
sprintf(buff, "bitcast (ptr @%s to %s)", name, type->str); |
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.
The variable sname
is no longer used. Please delete the related code and the bitcast instruction for the pointer type
.
@pawosm-arm Would you have time to work on this PR? |
Good question. Sadly, time management is the reason I may need to abandon this patch. As I said, I'm taking no credits on this one, so feel free to build on it if you need it. |
Superceded by #1321. |
This is my naïve approach, it's not perfect, uses ptr to ptr bitcasts, but may work as well.
Won't be of any use until we shift to LLVM15.