aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/TargetInfo.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-08-31Revert "Pull the target attribute parsing out of CGCall and onto TargetInfo."Eric Christopher1-47/+0
This reverts commit r246468 while we figure out what to do about Basic and AST. llvm-svn: 246508
2015-08-31Pull the target attribute parsing out of CGCall and onto TargetInfo.Eric Christopher1-0/+47
Also: - Add a typedef to make working with the result easier. - Update callers to use the new function. - Make initFeatureMap out of line. llvm-svn: 246468
2015-08-26Remove dead code associated with parsing and setting ABI based onEric Christopher1-15/+0
string name. llvm-svn: 246021
2015-08-05Rename DescriptionString -> DataLayoutString as it matches the actualEric Christopher1-1/+1
use of the string. llvm-svn: 244178
2015-07-14Add a "maximum TLS alignment" characteristic to the target info, so itPaul Robinson1-0/+1
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-02[OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for ↵Alexey Bataev1-0/+1
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-04-29Revert code changes made under r235976.Bradley Smith1-1/+0
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-28[ARM/AArch64] Enforce alignment for bitfielded structsBradley Smith1-0/+1
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-21Implement target-specific __attribute__((aligned)) valueUlrich Weigand1-0/+1
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-02-23Fixed typo.Zoran Jovanovic1-1/+1
llvm-svn: 230253
2015-02-18Change representation of member function pointers for MIPS targetsZoran Jovanovic1-0/+1
Differential Revision: http://reviews.llvm.org/D7148 llvm-svn: 229680
2015-01-14Sema: Relax parsing of '#' in constraintsDavid Majnemer1-4/+0
llvm-svn: 225942
2015-01-11Basic: Numeric constraints are multidigitDavid Majnemer1-3/+9
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-11Basic: [asmSymbolicName] follows the same rule as numbers in asm inputsDavid Majnemer1-0/+4
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-11Basic: The asm constraint '#m' isn't valid, reject itDavid Majnemer1-1/+7
llvm-svn: 225603
2015-01-11Basic: The asm constraint '+#r' isn't valid, reject itDavid Majnemer1-1/+5
llvm-svn: 225600
2015-01-10Sema: The asm constraint '+&m' isn't valid, reject itDavid Majnemer1-0/+7
Don't permit '+&m' to make it to CodeGen, it's invalid. llvm-svn: 225586
2015-01-06Sema: analyze I,J,K,M,N,O constraintsSaleem Abdulrasool1-0/+2
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
2014-08-17Fix assertion on asm register that are "%"Olivier Goffart1-0/+2
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-07-28Change __INTx_TYPE__ to be always signed. This changes the value forJoerg Sonnenberger1-1/+1
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-17If char/short are shorter than int, do not use U as suffix forJoerg Sonnenberger1-1/+5
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-15Provide builtin macros as template for PRIab and SCNab, matching theJoerg Sonnenberger1-0/+19
underlaying types. llvm-svn: 213063
2014-07-14Drop separate UIntMaxType and just derive it from IntMaxType.Joerg Sonnenberger1-2/+0
llvm-svn: 212987
2014-07-06Constify a read-only parameter and give function a better nameAlp Toker1-2/+2
This makes it clear that TargetInfo doesn't capture the LangOptions object, rather uses it to apply adjustments. llvm-svn: 212386
2014-06-25Implement predefined stdint macrosJF Bastien1-0/+15
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-05-08[C++11] Use 'nullptr'.Craig Topper1-1/+1
llvm-svn: 208280
2014-03-27Use the new Windows environment for target detectionSaleem Abdulrasool1-1/+1
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-01-14Remove the -cxx-abi command-line flag.Hans Wennborg1-2/+4
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
2013-12-18OpenCL: Do not force 64 bit floats for (embedded) targets with only 32bit ↵Pekka Jaaskelainen1-2/+8
floats. llvm-svn: 197592
2013-12-16Stop crashing on empty asm input constraintsDuncan P. N. Exon Smith1-0/+3
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-13Every target sets DescriptionString. Assert that.Rafael Espindola1-2/+1
llvm-svn: 197268
2013-09-13Certain multi-platform languages, such as OpenCL, have the concept ofDavid Tweed1-0/+1
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-10Fix minor coding style issue in r190296 pointed out by Richard Smith.David Tweed1-4/+4
llvm-svn: 190390
2013-09-09The OpenCL standard specifies the sizes and alignments of various types than ↵David Tweed1-0/+29
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-09Additional fix for PR16752 and for commit 190044:Stepan Dyatkovskiy1-1/+2
-- For TargetInfo::getRealTypeByWidth also added support for IEEEQuad float type. llvm-svn: 190294
2013-09-05Add new methods for TargetInfo:Stepan Dyatkovskiy1-0/+45
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-06-29Driver: Push triple objects around instead of going to std::string all the time.Benjamin Kramer1-2/+1
No functionality change. llvm-svn: 185261
2013-05-06Allow targets to define minimum alignment for global variablesUlrich Weigand1-0/+1
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-04-18Add comment to describe cleverness.Benjamin Kramer1-0/+2
llvm-svn: 179806
2013-04-18Reject asm output constraints that consist of modifiers only.Benjamin Kramer1-1/+1
Fixes PR15759. llvm-svn: 179756
2013-02-08Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose1-3/+3
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-01-25First pass at abstracting out a class for the target C++ ABI.John McCall1-1/+15
llvm-svn: 173514
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-1/+1
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-11-27Fix the definition of the vfork() builtin on Haiku. PR14378.Eli Friedman1-0/+1
llvm-svn: 168674
2012-10-29Handle '*' and '#' asm constraint modifiers.Ulrich Weigand1-0/+4
llvm-svn: 166924
2012-10-15Teach TargetInfo to hold on to the TargetOptions with which it wasDouglas Gregor1-1/+2
created. llvm-svn: 165943
2012-07-13Add a per target max vector alignment field (e.g., 32-byte alignment for x86 ↵Chad Rosier1-0/+1
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-04-16objective-c modern translator: buildit objc boolFariborz Jahanian1-0/+1
type for rewriter project will be BoolTy. // rdar://11231426. llvm-svn: 154861
2011-12-22Add support for bitcasts to vector type in Evaluate.Eli Friedman1-0/+1
llvm-svn: 147137
2011-12-16Add the value of "suitably aligned" from the C++11 standard to Basic/TargetInfo.Nick Lewycky1-0/+1
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