Commit graph

382 commits

Author SHA1 Message Date
Luna
82878ef32c
Improve Objective-C support (#4777)
* WIP: Objective-C support

* Further work on implementation

* ObjC dynamic cast

* Add swift stub class attribute

* Classes, protocols and ivars

* Fix compilation issues

* Fix objc ir codegen

* Add objc linker option

* Add swift stub classref get ir gen

* Minor cleanup

* Fix objc link flag being added on non-darwin platforms

* Refactor objc gen

* remove use of std::nullopt

* Emit protocol tables

* Remove unused variable

* Formatting

* Fix build in release mode. Thanks for nothing, c++.

* Fix consistency

* Fix dynamic casts

* Fix tocall parentfd ref and arm msgsend call

* Make instance variables work

* Implicitly add isa pointer to objc classes.

* Fix protocol referencing & allow pragma mangle

* Fix protocol linkage

* Fix direct call support

* always generate var type for methods

* Fix test 16096a

* Fix extern ivar symbol gen, retain method decls

* Remove arm32 and x86 support

* Check method and ivar info before pushing to member list

* Make ObjcMethod info untyped.

* Make ivar and method gen more robust

* Generate optional protocol symbols

* Use bitcasting instead of creating multiple type defs

* Fix invalid protocol list struct gen

* More codegen robustness

* emit protocol table as const

* Make protocol table anon struct

* Fix callable type, generate protocol_list_t properly.

* Cast vthis to argtype

* Handle protorefs and classrefs properly

* seperate label ref and deref

* Fix method lookup

* Enable objective-c tests

* Enable objc_call_static test

* Scan both classes and protocols for method ref

* Enable objective-c tests on arm as well.

* supress objc linker warning in tests

* Fix class and protocol gen structure

* Fix objc_protocol_sections test

* ObjcMethod only get callee for functions with bodies

* Fix protocol class method gen

* Make ObjcMethod anon again

* Fix missing emit calls

* Fix classref gen

* Implement some of the requested changes

* Enable compilable tests

* Fix property selector gen, ugly hack for final funcs.

* Fix segfault in referencing fd->type

* Refactor implementation

* Fix null references in class and method lookup

* include unordered_map

* Get functionality on-par with prev impl.

* Fix super context calls

* Move -L-w flag to d_do_test and use IN_LLVM in objc.d/h

* add LDC version tag to -L-w flag

* Update CHANGELOG.md
2024-12-03 04:26:27 +01:00
Martin Kinkelin
43f59b1e5c ELF: Emit (most) instantiated symbols in COMDATs
To fix issue #3589.
2024-09-07 13:47:28 +02:00
Martin Kinkelin
2463fe9949 Merge remote-tracking branch 'origin/master' into merge-2.110 2024-08-02 19:15:45 +02:00
Martin Kinkelin
0c1623c1a0 Replace getVoidPtrType() 2024-07-18 23:21:10 +02:00
Martin Kinkelin
f2fe3f51e5 Replace DtoPtrToType() 2024-07-18 23:17:34 +02:00
Martin Kinkelin
18709bb77f Replace getPtrToType() 2024-07-18 22:33:24 +02:00
Martin Kinkelin
d5af843ba9 Remove getNullPtr() parameter 2024-07-18 22:33:20 +02:00
Martin Kinkelin
a001ff6bd5 Introduce getOpaquePtrType() helper 2024-07-18 22:07:13 +02:00
Martin Kinkelin
c9ac30c236 Adapt to free-standing size(Type*) function 2024-07-16 16:22:35 +02:00
Martin Kinkelin
4818101c3e Get rid of some superfluous GEPs with (0, 0) indices 2024-05-20 17:30:02 +02:00
Martin Kinkelin
4c74f64a9c Get rid of D type param in DtoConstSlice() 2024-05-20 17:30:01 +02:00
Martin Kinkelin
d140f2a283 Skip superfluous IR pointer bitcasts, now that they are always opaque 2024-05-20 16:45:09 +02:00
Martin Kinkelin
3067b7b115 Enforce opaque IR pointers 2024-05-12 18:47:13 +02:00
Martin Kinkelin
e7091dd0c7 Drop support for LLVM < 14
LLVM 14 is the first version supporting both new pass manager and
opaque IR pointers.
2024-05-12 03:53:03 +02:00
liushuyu
fc4d884d2d
Multiple changes ...
* Use getVoidPtrType helper
* Replace #define with constexpr
2024-03-26 14:48:36 -06:00
Martin Kinkelin
8dd1957c34 Adapt to object.TypeInfo_Class layout change
Without populating the new `nameSig` field yet.
2024-03-04 00:14:28 +01:00
Martin Kinkelin
bb2dec2f87 Adapt to free arrayOf(Type*) function 2024-03-03 22:12:16 +01:00
Johan Engelen
91d306894e
Add support for LLVM 17. (#4533) 2023-12-03 19:07:31 +01:00
Martin Kinkelin
16b3c7e49a
ImportC: Fix static linkage (#4487)
Fixes #4484.
2023-09-04 11:18:20 +02:00
Martin Kinkelin
c8857e8cb8 Fix some LLVM 16 deprecations wrt. DataLayout::getABITypeAlignment() and llvm::makeArrayRef() 2023-08-13 19:10:57 +02:00
Martin Kinkelin
81ea49db13 Merge remote-tracking branch 'origin/master' into llvm16-2 2023-08-12 14:37:01 +02:00
Martin Kinkelin
5d3ded9eeb Remove legacy LL[Maybe]Align 2023-07-29 02:09:35 +02:00
Martin Kinkelin
e4e36f5dc0 [little dcompute fixup for LLVM 16] 2023-07-10 12:27:22 +02:00
Martin Kinkelin
a80dd003cd
Handle lambda mangle collisions by emitting lambdas with internal linkage (#4415)
See https://issues.dlang.org/show_bug.cgi?id=23722.
2023-06-08 00:39:38 +00:00
Johan Engelen
aa64fad44b
Fix deprecation warning (#4403)
We have a new codepath for LLVM >= 16, so the deprecation is solved.
2023-05-14 10:45:52 +00:00
Zachary Yedidia
8006b95b7e
Fix miscompilation when adding a 64-bit constant to a symbol (#4283)
Fixes #4264
2022-12-21 00:32:36 +01:00
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
Nicholas Wilson
af51b700be
Rename DtoAggrPaint to DtoSlicePaint (#4174)
It only does two elements and is exclusively used for slices
2022-09-15 20:44:28 +08:00
Nicholas Wilson
30e2d45f25
Remove getContainedType from DtoMemCpy (#4163) 2022-09-14 09:28:36 +08:00
Nicholas Wilson
4c7a714b4b
Remove getContainedType in DtoMemCpy (#4162) 2022-09-14 08:36:24 +08:00
Nicholas Wilson
3cfae312b7
Remove getContainedType in tollvm.cpp (#4159) 2022-09-13 22:18:37 +08:00
Nicholas Wilson
838146be71
Remove getContainedType from DtoMemSetZero (#4157) 2022-09-13 21:39:05 +08:00
Nicholas Wilson
6aa806f7df
Remove getContainedType from DtoType (#4147) 2022-09-13 18:16:50 +08:00
Martin Kinkelin
65cab03bf0 Rename DtoGEP() type argument to pointeeTy
Incl. clang-format.
2022-09-10 20:32:36 +02:00
Martin Kinkelin
da1d654dd8 Fix build (adapt RISC-V stuff to recent Dto{GEP,Load} changes) 2022-09-10 20:30:04 +02:00
Nicholas Wilson
148e55feee
Remove usage of getPointerElementType in stripAddrSpaces (#4114) 2022-09-06 14:39:48 +08:00
Nicholas Wilson
0829b40abe
Remove deprecated getPointeeType and DtoLoad (#4109) 2022-09-04 11:39:21 +08:00
Nicholas Wilson
85bd909fca
Remove now unused deprecated wrappers (#4104) 2022-09-03 15:22:40 +08:00
Nicholas Wilson
a448110fd3
Use typed gep in tollvm.cpp (#4085) 2022-09-01 10:26:47 +08:00
Nicholas Wilson
4aba54ed52
Add typed overloads for GEP, mark old ones deprecated (#4051) 2022-08-28 12:32:41 +08:00
Nicholas Wilson
f142ac2e83
Add overloads of DtoLoad to transition from getPointeeType (#4043) 2022-08-22 09:45:11 +08:00
Nicholas Wilson
aea2033c19
Remove getPointeeType from DtoAlignedLoad (#4025) 2022-08-21 08:24:40 +08:00
Nicholas Wilson
764e2fb34e
[NFC] Push getPointeeType up the stack in DtoGEP (#4026) 2022-08-20 06:25:53 +00:00
Nicholas Wilson
f0a3abf1dc
Remove getPointeeType from DtoVolatileLoad (#4024) 2022-08-20 05:23:17 +00:00
Nicholas Wilson
844508d059
Push getPointeeType up the stack from DtoLoadImpl (#4023) 2022-08-20 11:19:40 +08:00
Martin Kinkelin
be20833b22 codegen: Support {Not,Logical,Identity,Cmp}Exp with non-bool type (for importC AST)
Fixing failing LDC assertions.
2022-04-30 23:46:47 +02:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
f2a6fefb7b
Merge pull request #3923 from kinke/fix3916
Fix #3916 - undefined symbols with `-dllimport=all` on Windows
2022-02-28 22:19:02 +01:00
Martin Kinkelin
7b6810b01b Fix LLVM 13 deprecation messages during build 2022-02-26 19:15:46 +01:00
Martin Kinkelin
4bd8dcd91b Adapt to new TOK and EXP enum classes 2022-02-16 20:52:07 +01:00