Commit Graph

4850 Commits

Author SHA1 Message Date
Reid Kleckner 9ef63b2836 Option: Propagate flags from groups to options in each group
This should make it easy to set a flag for a whole group of clang driver
options.

llvm-svn: 212865
2014-07-12 00:18:58 +00:00
Alexander Kornienko 56ccdbbd29 Add FileCheck -implicit-check-not option to allow stricter tests without adding too many CHECK-NOTs manually.
Summary:
Add FileCheck -implicit-check-not option which allows specifying a
pattern that should only occur in the input when explicitly matched by a
positive check. This feature allows checking tool diagnostics in a way
clang -verify does it for compiler diagnostics.

The option has been tested on a number of clang-tidy checks, I'll post a link to
the clang-tidy patch to this thread.

Once there's an agreement on the general direction, I can add tests and
documentation.

Reviewers: djasper, bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D4462

llvm-svn: 212810
2014-07-11 12:39:32 +00:00
Jim Grosbach 37b8093a8f Change an assert() to a diagnostic.
llvm-svn: 212637
2014-07-09 18:55:49 +00:00
Nikola Smiljanic 9fa5444888 Use correct memeber when displaying StringMap's size.
llvm-svn: 212588
2014-07-09 05:34:24 +00:00
Tim Northover aeacbb1b54 [testing]: lld generally lives in tools/, so fix llvm-lit.
Otherwise we can't run individual tests directly ("llvm-lit /path/to/test")

llvm-svn: 212461
2014-07-07 15:26:53 +00:00
Rafael Espindola adf21f2a56 Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
2014-07-06 17:43:13 +00:00
Alp Toker a55b95b58a SourceMgr: make valid buffer IDs start from one
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned
representation to enable more idiomatic usage.

Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1
to identify the main file.

llvm-svn: 212398
2014-07-06 10:33:31 +00:00
Saleem Abdulrasool 4e63fc498c TableGen: introduce support for MSBuiltin
Add MSBuiltin which is similar in vein to GCCBuiltin.  This allows for adding
intrinsics for Microsoft compatibility to individual instructions.  This is
needed to permit the creation of ARM specific MSVC extensions.

This is not currently in use, and requires an associated change in clang to
enable use of the intrinsics defined by this new class.  This merely sets the
LLVM portion of the infrastructure in place to permit the use of this
functionality.  A separate set of changes will enable the new intrinsics.

llvm-svn: 212350
2014-07-04 18:42:25 +00:00
Alp Toker e69170a110 Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

llvm-svn: 211814
2014-06-26 22:52:05 +00:00
Alp Toker 614717388c Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

llvm-svn: 211749
2014-06-26 00:00:48 +00:00
Alp Toker 7899d5049b Use SourceMgr::getMemoryBuffer() in a couple of places
Cleanup only.

llvm-svn: 211656
2014-06-25 00:41:15 +00:00
Adam Nemet ee746be91f [Emacs] Use spaces rather than tabs for indentation in tablegen-mode
llvm-svn: 211564
2014-06-24 01:42:29 +00:00
Reid Kleckner 4377656e12 not: Only consider exit code 3 to be a crash with --crash
This fixes Clang's test/Index/comment-xml-schema.c with Cygwin's
xmllint.exe, which uses exit(3) for XML validation failure.

llvm-svn: 211550
2014-06-23 22:54:33 +00:00
Rafael Espindola c5f1a6c66f Delete utils/FileUpdate.
It is unused and it looks like it was never used.

llvm-svn: 211508
2014-06-23 17:58:39 +00:00
David Greene 03b1c3f438 Remove bogus configure check
Configure creates makefiles, so it doesn't make sense to check for
them to see if we can configure.

llvm-svn: 211301
2014-06-19 19:31:11 +00:00
David Greene 6367738990 Add option to keep flavor out of the install directory
Sometimes we want to install things in "standard" locations and the
flavor directories interfere with that.  Add an option to keep them
out of the install path.

llvm-svn: 211300
2014-06-19 19:31:09 +00:00
David Greene 9ccdb1700c Turn of -Werror by default
Don't build with -Werror unless asked to.

llvm-svn: 211299
2014-06-19 19:31:05 +00:00
Alp Toker 0b346e6be7 Remove OwningPtr.h and associated tests
llvm::OwningPtr is superseded by std::unique_ptr.

llvm-svn: 211259
2014-06-19 07:25:18 +00:00
Craig Topper 2a30d7889f Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211141
2014-06-18 05:05:13 +00:00
Hans Wennborg a3d77e7348 lit: simplify population of the actual_inputs array
Add all inputs to the array, except those starting with @, which
are treated as response files and expanded.

llvm-svn: 211119
2014-06-17 18:17:46 +00:00
James Molloy f1653b5260 Move SetTheory from utils/TableGen into lib/TableGen so Clang can use it.
llvm-svn: 211100
2014-06-17 13:10:38 +00:00
Hans Wennborg f9484b24b3 Revert "lit: warn when passed invalid pathname" (r210597)
It was pointed out that this breaks the "virtual test discovery"
mechanism, which allows for narming tests in the test exec root.

Reverting until I can figure out how to fix this.

llvm-svn: 211048
2014-06-16 20:18:41 +00:00
Rafael Espindola efb3822ac5 Remove broken include.
Looks like I got some git merge wrong.

llvm-svn: 210911
2014-06-13 15:21:50 +00:00
Rafael Espindola dbe027a9ed Fix KillTheDoctor after r210725.
We don't map these windows errors to generic ones since errc::timed_out is
not defined on mingw. Just use the raw windows error value.

llvm-svn: 210910
2014-06-13 15:01:11 +00:00
NAKAMURA Takumi a2e405cb35 [Win32] Let utils/not aware of abort(), aka llvm_unreachable(), in msvcrt.
It has exit code as 3. abort(), aka unreachable, may be handled as crash.

FIXME: Could we move this into Win32/Program.inc?
llvm-svn: 210895
2014-06-13 12:23:56 +00:00
Rafael Espindola c049c6574b Remove the last uses of 'using std::error_code'
This finishes the transition to std::error_code.

llvm-svn: 210877
2014-06-13 03:20:08 +00:00
Rafael Espindola 96f6ef2575 Fix the build of KillTheDoctor.
llvm-svn: 210843
2014-06-12 22:16:55 +00:00
Rafael Espindola 3acea39853 Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Rafael Espindola a6e9c3e43a Remove system_error.h.
This is a minimal change to remove the header. I will remove the occurrences
of "using std::error_code" in a followup patch.

llvm-svn: 210803
2014-06-12 17:38:55 +00:00
Rafael Espindola 5c4f829424 Use std::error_code instead of llvm::error_code.
The idea of this patch is to turn llvm/Support/system_error.h into a
transitional header that just brings in the erorr_code api to the llvm
namespace. I will remove it shortly afterwards.

The cases where the general idea needed some tweaking:

* std::errc is a namespace in msvc, so we cannot use "using std::errc". I could
add an #ifdef, but there were not that many uses, so I just added std:: to
them in this patch.

* Template specialization had to be moved to the std namespace in this
patch set already.

* The msvc implementation of default_error_condition doesn't seem to
provide the same transformations as we need. Not too surprising since
the standard doesn't actually say what "equivalent" means. I fixed the
problem by keeping our old mapping and using it at error_code
construction time.

Despite these shortcomings I think this is still a good thing. Some reasons:

* The different implementations of system_error might improve over time.
* It removes 925 lines of code from llvm already.
* It removes 6313 bytes from the text segment of the clang binary when
it is built with gcc and 2816 bytes when building with clang and
libstdc++.

llvm-svn: 210687
2014-06-11 19:05:50 +00:00
Rafael Espindola a813d608a9 Remove windows_error.
MSVC doesn't seem to provide any is_error_code_enum enumeration for the
windows errors.

Fortunately very few places in llvm have to handle raw windows errors, so
we can just construct the corresponding error_code directly.

llvm-svn: 210631
2014-06-11 03:58:34 +00:00
Hans Wennborg a55d30a223 lit: warn when passed invalid pathname
It would previously say things like

  warning: input 'test/Frontend/foo.c' contained no tests

and have the user pull their hair trying to figure out what's wrong with that
file. This patch changes the message to the much clearer:

  warning: no such file or directory: 'test/Frontend/foo.c'

Differential Revision: http://reviews.llvm.org/D4097

llvm-svn: 210597
2014-06-10 22:51:58 +00:00
Alexander Potapenko 14f8ac04e3 Add detection of OS X relocatable SDK to compiler-rt as a lit.util function
Clang's lit cfg already detects the currently selected SDK via
"xcrun --show-sdk-path". The same thing should be done for compiler-rt tests,
to make them work on recent OS X versions. Instead of duplicating the detection
code, this patch extracts the detection function into a lit.util method.

Patch by Kuba Brecka (kuba.brecka@gmail.com),
reviewed at http://reviews.llvm.org/D4072

llvm-svn: 210534
2014-06-10 14:22:00 +00:00
Artyom Skrobov 6c8682e2e9 Condition codes AL and NV are invalid in the aliases that use
inverted condition codes (CINC, CINV, CNEG, CSET, and CSETM).

Matching aliases based on "immediate classes", when disassembling,
wasn't previously supported, hence adding MCOperandPredicate
into class Operand, and implementing the support for it
in AsmWriterEmitter.

The parsing for those aliases was already custom, so just adding
the missing condition into AArch64AsmParser::parseCondCode.

llvm-svn: 210528
2014-06-10 13:11:35 +00:00
Artyom Skrobov af3c20f83a Refactoring in AsmWriterEmitter::EmitPrintAliasInstruction()
llvm-svn: 210527
2014-06-10 12:47:23 +00:00
Craig Topper 66f09ad041 [C++11] Use 'nullptr'.
llvm-svn: 210442
2014-06-08 22:29:17 +00:00
David Blaikie 960ea3f018 AsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperand
I saw at least a memory leak or two from inspection (on probably
untested error paths) and r206991, which was the original inspiration
for this change.

I ran this idea by Jim Grosbach a few weeks ago & he was OK with it.
Since it's a basically mechanical patch that seemed sufficient - usual
post-commit review, revert, etc, as needed.

llvm-svn: 210427
2014-06-08 16:18:35 +00:00
Rafael Espindola e9ffe3aeb9 really fix the windows build.
llvm-svn: 209964
2014-05-31 03:40:00 +00:00
Justin Bogner dc30fbf7b6 utils: Teach lldbDataFormatters to load automatically
Add an __lldb_init_module function so that importing the
lldbDataFormatters script automatically adds the formatters.

llvm-svn: 209712
2014-05-28 05:45:17 +00:00
Aaron Ballman 3892013a8a Teach the table generated emitPseudoExpansionLowering function to not emit a switch statement containing only a default statement (and no cases). Updated some of the code to use range-based for loops as well. No functional changes.
llvm-svn: 209521
2014-05-23 15:33:39 +00:00
Tim Northover c350acfda5 ARM64: separate load/store operands to simplify assembler
This changes ARM64 to use separate operands for each component of an
address, and look for separate '[', '$Rn, ..., ']' tokens when
parsing.

This allows us to do away with quite a bit of special C++ code to
handle monolithic "addressing modes" in the MC components. The more
incremental matching of the assembler operands also allows for better
diagnostics when LLVM is presented with invalid input.

Most of the complexity here is with the register-offset instructions,
which were extremely dodgy beforehand: even when the instruction used
wM, LLVM's model had xM as an operand. We papered over this
discrepancy before, but that approach doesn't work now so I split them
into separate X and W variants.

llvm-svn: 209425
2014-05-22 11:56:09 +00:00
Daniel Sanders 3ea9274c87 [asm matcher] Fix incorrect assertion when there are exactly 32 SubtargetFeatures
Summary:
The minimal type needs to hold a value of '1ULL << 31' but
getMinimalTypeForRange() is called with a value of '1ULL << 32'.

This patch will also reduce the size of the matcher table when there are 8
or 16 SubtargetFeatures.

Also added a dump of the SubtargetFeatures to the -debug output and corrected getMinimalTypeInRange() to consider 0xffffffffull to be a 32-bit value.

The testcase is that no existing code is broken and that LLVM still successfully
compiles after adding MIPS64r6 CodeGen support.

Reviewers: rafael

Reviewed By: rafael

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D3787

llvm-svn: 209288
2014-05-21 10:11:24 +00:00
Richard Smith 56f9c191e1 [modules] Add module maps for LLVM. These are not quite ready for prime-time
yet, but only a few more Clang patches need to land. (I have 'ninja check'
passing locally.)

llvm-svn: 209269
2014-05-21 02:46:14 +00:00
Eric Christopher 650c8f2a06 Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209216
2014-05-20 17:11:11 +00:00
Tim Northover c807a17a9b TableGen: permit non-leaf ComplexPattern uses
This allows the results of a ComplexPattern check to be distributed to separate
named Operands, instead of the current system where all results must apply (and
match perfectly) with a single Operand.

For example, if "some_addrmode" is a ComplexPattern producing two results, you
can write:

   def : Pat<(load (some_addrmode GPR64:$base, imm:$offset)),
             (INST GPR64:$base, imm:$offset)>;

This should allow neater instruction definitions in TableGen that don't put all
possible aspects of addressing into a single operand, but are still usable with
relatively simple C++ CodeGen idioms.

llvm-svn: 209206
2014-05-20 11:52:46 +00:00
Tim Northover 9a24f88a37 TableGen: convert InstAlias's Emit bit to an int.
When multiple aliases overlap, the correct string to print can often be
determined purely by considering the InstAlias declarations in some particular
order. This allows the user to specify that order manually when desired,
without resorting to hacking around with the default lexicographical order on
Record instantiation, which is error-prone and ugly.

I was also mistaken about "add w2, w3, w4" being the same as "add w2, w3, w4,
uxtw". That's only true if Rn is the stack pointer.

llvm-svn: 209199
2014-05-20 09:17:16 +00:00
Eric Christopher 710c0ae7de Fix typos.
llvm-svn: 209164
2014-05-19 21:18:47 +00:00
Tim Northover 5896b066e6 TableGen: fix operand counting for aliases
TableGen has a fairly dubious heuristic to decide whether an alias should be
printed: does the alias have lest operands than the real instruction. This is
bad enough (particularly with no way to override it), but it should at least be
calculated consistently for both strings.

This patch implements that logic: first get the *correct* string for the
variant, in the same way as the Matcher, without guessing; then count the
number of whitespace chars.

There are basically 4 changes this brings about after the previous
commits; all of these appear to be good, so I have changed the tests:

+ ARM64: we print "neg X, Y" instead of "sub X, xzr, Y".
+ ARM64: we skip implicit "uxtx" and "uxtw" modifiers.
+ Sparc: we print "mov A, B" instead of "or %g0, A, B".
+ Sparc: we print "fcmpX A, B" instead of "fcmpX %fcc0, A, B"

llvm-svn: 208969
2014-05-16 09:42:04 +00:00
Tim Northover 60091cfeb9 TableGen: use correct MIOperand when printing aliases
Previously, TableGen assumed that every aliased operand consumed precisely 1
MachineInstr slot (this was reasonable because until a couple of days ago,
nothing more complicated was eligible for printing).

This allows a couple more ARM64 aliases to print so we can remove the special
code.

On the X86 side, I've gone for explicit AT&T size specifiers as the default, so
turned off a few of the aliases that would have just started printing.

llvm-svn: 208880
2014-05-15 13:36:01 +00:00
Tim Northover d8d65a69cf TableGen/ARM64: print aliases even if they have syntax variants.
To get at least one use of the change (and some actual tests) in with its
commit, I've enabled the AArch64 & ARM64 NEON mov aliases.

llvm-svn: 208867
2014-05-15 11:16:32 +00:00