Commit Graph

234 Commits

Author SHA1 Message Date
Eric Christopher d50e2e6397 Remove dead code associated with parsing and setting ABI based on
string name.

llvm-svn: 246021
2015-08-26 07:01:33 +00:00
Eric Christopher 964a5f3b5c Rename DescriptionString -> DataLayoutString as it matches the actual
use of the string.

llvm-svn: 244178
2015-08-05 23:48:05 +00:00
Paul Robinson d30e2eefc3 Add a "maximum TLS alignment" characteristic to the target info, so it
can be different from the normal variable maximum.
Add an error diagnostic for when TLS variables exceed maximum TLS alignment.
Currenty only PS4 sets an explicit maximum TLS alignment.

Patch by Charles Li!

llvm-svn: 242198
2015-07-14 20:52:32 +00:00
Alexey Bataev 0039651304 [OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for default simd alignment.
Adds type trait "__builtin_omp_required_simd_align" after discussions here http://reviews.llvm.org/D9894
Differential Revision: http://reviews.llvm.org/D10597

llvm-svn: 241237
2015-07-02 03:40:19 +00:00
Bradley Smith dfddebcfb9 Revert code changes made under r235976.
This issue was fixed elsewhere in r235396 in a more general way, hence these
changes no longer do anything. Keep the testcase however, to ensure that we
don't regress this for ARM.

llvm-svn: 236104
2015-04-29 14:32:06 +00:00
Bradley Smith ba945626b0 [ARM/AArch64] Enforce alignment for bitfielded structs
When creating a global variable with a type of a struct with bitfields, we must
forcibly set the alignment of the global from the RecordDecl. We must do this so
that the proper bitfield alignment makes its way down to LLVM, since clang will
mangle the bitfields into one large type.

llvm-svn: 235976
2015-04-28 11:24:54 +00:00
Ulrich Weigand ca3cb7f35c Implement target-specific __attribute__((aligned)) value
The GCC construct __attribute__((aligned)) is defined to set alignment
to "the default alignment for the target architecture" according to
the GCC documentation:

  The default alignment is sufficient for all scalar types, but may not be
  enough for all vector types on a target that supports vector operations.
  The default alignment is fixed for a particular target ABI.

clang currently hard-coded an alignment of 16 bytes for that construct,
which is correct on some platforms (including X86), but wrong on others
(including SystemZ).  Since this value is ABI-relevant, it is important
to get correct for compatibility purposes.

This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned"
that targets can set to the appropriate default __attribute__((aligned))
value.

Note that I'm deliberately *not* using the existing "SuitableAlign"
value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__,
since those two values may not be the same on all platforms.  In fact,
on X86, __attribute__((aligned)) always uses 16-byte alignment, while
__BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported.
(This is actually not yet correctly implemented in clang either.)

The patch provides a value for DefaultAlignForAttributeAligned only for
SystemZ, and leaves the default for all other targets at 16, which means
no visible change in behavior on all other targets.  (The value is still
wrong for some other targets, but I'd prefer to leave it to the target
maintainers for those platforms to fix.)

llvm-svn: 235397
2015-04-21 17:29:35 +00:00
Zoran Jovanovic 5e7483a4c1 Fixed typo.
llvm-svn: 230253
2015-02-23 20:20:49 +00:00
Zoran Jovanovic 26a1216a74 Change representation of member function pointers for MIPS targets
Differential Revision: http://reviews.llvm.org/D7148

llvm-svn: 229680
2015-02-18 15:21:35 +00:00
David Majnemer b5d2d45c5c Sema: Relax parsing of '#' in constraints
llvm-svn: 225942
2015-01-14 05:11:09 +00:00
David Majnemer b6b5643b36 Basic: Numeric constraints are multidigit
Clang would treat the digits in an "11m" input constraint separately as
if it was handling constraint 1 twice instead of constraint 11.

llvm-svn: 225606
2015-01-11 10:22:41 +00:00
David Majnemer 55164f901b Basic: [asmSymbolicName] follows the same rule as numbers in asm inputs
Input constraints like "0" and "[foo]" should be treated the same when
it comes to their corresponding output constraint.

This fixes PR21850.

llvm-svn: 225605
2015-01-11 09:57:13 +00:00
David Majnemer c71a566d00 Basic: The asm constraint '#m' isn't valid, reject it
llvm-svn: 225603
2015-01-11 09:39:03 +00:00
David Majnemer 50cb05591d Basic: The asm constraint '+#r' isn't valid, reject it
llvm-svn: 225600
2015-01-11 08:52:38 +00:00
David Majnemer a0040df38c Sema: The asm constraint '+&m' isn't valid, reject it
Don't permit '+&m' to make it to CodeGen, it's invalid.

llvm-svn: 225586
2015-01-10 10:43:19 +00:00
Saleem Abdulrasool a2823578e6 Sema: analyze I,J,K,M,N,O constraints
Add additional constraint checking for target specific behaviour for inline
assembly constraints.  We would previously silently let all arguments through
for these constraints.  In cases where the constraints were violated, we could
end up failing to select instructions and triggering assertions or worse,
silently ignoring instructions.

llvm-svn: 225244
2015-01-06 04:26:34 +00:00
Olivier Goffart fc8f893192 Fix assertion on asm register that are "%"
Name might be empty again after we removed the '%' prefix
and Name[0] would assert.

Found on code like
register int foo asm("%" MACRO);
where MACRO was supposed to be defined in a header file that was not found.

llvm-svn: 215834
2014-08-17 13:19:48 +00:00
Joerg Sonnenberger 3d9478cf3a Change __INTx_TYPE__ to be always signed. This changes the value for
char-based types from "char" to "signed char". Adjust stdint.h to use
__INTx_TYPE__ directly without prefixing it with signed and to use
__UINTx_TYPE__ for unsigned ones.

The value of __INTx_TYPE__ now matches GCC.

llvm-svn: 214119
2014-07-28 21:06:22 +00:00
Joerg Sonnenberger 587deea875 If char/short are shorter than int, do not use U as suffix for
constants. Comparing int against a constant of the given type like
UINT8_MAX will otherwise force a promotion to unsigned int, which is
typically not expected.

llvm-svn: 213301
2014-07-17 20:12:32 +00:00
Joerg Sonnenberger be324f9832 Provide builtin macros as template for PRIab and SCNab, matching the
underlaying types.

llvm-svn: 213063
2014-07-15 11:30:00 +00:00
Joerg Sonnenberger 9b7060e218 Drop separate UIntMaxType and just derive it from IntMaxType.
llvm-svn: 212987
2014-07-14 21:00:38 +00:00
Alp Toker 74437975c4 Constify a read-only parameter and give function a better name
This makes it clear that TargetInfo doesn't capture the LangOptions object,
rather uses it to apply adjustments.

llvm-svn: 212386
2014-07-06 05:14:24 +00:00
JF Bastien ab8d0a0dd5 Implement predefined stdint macros
Add predefined stdint macros that match the given patterns:

U?INT{_,_FAST,_LEAST}{8,16,32,64}_{MAX,TYPE}
U?INT{PTR,MAX}_{MAX,TYPE}

http://reviews.llvm.org/D4141

Author: binji
llvm-svn: 211657
2014-06-25 01:31:33 +00:00
Craig Topper f1186c5a8f [C++11] Use 'nullptr'.
llvm-svn: 208280
2014-05-08 06:41:40 +00:00
Saleem Abdulrasool 377066a5f5 Use the new Windows environment for target detection
This follows the LLVM change to canonicalise the Windows target triple
spellings.  Rather than treating each Windows environment as a single entity,
the environments are now modelled properly as an environment.  This is a
mechanical change to convert the triple use to reflect that change.

llvm-svn: 204978
2014-03-27 22:50:18 +00:00
Hans Wennborg c9bd88e681 Remove the -cxx-abi command-line flag.
This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples,
Itanium otherwise. It's no longer possible to do weird combinations.

To be able to run a test with a specific ABI without constraining it to a
specific triple, new substitutions are added to lit: %itanium_abi_triple and
%ms_abi_triple can be used to get the current target triple adjusted to the
desired ABI. For example, if the test suite is running with the i686-pc-win32
target, %itanium_abi_triple will expand to i686-pc-mingw32.

Differential Revision: http://llvm-reviews.chandlerc.com/D2545

llvm-svn: 199250
2014-01-14 19:35:09 +00:00
Pekka Jaaskelainen 43c39d5f1f OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit floats.
llvm-svn: 197592
2013-12-18 18:15:03 +00:00
Duncan P. N. Exon Smith d68c7aa7e6 Stop crashing on empty asm input constraints
An empty string for an ASM input constraint is invalid, and will crash
during clang CodeGen.  Change TargetInfo::validateInputConstraint to
reject an empty string.

<rdar://problem/15552191>

llvm-svn: 197362
2013-12-16 03:20:06 +00:00
Rafael Espindola 1658de9a2a Every target sets DescriptionString. Assert that.
llvm-svn: 197268
2013-12-13 19:56:31 +00:00
David Tweed 31d09b0cef Certain multi-platform languages, such as OpenCL, have the concept of
address spaces which is both (1) a "semantic" concept and
(2) possibly a hardware level restriction. It is desirable to
be able to discard/merge the LLVM-level address spaces on arguments for which
there is no difference to the current backend while keeping
track of the semantic address spaces in a funciton prototype. To do this
enable addition of the address space into the name-mangling process. Add
some tests to document this behaviour against inadvertent changes.

Patch by Michele Scandale!

llvm-svn: 190684
2013-09-13 12:04:22 +00:00
David Tweed 6c2149b3e5 Fix minor coding style issue in r190296 pointed out by Richard Smith.
llvm-svn: 190390
2013-09-10 08:00:34 +00:00
David Tweed 2da6438969 The OpenCL standard specifies the sizes and alignments of various types than other C-family
languages, as well as specifying errno is not set by the math functions. Make the
clang front-end set those appropriately when the OpenCL language option is set.

Patch by Erik Schnetter!

llvm-svn: 190296
2013-09-09 09:17:24 +00:00
Stepan Dyatkovskiy a4a59d7468 Additional fix for PR16752 and for commit 190044:
-- For TargetInfo::getRealTypeByWidth also added support for IEEEQuad float type.

llvm-svn: 190294
2013-09-09 07:46:54 +00:00
Stepan Dyatkovskiy 5a63792239 Add new methods for TargetInfo:
getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth.

As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly
Description:
Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp).
For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only.
Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct.
Please consider the next solution:
1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here.
2. Fix handleModeAttr according to new methods in TargetInfo.
This approach is implemented in the patch attached to this post.

Fixes:
1st Commit (Current): Add new methods for TargetInfo:
     getRealTypeByWidth and getIntTypeByWidth
  for ASTContext names are almost same(invokes new methods from TargetInfo):
     getIntTypeForBitwidth and getRealTypeForBitwidth

2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function.

llvm-svn: 190044
2013-09-05 11:23:21 +00:00
Benjamin Kramer b1276b4cff Driver: Push triple objects around instead of going to std::string all the time.
No functionality change.

llvm-svn: 185261
2013-06-29 16:37:14 +00:00
Ulrich Weigand fa80642205 Allow targets to define minimum alignment for global variables
This patch adds a new common code feature that allows platform code to
request minimum alignment of global symbols.  The background for this is
that on SystemZ, the most efficient way to load addresses of global symbol
is the LOAD ADDRESS RELATIVE LONG (LARL) instruction.  This instruction
provides PC-relative addressing, but only to *even* addresses.  For this
reason, existing compilers will guarantee that global symbols are always
aligned to at least 2.  [ Since symbols would otherwise already use a
default alignment based on their type, this will usually only affect global
objects of character type or character arrays. ]  GCC also allows creating
symbols without that extra alignment by using explicit "aligned" attributes
(which then need to be used on both definition and each use of the symbol).

To enable support for this with Clang, this patch adds a
TargetInfo::MinGlobalAlign variable that provides a global minimum for the
alignment of every global object (unless overridden via explicit alignment
attribute), and adds code to respect this setting.  Within this patch, no
platform actually sets the value to anything but the default 1, resulting
in no change in behaviour on any existing target.

This version of the patch incorporates feedback from reviews by
Eric Christopher and John McCall.  Thanks to all reviewers!

Patch by Richard Sandiford.

llvm-svn: 181210
2013-05-06 16:23:57 +00:00
Benjamin Kramer 1e4a886c28 Add comment to describe cleverness.
llvm-svn: 179806
2013-04-18 22:49:48 +00:00
Benjamin Kramer 7ee3b9c0e4 Reject asm output constraints that consist of modifiers only.
Fixes PR15759.

llvm-svn: 179756
2013-04-18 13:23:23 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
John McCall 359b885e12 First pass at abstracting out a class for the target C++ ABI.
llvm-svn: 173514
2013-01-25 22:30:49 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Eli Friedman 4e91899e7b Fix the definition of the vfork() builtin on Haiku. PR14378.
llvm-svn: 168674
2012-11-27 02:58:24 +00:00
Ulrich Weigand 7bcc7ec745 Handle '*' and '#' asm constraint modifiers.
llvm-svn: 166924
2012-10-29 12:20:54 +00:00
Douglas Gregor bc10b9fbc5 Teach TargetInfo to hold on to the TargetOptions with which it was
created.

llvm-svn: 165943
2012-10-15 16:45:32 +00:00
Chad Rosier cc40ea7f9a Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX).  Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size.  Thus, very large vectors will be over-aligned with no 
benefit.  Target owners should set this target max.

llvm-svn: 160209
2012-07-13 23:57:43 +00:00
Fariborz Jahanian 29898f4565 objective-c modern translator: buildit objc bool
type for rewriter project will be BoolTy.
// rdar://11231426. 

llvm-svn: 154861
2012-04-16 21:03:30 +00:00
Eli Friedman 803acb3ff2 Add support for bitcasts to vector type in Evaluate.
llvm-svn: 147137
2011-12-22 03:51:45 +00:00
Nick Lewycky f59e129c3b Add the value of "suitably aligned" from the C++11 standard to Basic/TargetInfo.
This is equal to alignof(std::max_align_t) on the platform and equal to the
alignment provided by malloc. (Platform owners please double-check your
platform's value.)

llvm-svn: 146762
2011-12-16 22:34:14 +00:00
Anders Carlsson 2f1a6c3f01 In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
llvm-svn: 143350
2011-10-31 16:27:11 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Eli Friedman 4b72fddd99 Misc fixes for atomics. Biggest fix is doing alignment correctly for _Atomic types.
llvm-svn: 142002
2011-10-14 20:59:01 +00:00
David Blaikie 76bd3c80d4 Fix missing includes for llvm_unreachable
llvm-svn: 140368
2011-09-23 05:35:21 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Abramo Bagnara 41bfb66e76 Added missing initialization.
llvm-svn: 139291
2011-09-08 14:20:25 +00:00
Chad Rosier 18903ee2d3 Add partial support for using anonymous bitfields (e.g., int : 0) to enforce
alignment.  This fixes cases where the anonymous bitfield is followed by a 
non-bitfield member.  E.g.,

struct t4
{
  int foo : 1;
  long : 0;
  char bar;
};

Part of rdar://9859156

llvm-svn: 136858
2011-08-04 01:21:14 +00:00
Chad Rosier 99ee7829ff After further discussion it has been determined that alignof should report
the preferred alignment.  Thus, revert r135934, r135935, and r135940.

llvm-svn: 136062
2011-07-26 07:03:04 +00:00
Chad Rosier b23ee96cd5 Allow target to specify about using minimum alignment vs preferred. Takes care of
FIXME: Override "preferred align" for double and long long for ARM apcs-gnu ABI. 
Also part of rdar://9802874

llvm-svn: 135940
2011-07-25 19:39:39 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Eric Christopher fd9a5f4f66 Split out logic for valid clobbers and valid inline asm registers.
Fixes rdar://9281377

llvm-svn: 134016
2011-06-28 18:20:53 +00:00
Eric Christopher cdd3635b09 Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559

llvm-svn: 133485
2011-06-21 00:05:20 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Douglas Gregor 20b2ebd785 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

llvm-svn: 128127
2011-03-23 00:50:03 +00:00
Peter Collingbourne 599cb8e430 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

llvm-svn: 127915
2011-03-18 22:38:29 +00:00
Roman Divacky 178e0160b7 Implement mcount profiling, enabled via -pg.
llvm-svn: 125282
2011-02-10 16:52:03 +00:00
Roman Divacky 965b0b72b1 PowerPC fixes.
Fix the width and align of bool type on Darwin to be 32bits
while keeping it 8 everywhere else.

Change the definition of va_list to default to SV4 ABI one
and let darwin subtarget override this.

Both changes submitted by Nathan Whitehorn and reviewed
by Rafael Espindola.

llvm-svn: 122956
2011-01-06 08:27:10 +00:00
Chris Lattner ad3467ee89 The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.

llvm-svn: 122558
2010-12-25 23:25:43 +00:00
Nick Lewycky 2e998b7a6e Add missing standard includes. Patch by Joerg Sonnenberger!
llvm-svn: 122194
2010-12-19 20:49:25 +00:00
Anders Carlsson 2d5f8b4201 When setting a tied check if it's already tied. If it's tied to another constraint it's invalid. Fixes PR3905.
llvm-svn: 118146
2010-11-03 02:54:51 +00:00
Anders Carlsson da1f5fc881 A number in an input constraint can't point to a read-write ('+') constraint. Fixes PR3904.
llvm-svn: 118145
2010-11-03 02:22:29 +00:00
Michael J. Spencer feb799c14b Fix Whitespace.
llvm-svn: 116699
2010-10-18 07:10:59 +00:00
John Thompson c467aa2fa4 Fixed pr20314-2.c failure, added E, F, p constraint letters.
llvm-svn: 114490
2010-09-21 22:04:54 +00:00
John Thompson 1224061281 Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
llvm-svn: 114253
2010-09-18 01:15:13 +00:00
Dale Johannesen 8499f47ef4 Allow 'o' and 'V' as constraints for output asm operands.
Allow '<' and '>' as constraints for input or output.

llvm-svn: 113246
2010-09-07 18:40:41 +00:00
John McCall 86353416a7 The ARM C++ ABI is sufficiently different from the Itanium C++ ABI that
it deserves its own enumerator.  Obviously the implementations should
closely follow the Itanium ABI except in cases of divergence.

llvm-svn: 111749
2010-08-21 22:46:04 +00:00
Eli Friedman 854f110834 Fix oversight with symbolic names in TargetInfo::validateInputConstraint.
llvm-svn: 110870
2010-08-11 23:03:37 +00:00
John Thompson 46667afccd Fix for pr7869, inline asm mult-alt constraints.
llvm-svn: 110764
2010-08-11 00:58:20 +00:00
John Thompson a5c7d706b8 Slightly revised handling of mult-alt constraints, to avoid an assert, until we have the full fix.
llvm-svn: 110706
2010-08-10 19:20:14 +00:00
Daniel Dunbar 6f2e839693 CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosing
whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI
dependent.
 - <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug

llvm-svn: 108379
2010-07-14 23:39:36 +00:00
John Thompson c438947242 Hack for dealing with commas until we support multiple alternative constraints, per pr7338.
llvm-svn: 108028
2010-07-09 22:49:34 +00:00
Rafael Espindola e971b9a260 Correctly align large arrays in x86-64. This fixes PR5599.
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
Daniel Dunbar bd60652ace Sema: Reject '#pragma options align=mac68k' everywhere except i386-apple-darwin.
llvm-svn: 104789
2010-05-27 00:35:16 +00:00
Chris Lattner 1a8f394a1f david conrad points out that {|} in inline assembly on arm are not asm
variants.  This fixes neon inline asm which my patch for PR6780 broke.

llvm-svn: 102181
2010-04-23 16:29:58 +00:00
Daniel Dunbar 9302f60606 clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.
llvm-svn: 101370
2010-04-15 15:06:22 +00:00
Daniel Dunbar 1da6511b99 Tweak spelling (Bitfield -> BitField)
llvm-svn: 101369
2010-04-15 15:06:18 +00:00
Daniel Dunbar 3d9289c736 Add TargetInfo::useBitfieldTypeAlignment().
- Used to determine whether the alignment of the type in a bit-field is
   respected when laying out structures. The default is true, targets can
   override this as needed.

 - This is designed to correspond to the PCC_BITFIELD_TYPE_MATTERS macro in
   gcc. The AST/Sema implementation only affects one line, unless I have
   forgotten something. I'd appreciate further review.

 - IRgen still needs to be updated to fully support this (which is effectively
   PR5591).

llvm-svn: 101356
2010-04-15 06:18:39 +00:00
Anders Carlsson c7c5baa482 Yay for more StringRefs.
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Nuno Lopes 2af2af219f fix PR5689: add support for 'o' and 'V' asm input operands
llvm-svn: 91540
2009-12-16 14:28:21 +00:00
Edward O'Callaghan 847f2a10ee Add SigAtomicType to TargetInfo, Needed for MSP and PIC Targets, Credit to Ken Dyck.
llvm-svn: 89520
2009-11-21 00:49:54 +00:00
Chris Lattner 0fb5bbd401 do not store wchar/char16/char32/intmax width/alignment info
into TargetInfo, just derive this based on the underlying type.
This prevents them from getting out of synch, patch by Ken Dyck!

llvm-svn: 86976
2009-11-12 08:04:33 +00:00
Chris Lattner 5c67237ff6 teach the various targets what native integer types they have.
llvm-svn: 86395
2009-11-07 18:59:41 +00:00
John Thompson 864bf7562f Eliminate tabls
llvm-svn: 86183
2009-11-05 22:03:02 +00:00
Chris Lattner e4a8c64731 clean up integer preprocessor type definitions, patch by Ken Dyck!
llvm-svn: 86177
2009-11-05 21:21:32 +00:00
John Thompson ed4e2950bc Adding -fshort-wchar option.
llvm-svn: 86167
2009-11-05 20:14:16 +00:00
Chris Lattner c0c043903b rename getTypeSigned() -> isTypeSigned() per daniel's review.
llvm-svn: 85076
2009-10-25 22:49:18 +00:00
Chris Lattner 72cdcacb02 add helpful methods to TargetInfo for querying builtin integer type properties,
patch by Ken Dyck!

llvm-svn: 84746
2009-10-21 06:24:21 +00:00
Chris Lattner 6720492c39 hookize wint_t's definition, patch by Edward O'Callaghan (from PR5233).
llvm-svn: 84740
2009-10-21 04:59:34 +00:00
Chris Lattner f315471e24 fix PR4938 by recognizing % as a modifier on outputs,
previously we only recognized it on inputs.

llvm-svn: 83939
2009-10-13 04:32:07 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Alisdair Meredith a9ad47d94c Basic support for C++0x unicode types. Support for literals will follow in an incremental patch
llvm-svn: 75622
2009-07-14 06:30:34 +00:00
Eli Friedman 2857ccbaa7 Fix for PR4192: fix the definition of int64_t on x86_64 Linux.
Note that I'm guessing that *BSD and Solaris do the same thing as Linux 
here, but it's quite possible I'm wrong; if the following testcase 
gives an error on x86-64 with gcc for any of those operating systems, please
tell me:

#include <stdint.h>

int64_t x; long x;

llvm-svn: 74583
2009-07-01 03:36:11 +00:00
Eli Friedman 9ffd4a9b96 Move CharIsSigned from TargetInfo to LangOptions.
llvm-svn: 72928
2009-06-05 07:05:05 +00:00
Chris Lattner dbcc5ca57f Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.

llvm-svn: 71064
2009-05-06 04:33:31 +00:00
Chris Lattner 4c92b51089 in a tied operand, don't copy over the name or constraint string, just the flags.
llvm-svn: 70137
2009-04-26 18:05:25 +00:00
Chris Lattner c16d476b30 pull operands names "[foo]" into ConstraintInfo.
llvm-svn: 70136
2009-04-26 17:57:12 +00:00
Chris Lattner c3f4c7b1c5 pull the constraint string into the ConstraintInfo struct
instead of passing it around in addition to it.

llvm-svn: 70135
2009-04-26 17:19:08 +00:00
Chris Lattner d9725f7041 change TargetInfo::ConstraintInfo to be a struct that contains
the enum along with some other data.

llvm-svn: 70114
2009-04-26 07:16:29 +00:00
Eli Friedman d88c8a104f Add target property for whether thread-local storage is supported.
Let me know if I messed up for some target.  Note that for Windows, we 
should be able to support it (MSVC supports "__declspec(thread)"), but 
I'm pretty sure LLVM doesn't know how to generate the correct code.

llvm-svn: 69552
2009-04-19 21:38:35 +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
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
Chris Lattner a91c30fdb0 simplify and refactor a bunch of type definition code in Preprocessor
predefines buffer initialization.

llvm-svn: 63919
2009-02-06 05:04:11 +00:00
Anders Carlsson 570c357ded If an input constraint refers to an output constraint, it should have the same constraint info as the output constraint. Fixes PR3417
llvm-svn: 63127
2009-01-27 20:38:24 +00:00
Anders Carlsson e70cde134e Handle the 'X' constraint. Fixes <rdar://problem/6504897>.
llvm-svn: 62446
2009-01-18 02:12:04 +00:00
Anders Carlsson a79203be85 Add sema support for symbolic names in inline asm statements.
llvm-svn: 62441
2009-01-18 01:56:57 +00:00
Nate Begeman a45707c06a Allow targets to override IntMaxTWidth
llvm-svn: 62434
2009-01-17 23:56:13 +00:00
Anders Carlsson 19aa04d270 Change TargetInfo::validateInputConstraint to take begin/end name iterators instead of the number of outputs. No functionality change.
llvm-svn: 62433
2009-01-17 23:36:15 +00:00
Anders Carlsson 30c235d182 Make sure to initialize the ConstraintInfo to 0
llvm-svn: 62068
2009-01-12 02:15:29 +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
Anders Carlsson 2a79a90430 Fix a bug that was introduced in 58501. Ideally I think we should force all targets to set these values and not have defaults.
llvm-svn: 58511
2008-10-31 16:05:19 +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 f37bafc5ca Implement PR2773, support for __USER_LABEL_PREFIX__
llvm-svn: 57127
2008-10-05 19:22:37 +00:00
Daniel Dunbar 81128e04e7 Stop asserting in TargetInfo::validateInputConstraint
- Sema gives a perfectively nice error message on invalid constraints.

llvm-svn: 55310
2008-08-25 09:46:27 +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
Sanjiv Gupta 14f18f3f91 Allow targets to override description string.
llvm-svn: 54914
2008-08-18 10:05:22 +00:00
Daniel Dunbar 56fdb6ae69 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.

llvm-svn: 54632
2008-08-11 06:23:49 +00:00
Eli Friedman b53660698a Some small changes to make the target info a bit more accurate.
llvm-svn: 51319
2008-05-20 14:21:01 +00:00
Chris Lattner 5e2ef0c18a parameterize pointer size/align better without doing virtual method calls in normal case.
llvm-svn: 50890
2008-05-09 06:08:39 +00:00
Chris Lattner 5a9aaaf687 parameterize long long.
llvm-svn: 50887
2008-05-09 05:50:02 +00:00
Chris Lattner 5dc7ff1cf3 correctly parameterize long, patch by Nate.
llvm-svn: 50886
2008-05-09 05:47:41 +00:00
Chris Lattner b781dc79aa Add basic support for the pic-* target triples and add support for
targets that do not support recursion (and thus codegen stack variables
as globals).

Patch contributed by Alireza Moshtaghi!

llvm-svn: 50844
2008-05-08 05:58:21 +00:00
Ted Kremenek b44485b835 Have ValidateOutputConstraint return false instead of firing an assertion
when processing a constraint we don't understand.  This allows the frontend
to gracefully fail.

llvm-svn: 50213
2008-04-24 16:36:38 +00:00
Nate Begeman 65bea23674 Tabs -> spaces
llvm-svn: 49909
2008-04-18 17:17:24 +00:00
Nate Begeman c00bed3871 Initialize default double width and alignment
llvm-svn: 49899
2008-04-18 05:49:49 +00:00
Chris Lattner c4f02b6bed add a missing #include
llvm-svn: 49256
2008-04-06 04:02:29 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00