Commit Graph

73 Commits

Author SHA1 Message Date
Chris Lattner 4ba73aa0c2 pass LangOptions into TargetInfo::getTargetDefines, so that targets
can have language-specific defines.

llvm-svn: 67375
2009-03-20 15:52:06 +00:00
Chris Lattner 5c3529634a implement support for propagating *features* down to the code generator
and defining target-specific macros based on them (like __SSE3__ and 
friends).  After extensive discussion with Daniel, this work will need
driver support, which will translate things like -msse3 into a -mattr 
feature.  Until this work is done, the code in clang.cpp is disabled and
the X86TargetInfo ctor still defaults to SSE2.  With these two things
changed, this code will work.  PR3634

llvm-svn: 65966
2009-03-03 19:56:18 +00:00
Chris Lattner 96e43578fc Add plumbing to support programatically defining __SSE2__ and friends,
even though we still hard code sse2 for now.  No support for 3dnow or sse4a,
but someone could add that if they desired.

llvm-svn: 65886
2009-03-02 22:40:39 +00:00
Chris Lattner ecd49037ec minor cleanups to target-specific #defines, no functionality change.
llvm-svn: 65885
2009-03-02 22:27:17 +00:00
Chris Lattner c25d8a7e30 improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)
llvm-svn: 65884
2009-03-02 22:20:04 +00:00
Anders Carlsson 5843635b37 TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).
llvm-svn: 65696
2009-02-28 17:11:49 +00:00
Fariborz Jahanian 30b3ac5e9e Minor refactoring.
llvm-svn: 65414
2009-02-24 23:38:42 +00:00
Fariborz Jahanian 240f2b7851 patch for two things.
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.

llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Chris Lattner d0b80c8c75 add support for amd64-*, patch by Brooks Davis!
llvm-svn: 65124
2009-02-20 17:04:14 +00:00
Douglas Gregor 9eebd9709a Supply the header corresponding to a library builtin as a separate argument to the LIBBUILTIN macro
llvm-svn: 64676
2009-02-16 21:58:21 +00:00
Douglas Gregor 69c7951c8e Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
llvm-svn: 64566
2009-02-14 20:49:29 +00:00
Anton Korobeynikov 7e96595f11 Define __ELF__ on FreeBSD. Patch by Roman Divacky!
llvm-svn: 64557
2009-02-14 16:42:50 +00:00
Argyrios Kyrtzidis d831cac2a7 Define __ELF__ for linux systems.
llvm-svn: 64553
2009-02-14 15:02:45 +00:00
Chris Lattner 7e4c81c8c6 Give TargetInfo a new IntPtrType to hold the intptr_t type for
a target.

Make Preprocessor.cpp define a new __INTPTR_TYPE__ macro based on this.

On linux/32, set intptr_t to int, instead of long.  This fixes PR3563.

llvm-svn: 64495
2009-02-13 22:28:55 +00:00
Fariborz Jahanian 13de253bd6 Make nonfragile-abi the default for darwin's 64bit
abi for objective-c programs.

llvm-svn: 64386
2009-02-12 17:54:33 +00:00
Chris Lattner d0a79b2eb8 make clang agree with gcc 4.2's x86-64 predefines and settings.
llvm-svn: 63849
2009-02-05 07:32:46 +00:00
Chris Lattner 8181312251 fix some differences between apple gcc and clang on darwin/x86-32.
llvm-svn: 63846
2009-02-05 07:19:24 +00:00
Chris Lattner 22ebe7ba66 long long and double have 64-bit alignment on x86-64.
llvm-svn: 63191
2009-01-28 06:58:19 +00:00
Chris Lattner 9b415d6142 add SparcV8 asm register info support. Patch by Ben Lickly!
llvm-svn: 63085
2009-01-27 01:58:38 +00:00
Anders Carlsson a0b892113a Handle the 'e' constraint. Fixes PR3385
llvm-svn: 62923
2009-01-24 18:03:09 +00:00
Nate Begeman 95439108e8 Fit in 80 cols
llvm-svn: 62439
2009-01-18 01:08:03 +00:00
Chris Lattner 2ca529ce61 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.

llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Chris Lattner c7c6dd4d97 replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.

llvm-svn: 60561
2008-12-04 22:54:33 +00:00
Eli Friedman d50881c6a9 More fallout from r58501: primary fix is some more corrections to make
the types for size_t and ptrdiff_t more accurate.  I think all of these
are correct, but please compare the defines for __PTRDIFF_TYPE__ and 
__SIZE_TYPE__ to gcc to double-check; this particularly applies to 
those on BSD variants, since I'm not sure what they do here; I assume 
here that they're the same as on Linux.

Fixes wchar_t to be "int", not "unsigned int" (which I think is 
correct on everything but Windows).

Fixes ptrdiff_t to be "int" rather than "short" on PIC16; "short" is an 
somewhat strange choice because it normally gets promoted, and it's not 
consistent with the choice for size_t.

llvm-svn: 58556
2008-11-02 02:43:55 +00:00
Sanjiv Gupta d79592448b Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.

Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.

llvm-svn: 58501
2008-10-31 09:52:39 +00:00
Chris Lattner 69f9bc24f4 Fix the definition of __builtin_va_list on PPC, which was set to the V4 ABI, not the
darwin or AIX abis.  This fixes PR2904.

llvm-svn: 58222
2008-10-27 01:11:29 +00:00
Chris Lattner 3c3e2cc77f Add basic FreeBSD target support, patch by Roman Divacky!
llvm-svn: 57645
2008-10-16 17:04:31 +00:00
Anders Carlsson 5f7ee680f8 Add 'x' constraint character.
llvm-svn: 57198
2008-10-06 19:17:39 +00:00
Anders Carlsson 83661acf30 Add the 'y' assembler constraint.
llvm-svn: 57144
2008-10-06 00:41:45 +00:00
Chris Lattner 09d98f5d8a miscellaneous cleanups
llvm-svn: 57140
2008-10-05 21:50:58 +00:00
Chris Lattner ac7ed9a71a move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
target indep code.

llvm-svn: 57139
2008-10-05 21:49:27 +00:00
Chris Lattner c34a35d56f it helps when I save the file before testing and committing.
llvm-svn: 57138
2008-10-05 21:42:17 +00:00
Chris Lattner 6da2f0dd2e suck the rest of the FP macros out of the targets into the PP
llvm-svn: 57137
2008-10-05 21:40:58 +00:00
Chris Lattner 5cd8351808 start moving fp macros over
llvm-svn: 57134
2008-10-05 20:40:30 +00:00
Chris Lattner 6512a88984 move a bunch more integer sizing out of target-specific code into
target indep code.  

Note that this changes functionality on PIC16: it defines __INT_MAX__
correctly for it, and it changes sizeof(long) to 16-bits (to match
the size of pointer).

llvm-svn: 57132
2008-10-05 20:06:37 +00:00
Chris Lattner 4ecd753486 eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
integer size #defines over to the Preprocessor.

llvm-svn: 57130
2008-10-05 19:44:25 +00:00
Chris Lattner 97d749464d Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9"

llvm-svn: 56873
2008-09-30 20:30:12 +00:00
Nick Lewycky e275a66538 Add missing include for use of atoi.
llvm-svn: 56836
2008-09-30 07:18:57 +00:00
Chris Lattner b3793bb415 The definition of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ follows
the target triple on darwin.  For example i386-apple-darwin9 -> 1050 because
darwin9 is "10.5".

llvm-svn: 56826
2008-09-30 01:00:25 +00:00
Chris Lattner 7ed3209332 define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.
llvm-svn: 56824
2008-09-30 00:48:48 +00:00
Chris Lattner 006579ddb5 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #define
llvm-svn: 56822
2008-09-30 00:46:39 +00:00
Daniel Dunbar d0921de8b0 Add x86_64 Linux target.
- PR2824

llvm-svn: 56491
2008-09-23 17:37:57 +00:00
Eli Friedman 6565d45b5f Per PR2773, define __USER_LABEL_PREFIX__ for x86-32 Linux and Windows.
If you're on some other platform, the correct definition for this macro 
would be appreciated; to find the correct definition, just run the 
following command:

echo | gcc -dM -E - | grep USER_LABEL_PREFIX

llvm-svn: 55869
2008-09-06 01:37:51 +00:00
Chris Lattner 5637ef5fce Add dragonfly target support, patch by Sascha Wildner
llvm-svn: 55241
2008-08-23 18:23:14 +00:00
Daniel Dunbar b8767ac183 Add TargetInfo::useNeXTRuntimeAsDefault
- Used to autoselect runtime when neither -fnext-runtime nor
   -fgnu-runtime is specified.
 - Default impl is false, all darwin targets set it to true.

llvm-svn: 55231
2008-08-23 08:43:39 +00:00
Eli Friedman 41d7e49e15 Remove duplicate define from Windows-x86 target.
llvm-svn: 55101
2008-08-21 01:56:54 +00:00
Eli Friedman c968a6ab8e Initial implementation of Windows x86 target; at the moment, the only
difference from generic x86 is the defines.  The rest is non-trivial to 
implement.

I'm not planning on adding any more targets myself; if there are any 
targets anyone is currently using that are missing, feel free to add 
them, or ask me to add them.

This concludes the work I'm planning for the TargetInfo 
implementations at the moment; all the other issues with TargetInfo require
some API changes, and I haven't really thought it through.  Some of the
remaining issues: allowing targets to define size_t and wchar_t properly,
adding some sort of __builtin_type_info intrinsic so we can finish clang's 
limits.h and float.h and get rid of a massive number of macro 
definitions, allowing target-specific command-line options, allowing
target-specific defaults for certain command-line options like
-fms-extensions, exposing vector alignment outside of the description 
string, exposing endianness outside of the description string, allowing 
targets to expose special bit-field layout requirements, exposing some 
sort of custom hook for call generation in CodeGen, and adding CPU 
selection to control defines like __SSE__.

llvm-svn: 55098
2008-08-21 01:40:19 +00:00
Eli Friedman ff594f24dd Add Linux x86-32 target.
llvm-svn: 55095
2008-08-21 00:24:02 +00:00
Eli Friedman 873f65afe8 First cut at OS detection, taking advantage of the new generic targets.
This approach allows adding OS-specific targets/defines/etc. without 
completely breaking unknown subtargets.  No new subtargets yet, although 
I plan to add x86-Linux soon.  Others can add targets that they use as 
needed; adding a new subtarget takes very little code.

Also does some fixups for description strings; a lot of them were 
unspecified.  I think all the ones I added are correct, but 
they're unverified; corrections are welcome.

llvm-svn: 55091
2008-08-21 00:13:15 +00:00
Eli Friedman b9e5bed4dd Class reorg for PPC; shouldn't be any visible changes unless I messed
up somehow.

This concludes the series of reorg patches for the target 
implementations.

llvm-svn: 55086
2008-08-20 23:11:40 +00:00