summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix usage of APInt.getRawData for big-endian systemsUlrich Weigand2016-04-147-310/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Scalar implementation and a few other places in LLDB directly access the internal implementation of APInt values using the getRawData method. Unfortunately, pretty much all of these places do not handle big-endian systems correctly. While on little-endian machines, the pointer returned by getRawData can simply be used as a pointer to the integer value in its natural format, no matter what size, this is not true on big-endian systems: getRawData actually points to an array of type uint64_t, with the first element of the array always containing the least-significant word of the integer. This means that if the bitsize of that integer is smaller than 64, we need to add an offset to the pointer returned by getRawData in order to access the value in its natural type, and if the bitsize is *larger* than 64, we actually have to swap the constituent words before we can access the value in its natural type. This patch fixes every incorrect use of getRawData in the code base. For the most part, this is done by simply removing uses of getRawData in the first place, and using other APInt member functions to operate on the integer data. This can be done in many member functions of Scalar itself, as well as in Symbol/Type.h and in IRInterpreter::Interpret. For the latter, I've had to add a Scalar::MakeUnsigned routine to parallel the existing Scalar::MakeSigned, e.g. in order to implement an unsigned divide. The Scalar::RawUInt, Scalar::RawULong, and Scalar::RawULongLong were already unused and can be simply removed. I've also removed the Scalar::GetRawBits64 function and its few users. The one remaining user of getRawData in Scalar.cpp is GetBytes. I've implemented all the cases described above to correctly implement access to the underlying integer data on big-endian systems. GetData now simply calls GetBytes instead of reimplementing its contents. Finally, two places in the clang interface code were also accessing APInt.getRawData in order to actually construct a byte representation of an integer. I've changed those to make use of a Scalar instead, to avoid having to re-implement the logic there. The patch also adds a couple of unit tests verifying correct operation of the GetBytes routine as well as the conversion routines. Those tests actually exposed more problems in the Scalar code: the SetValueFromData routine didn't work correctly for 128- and 256-bit data types, and the SChar routine should have an explicit "signed char" return type to work correctly on platforms where char defaults to unsigned. Differential Revision: http://reviews.llvm.org/D18981 llvm-svn: 266311
* Make Scalar::GetBytes and RegisterValue::GetBytes constUlrich Weigand2016-04-146-194/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scalar::GetBytes provides a non-const access to the underlying bytes of the scalar value, supposedly allowing for modification of those bytes. However, even with the current implementation, this is not really possible. For floating-point scalars, the pointer returned by GetBytes refers to a temporary copy; modifications to that copy will be simply ignored. For integer scalars, the pointer refers to internal memory of the APInt implementation, which isn't supposed to be directly modifyable; GetBytes simply casts aways the const-ness of the pointer ... With my upcoming patch to fix Scalar::GetBytes for big-endian systems, this problem is going to get worse, since there we need temporary copies even for some integer scalars. Therefore, this patch makes Scalar::GetBytes const, fixing all those problems. As a follow-on change, RegisterValues::GetBytes must be made const as well. This in turn means that the way of initializing a RegisterValue by doing a SetType followed by writing to GetBytes no longer works. Instead, I've changed SetValueFromData to do the equivalent of SetType itself, and then re-implemented SetFromMemoryData to work on top of SetValueFromData. There is still a need for RegisterValue::SetType, since some platform-specific code uses it to reinterpret the contents of an already filled RegisterValue. To make this usage work in all cases (even changing from a type implemented via Scalar to a type implemented as a byte buffer), SetType now simply copies the old contents out, and then reloads the RegisterValue from this data using the new type via SetValueFromData. This in turn means that there is no remaining caller of Scalar::SetType, so it can be removed. The only other follow-on change was in MIPS EmulateInstruction code, where some uses of RegisterValue::GetBytes could be made const trivially. Differential Revision: http://reviews.llvm.org/D18980 llvm-svn: 266310
* Fixes for platforms that default to unsigned charUlrich Weigand2016-04-143-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This fixes several test case failure on s390x caused by the fact that on this platform, the default "char" type is unsigned. - In ClangASTContext::GetBuiltinTypeForEncodingAndBitSize we should return an explicit *signed* char type for encoding eEncodingSint and bit size 8, instead of the default platform char type (which may be unsigned). This fix matches existing code in ClangASTContext::GetIntTypeFromBitSize, and fixes the TestClangASTContext.TestBuiltinTypeForEncodingAndBitSize unit test case. - The test/expression_command/char/TestExprsChar.py test case is known to fail on platforms defaulting to unsigned char (pr23069), and just needs to be xfailed on s390x like on arm. - The test/functionalities/watchpoint/watchpoint_on_vectors/main.c test case defines a vector of "char" and implicitly assumes to be signed. Use an explicit "signed char" instead. Differential Revision: http://reviews.llvm.org/D18979 llvm-svn: 266309
* Support Linux on SystemZ as platformUlrich Weigand2016-04-1447-5/+2882
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for Linux on SystemZ: - A new ArchSpec value of eCore_s390x_generic - A new directory Plugins/ABI/SysV-s390x providing an ABI implementation - Register context support - Native Linux support including watchpoint support - ELF core file support - Misc. support throughout the code base (e.g. breakpoint opcodes) - Test case updates to support the platform This should provide complete support for debugging the SystemZ platform. Not yet supported are optional features like transaction support (zEC12) or SIMD vector support (z13). There is no instruction emulation, since our ABI requires that all code provide correct DWARF CFI at all PC locations in .eh_frame to support unwinding (i.e. -fasynchronous-unwind-tables is on by default). The implementation follows existing platforms in a mostly straightforward manner. A couple of things that are different: - We do not use PTRACE_PEEKUSER / PTRACE_POKEUSER to access single registers, since some registers (access register) reside at offsets in the user area that are multiples of 4, but the PTRACE_PEEKUSER interface only allows accessing aligned 8-byte blocks in the user area. Instead, we use a s390 specific ptrace interface PTRACE_PEEKUSR_AREA / PTRACE_POKEUSR_AREA that allows accessing a whole block of the user area in one go, so in effect allowing to treat parts of the user area as register sets. - SystemZ hardware does not provide any means to implement read watchpoints, only write watchpoints. In fact, we can only support a *single* write watchpoint (but this can span a range of arbitrary size). In LLDB this means we support only a single watchpoint. I've set all test cases that require read watchpoints (or multiple watchpoints) to expected failure on the platform. [ Note that there were two test cases that install a read/write watchpoint even though they nowhere rely on the "read" property. I've changed those to simply use plain write watchpoints. ] Differential Revision: http://reviews.llvm.org/D18978 llvm-svn: 266308
* Add new ABI callback to provide fallback unwind register locationsUlrich Weigand2016-04-144-26/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the UnwindPlan did not identify how to unwind the stack pointer register, LLDB currently assumes it can determine to caller's SP from the current frame's CFA. This is true on most platforms where CFA is by definition equal to the incoming SP at function entry. However, on the s390x target, we instead define the CFA to equal the incoming SP plus an offset of 160 bytes. This is because our ABI defines that the caller has to provide a register save area of size 160 bytes. This area is allocated by the caller, but is considered part of the callee's stack frame, and therefore the CFA is defined as pointing to the top of this area. In order to make this work on s390x, this patch introduces a new ABI callback GetFallbackRegisterLocation that provides platform- specific fallback register locations for unwinding. The existing code to handle SP unwinding as well as volatile registers is moved into the default implementation of that ABI callback, to allow targets where that implementation is incorrect to override it. This patch in itself is a no-op for all existing platforms. But it is a pre-requisite for adding s390x support. Differential Revision: http://reviews.llvm.org/D18977 llvm-svn: 266307
* Return back the zero parameter of aggregate initialization in ↵George Rimar2016-04-141-1/+1
| | | | | | | | | | | OutputSectionFactory::lookup(). That was removed in r266304, but leads to warnings by Clang. Thanks to Rafael Espíndola for pointing on that. Though I think change was legal from point of C++. llvm-svn: 266306
* [sanitizer] remove FreeBSD PS_STRINGS fallbackEd Maste2016-04-141-4/+5
| | | | | | | | | | | | The PS_STRINGS constant can easily be incorrect with mismatched kernel/userland - e.g. when building i386 sanitizers on FreeBSD/amd64 with -m32. The kern.ps_strings sysctl was introduced over 20 years ago as the supported way to fetch the environment and argument string addresses from the kernel, so the fallback is never used. Differential Revision: http://reviews.llvm.org/D19027 llvm-svn: 266305
* Make OutputSectionFactory::lookup() inline. NFC.George Rimar2016-04-141-8/+4
| | | | | | | Also I removed the last zero parameter of aggregate initialization as it is excessive here. llvm-svn: 266304
* Removed excessive line. NFC.George Rimar2016-04-141-2/+1
| | | | llvm-svn: 266303
* Reduce expression to single line. NFC.George Rimar2016-04-141-3/+1
| | | | llvm-svn: 266302
* Summary:Simon Dardis2016-04-1413-49/+73
| | | | | | | | | | Alias 'jic $reg, 0' to 'jrc $reg' and 'jialc $reg, 0' to 'jalrc $reg' like binutils. This patch was previous committed as r266055 as seemed to have caused some spurious test failures. They did not reappear after further local testing. llvm-svn: 266301
* Revert "Make tsan tests more portable (take 2)"Renato Golin2016-04-1451-63/+63
| | | | | | This reverts commit r266294, as it broke some buildbots again. :/ llvm-svn: 266300
* Clang formated file. NFC.George Rimar2016-04-141-10/+9
| | | | llvm-svn: 266299
* Combine code branch into single line. NFC.George Rimar2016-04-141-5/+2
| | | | llvm-svn: 266298
* [sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.Marcin Koscielnicki2016-04-145-0/+89
| | | | | | | | | | | | | | | | | | In short, CVE-2016-2143 will crash the machine if a process uses both >4TB virtual addresses and fork(). ASan, TSan, and MSan will, by necessity, map a sizable chunk of virtual address space, which is much larger than 4TB. Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug is detected. Disable all three by aborting on process initialization if the running kernel version is not known to contain a fix. Unfortunately, there's no reliable way to detect the fix without crashing the kernel. So, we rely on whitelisting - I've included a list of upstream kernel versions that will work. In case someone uses a distribution kernel or applied the fix themselves, an override switch is also included. Differential Revision: http://reviews.llvm.org/D18915 llvm-svn: 266297
* [sanitizer] [SystemZ] Add virtual space size.Marcin Koscielnicki2016-04-142-0/+10
| | | | | | | | | This teaches sanitizer_common about s390 and s390x virtual space size. s390 is unusual in that it has 31-bit virtual space. Differential Revision: http://reviews.llvm.org/D18896 llvm-svn: 266296
* [sanitizer] [SystemZ] Implement internal_mmap.Marcin Koscielnicki2016-04-141-1/+26
| | | | | | | | | | mmap on s390 is quite a special snowflake: since it has too many parameters to pass them in registers, it passes a pointer to a struct with all the parameters instead. Differential Revision: http://reviews.llvm.org/D18889 llvm-svn: 266295
* Make tsan tests more portable (take 2)Renato Golin2016-04-1451-63/+63
| | | | | | | | | Using stderr more uniformily, avoiding potential races when scanning stdout and stderr output. Patch by Maxim Kuvyrkov. llvm-svn: 266294
* [analyzer] Make it possible to query the function name from a CallDescription.Gabor Horvath2016-04-141-0/+3
| | | | llvm-svn: 266293
* [ASTImporter] Implement some expression-related AST node import.Artem Dergachev2016-04-144-59/+995
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce ASTImporter unit test framework. Fix a memory leak introduced in cf8ccff5: an array is allocated in ImportArray and never freed. Support new node kinds: - GCCAsmStmt - AddrLabelExpr - AtomicExpr - CompoundLiteralExpr - CXXBoolLiteralExpr - CXXNullPtrLiteralExpr - CXXThisExpr - DesignatedInitExpr - GNUNullExpr - ImplicitValueInitExpr - InitListExpr - OpaqueValueExpr - PredefinedExpr - ParenListExpr - StmtExpr - VAArgExpr - BinaryConditionalOperator - ConditionalOperator - FloatingLiteral - StringLiteral - InjectedClassNameType - TemplateTypeParmType - LabelDecl Patch by Aleksei Sidorin! Differential Revision: http://reviews.llvm.org/D14286 llvm-svn: 266292
* asan: fix buildDmitry Vyukov2016-04-141-1/+1
| | | | | | | | | | | Some bots failed with: sanitizer_quarantine.h:104:7: error: unused typedef 'assertion_failed__104' [-Werror,-Wunused-local-typedef] COMPILER_CHECK(kPrefetch <= ARRAY_SIZE(b->batch)); Replace COMPILER_CHECK with CHECK. llvm-svn: 266291
* Reapply r258505 after r266254, this time with a comment to make it more sticky.Nico Weber2016-04-141-1/+7
| | | | llvm-svn: 266290
* [Coverage] Update testing methods to support more than two filesIgor Kudrin2016-04-141-11/+58
| | | | | | Differential Revision: http://reviews.llvm.org/D18757 llvm-svn: 266289
* asan: fix out-of-bounds access in quarantineDmitry Vyukov2016-04-141-2/+4
| | | | llvm-svn: 266288
* [MSVC] Fix check for wchar_t type in case of -fno-wcharDmitry Polukhin2016-04-142-1/+23
| | | | | | | | | | | The example below should work identically with and without compiler native wchar_t support. void foo(wchar_t * t = L""); Differential Revision: http://reviews.llvm.org/D19056 llvm-svn: 266287
* FileSpec: make matching separator-agnostic againPavel Labath2016-04-142-6/+22
| | | | | | | | | | | | | | | | | | | | | Summary: In D18689, I removed the call to Normalize() in FileSpec::SetFile, because it no longer seemed needed, and it resolved a quirk in the FileSpec API (spec.GetCString() returnes a path with backslashes, but spec.GetDirectory().GetCString() has forward slashes). This turned out to be a problem because we would consider paths with different separators as different (which led to unresolved breakpoints for instance). Here, I am putting back in the call to Normalize() and adding a unittest for FileSpec::Equal. I am commenting out the GetDirectory unittests until we figure out the what is the expected behaviour here. Reviewers: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D19060 llvm-svn: 266286
* [mips] Remove duplicate tests and add missing prefixes for *-LABEL checks. NFC.Vasileios Kalintiris2016-04-144-419/+119
| | | | | | | | | | | | | | | Summary: The only difference between the removed tests and the pre-existing ones, is the materialization of the zero constant, which shouldn't matter for these cases. Reviewers: dsanders, sdardis Subscribers: dsanders, sdardis, llvm-commits Differential Revision: http://reviews.llvm.org/D18693 llvm-svn: 266285
* [Coverage] Avoid unnecessary copying of std::vectorIgor Kudrin2016-04-141-7/+16
| | | | | | | | Approved by: Justin Bogner <mail@justinbogner.com> Differential Revision: http://reviews.llvm.org/D18756 llvm-svn: 266284
* [tsan] Fix size reporting for OS X zone allocator with 0-sized allocationsKuba Brecka2016-04-142-1/+25
| | | | | | | | The custom zone implementation for OS X must not return 0 (even for 0-sized allocations). Returning 0 indicates that the pointer doesn't belong to the zone. This can break existing applications. The underlaying allocator allocates 1 byte for 0-sized allocations anyway, so returning 1 in this case is okay. Differential Revision: http://reviews.llvm.org/D19100 llvm-svn: 266283
* Revert "Support arbitrary addrspace pointers in masked load/store intrinsics"Adam Nemet2016-04-1412-339/+206
| | | | | | | | This reverts commit r266086. It breaks the LTO build of gcc in SPEC2000. llvm-svn: 266282
* ThinLTO: linkonce compile-time optimization, do not bother when there is ↵Mehdi Amini2016-04-141-0/+4
| | | | | | | only one input file From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266281
* [Clang][AVX512][BUILTIN] Adding support for intrinsics of ↵Michael Zuckerman2016-04-145-0/+827
| | | | | | | | vpmov{d|q}{b|w|d}{128|256|512} instruction set Differential Revision: http://reviews.llvm.org/D19055 llvm-svn: 266280
* [CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NANDavid Majnemer2016-04-1410-74/+151
| | | | | | | | | | | | | | | The behavior of {MIN,MAX}NAN differs from that of {MIN,MAX}NUM when only one of the inputs is NaN: -NUM will return the non-NaN argument while -NAN would return NaN. It is desirable to lower to @llvm.{min,max}num to -NAN if they don't have a native instruction for -NUM. Notably, ARMv7 NEON's vmin has the -NAN semantics. N.B. Of course, it is only safe to do this if the intrinsic call is marked nnan. llvm-svn: 266279
* [Clang][AVX512][Builtin] Adding intrinsics of ↵Michael Zuckerman2016-04-145-0/+832
| | | | | | | | vpmovus{d|q}{b|w|d}{128|256|512} instruction set Differential Revision: http://reviews.llvm.org/D19050 llvm-svn: 266278
* Make sure the LLVMContext outlive the CompilerInstanceMehdi Amini2016-04-141-1/+1
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266277
* Do not use llvm:getGlobalContext() in unittestsMehdi Amini2016-04-141-1/+2
| | | | | | | Currently trying to nuke this API from LLVM. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266276
* Do not use getGlobalContext()... ever.Mehdi Amini2016-04-141-5/+5
| | | | | | | | This code was creating a new type in the global context, regardless of which context the user is sitting in, what can possibly go wrong? From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266275
* Fix Android build after r266267Oleksiy Vyalov2016-04-141-17/+17
| | | | llvm-svn: 266274
* ELF: Do not create copy relocations for references in writable sections.Peter Collingbourne2016-04-144-29/+53
| | | | | | | | | They are unnecessary, as the dynamic loader can apply the original relocations directly. This was also resulting in the creation of copy relocations in PIEs. Differential Revision: http://reviews.llvm.org/D19089 llvm-svn: 266273
* AMDGPU: Implement canonicalizeMatt Arsenault2016-04-149-1/+383
| | | | | | Also add generic DAG node for it. llvm-svn: 266272
* Don't use auto - (try to) appease the Android g++ botEnrico Granata2016-04-141-1/+1
| | | | llvm-svn: 266271
* TargetLowering: Factor out common code for tail call eligibility checking; NFCMatthias Braun2016-04-145-63/+46
| | | | llvm-svn: 266270
* [modules] Store the location of the lexical update record in a decl update asRichard Smith2016-04-142-3/+2
| | | | | | | an offset from the current record rather than as an absolute bit number. This gives a minor .pcm file size reduction. llvm-svn: 266269
* Reorder ASTNodeKind::AllKindInfo to match NodeKindId.Alexander Kornienko2016-04-144-15/+25
| | | | | | | | | | | | | | Summary: AllKindInfo is being indexed by NodeKindId, so the order must match. Extended ASTTypeTraits tests to cover this. Reviewers: sbenza Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19059 llvm-svn: 266268
* Augment the 'language objc class-table dump' command to take a "-v" option, ↵Enrico Granata2016-04-142-8/+159
| | | | | | which makes it print ivar and method information, as well as an optional regex argument which filters out all class names that don't match the regex llvm-svn: 266267
* [modules] Remove CXX_BASE_SPECIFIERS_OFFSETS table. Instead of storing an ID ofRichard Smith2016-04-1410-172/+30
| | | | | | | | a table entry in the corresponding decl, store an offset from the current record to the relevant CXX_BASE_SPECIFIERS record. This results in fewer indirections and a minor .pcm file size reduction. llvm-svn: 266266
* clang-tools-extra/test/clang-tidy/readability-deleted-default.cpp: Add ↵NAKAMURA Takumi2016-04-131-1/+1
| | | | | | -fno-ms-compatibility. llvm-svn: 266265
* ObjC kindof: order the methods in global pool relative to availability.Manman Ren2016-04-133-14/+45
| | | | | | | | | | | | | | r265877 tries to put methods that are deprecated or unavailable to the front of the global pool to emit diagnostics, but it breaks some of our existing codes that depend on choosing a certain method for id lookup. This commit orders the methods with the same declaration with respect to the availability, but do not order methods with different declaration. rdar://25707511 llvm-svn: 266264
* [CodeGen] Avoid ctor/dtor boilerplate with some C++11Reid Kleckner2016-04-133-113/+94
| | | | | | | | | | | | | | Non-owning pointers that cache LLVM types and constants can use 'nullptr' default member initializers so that we don't need to mention them in the constructor initializer list. Owning pointers should use std::unique_ptr so that we don't need to manually delete them in the destructor. They also don't need to be mentioned in the constructor at that point. NFC llvm-svn: 266263
* [CFLAA] Fix up code style a bit. NFC.George Burgess IV2016-04-132-292/+276
| | | | llvm-svn: 266262
OpenPOWER on IntegriCloud