-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
Clean up druntime fwd decls #1208
Conversation
gABI->rewriteFunctionType(dty, irFty); | ||
fn->setAttributes(attribset.addAttributes( | ||
gIR->context(), 1, | ||
llvm::AttributeSet::get(gIR->context(), 1, irFty.args[0]->attrs))); |
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.
Attributes index 1 is most likely wrong (1st LL parameter). You'll probably want llvm::AttributeSet::AttrIndex::FunctionIndex = ~0U
for the function attributes and make sure that addAttributes()
merges it with potential existing ones.
More precisely: passing (incl. sret) dynamic arrays (slices) as regular 16-bytes struct for the Win64 ABI. ;) |
(I actually only have half a clue what "sret" means, lol :D) |
https://github.com/ldc-developers/ldc/blob/master/gen/abi.h#L100 hopefully explains it, and https://github.com/ldc-developers/ldc/blob/master/gen/abi-generic.h#L180 should clarify why we need an ABIRewrite for dynamic arrays on Win64. |
While you are at it, could you please get rid of the |
OK, will do. Saving symbol name cleanup for last (note all the dumb "DD" prefixing for now). |
Unfortunately, LLVM3.5 has initializer list constructor of ArrayRef behind an #ifdef LLVM_HAS_INITIALIZER_LISTS. That define is really only set for Clang… Edit: Sry Johan, I've edited your comment instead of adding my own (kinke). I don't see how I can restore it. :/ |
Thanks for tackling the naming cleanup. I'm wondering, by the way, whether we should really keep the separate runtime module, or whether it would be a better idea to just lazily create them in the real codegen modules. There doesn't seem to be any relevant extra overhead, if you are compiling a gazillion small D modules all at once, you'll run into other limitations first.
Seems like a sensible workaround. |
|
We do know that all our target compilers support C++11, so I don't mind working around the LLVM issue at its source. |
|
0f63193
to
7adaf34
Compare
(rebased to hide embarrassing coding error ;)) |
319f064
to
926f5cc
Compare
@kinke I'm sorry I am sometimes flooding the AppVeyor build server with a string of new commits when trying to debug an issue that perhaps I don't see locally. Is there a way to cancel or remove jobs from the queue? (On Travis, I can click the "cancel job" button) |
Hehe no worries. Unfortunately I have no idea how to give you guys proper access to the AppVeyor project. I just set some explicit permissions for the |
3978ad2
to
3ce93c2
Compare
@kinke @klickverbot I think the clean-up is ready. What do you think? |
3ce93c2
to
46d5163
Compare
for (size_t i = 0, e = paramtypes.size(); i < e; ++i) { | ||
fn->addAttributes(i + 1, attribset.getParamAttributes( | ||
i + 1)); // func param index starts at 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.
This should be replaceable by
fn->setAttributes(AttrSet(fn->getAttributes()).merge(attribset));
with #1217.
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.
thanks!
46d5163
to
554d0a2
Compare
FuncDeclaration *fdecl) { | ||
IrFuncTy &irFty = getIrFunc(fdecl)->irFty; | ||
AttrSet newAttrs = AttrSet::extractFunctionAndReturnAttributes(func); | ||
AttrSet getParamAttrs(TypeFunction *f, IrFuncTy &irFty) { |
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.
Just one more thing - please convert this to a method of IrFuncTy
, as it nearly exclusively depends upon it.
554d0a2
to
e0a6856
Compare
e0a6856
to
70a6e73
Compare
It's still not super pretty. It's because IrFuncTy apparently does not know whether to passThisBeforeSret. Fixing it would require more surgery though :( |
Lgtm, thanks Johan. So the ABI rewrites are now applied when forward declaring all runtime functions [except for |
@thanks kinke. |
WORK IN PROGRESS
Makes the code much prettier I hope.
The main motivation is to enable sret for dynamic arrays, see closed PR #901.