Commit graph

59 commits

Author SHA1 Message Date
kinke
ae9d43c167 Use LLVM headers for shared codegen command-line options (#2148)
I.e., llvm/CodeGen/CommandFlags.h which in turn includes
llvm/MC/MCTargetOptionsCommandFlags.h.

This gets rid of a few duplicates on our side and includes about 35
(depending on LLVM version) new command-line options. LLVM provides a
helper function to set up the TargetOptions according to (most of) these
options.
Newer LLVM versions may add new options and we'll automatically inherit
them, including setting up the TargetOptions accordingly.

I did my best (TM) to remove a few unused/undesirable options and hide all
remaining new ones except for `-fp-contract`. The lists will need to be
tweaked from time to time.
2017-09-20 01:04:43 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Nicholas Wilson
ae6ff33fc1 [dcomptue] codegen (#2126)
* code generation

* simplify logic

* apply clang-format

* Undo completely inane choice by clang-format

* Guard the use of the command line args.
2017-05-24 08:55:32 +08:00
Johan Engelen
ed3afed77a UseSoftFloat was removed from the TargetOptions in LLVM3.7. It's replacement (I believe) is the "+soft-float" target feature (in the target feature string). Inside LLVM, the "use-soft-float" attribute is upgraded to the "+soft-float" feature, so we can do that ourselves when creating the target machine.
(at the point where we add the attributes to the function, we have no access to whether our TargetMachine was created with FloatABI:SoftFP or not)
2016-10-28 17:19:26 +09:00
Martin
4da394d9d0 Let LLVM figure out default CPU for ARM/AArch64 2016-10-09 02:08:08 +02:00
David Nadlinger
6f98b63996 driver: Remove some elses for ifs with return statements [nfc]
Also some very minor deduplication.
2016-09-03 00:52:03 +01:00
David Nadlinger
11572489d5 clang-format again some files touched in the next commits [nfc] 2016-09-03 00:52:00 +01:00
Matthias Klumpp
d949688216 Default to PIC code on Linux
Modern Linux distributions have their toolchain generate PIC code for
additional security features (like ASLR).
Since there is no (sane) way to detect whether the toolchain defaults to
PIC code, we simply default to PIC code on all Linux
distributions to avoid linking issues on these OSes.

The relocation model can be switched back to non-PIC code manually at
any time.
2016-08-02 20:55:54 +02:00
Martin
9404a1ab43 Use i686 instead of i386 for -march=x86 2016-05-27 16:06:31 +02:00
Martin
789c0935d8 [x86_64] -m32: Use i686 architecture instead of i386
`get32BitArchVariant()` for x86_64 seems to return i386 which is
inconsistent with i686 (Pentium Pro+) for a native 32-bit build.
2016-05-26 15:41:52 +02:00
Kai Nacke
de296b90ec LLVM 3.9: llvm::Reloc::Default was removed.
The value is now optional as there is nothing like a default relocation.
2016-05-20 21:17:20 +02:00
Kai Nacke
ffc07566b1 LLVM 3.9: DataLayout.getLargestLegalIntTypeSize() was renamed.
Fixes a compile error with LLVM 3.9. Original by Rainer.
2016-05-19 22:56:33 +02:00
Dan Olson
13cef8a9a8 Override LLVM default relocation model for ARM
Sets ARM default relocation model to PIC for Darwin & Android and static
for rest.  This is needed because LLVM picks default relocation model of
DynamicNoPIC for non-Darwin targets, which generates bad code at -O0.
Clang source code even states that DynamicNoPIC isn't valid on any OS
but Darwin.
2016-02-06 01:22:01 -08:00
Kai Nacke
8df1f7ec1a Add more support for xBSD type OS.
Use the same code for FreeBSD, NetBSD, OpenBSD and DragonFly BSD.
2016-01-22 22:10:33 +01:00
Kai Nacke
8a26fcf52b Support Gentoo CHOST triple
The Gentoo CHOST triple differs from the normalized triple used by
LLVM. See https://wiki.gentoo.org/wiki/CHOST for details.

This results in a failure to detect the used float ABI. The vendor
field can be hardfloat or softfloat in order to indicate the float
ABI. This is the only way to specify the hardfloat ABI because the
C library value gnueabihf is not supported.

This commit adds a check for vendor names hardfloat and softfloat.
2016-01-16 21:39:31 +01:00
Dan Olson
49ba2910b0 OS X - default OS to macosx instead of darwin
On OS X, the OS in Triple should be macosx, not darwin.  This is not
comprehensive like clang which has a bunch of darwin to other OS
translation rules, but since only Darwin target currently supported is
OS X, this does the job.
2015-11-12 10:52:05 -08:00
David Nadlinger
51afced357 Also clang-tidy driver/ 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Kai Nacke
2cdbe58d86 Default enable attribute cx16 (-mattr=+cx16).
This enables code generation for cmpxchg16b instruction which is
not available on very old 64bit CPUs.

The user can change this be choosing a different cpu (`-mcpu=...`)
or by explicitly disabling the attribute (`-mattr=-cx16`).
2015-09-10 21:03:21 +02:00
Martin
2cf1a07f35 Fix LLVM 3.7 build 2015-08-08 17:08:41 +02:00
Kai Nacke
bbe3c279f1 LLVM 3.8: Access to data layout from llvm::TargetMachine has changed.
This changes only a small fraction of the code.
2015-08-07 11:54:38 +02:00
Kai Nacke
f67186592a LLVM 3.7: NoFramePointerElim is now an attribute.
Temporary workaround to enable Travis-CI.
2015-06-04 15:07:02 +02:00
Kai Nacke
2d9e66de66 Fix assertion in getABI(). 2015-05-25 16:20:48 +02:00
Kai Nacke
2331889669 MIPS: Implement ABI handling.
Adds a new command line option -mabi= and uses the value to compute
the ABI to use. Adds the ABI to linker and assembler invocation, too.
Allows consistent invocation of the whole tool chain.
2015-05-24 18:11:24 +02:00
Kai Nacke
afe6051ead LLVM 3.7: Fix MIPS ABI definition.
Detection of EABI is still missing.
2015-05-16 18:56:59 +02:00
Kai Nacke
82a76cf3f8 LLVM 3.7: TargetOptions.UseSoftFloat is gone.
A function attribute use-soft-float with values true or false is used instead.

This commi only ensures that LDC compiles with LLVM 3.7. The possible semantic
change needs to be evaluated.
2015-05-12 18:11:30 +02:00
Kai Nacke
cc9a810a69 LLVM: TargetRegistry: iterator was replaced by iterator_range. 2015-05-12 17:51:48 +02:00
Dan Olson
f554c322a8 Lookup default float-abi for thumb same as arm
Was always defaulting thumb to soft, now uses same rules for arm.  The
end result is that thumbv7-apple-ios now defaults to softfp correctly.

(cherry picked from commit e0cf8e85c2e42f382742c326f8963b8bf779df8c)
2015-02-28 23:57:38 -08:00
Dan Olson
3c9da62ea3 Set version ARM_SoftFP
Set versions ARM_SoftFP & D_HardFloat instead of ARM_SoftFloat &
D_SoftFloat for option -mfloat-abi=softfp (function calls use soft float
ABI but using hardware floating point instruction).

(cherry picked from commit 5a19080e04cc775fe94ea2ef74c850b26bb8a469)
2015-02-28 23:53:30 -08:00
Andreas Hollandt
8af29baeda fix #667 flags list used as string
enable function and data sections
fix incorrect library search paths
2014-07-17 00:11:08 +02:00
Andreas Hollandt
956f1ff528 adapt to API change 2014-07-01 18:34:36 +02:00
David Nadlinger
d8a7ae1841 Use --gc-sections on Linux.
This was painful.
2014-06-30 16:18:15 +02:00
Kai Nacke
92c06dede0 Merge branch 'merge-2.064' into merge-2.065
Conflicts:
	runtime/druntime
2014-05-10 21:38:37 +02:00
kai
841f874e04 Fix LLVM 3.5 API change 2014-05-07 07:18:37 +02:00
kai
456924116b Merge branch 'merge-2.064' into merge-2.065 2014-04-05 22:37:27 +02:00
Kai Nacke
46090e6316 Fix use of default MIPS ABI. 2014-04-04 07:33:35 +02:00
Kai Nacke
a1e73fa609 Merge branch 'merge-2.064' into merge-2.065 2014-03-30 22:59:15 +02:00
Kai Nacke
38c98c3584 Add version identifiers of MIPS ABI.
Parses the feature string and appends the required ABI feature.
Uses the feature string to define the version identifier.
2014-03-30 22:39:05 +02:00
Kai Nacke
34322f78dc Merge branch 'merge-2.064' into merge-2.065 2014-03-24 07:27:59 +01:00
Kai Nacke
61f4603afe Merge branch 'master' into merge-2.064 2014-03-24 07:27:25 +01:00
Kai Nacke
794d5d2d71 Add Krait cpu for detection of ARM architecture version. 2014-03-23 20:05:22 +01:00
Kai Nacke
fe39da53e3 Merge of 2.065.0-b3.
The new visitor class is used for IR generation. This removes some modifications from DMD source.
2014-02-10 08:47:25 +01:00
kai
5ded3ff54c Do not enable EABI on Darwin.
This should fix a crash using triple armv7-apple-darwin with LLVM 3.4.
2014-02-01 22:40:27 +01:00
Kai Nacke
4c2d23922e Fix the ARM build with LLVM 3.5.
EHABI is now enabled be default and the options to enable it are gone.
2014-02-01 15:17:38 +01:00
David Nadlinger
257da5afe5 Bring back -disable-fp-elim.
It was moved to llvm/CodeGen/CommandLineFlags.h.

GitHub: Fixes #502.
2013-10-13 20:26:19 +02:00
David Nadlinger
e4fee1116a ARM: Use -arm-enable-ehabi(-descriptors).
D exception handling does not work at all yet, but with these
flags it does for C++/Clang, at least in simple cases.
2013-10-06 20:15:28 +02:00
David Nadlinger
aba1b82539 Finally fix LLVM 3.1 compilation. 2013-10-06 19:26:58 +02:00
David Nadlinger
445b743ba5 Implement lookupTarget() with arch override for LLVM 3.1.
To be removed again once we drop 3.1 support.
2013-10-06 19:12:36 +02:00