Commit graph

595 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
liushuyu
ce45b2e8b1 gen/llvm.h: add a type parameter to GET_INTRINSIC_DECL macro ...
... because now LLVM requires most intrinsics to have parameter types
specified
2024-11-26 08:46:15 -07:00
Martin Kinkelin
2463fe9949 Merge remote-tracking branch 'origin/master' into merge-2.110 2024-08-02 19:15:45 +02:00
Martin Kinkelin
6bfa6d9adb [remove dead code] 2024-07-18 23:35:09 +02:00
Martin Kinkelin
18709bb77f Replace getPtrToType() 2024-07-18 22:33:24 +02:00
Martin Kinkelin
c9ac30c236 Adapt to free-standing size(Type*) function 2024-07-16 16:22:35 +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
2cd14c59dd Drop support for LLVM 14
Mainly because opaque IR pointers appear buggy in LLVM 14 (LLVM
crashes when compiling druntime).
2024-05-19 14:18:32 +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
Harry Gillanders
48db5d5621
Avoid setting always-inline for functions that contain DMD-style inline assembly. (#4631)
As the presence of DMD-style inline assembly in a function causes
never-inline to be set for that function.
2024-04-28 01:11:22 +02:00
Martin Kinkelin
3beb68904f Avoid deprecations with LLVM 18 wrt. renamed llvm::StringRef::{starts,ends}with() 2024-03-28 16:42:51 +01:00
Martin Kinkelin
078f0532ca Don't forward-declare magic intrinsics mapping to instructions
It's ugly in general, and apparently causes LTO issues on Windows.

This required a larger refactoring.
2024-03-16 16:28:09 +01:00
Martin Kinkelin
bb2dec2f87 Adapt to free arrayOf(Type*) function 2024-03-03 22:12:16 +01:00
Martin Kinkelin
9041c0bf67 Adapt to free functions in dmd C++ namespace now 2024-03-03 19:14:00 +01:00
Martin Kinkelin
61da18939b Handle new @standalone shared module constructors
Fixes runnable/standalone_modctor.d.
2024-01-20 21:11:07 +01:00
Johan Engelen
91d306894e
Add support for LLVM 17. (#4533) 2023-12-03 19:07:31 +01:00
Johan Engelen
de948bd664
Add -fprofile-sample-use (#4531)
Resolves issue #4527
2023-11-23 19:11:23 +01:00
Martin Kinkelin
1ab3809f14 Slightly improve error for colliding entry points
To make `fail_compilation/main.d` happy.
2023-11-06 01:10:16 +01:00
Martin Kinkelin
d6d79187e6 Merge fix: Adapt to removed error/warning members 2023-11-06 01:10:16 +01:00
Martin Kinkelin
8fc096e4c6 Adapt to Loc::filename now being a function 2023-08-26 15:56:33 +02:00
Martin Kinkelin
9ce57807c0 Drop support for LLVM 9 and LLVM 10 2023-07-29 01:12:43 +02:00
Martin Kinkelin
9b2107927c Support new C variadic kind VarArg.KRvariadic
Fixes a few dmd-testsuite regressions, such as runnable/test22342.c.
2023-07-16 18:22:34 +02:00
Johan Engelen
93266c014a
Implement @ldc.attributes.noSplitStack (#4382) 2023-05-02 21:53:20 +02:00
Johan Engelen
ba2e25bc44
Add --fsplit-stack. (#4379) 2023-04-19 23:00:51 +02:00
Johan Engelen
044b919bf6
Add --fwarn-stack-size=<threshold> for LLVM >= 13. (#4378) 2023-04-19 23:00:24 +02:00
Johan Engelen
338f352bdb
Add ldc.attributes.callingConvention("...") (#4299)
Add ldc.attributes.callingConvention("...")
2023-01-19 22:44:19 +01:00
Johan Engelen
07f009cdee
Add -fno-delete-null-pointer-checks (#4297)
The commandline option name stems from GCC and Clang.
2023-01-13 01:00:48 +00:00
Johan Engelen
62bcb9854b
LLVM15: fix tests for LLVM15 and opaque pointers (#4252) 2022-11-10 23:55:17 +00:00
Nicholas Wilson
906037988f
Move abi*.* to abi/ (#4192) 2022-09-21 13:16:04 +00:00
jamesragray
7d8e0f787b
Add UWTableKind for LLVM15+ (#4169)
uwtable attribute needs an argument. This was set using setUWTableKind

Co-authored-by: james <jamesragray@bitbucket.org>
2022-09-15 21:24:53 +08:00
Nicholas Wilson
78e68b5149
Make DComputeTarget::ID an enum class (#4172) 2022-09-15 20:00:52 +08:00
Nicholas Wilson
2dd2f7fc15
Use typed GEP in functions.cpp (#4072) 2022-08-28 21:19:15 +08:00
Martin Kinkelin
be9d5817a1 Adapt glue layer to renamed/changed Declaration::linkage 2022-05-06 19:42:18 +02:00
Martin Kinkelin
b7b8e59043 Upgrade frontend & libs to v2.100.0-beta.1+ (dlang/dmd@c0cff59c79) 2022-04-26 23:01:13 +02:00
Martin Kinkelin
bdef01e7cc Raise min LLVM version to 9.0 2022-04-25 23:11:48 +02:00
Martin Kinkelin
143d7b3171 Fix compile & link errors against LLVM 14 2022-03-30 13:51:18 +02:00
Nicholas Wilson
4349388563
Prepare for LLVM15: Headers, attributes (#3936)
`llvm::AttrBuilder` was changed to require an LLVMContext in its constructor, and can no longer be copied.

declare `DEBIG_TYPE` after includes for the GC2Stack pass as `llvm/Support/GenericDomTreeConstruction.h `(included from `llvm/IR/Dominators.h` `#define`s and `#undef`s it.

`llvm::DIBuilder::createExpression` now takes an `ArrayRef<uint64_t>` instead of `int64_t`. EmitLocalVariable has similarly changed
2022-03-11 16:38:49 +01:00
Martin Kinkelin
0fd5c6ec16
Merge pull request #3873 from kinke/no_reverse
Don't reverse parameters order for extern(D)
2022-03-08 17:03:17 +01:00
Martin Kinkelin
dc25da9557 ABI: Handle extern(C++) delegates for 32-bit MSVC with __thiscall convention 2022-02-22 14:48:38 +01:00
Martin Kinkelin
84da9adf7d Handle ImportC special case wrt. non-variadic declaration vs. variadic definition 2022-02-19 23:55:20 +01:00
Martin Kinkelin
34f2628480 Handle newly unparsed unittests from non-root modules 2022-02-17 00:19:02 +01:00
Martin Kinkelin
9d2d891f95 Adapt to new PASS enum class 2022-02-16 20:52:07 +01:00
Johan Engelen
6a56267699
Add @ldc.attributes.noSanitize UDA to selectively disable sanitizer instrumentation of functions. (#3889) 2022-01-01 14:27:36 +01:00
Martin Kinkelin
25abb0bb48
Try a blunter, clone-less approach for MSVC weak-any emulation (#3869)
As cloning a function with debuginfos has always been problematic,
and I haven't found a suitable workaround for new assertions with
LLVM 13, without resorting to even blunter instruments like
suppressing debuginfos for weak-any functions and MSVC targets.
2021-11-12 17:02:05 +01:00
Martin Kinkelin
9858cfb01c Simplify dmd/ldcbindings.{d,h} 2021-09-17 03:49:28 +02:00
Martin Kinkelin
5e8490d69e
Merge pull request #3821 from kinke/merge-2.098
Upgrade frontend & libs to early v2.098.0
2021-09-11 20:12:55 +02:00
Martin Kinkelin
86f430c039 Slightly revise frontend diff
E.g., preferring local imports for less merge conflict potential.
2021-09-11 17:34:51 +02:00
Martin Kinkelin
16b9eab374
-dllimport=defaultLibsOnly: Avoid -linkonce-templates requirement (#3816)
Via a sorts-of '-linkonce-templates light', only defining all *data*
symbols instantiated from druntime/Phobos templates in each
referencing CU.
2021-09-11 04:53:21 +02:00
Martin Kinkelin
369cfd13ce Adapt to TY enum class 2021-09-07 16:51:19 +02:00