Commit Graph

4386 Commits

Author SHA1 Message Date
Tom Stellard
57e6b2d1f3 SimplifyCFG: Use parallel-and and parallel-or mode to consolidate branch conditions
Merge consecutive if-regions if they contain identical statements.
Both transformations reduce number of branches.  The transformation
is guarded by a target-hook, and is currently enabled only for +R600,
but the correctness has been tested on X86 target using a variety of
CPU benchmarks.

Patch by: Mei Ye

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187278 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-27 00:01:07 +00:00
Rafael Espindola
6fccaafd8b Remove the mblaze backend from llvm.
Approval in here http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/064169.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187145 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-25 18:55:05 +00:00
Bill Wendling
f245ae5a4a Replace the "NoFramePointerElimNonLeaf" target option with a function attribute.
There's no need to specify a flag to omit frame pointer elimination on non-leaf
nodes...(Honestly, I can't parse that option out.) Use the function attribute
stuff instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187093 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-25 00:34:29 +00:00
Rafael Espindola
70c7e48545 Split getOpenFile into getOpenFile and getOpenFileSlice.
The main observation is that we never need both the filesize and the map size.
When mapping a slice of a file, it doesn't make sense to request a null
terminator and that would be the only case where the filesize would be used.

There are other cleanups that should be done in this area:

* A client should not have to pass the size (even an explicit -1) to say if
  it wants a null terminator or not, so we should probably swap the argument
  order.
* The default should be to not require a null terminator. Very few clients
  require this, but many end up asking for it just because it is the default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 20:25:01 +00:00
Rafael Espindola
963cf75e1c Fix use of the getOpenFile api.
The gold plugin was passing the desired map size as the file size. This was
working for two reasons:
* Recent version of gold provide the get_view callback, so this code was not
  used.
* In older versions, getOpenFile was called, but the file size is never used
  if we don't require null terminated buffers and map size defaults to the
  file size.

Thanks to Eli Bendersky for noticing this.

I will try to make this api a bit less error prone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 18:44:31 +00:00
Rafael Espindola
af02bf4a58 Fix the build in c++03 mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186935 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 11:02:16 +00:00
Rafael Espindola
26b10da9c2 Add an initial implementation of archive symbol table generation.
The symbol table has forward references in the file. Instead of allocating
a temporary buffer or counting the size and then writing, this implementation
writes a dummy value first and patches it once the final value is known.

There is room for performance improvement. I will implement them as soon as I
get some other features (like a ranlib mode) in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186934 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 10:47:01 +00:00
Shuxin Yang
c679d6b461 remove unnecessary space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186931 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 06:44:34 +00:00
Bill Wendling
0dcba2fadb Recommit r186217 with testcase fix:
Use the function attributes to pass along the stack protector buffer size.

 Now that we have robust function attributes, don't use a command line option to
 specify the stack protecto buffer size.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186863 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 20:15:21 +00:00
Shuxin Yang
8945f753ed Initialize/Register LTO passes to enable flags like -print-after=<lto-pass>
There already have two "dead" functions, initialize{IPO|IPA}, defined for 
similar purpose. I decide not to call these two functions for two reasons:
  o. they don't cover all LTO passes (which will soon be separated into IPO 
     and post-IPO passes)
  o. We have not yet figured out the right passes and the ordering for IPO 
     and post-IPO stages, meaning this change is only for the time being.

Since LTO passes are registered, we are now able to print IR before and 
after particular point.

For OSX users:
--------------
  "...-Wl,-mllvm -Wl,-print-after=<pass-name>" will print IR after the
  specified pass.

For Other UNIX with GNU gold linker:
------------------------------------
  "-Wl,-plugin-opt=-print-after=<pass-name>" should work.
  (NOTE: no need for "-Wl,-mllvm")

  Strip "-Wl," if flags are fed directly to linker instead of clang/clang++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186853 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 18:40:34 +00:00
Rafael Espindola
51392a079e Replace archive members in the old position.
This matches gnu archive behavior and since archive member order can change
which member is used, not changing the order on replacement looks like the
right thing to do.

This patch also refactors the logic for which archive member to keep and
whether to move it to a helper function (computeInsertAction). The
nesting in computeNewArchiveMembers was getting a bit confusing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186829 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 15:11:51 +00:00
Rafael Espindola
02a1364bf8 Handle replacement into a position past the original member.
We were incorrectly computing where to insert a member if it was replacing
a previous member that was before the insert point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186792 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-21 12:58:07 +00:00
Rui Ueyama
2f6c0484d6 Retry submitting r186623: COFFDumper: Dump data directory entries.
The original change was rolled back in r186627 because of test
failures on the big endian machine. I believe I fixed the issue
so re-submitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186734 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 23:23:29 +00:00
Rafael Espindola
b55dcfe47f Fix inserting new elements in a specified location.
We were only handling the 'a' and 'b' options during moves before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186721 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 21:23:28 +00:00
Tim Northover
38c6ff6c11 Improve llvm-mc disassembler mode and refactor ARM tests to use it
This allows "llvm-mc -disassemble" to accept two new features:
  + Using comma as a byte separator
  + Grouping bytes with '[' and ']' pairs.

The behaviour outside a [...] group is unchanged. But within the group once
llvm-mc encounters a true error, it stops rather than trying to resynchronise
the stream at the next byte. This is more useful for disassembly tests, where
we have an almost-instruction in mind and don't care what the misaligned
interpretation would be. Particularly if it means llvm-mc won't actually see
the next intended almost-instruction.

As a side effect, this means llvm-mc can disassemble its own -show-encoding
output if copy-pasted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186661 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 10:05:04 +00:00
Rui Ueyama
9d1359453f Revert "COFFDumper: Dump data directory entries."
Because it broke s390x and ppc64-linux buildbots. This reverts commit r186623.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 23:15:50 +00:00
Rui Ueyama
06bd2061fc COFFDumper: Dump data directory entries.
Summary:
Dump optional data directory entries in the PE/COFF header, so that
we can test the output of LLD linker. This patch updates the test binary
file, but the source of the binary is the same. I just re-linked the file.
I don't know how the previous file was linked, but the previous file did
not have any data directory entries for some reason.

Reviewers: rafael

CC: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 22:44:20 +00:00
NAKAMURA Takumi
946dbd83df llvm-ar: doExtract(): Write extracted files with F_Binary. It should fix llvm/test/Object/extract.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186503 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 12:31:50 +00:00
NAKAMURA Takumi
1e65bf2628 LLVMSymbolize.cpp: Fix build. Triple::ArchType is not a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186494 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 06:53:51 +00:00
Alexey Samsonov
df959c70c9 llvm-symbolizer: be more careful with colons in file names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186493 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 06:45:36 +00:00
Rafael Espindola
c1b49b56d4 Add a wrapper for open.
This centralizes the handling of O_BINARY and opens the way for hiding more
differences (like how open behaves with directories).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 19:44:17 +00:00
Rafael Espindola
95779b65cf On error, close the temporary file descriptor.
With this change llvm-ar can remove the temporary file on windows too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186423 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 16:00:32 +00:00
Rafael Espindola
bd6cb260b9 Use open+fstat instead of stat+open.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186381 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 03:34:31 +00:00
Rafael Espindola
289e241d77 Remember that we have a null terminated string.
This is a micro optimization. Instead of going char*->StringRef->Twine->char*,
go char*->Twine->char* and avoid having to copy the filename on the stack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186380 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 03:30:10 +00:00
Rafael Espindola
718af78920 Try to open the file before use data from stat.
Looks like on mingw we get bogus last modification times on directories.
Should fix the mingw bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186240 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 05:07:22 +00:00
Rafael Espindola
ee795f35f7 Remove unused file. Thanks to Sean Silva for noticing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 04:24:33 +00:00
Rafael Espindola
c951651894 Add r186216 back, but make the test tolerant of different uids and gids.
original message:
Fix a off by one error about which members need to use the string table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186238 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 04:14:13 +00:00
Chandler Carruth
12c74dc2c2 Revert commit r186217 -- this is breaking bots:
http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/4328

Original commit log:
  Use the function attributes to pass along the stack protector buffer
  size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186234 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 01:00:17 +00:00
Chandler Carruth
1dedabdfad Revert commit r186216 -- it's breaking bots:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/6897/steps/check-all/logs/LLVM%3A%3Aarchive-format.test

Original commit log:
  Fix a off by one error about which members need to use the string
  table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186232 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 00:42:56 +00:00
Bill Wendling
8a50013cc2 Use the function attributes to pass along the stack protector buffer size.
Now that we have robust function attributes, don't use a command line option to
specify the stack protecto buffer size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 22:25:20 +00:00
Rafael Espindola
6383ef98fa Fix a off by one error about which members need to use the string table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 22:22:34 +00:00
Rafael Espindola
f745d95347 fix autoconf build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 20:45:01 +00:00
Rafael Espindola
33ccfb2d26 Fix the build with c++03.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186198 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 20:28:02 +00:00
Rafael Espindola
34ac52d937 Change llvm-ar to use lib/Object.
This fixes two bugs is lib/Object that the use in llvm-ar found:
* In OS X created archives, the name can be padded with nulls. Strip them.
* In the constructor, remember the first non special member and use that in
  begin_children. This makes sure we skip all special members, not just the
  first one.

The change to llvm-ar itself consist of
* Using lib/Object for reading archives instead of ArchiveReader.cpp.
* Writing the modified archive directly, instead of creating an in memory
  representation.

The old Archive library was way more general than what is needed, as can
be seen by the diffstat of this patch.

Having llvm-ar using lib/Object now opens the way for creating regular symbol
tables for both native objects and bitcode files so that we can use those
archives for LTO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186197 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 20:21:39 +00:00
Rafael Espindola
2494dfcf17 Add static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186170 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-12 16:29:27 +00:00
Benjamin Kramer
7172b38af7 llvm-ar: Clean up memory management with OwningPtr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186131 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 23:15:05 +00:00
Rafael Espindola
4d5b0da81b Use %llu to print a 64 bit number. Should fix the ARM bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186113 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 20:01:30 +00:00
Rafael Espindola
1b3e3eef1f InsertBefore is the same as AddBefore. Delete it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186094 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 15:54:53 +00:00
Rafael Espindola
71857ccdb8 Fix a FIXME about the format and add a test.
While at it, use strftime on Unix too and use the thread safe versions
of localtime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186090 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 15:35:23 +00:00
Rafael Espindola
1b0dc64919 Remove the 'N' modifier from llvm-ar.
* It is not present on OS X.
* It is untested.
* It is not needed for using ar in a build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 13:03:27 +00:00
Rafael Espindola
55804a089e Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186079 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:54:11 +00:00
Rafael Espindola
ab7348f8b1 Remove support for truncating names in archives.
* All systems we support have some form of long name support.
* The options has different names and semantics in different implementations
  ('f' on gnu, 'T' on OS X), which makes it unlikely it is normally used on
  build systems.
* It was completely untested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186078 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:38:02 +00:00
Rafael Espindola
4f2779b809 Sync llvm-ar's help string with the options it supports.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186076 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 12:28:36 +00:00
Rafael Espindola
5159718095 Don't crash in 'llvm -s' when an archive has no symtab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186029 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-10 20:14:22 +00:00
Bill Wendling
c6fbaa9701 Don't run internalize if we're outputing bit-code and not an object file.
The problem with running internalize before we're ready to output an object file
is that it may change a 'weak' symbol into an internal one, but that symbol
could be needed by an external object file --- e.g. with arclite.

<rdar://problem/14334895>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185882 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 23:23:03 +00:00
Rafael Espindola
35637fc623 Create files with the correct permission instead of changing it afterwards.
No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185832 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 16:16:51 +00:00
Manuel Klimek
a012a66688 Fixes problem when calling llvm-ar from an unmodifiable directory.
This fixes a regression introduced by r185726: the new call to get
a unique file does not prepend the system temporary directory, so
we need to anchor on the file that the temporary file gets moved
to to ensure we're on the same file system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185825 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 14:44:57 +00:00
Benjamin Kramer
0bb8aa29d8 COFFDumper: Print uint64_t with the right format string.
I wish we could typecheck llvm::format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185766 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-06 20:01:46 +00:00
Michael Gottesman
2be430d251 [llvm-ar] Added llvm_unreachable to quiet -Wreturn-type warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185751 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-06 02:39:51 +00:00
Rafael Espindola
200c748a86 Add a createUniqueFile function and switch llvm's users of unique_file.
This function is complementary to createTemporaryFile. It handles the case were
the unique file is *not* temporary: we will rename it in the end. Since we
will rename it, the file has to be in the same filesystem as the final
destination and we don't prepend the system temporary directory.

This has a small semantic difference from unique_file: the default mode is 0666.
This matches the behavior of most unix tools. For example, with this change
lld now produces files with the same permissions as ld. I will add a test
of this change when I port clang over to createUniqueFile (next commit).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 21:01:08 +00:00