Commit Graph

4661 Commits

Author SHA1 Message Date
Simon Atanasyan 728d21600c [Mips] Add support for DT_MIPS_RLD_MAP and DT_MIPS_PLTGOT dynamic
section tags to the llvm-readobj.

llvm-svn: 198561
2014-01-05 13:40:27 +00:00
Nico Weber 62588e1a86 Port r198087 and r198089 (strip dead code by default) from make to cmake.
llvm-svn: 198198
2013-12-30 03:36:05 +00:00
Nico Weber 1226531099 Set LLVM_EXPORTED_SYMBOL_FILE in CMakeLists whose corresponding Makefiles do so.
(unittests/ExecutionEngine/JIT/CMakeLists.txt is still missing for now, since
it handles export files in a strange way: It generates a .exports file from a
.def file instead of the other way round.)

llvm-svn: 198183
2013-12-29 23:06:49 +00:00
Nico Weber c27118ddb6 EXPORTED_SYMBOL_FILE support for cmake
The cmake build didn't support EXPORTED_SYMBOL_FILE. Instead, it had a
Windows-only implementation in tools/lto/CMakeLists.txt, a linux-only
implementation in tools/gold/CMakeLists.txt, and a darwin-only implementation
in tools/clang/tools/libclang/CMakeLists.txt.

This attempts to consolidate these one-offs into a single place. Clients can now
just set LLVM_EXPORTED_SYMBOL_FILE and things (hopefully) Just Work, like in
the make build.

llvm-svn: 198136
2013-12-28 23:31:44 +00:00
Nico Weber 47ba8fa7ec Strip dead code when linking by default with BFD ld (linux, ...) and ld64 (os x).
This reduces the size of clang-format from 22 MB to 1.8 MB, diagtool goes from
21 MB to 2.8 MB, libclang.so goes from 29 MB to 20 MB, etc.  The size of the
bin/ folder shrinks from 270 MB to 200 MB.

Targets that support plugins and don't already use EXPORTED_SYMBOL_FILE
(which libclang and libLTO already do) can set NO_DEAD_STRIP to opt out.

llvm-svn: 198087
2013-12-27 22:38:59 +00:00
NAKAMURA Takumi 2e299d1cae gold-plugin.cpp: Use form of <plugin-api.h>, since it is external header.
llvm-svn: 197997
2013-12-25 02:24:38 +00:00
NAKAMURA Takumi 800eb08cfa llvm-config: Fix typo in help message introduced with r197664.
Thanks, Vinson Lee!

llvm-svn: 197996
2013-12-25 02:24:32 +00:00
Alexey Samsonov 60e59e29f8 llvm-symbolizer: add --obj flag to specify a single object file that should be symbolized.
llvm-svn: 197988
2013-12-24 19:33:22 +00:00
NAKAMURA Takumi 46c1903938 llvm-config: Show OBJROOT rather than OBJROOT/BUILD_MODE in MakefileStyle.
llvm-svn: 197818
2013-12-20 17:35:52 +00:00
NAKAMURA Takumi 5a600a972e llvm-config: Use build_mode instead of LLVM_BUILDMODE. It should be equivalent in MakefileStyle.
llvm-svn: 197817
2013-12-20 17:35:46 +00:00
NAKAMURA Takumi 93a146269d llvm-config: Don't show build tree with --obj-root for installed llvm-config. Show $(prefix) instead.
llvm-svn: 197684
2013-12-19 16:02:28 +00:00
NAKAMURA Takumi 429a222707 llvm-config: Show build root instead of parent path in build tree with --obj-root for CMake multiconfig.
llvm-svn: 197683
2013-12-19 16:02:23 +00:00
Timur Iskhodzhanov 48703be503 Teach the llvm-readobj COFF dumper to dump debug line tables from object files
Reviewed at http://llvm-reviews.chandlerc.com/D2425

llvm-svn: 197674
2013-12-19 11:37:14 +00:00
NAKAMURA Takumi f8c58c8dc8 llvm-config: Introduce --system-libs to print SYSTEM_LIBS, and deprecate SYSTEM_LIBS in --ldflags.
Although --system-libs is expected to use after --libs, it can be used alone.

  $ bin/llvm-config --ldflags
  -L/path/to/llvm/objroot/lib

  $ bin/llvm-config --libs object
  -lLLVMObject -lLLVMSupport

  $ bin/llvm-config --system-libs
    (Blank line. "all" is assumed but nothing is printed.)
  -lrt -ldl -ltinfo -lpthread -lz

  $ bin/llvm-config --ldflags --libs --system-libs object
  -L/path/to/llvm/objroot/lib
  -lLLVMObject -lLLVMSupport
  -lrt -ldl -ltinfo -lpthread -lz

It is reimplementation of r197380, and workaround for PR3347 and PR8449.

FIXME: Each LLVM component may have its dependent system libs.
llvm-svn: 197664
2013-12-19 08:46:36 +00:00
Yuchen Wu bb6a477131 llvm-cov: Added -f option for function summaries.
Similar to the file summaries, the function summaries output line,
branching and call statistics. The file summaries have been moved
outside the initial loop so that all of the function summaries can be
outputted before file summaries.

Also updated test cases.

llvm-svn: 197633
2013-12-19 00:29:25 +00:00
Yuchen Wu 73dc38187b llvm-cov: Added -c option for branch counts.
This will cause llvm-cov to output branch counts instead of branch
probabilities. -b must be enabled.

Also updated tests.

llvm-svn: 197594
2013-12-18 18:40:15 +00:00
NAKAMURA Takumi 4b0ffe7e49 Revert r197380, "llvm-config: Print SYSTEM_LIBS with --libs, instead of --ldflags."
I will introduce another flag, like --system-libs, later.

llvm-svn: 197583
2013-12-18 16:21:16 +00:00
NAKAMURA Takumi 7b789b3b3a llvm-config: Let directories aware of CMAKE_CFG_INTDIR.
With llvm-config.exe --bindir --libdir --build-mode, on Visual Studio 2010,

In build tree:
  (OBJ_ROOT)/bin/MinSizeRel
  (OBJ_ROOT)/lib/MinSizeRel
  MinSizeRel

In installed tree:
  (INSTALL_PREFIX)/bin
  (INSTALL_PREFIX)/lib
  MinSizeRel

This is enhancements since r196283.

llvm-svn: 197467
2013-12-17 05:48:37 +00:00
Yuchen Wu 66d93b82ac llvm-cov: Added -u option for unconditional branch info.
Outputs branch information for unconditional branches in addition to
conditional branches. -b option must be enabled.

Also updated tests.

llvm-svn: 197432
2013-12-16 22:14:02 +00:00
NAKAMURA Takumi e73df85038 [CMake] Introduce LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR to reduce references to CMAKE_CFG_INTDIR.
Each of them forms like;
  ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}
  ${CMAKE_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}

llvm-svn: 197394
2013-12-16 16:03:08 +00:00
NAKAMURA Takumi c062b23ec2 llvm-config: Fixup r197380, tweak for cross compilation. SYSTEM_LIBS should be --host's in BuildTools/llvm-config.
FIXME: Host's llvm-config is not generated. It's for target's.
Host tools, aka "BuildTools", in utils, do not require llvm-config to build.

For example with --host=i686-pc-mingw32 --build=linux,

  $ BuildTools/Release+Asserts/bin/llvm-config --libs support
  -lLLVMSupport
  -lpthread -lshell32 -lpsapi -limagehlp -lm

llvm-svn: 197382
2013-12-16 13:09:06 +00:00
NAKAMURA Takumi ce142e080b llvm-config: Print SYSTEM_LIBS with --libs, instead of --ldflags.
LLVM libs are printed in the first line, and system libs are printed in the next line.

  $ bin/llvm-config --libs object
  -lLLVMObject -lLLVMSupport
  -lrt -ldl -ltinfo -lpthread -lz

It is workaround for PR3347 and PR8449.

llvm-svn: 197380
2013-12-16 11:22:22 +00:00
Yuchen Wu 342714c11c llvm-cov: Added -b option for branch probabilities.
This option tells llvm-cov to print out branch probabilities when
a basic block contains multiple branches. It also prints out some
function summary info including the number of times the function enters,
the percent of time it returns, and how many blocks were executed.

Also updated tests.

llvm-svn: 197198
2013-12-13 01:15:07 +00:00
Matt Arsenault 0f5f015bfd Fix gcc warnings.
Unused variable and unused typedef in release build.

llvm-svn: 196947
2013-12-10 18:55:37 +00:00
NAKAMURA Takumi 17b23098ee [CMake] Add MCDisassembler to tools/lto. (has been removed since r196908)
lto.exports really exports LLVM-C Disasm stuff.

llvm-svn: 196911
2013-12-10 11:50:34 +00:00
NAKAMURA Takumi b5c4b87690 [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196908
2013-12-10 11:13:32 +00:00
NAKAMURA Takumi 16ff7bd5d2 [CMake] lli/CMakeLists.txt: Move add_subdirectory(ChildTarget) to the front. It depends on nothing described in LLVM_LINK_COMPONENTS.
llvm-svn: 196902
2013-12-10 10:30:08 +00:00
Yuchen Wu 8c6bb5f4d4 llvm-cov: Added -a option for block data.
Similar to gcov, llvm-cov will now print out the block count at the end
of each block. Multiple blocks can end on the same line.

One computational difference is by using -a, llvm-cov will no longer
simply add the block counts together to form a line count. Instead, it
will take the maximum of the block counts on that line. This has a
similar effect to what gcov does, but generates more correct counts in
certain scenarios.

Also updated tests.

llvm-svn: 196856
2013-12-10 01:02:07 +00:00
NAKAMURA Takumi 87e0880606 Whitespace cleanups.
llvm-svn: 196654
2013-12-07 11:21:42 +00:00
Lang Hames 567befd88f Revert r196639 while I investigate a bot failure.
llvm-svn: 196641
2013-12-07 04:25:19 +00:00
Lang Hames a691358078 Add support for archives and object file caching under MCJIT.
Patch by Andy Kaylor, with minor edits to resolve merge conflicts.

llvm-svn: 196639
2013-12-07 03:05:51 +00:00
Yuchen Wu c3e6424722 llvm-cov: Conformed headers.
llvm-svn: 196541
2013-12-05 22:02:29 +00:00
Renato Golin 729a3ae90a Add #pragma vectorize enable/disable to LLVM
The intended behaviour is to force vectorization on the presence
of the flag (either turn on or off), and to continue the behaviour
as expected in its absence. Tests were added to make sure the all
cases are covered in opt. No tests were added in other tools with
the assumption that they should use the PassManagerBuilder in the
same way.

This patch also removes the outdated -late-vectorize flag, which was
on by default and not helping much.

The pragma metadata is being attached to the same place as other loop
metadata, but nothing forbids one from attaching it to a function
(to enable #pragma optimize) or basic blocks (to hint the basic-block
vectorizers), etc. The logic should be the same all around.

Patches to Clang to produce the metadata will be produced after the
initial implementation is agreed upon and committed. Patches to other
vectorizers (such as SLP and BB) will be added once we're happy with
the pass manager changes.

llvm-svn: 196537
2013-12-05 21:20:02 +00:00
Matt Arsenault c44a3ff638 Fix minor GCC warnings.
Unused typedefs and unused variables.

llvm-svn: 196526
2013-12-05 19:37:36 +00:00
Alp Toker f907b891da Correct word hyphenations
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities and contractions in nearby lines.

llvm-svn: 196471
2013-12-05 05:44:44 +00:00
Will Dietz ff1264b51a Export symbols in tools that support loading plugins.
llvm-svn: 196447
2013-12-05 01:01:58 +00:00
Yuchen Wu bec4e90769 llvm-cov: Split GCOVFile's read into GCNO and GCDA.
This splits the file-scope read() function into readGCNO() and
readGCDA(). Also broke file format read into functions that first read
the file type, then check the version.

llvm-svn: 196353
2013-12-04 04:49:23 +00:00
NAKAMURA Takumi 303f0f5abd check-llvm: Ask llvm-config about assertion mode, instead of llc.
Add --assertion-mode to llvm-config. It emits ON or OFF according to NDEBUG.

llvm-svn: 196329
2013-12-03 23:22:25 +00:00
Arnold Schwaighofer 46db725a43 opt: Mirror vectorization presets of clang
clang enables vectorization at optimization levels > 1 and size level < 2. opt
should behave similarily.

Loop vectorization and SLP vectorization can be disabled with the flags
-disable-(loop/slp)-vectorization.

llvm-svn: 196294
2013-12-03 16:33:06 +00:00
NAKAMURA Takumi 1b16e277dc llvm-config: With --build-mode, show ${CMAKE_CFG_INTDIR} on multiconfig builder.
llvm-svn: 196283
2013-12-03 14:35:17 +00:00
Yuchen Wu 26326ad396 llvm-cov: Removed output to STDOUT/specified file.
Instead of asking the user to specify a single file to output coverage
info and defaulting to STDOUT, llvm-cov now creates files for each
source file with a naming system of: <source filename> + ".llcov".

This is what gcov does and although it can clutter the working directory
with numerous coverage files, it will be easier to hook the llvm-cov
output to tools which operate on this assumption (such as lcov).

llvm-svn: 196184
2013-12-03 00:57:11 +00:00
Alp Toker 9e67d594ef Cut the gold plugin README down to size
This file hasn't been updated in years. Remove old information and point to
the current documentation at GoldPlugin.rst.

llvm-svn: 196100
2013-12-02 14:17:47 +00:00
Chandler Carruth 16f56b4c23 [PM] Remove the underspecified 'getRoot' method from CallGraph. It's
only user was an ancient SCC printing bit of the opt tool which really
should be walking the call graph the same way the CGSCC pass manager
does.

llvm-svn: 195800
2013-11-27 01:32:17 +00:00
Chandler Carruth 6378cf539f [PM] Split the CallGraph out from the ModulePass which creates the
CallGraph.

This makes the CallGraph a totally generic analysis object that is the
container for the graph data structure and the primary interface for
querying and manipulating it. The pass logic is separated into its own
class. For compatibility reasons, the pass provides wrapper methods for
most of the methods on CallGraph -- they all just forward.

This will allow the new pass manager infrastructure to provide its own
analysis pass that constructs the same CallGraph object and makes it
available. The idea is that in the new pass manager, the analysis pass's
'run' method returns a concrete analysis 'result'. Here, that result is
a 'CallGraph'. The 'run' method will typically do only minimal work,
deferring much of the work into the implementation of the result object
in order to be lazy about computing things, but when (like DomTree)
there is *some* up-front computation, the analysis does it prior to
handing the result back to the querying pass.

I know some of this is fairly ugly. I'm happy to change it around if
folks can suggest a cleaner interim state, but there is going to be some
amount of unavoidable ugliness during the transition period. The good
thing is that this is very limited and will naturally go away when the
old pass infrastructure goes away. It won't hang around to bother us
later.

Next up is the initial new-PM-style call graph analysis. =]

llvm-svn: 195722
2013-11-26 04:19:30 +00:00
Hans Wennborg a74768a12a VS integration: use the correct registry key after r195379
I changed the registry key in that commit, but forgot to update
the integration files. This change makes them use the same variable.

llvm-svn: 195479
2013-11-22 18:25:43 +00:00
Juergen Ributzka 05c5a93283 [weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous
namespaces to prevent weak vtables. This eliminates the need of providing an
out-of-line definition to pin the vtable explicitly to the file.

llvm-svn: 195092
2013-11-19 03:08:35 +00:00
Juergen Ributzka d12ccbd343 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

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

Reviewed by Andy

llvm-svn: 195064
2013-11-19 00:57:56 +00:00
David Blaikie 3af14421f2 llvm-dwarfdump: support for emitting only the debug_types section using -debug-dump
llvm-svn: 195063
2013-11-19 00:29:42 +00:00
Alexey Samsonov 49109a279c Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.

llvm-svn: 194997
2013-11-18 09:31:53 +00:00
Juergen Ributzka dbedae89b9 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

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

Reviewed by Andy

llvm-svn: 194865
2013-11-15 22:34:48 +00:00
Benjamin Kramer 67421c1087 llvm-cov: Clean up memory leaks.
llvm-svn: 194799
2013-11-15 09:44:17 +00:00
NAKAMURA Takumi bef6171f7d llvm-cov requires IR and Support as libraries. Instrumentation would be overkill.
llvm-svn: 194695
2013-11-14 11:45:16 +00:00
Simon Atanasyan 5c8377f32c Add support for DT_VERxxx and DT_MIPS_xxx .dynamic section entries to the
llvm-readobj.

The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D2113

llvm-svn: 194421
2013-11-11 20:51:48 +00:00
Bob Wilson ed1b2e5d98 Change libLTO back to linking with @executable_path instead of @rpath.
This partially reverts r187641 until ld64 adopts a change to link with an
rpath setting.

llvm-svn: 194418
2013-11-11 20:08:24 +00:00
NAKAMURA Takumi 0d82bac470 llvm-ar: Let opening a directory failed in llvm-ar.
Linux cannot open directories with open(2), although cygwin and *bsd can.

Motivation: The test, Object/directory.ll, had been failing with --target=cygwin on Linux. XFAIL was improper for host issues.
llvm-svn: 194257
2013-11-08 12:35:56 +00:00
Alp Toker 9f67932ee7 Suppress OS crash dialog in llvm-rtdyld
All other tools have this -- it's needed to avoid hanging lit on Windows in
case of a crash.

llvm-svn: 194060
2013-11-05 09:33:43 +00:00
Yuchen Wu e68c5f8242 Revert "llvm-cov: Added command-line option to change dir."
This reverts commit d8acf0078cf363252727acff00f85ae8074f95b3.

llvm-svn: 194040
2013-11-05 01:56:29 +00:00
Yuchen Wu 446e991f44 llvm-cov: Added command-line option to change dir.
This will allow for much easier testing when the input files are in a
different folder from the test script.

llvm-svn: 194034
2013-11-05 01:20:41 +00:00
Jakub Staszak cfcfee0be4 Use startswith_lower() where possible.
llvm-svn: 194007
2013-11-04 19:22:50 +00:00
Rafael Espindola 586af97a30 move getSymbolNMTypeChar to the one program that needs it: nm.
llvm-svn: 193933
2013-11-02 21:16:09 +00:00
Yuchen Wu dbcf19758d Added command-line option to output llvm-cov to file.
Added -o option to llvm-cov. If no output file is specified, it defaults
to STDOUT.

llvm-svn: 193899
2013-11-02 00:09:17 +00:00
Rafael Espindola 282a47037b Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list".
There are two ways one could implement hiding of linkonce_odr symbols in LTO:
* LLVM tells the linker which symbols can be hidden if not used from native
  files.
* The linker tells LLVM which symbols are not used from other object files,
  but will be put in the dso symbol table if present.

GOLD's API is the second option. It was implemented almost 1:1 in llvm by
passing the list down to internalize.

LLVM already had partial support for the first option. It is also very similar
to how ld64 handles hiding these symbols when *not* doing LTO.

This patch then
* removes the APIs for the DSO list.
* marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr
  global values and other linkonce_odr whose address is not used.
* makes the gold plugin responsible for handling the API mismatch.

llvm-svn: 193800
2013-10-31 20:51:58 +00:00
Rafael Espindola aca9739a1a Rules adjustments in order to build on DragonFly BSD.
Patch by Robin Hahling.

llvm-svn: 193750
2013-10-31 14:35:00 +00:00
Yuchen Wu 9194d7b063 Updated llvm-cov's OVERVIEW description
llvm-svn: 193732
2013-10-31 02:01:24 +00:00
Rafael Espindola e804b1a44e Support names like llvm-ar-3.4 and llvm-ranlib-3.4.
They are used in some packages. For example:
http://packages.ubuntu.com/saucy/i386/llvm-3.4/filelist

This fixes pr17721.

llvm-svn: 193612
2013-10-29 14:25:43 +00:00
Andrew Kaylor 8935258b4e Cleaning up comments in lli
llvm-svn: 193571
2013-10-29 01:33:14 +00:00
Andrew Kaylor 1ca510ea67 Adding a workaround for __main linking with remote lli and Cygwin/MinGW
llvm-svn: 193570
2013-10-29 01:29:56 +00:00
Alp Toker 0a09ebf445 Fix the lli --extra-module value_desc
llvm-svn: 193552
2013-10-28 22:51:25 +00:00
Andrew Kaylor 4404eb4857 Standardizing lli's extra module command line option
llvm-svn: 193544
2013-10-28 21:58:15 +00:00
NAKAMURA Takumi 5bb014371e MCJIT-remote: __main should be resolved in child context.
- Mark tests as XFAIL:cygming in test/ExecutionEngine/MCJIT/remote.
    Rather to suppress them, I'd like to leave them running as XFAIL.
  - Revert r193472. RecordMemoryManager no longer resolves __main on cygming.

There are a couple of issues.

  - X86 Codegen emits "call __main" in @main for targeting cygming.
    It is useless in JIT. FYI, tests are passing when emitting __main is disabled.
  - Current remote JIT does not resolve any symbols in child context.

FIXME: __main should be disabled, or remote JIT should resolve __main.
llvm-svn: 193498
2013-10-27 10:22:52 +00:00
NAKAMURA Takumi da469ecbbd lli/RemoteMemoryManager.cpp: Resurrect __main stuff removed in r192504 to unbreak mingw32.
llvm-svn: 193472
2013-10-26 13:52:31 +00:00
Daniel Sanders 1b71f42f7d [bugpoint] Increase the default memory limit for subprocesses to 300MB.
Summary:
Currently shared library builds (BUILD_SHARED_LIBS=ON in cmake) fail three
bugpoint tests (BugPoint/remove_arguments_test.ll,
BugPoint/crash-narrowfunctiontest.ll, and BugPoint/metadata.ll).

If I run the bugpoint commands that llvm-lit runs with without -silence-passes
I see errors such as this:
    opt: error while loading shared libraries: libLLVMSystemZInfo.so: failed to
    map segment from shared object: Cannot allocate memory

It seems that the increased size of the binaries in a shared library build is
causing the subprocess to exceed the 100MB memory limit. This patch therefore
increases the default limit to a level at which these tests pass.

Reviewers: dsanders

Reviewed By: dsanders

CC: llvm-commits, rafael

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

llvm-svn: 193420
2013-10-25 17:41:41 +00:00
Benjamin Kramer 2daaea5db7 llvm-c-test: Don't leak memory buffers.
Detected by valgrind.

llvm-svn: 193416
2013-10-25 15:58:58 +00:00
Reid Kleckner ddac15108a lto.h: Use lto_bool_t instead of int to restore the ABI
This reverts commit r193255 and instead creates an lto_bool_t typedef
that points to bool, _Bool, or unsigned char depending on what is
available.  Only recent versions of MSVC provide a stdbool.h header.

Reviewers: rafael.espindola

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

llvm-svn: 193377
2013-10-24 22:26:04 +00:00
NAKAMURA Takumi 07a6406444 llvm/tools/llvm-c-test should be built also on msvc.
llvm-svn: 193257
2013-10-23 17:56:59 +00:00
NAKAMURA Takumi b13d51c6eb llvm-c/lto.h: Avoid use of bool.
llvm-svn: 193255
2013-10-23 17:56:46 +00:00
NAKAMURA Takumi c49146956e llvm-c-test: Make them C89-compliant.
llvm-svn: 193254
2013-10-23 17:56:37 +00:00
Anders Waldenborg b932c66955 Add llvm-c-test tool for testing llvm-c
This provides rudimentary testing of the llvm-c api.

The following commands are implemented:

  * --module-dump
    Read bytecode from stdin - print ir

  * --module-list-functions
    Read bytecode from stdin - list summary of functions

  * --module-list-globals
    Read bytecode from stdin - list summary of globals

  * --targets-list
    List available targets

  * --object-list-sections
    Read object file from stdin - list sections

  * --object-list-symbols
    Read object file from stdin - list symbols (like nm)

  * --disassemble
    Read lines of triple, hex ascii machine code from stdin - print disassembly

  * --calc
    Read lines of name, rpn from stdin - print generated module ir

Differential-Revision: http://llvm-reviews.chandlerc.com/D1776
llvm-svn: 193233
2013-10-23 08:10:20 +00:00
Bob Wilson 3461bedbfd Change llvm-cov output formatting to be more similar to gcov.
- Replaced tabs with proper padding
- print() takes two arguments, which are the GCNO and GCDA filenames
- Files are listed at the top of output, appended by line 0
- Stripped strings of trailing \0s
- Removed last two lines of whitespace in output

Patch by Yuchen Wu!

llvm-svn: 193148
2013-10-22 05:09:41 +00:00
Bob Wilson 2f19d42f6e Move the printing of llvm-cov information out from collectLineCounts().
collectLineCounts() should only organize the output data. This is done in
anticipation of subsequent changes which will pass in GCNO and GCDA filenames
into the print function where it is printed similar to the gcov output.

Patch by Yuchen Wu!

llvm-svn: 193134
2013-10-22 00:09:03 +00:00
Rafael Espindola d578b69867 Check for errors when calling lto_codegen_add_module in the gold plugin.
Thanks to Milan Lenčo for noticing it.

llvm-svn: 192996
2013-10-18 19:32:06 +00:00
Rafael Espindola 143fc3b6ba [pr17595] Fix a use after free.
Destroying the codegen also frees the path of the created object. Copy the
path to a std::string.

llvm-svn: 192787
2013-10-16 12:47:04 +00:00
Alexey Samsonov 6f943e5fb8 llvm-symbolizer: don't always run demangler on global object names
llvm-svn: 192781
2013-10-16 09:54:49 +00:00
Andrew Kaylor c442a76c60 Adding support for deregistering EH frames with MCJIT.
Patch by Yaron Keren

llvm-svn: 192753
2013-10-16 00:14:21 +00:00
Hans Wennborg 1f39e343ef vs2013 msbuild integration: add missing .target files, fix typo in CMakeLists
This should fix PR17568.

Patch by Josh Samuel!

llvm-svn: 192610
2013-10-14 18:16:37 +00:00
Will Dietz 0b48c738e6 yaml2coff/elf: Touchup for compatibility.
* std::string::append(int, int) can be ambiguous.
* std::vector<>::data() is a C++11 feature, use ArrayRef abstraction.

llvm-svn: 192542
2013-10-12 21:29:16 +00:00
Will Dietz 981af0021b Add missing #include's to cctype when using isdigit/alpha/etc.
llvm-svn: 192519
2013-10-12 00:55:57 +00:00
Andrew Kaylor 6587bcfdbc Fixing problems in lli's RemoteMemoryManager.
This fixes a problem from a previous check-in where a return value was omitted.

Previously the remote/stubs-remote.ll and remote/stubs-sm-pic.ll tests were reporting passes, but they should have been failing.  Those tests attempt to link against an external symbol and remote symbol resolution is not supported.  The old RemoteMemoryManager implementation resulted in local symbols being used for resolution and the child process crashed but the test didn't notice.  With this check-in remote symbol resolution fails, and so the test (correctly) fails.

llvm-svn: 192514
2013-10-11 22:47:10 +00:00
Andrew Kaylor 7bb1344c67 Adding multiple object support to MCJIT EH frame handling
llvm-svn: 192504
2013-10-11 21:25:48 +00:00
Manman Ren c50fa1114b Debug Info: In DIBuilder, the context field of subprogram is updated to use
DIScopeRef.

A paired commit at clang is required due to changes to DIBuilder.

llvm-svn: 192378
2013-10-10 18:40:01 +00:00
Hans Wennborg 4fa1eb0d0d Provide msbuild integration for vs2013.
Patch by Josh Samuel!

llvm-svn: 192371
2013-10-10 17:32:01 +00:00
Hans Wennborg d2aa909462 Fix msbuild integration install script.
We previously failed to check whether the SUCCESS variable was set,
and would thus always exit with a failure if vs2012 didn't exist.

llvm-svn: 192370
2013-10-10 17:31:54 +00:00
Greg Bedwell 1411aeb2a2 Test commit. Remove whitespace from otherwise empty lines.
llvm-svn: 192284
2013-10-09 08:55:27 +00:00
Andrew Kaylor cc7a0ff857 Removing unintended code block from lli
llvm-svn: 192205
2013-10-08 17:15:11 +00:00
Rafael Espindola 3f359430b3 Only modify lto.exports.def when contents have changed.
Patch by Greg Bedwell.

llvm-svn: 192182
2013-10-08 15:07:00 +00:00
NAKAMURA Takumi 6339988787 Revert r191088, corresponding to r191823 to re-enable llvm-lto on cygming.
r191088 is "llvm/tools/Makefile: Suppress building llvm-lto on cygming, for now, probably due to LTO.dll."

llvm-svn: 192104
2013-10-07 15:42:22 +00:00
Simon Atanasyan 39ff5f6702 [Mips] Teach llvm-readobj to print MIPS-specific ELF program headers.
The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D1846

llvm-svn: 192093
2013-10-07 08:58:27 +00:00
Benjamin Kramer c83946f7f5 lli: Plug leaks in the remote target external implementation.
llvm-svn: 192031
2013-10-05 11:53:20 +00:00
Rafael Espindola dc9fe0af85 Fix object file writing in llvm-lto on Windows.
We were writing in text mode.

Patch by Greg Bedwell.

llvm-svn: 191985
2013-10-04 21:40:54 +00:00
Andrew Kaylor 217308086d Attempting to fix lli build error
llvm-svn: 191979
2013-10-04 20:53:49 +00:00
Andrew Kaylor 9723176511 Fixing container/pointer bug in remote-lli found by ASan
llvm-svn: 191976
2013-10-04 20:09:36 +00:00
Benjamin Kramer 3cfafb8ad6 lli: Check pipe creation for errors.
This is unlikely to ever fail, but ubuntu GCC warns when the return value is
unused.

llvm-svn: 191973
2013-10-04 19:10:03 +00:00
Rafael Espindola 1c26db861b Add lto_codegen_add_dso_symbol to the export list.
llvm-svn: 191970
2013-10-04 17:30:14 +00:00
Andrew Kaylor 1b2cfb6495 Adding support and tests for multiple module handling in lli
llvm-svn: 191938
2013-10-04 00:49:38 +00:00
Rafael Espindola cda2911caa Optimize linkonce_odr unnamed_addr functions during LTO.
Generalize the API so we can distinguish symbols that are needed just for a DSO
symbol table from those that are used from some native .o.

The symbols that are only wanted for the dso symbol table can be dropped if
llvm can prove every other dso has a copy (linkonce_odr) and the address is not
important (unnamed_addr).

llvm-svn: 191922
2013-10-03 18:29:09 +00:00
Rafael Espindola fb7a0b8943 Dispose the codegen even when just writing the bitcode file.
This makes it possible to add timers to the code generator and still use them
with -plugin-opt=emit-llvm.

llvm-svn: 191866
2013-10-03 00:07:30 +00:00
Andrew Kaylor c483237f06 Fixing lli-child-target build
llvm-svn: 191861
2013-10-02 22:27:23 +00:00
Benjamin Kramer c12c7d0c93 Add newline at eof.
llvm-svn: 191857
2013-10-02 21:58:02 +00:00
Richard Smith 2f1c87b0fb Pass the resolved lli-child-target executable name to execv, rather than
searching $PATH for it then blindly executing it from $PWD anyway.

llvm-svn: 191856
2013-10-02 21:33:12 +00:00
Andrew Kaylor 74a61ed70d Fix build problems with remote lli implementation
llvm-svn: 191848
2013-10-02 19:26:16 +00:00
Andrew Kaylor c87c347bed Clean up lli execution code
llvm-svn: 191845
2013-10-02 18:04:40 +00:00
Andrew Kaylor 004e12ff7b Fixing compile warnings
llvm-svn: 191844
2013-10-02 18:00:34 +00:00
Andrew Kaylor c2ebf3f517 Adding out-of-process execution support to lli.
At this time only Unix-based systems are supported.  Windows has stubs and should re-route to the simulated mode.

Thanks to Sriram Murali for contributions to this patch.

llvm-svn: 191843
2013-10-02 17:12:36 +00:00
Chandler Carruth ea56494625 Remove the very substantial, largely unmaintained legacy PGO
infrastructure.

This was essentially work toward PGO based on a design that had several
flaws, partially dating from a time when LLVM had a different
architecture, and with an effort to modernize it abandoned without being
completed. Since then, it has bitrotted for several years further. The
result is nearly unusable, and isn't helping any of the modern PGO
efforts. Instead, it is getting in the way, adding confusion about PGO
in LLVM and distracting everyone with maintenance on essentially dead
code. Removing it paves the way for modern efforts around PGO.

Among other effects, this removes the last of the runtime libraries from
LLVM. Those are being developed in the separate 'compiler-rt' project
now, with somewhat different licensing specifically more approriate for
runtimes.

llvm-svn: 191835
2013-10-02 15:42:23 +00:00
Chandler Carruth d8c3e91eeb Tidy up this line of the Makefile before I start hacking on it.
I really should sort it or do something more sustainable, but I couldn't
work up the energy to do it... Sorry.

llvm-svn: 191832
2013-10-02 15:14:13 +00:00
Rafael Espindola efa02d53ff Fix option parsing in the gold plugin.
This was broken when options were moved up in r191680. No test because this is
specific LLVMgold.so/libLTO.so.

Patch by Tom Roeder!

llvm-svn: 191829
2013-10-02 14:36:23 +00:00
Rafael Espindola dafc53dde1 Add a -exported-symbol option to llvm-lto.
Patch by Tom Roeder.

llvm-svn: 191825
2013-10-02 14:12:56 +00:00
Rafael Espindola d38f9af213 Enable building LTO on WIN32.
Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with
MSVC and Mingw as well as re-enabling the associated test.

Patch by Greg Bedwell!

llvm-svn: 191823
2013-10-02 14:04:38 +00:00
Filip Pizlo 7aa695e026 This threads SectionName through the allocateCodeSection/allocateDataSection APIs, both in C++ and C land.
It's useful for the memory managers that are allocating a section to know what the name of the section is.  
At a minimum, this is useful for low-level debugging - it's customary for JITs to be able to tell you what 
memory they allocated, and as part of any such dump, they should be able to tell you some meta-data about 
what each allocation is for.  This allows clients that supply their own memory managers to do this.  
Additionally, we also envision the SectionName being useful for passing meta-data from within LLVM to an LLVM 
client.

This changes both the C and C++ APIs, and all of the clients of those APIs within LLVM.  I'm assuming that 
it's safe to change the C++ API because that API is allowed to change.  I'm assuming that it's safe to change 
the C API because we haven't shipped the API in a release yet (LLVM 3.3 doesn't include the MCJIT memory 
management C API).

llvm-svn: 191804
2013-10-02 00:59:25 +00:00
Rafael Espindola 44fee4e0eb Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Andrew Kaylor ea395924d2 Adding multiple module support for MCJIT.
Tests to follow.

PIC with small code model and  EH frame handling will not work with multiple modules.  There are also some rough edges to be smoothed out for remote target support.

llvm-svn: 191722
2013-10-01 01:47:35 +00:00
Rafael Espindola 0b385c77f7 Move command line options to the users of libLTO. Fixes --enable-shared build.
Patch by Richard Sandiford.

llvm-svn: 191680
2013-09-30 16:39:19 +00:00
Rafael Espindola cbef8e60e3 Revert "Enable building LTO on WIN32."
This reverts commit r191670.

It was causing build failures on the msvc bots:

http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/5166/steps/compile/logs/stdio

llvm-svn: 191679
2013-09-30 16:32:51 +00:00
Rafael Espindola e693181c10 Enable building LTO on WIN32.
Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with
MSVC and Mingw as well as re-enabling the associated test.

Patch by Greg Bedwell!

llvm-svn: 191670
2013-09-30 15:28:14 +00:00
Rui Ueyama bc654b18bc Object/COFF: Rename getXXX{Begin,End} -> xxx_{begin,end}.
It is mentioned in the LLVM coding standard that _begin() and _end() suffixes
should be used.

llvm-svn: 191569
2013-09-27 21:47:05 +00:00
Rui Ueyama c2bed42904 Re-submit r191472 with a fix for big endian.
llvm-objdump: Dump COFF import table if -private-headers option is given.
llvm-svn: 191557
2013-09-27 21:04:00 +00:00
Rui Ueyama 333d28a0bb Revert "llvm-objdump: Dump COFF import table if -private-headers option is given."
This reverts commit r191472 because it's failing on BE machine.

llvm-svn: 191480
2013-09-27 01:29:36 +00:00
Rui Ueyama 6b27fe648a Fix another -Wnon-pod-varargs error in r191472.
llvm-svn: 191474
2013-09-27 00:53:07 +00:00
Rui Ueyama 9a80df5537 Fix -Wnon-pod-varargs error in r191472.
llvm-svn: 191473
2013-09-27 00:20:53 +00:00
Rui Ueyama 5b1adbaad9 llvm-objdump: Dump COFF import table if -private-headers option is given.
This is a patch to add capability to llvm-objdump to dump COFF Import Table
entries, so that we can write tests for LLD checking Import Table contents.

llvm-objdump did not print anything but just file name if the format is COFF
and -private-headers option is given. This is a patch adds capability for
dumping DLL Import Table, which is specific to the COFF format.

In this patch I defined a new iterator to iterate over import table entries.
Also added a few functions to COFFObjectFile.cpp to access fields of the entry.

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

llvm-svn: 191472
2013-09-27 00:07:01 +00:00
Eric Christopher a9e303e746 Add gnu pubsections as options to llvm-dwarfdump.
Argument spelling feedback welcome.

llvm-svn: 191409
2013-09-25 23:02:44 +00:00
Eric Christopher 4c7e6ba7d3 Dump the normal dwarf pubtypes section as well.
llvm-svn: 191408
2013-09-25 23:02:41 +00:00
Peter Collingbourne 4ccf0f1bef Move LTO support library to a component, allowing it to be tested
more reliably across platforms.  Patch by Tom Roeder!

llvm-svn: 191343
2013-09-24 23:52:22 +00:00
NAKAMURA Takumi f4bfb4ff0a llvm/tools/Makefile: Suppress building llvm-lto on cygming, for now, probably due to LTO.dll.
llvm-svn: 191088
2013-09-20 13:12:24 +00:00
Peter Collingbourne 4e380b0a04 Fix LTO handling of module-level assembly (PR14152).
Patch by Tom Roeder!

llvm-svn: 191042
2013-09-19 22:15:52 +00:00
Reid Kleckner ab675128e9 msbuild: Set _MSC_VER to match the CRT we're using
Various Windows SDK headers use _MSC_VER values to figure out what
version of the VC++ headers they're using, in particular for SAL macros.

Patch by Paul Hampson!

llvm-svn: 191015
2013-09-19 17:18:35 +00:00
Reid Kleckner 58c16ee609 Include an LLVM-vs2012_xp toolset in the MSBuild integration
Patch by Paul Hampson!

llvm-svn: 191010
2013-09-19 16:50:40 +00:00
Andrew Trick b5e1e6cc11 Revert "Encapsulate PassManager debug flags to avoid static init and cxa_exit."
Working on a better solution to this.

This reverts commit 7d4e9934e7ca83094c5cf41346966c8350179ff2.

llvm-svn: 190990
2013-09-19 06:02:43 +00:00
Andrew Trick f33d6df899 Encapsulate PassManager debug flags to avoid static init and cxa_exit.
This puts all the global PassManager debugging flags, like
-print-after-all and -time-passes, behind a managed static. This
eliminates their static initializers and, more importantly, exit-time
destructors.

The only behavioral change I anticipate is that tools need to
initialize the PassManager before parsing the command line in order to
export these options, which makes sense. Tools that already initialize
the standard passes (opt/llc) don't need to do anything new.

llvm-svn: 190974
2013-09-18 23:31:16 +00:00
Andrew Trick dc073addc5 whitespace
llvm-svn: 190973
2013-09-18 23:31:10 +00:00
Craig Topper 98064b9f4d Lift alignment restrictions for load/store folding on VINSERTF128/VEXTRACTF128. Fixes PR17268.
llvm-svn: 190916
2013-09-18 03:55:53 +00:00
Benjamin Kramer ac511cac77 ELF: Add support for the exclude section bit for gas compat.
llvm-svn: 190769
2013-09-15 19:53:20 +00:00
Joey Gouly db6144e3e3 [LTO] Fix the LTO tool, after my API breakage.
Thanks to Zonr Chang!

llvm-svn: 190602
2013-09-12 12:55:29 +00:00
Joey Gouly 0e76fa7df5 Add an instruction deprecation feature to TableGen.
The 'Deprecated' class allows you to specify a SubtargetFeature that the
instruction is deprecated on.

The 'ComplexDeprecationPredicate' class allows you to define a custom
predicate that is called to check for deprecation.
For example:
  ComplexDeprecationPredicate<"MCR">

would mean you would have to define the following function:
  bool getMCRDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI,
                             std::string &Info)

Which returns 'false' for not deprecated, and 'true' for deprecated
and store the warning message in 'Info'.

The MCTargetAsmParser constructor was chaned to take an extra argument of
the MCInstrInfo class, so out-of-tree targets will need to be changed.

llvm-svn: 190598
2013-09-12 10:28:05 +00:00
Manman Ren 116868eadd Debug Info: Use DIScopeRef for DIType::getContext.
In DIBuilder, the context field of a TAG_member is updated to use the
scope reference. Verifier is updated accordingly.
    
DebugInfoFinder now needs to generate a type identifier map to have
access to the actual scope. Same applies for BreakpointPrinter.
    
processModule of DebugInfoFinder is called during initialization phase
of the verifier to make sure the type identifier map is constructed early
enough.
    
We are now able to unique a simple class as demonstrated by the added
testing case.

llvm-svn: 190334
2013-09-09 19:47:11 +00:00
Bob Wilson e407736a06 Revert patches to add case-range support for PR1255.
The work on this project was left in an unfinished and inconsistent state.
Hopefully someone will eventually get a chance to implement this feature, but
in the meantime, it is better to put things back the way the were.  I have
left support in the bitcode reader to handle the case-range bitcode format,
so that we do not lose bitcode compatibility with the llvm 3.3 release.

This reverts the following commits: 155464, 156374, 156377, 156613, 156704,
156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575,
157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884,
157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100,
159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659,
159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736

llvm-svn: 190328
2013-09-09 19:14:35 +00:00
Bill Wendling 58e2d3d856 Generate compact unwind encoding from CFI directives.
We used to generate the compact unwind encoding from the machine
instructions. However, this had the problem that if the user used `-save-temps'
or compiled their hand-written `.s' file (with CFI directives), we wouldn't
generate the compact unwind encoding.

Move the algorithm that generates the compact unwind encoding into the
MCAsmBackend. This way we can generate the encoding whether the code is from a
`.ll' or `.s' file.

<rdar://problem/13623355>

llvm-svn: 190290
2013-09-09 02:37:14 +00:00
Hans Wennborg 8df6417683 msbuild integration: provide separate files for VS2010 and VS2012
The previous msbuild integration only worked if VS2010 was installed. This patch
renames the current integration to LLVM-vs2010 and adds LLVM-vs2012.

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

llvm-svn: 190173
2013-09-06 17:05:46 +00:00
Reid Kleckner 6ad0686da8 msbuild: Add clang's compiler-rt libs to the LibraryPath
This allows linking libraries like the asan RTL.

llvm-svn: 190028
2013-09-05 02:09:34 +00:00
Rafael Espindola b7c0b4a327 Rename some variables to match the style guide.
I am about to patch this code, and this makes the diff far more readable.

llvm-svn: 189982
2013-09-04 20:08:46 +00:00
Rafael Espindola c80c969e6f Rename variables to match the style guide and clang-format.
llvm-svn: 189962
2013-09-04 17:44:24 +00:00
Joerg Sonnenberger ce91d01a1b Print string value for DT_RPATH and DT_RUNPATH.
llvm-svn: 189829
2013-09-03 17:13:53 +00:00
Dmitri Gribenko 6e0520e9d9 Added std:: qualifier to find() invocation
Iterator of std::vector may be implemented as a raw pointer. In
this case ADL does not find the find() function in the std namespace.
For example, this is the case with STDCXX implementation of vector.

Patch by Konstantin Tokarev.

llvm-svn: 189733
2013-09-02 01:18:56 +00:00
Charles Davis 8bdfafd505 Move everything depending on Object/MachOFormat.h over to Support/MachO.h.
llvm-svn: 189728
2013-09-01 04:28:48 +00:00
Reid Kleckner c974f09731 Substitute LLVM's version into the msbuild property file at config time
Requires shuffling the CPack code up before add_subdirectory(tools), but
that's where the version settings are anyway.

llvm-svn: 189615
2013-08-29 22:09:43 +00:00
Warren Hunt d843249f2c Modified ms-build configuration file to be version locked to the VS2010 toolchain, this avoids conflicts with having VS2012 and
Win7SDK used at the same time.

llvm-svn: 189613
2013-08-29 21:23:53 +00:00
Warren Hunt 42646d2f17 Adding VCIncludeDir and WindowsSDKDir to the msbuild configuration file. This allows clang to find windows.h and other files in the
sdk and visutal studio includes.

llvm-svn: 189528
2013-08-28 22:54:13 +00:00
Rafael Espindola 0642df3fa4 Fix name matching to work on windows.
llvm-svn: 189517
2013-08-28 21:00:03 +00:00
Hal Finkel 6d09904cc9 Disable unrolling in the loop vectorizer when disabled in the pass manager
When unrolling is disabled in the pass manager, the loop vectorizer should also
not unroll loops. This will allow the -fno-unroll-loops option in Clang to
behave as expected (even for vectorizable loops). The loop vectorizer's
-force-vector-unroll option will (continue to) override the pass-manager
setting (including -force-vector-unroll=0 to force use of the internal
auto-selection logic).

In order to test this, I added a flag to opt (-disable-loop-unrolling) to force
disable unrolling through opt (the analog of -fno-unroll-loops in Clang). Also,
this fixes a small bug in opt where the loop vectorizer was enabled only after
the pass manager populated the queue of passes (the global_alias.ll test needed
a slight update to the RUN line as a result of this fix).

llvm-svn: 189499
2013-08-28 18:33:10 +00:00
Hans Wennborg 5c6235968f cmake: Prevent semicolon separated lists in llvm-config (PR17020)
llvm-svn: 189491
2013-08-28 17:04:06 +00:00
Rafael Espindola 0c8a3524b8 Add a minimal implementation of ranlib.
This is just enough to get "llvm-ranlib foo.a" working and tested. Making
llvm-ranlib a symbolic link to llvm-ar doesn't work so well with llvm's option
parsing, but ar's option parsing is mostly custom anyway.

This patch also removes the -X32_64 option. Looks like it was just added in
r10297 as part of implementing the current command line parsing. I can add it
back (with a test) if someone really has AIX portability problems without it.

llvm-svn: 189489
2013-08-28 16:22:16 +00:00
Hans Wennborg d2cbe22b4a cmake: Add msbuild integration to the install
This adds the msbuild integration files to the install, provides batch scripts
for (un)installing it in a convenient way, and hooks up the nsis installer to
run those scripts.

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

llvm-svn: 189434
2013-08-28 01:19:26 +00:00
Argyrios Kyrtzidis dba67a226f [CMake] Put back the add_llvm_external_project() calls for specific projects.
This allows setting-up the LLVM_EXTERNAL_* CMake variables that some people are using,
e.g. to set the source directory of the project in a different place.

llvm-svn: 189415
2013-08-27 23:27:56 +00:00
Reid Kleckner 8f4524a728 Add xml files for msbuild integration
These files are intended to live in the msbuild toolset directory, which
is somewhere like:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\
  v4.0\Platforms\Win32\PlatformToolsets\llvm

More work is needed to install them as part of the NSIS installer.

Patch by Warren Hunt!

llvm-svn: 189411
2013-08-27 23:07:17 +00:00
Shuxin Yang 388b52c0ce Revert 189297, the original commit message is following.
----
  Add new API lto_codegen_compile_parallel().

  This API is proposed by Nick Kledzik. The semantic is:

  --------------------------------------------------------------------------
   Generate code for merged module into an array of native object files. On 
   success returns a pointer to an array of NativeObjectFile.  The count 
   parameter returns the number of elements in the array.  Each element is 
   a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
   by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
   or lto_codegen_compile() is called again. On failure, returns NULL 
   (check lto_get_error_message() for details).

   extern const struct  NativeObjectFile*
   lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
  ---------------------------------------------------------------------------

  This API is currently only called on OSX platform. Linux or other Unixes
using GNU gold are not supposed to call this function, because on these systems, 
object files are fed back to linker via disk file instead of memory buffer.

  In this commit, lto_codegen_compile_parallel() simply calls
lto_codegen_compile() to return a single object file. In the near future,
this function is the entry point for compilation with partition. Linker can
blindly call this function even if partition is turned off; in this case,
compiler will return only one object file.

llvm-svn: 189386
2013-08-27 17:15:54 +00:00
Charles Davis 1827bd8a6c Revert "Fix the build broken by r189315." and "Move everything depending on Object/MachOFormat.h over to Support/MachO.h."
This reverts commits r189319 and r189315. r189315 broke some tests on what I
believe are big-endian platforms.

llvm-svn: 189321
2013-08-27 05:38:30 +00:00
David Blaikie ed80aa5588 Fix the build broken by r189315.
(this triggered Clang's -Wsometimes-uninitialized on the default path
through the switch)

llvm-svn: 189319
2013-08-27 05:16:07 +00:00
Charles Davis 0c6f71b40d Move everything depending on Object/MachOFormat.h over to Support/MachO.h.
llvm-svn: 189315
2013-08-27 05:00:43 +00:00
Shuxin Yang a44362e4e9 Add new API lto_codegen_compile_parallel().
This API is proposed by Nick Kledzik. The semantic is:

  --------------------------------------------------------------------------
   Generate code for merged module into an array of native object files. On 
   success returns a pointer to an array of NativeObjectFile.  The count 
   parameter returns the number of elements in the array.  Each element is 
   a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
   by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
   or lto_codegen_compile() is called again. On failure, returns NULL 
   (check lto_get_error_message() for details).

   extern const struct  NativeObjectFile*
   lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
  ---------------------------------------------------------------------------

  This API is currently only called on OSX platform. Linux or other Unixes
using GNU gold are not supposed to call this function, because on these systems, 
object files are fed back to linker via disk file instead of memory buffer.

  In this commit, lto_codegen_compile_parallel() simply calls
lto_codegen_compile() to return a single object file. In the near future,
this function is the entry point for compilation with partition. Linker can
blindly call this function even if partition is turned off; in this case,
compiler will return only one object file.

llvm-svn: 189297
2013-08-27 00:03:23 +00:00
Alexey Samsonov a591ae6db3 llvm-symbolizer: use real path when looking for debug binary location
llvm-svn: 189250
2013-08-26 18:12:03 +00:00
Hans Wennborg d489b7c48f CMake: move lto.h install to tools/lto/CMakeLists.txt
It looked misplaced in the main CMakeLists.txt file.

llvm-svn: 189230
2013-08-26 16:54:12 +00:00
Hans Wennborg fe06e811a3 CMake: build llvm-config on Windows.
It was previously not being built on Windows because the cmake file relied
on a sed script to generate a .in file that llvm-config needs.

By using cmake's configure_file function, we can get rid off the sed hack,
and also have this work on Windows.

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

llvm-svn: 189125
2013-08-23 17:59:13 +00:00
NAKAMURA Takumi 8c8f4325a5 lto/CMakeLists.txt: Cut the dep to intrinsics_gen. LTO doesn't depend on it and LTO_static doesn't depend on anything.
llvm-svn: 189086
2013-08-23 02:51:13 +00:00
Argyrios Kyrtzidis 7eec9d0c04 [CMake] Automatically pick up subdirectories in llvm/tools as 'external projects' if they contain a 'CMakeLists.txt' file.
Allow CMake to pick up external projects in llvm/tools without the need to modify the "llvm/tools/CMakeLists.txt" file.
This makes it easier to work with projects that live in other repositories, without needing to specify each one in "llvm/tools/CMakeLists.txt".

llvm-svn: 188921
2013-08-21 19:13:44 +00:00
Ahmed Bougacha d56f705d87 Add basic YAML MC CFG testcase.
Drive-by llvm-objdump cleanup (don't hardcode ToolName).

llvm-svn: 188904
2013-08-21 16:13:25 +00:00
Ahmed Bougacha 1792647942 MC CFG: Add YAML MCModule representation to enable MC CFG testing.
Like yaml ObjectFiles, this will be very useful for testing the MC CFG
implementation (mostly MCObjectDisassembler), by matching the output
with YAML, and for potential users of the MC CFG, by using it as an input.

There isn't much to the actual format, it is just a serialization of the
MCModule class. Of note:
  - Basic block references (pred/succ, ..) are represented by the BB's
    start address.
  - Just as in the MC CFG, instructions are MCInsts with a size.
  - Operands have a prefix representing the type (only register and
    immediate supported here).
  - Instruction opcodes are represented by their names; enum values aren't
    stable, enum names mostly are: usually, a change to a name would need
    lots of changes in the backend anyway.
    Same with registers.

All in all, an example is better than 1000 words, here goes:

A simple binary:

  Disassembly of section __TEXT,__text:
  _main:
  100000f9c:      48 8b 46 08             movq    8(%rsi), %rax
  100000fa0:      0f be 00                movsbl  (%rax), %eax
  100000fa3:      3b 04 25 48 00 00 00    cmpl    72, %eax
  100000faa:      0f 8c 07 00 00 00       jl      7 <.Lend>
  100000fb0:      2b 04 25 48 00 00 00    subl    72, %eax
  .Lend:
  100000fb7:      c3                      ret

And the (pretty verbose) generated YAML:

  ---
  Atoms:
    - StartAddress:    0x0000000100000F9C
      Size:            20
      Type:            Text
      Content:
        - Inst:            MOV64rm
          Size:            4
          Ops:             [ RRAX, RRSI, I1, R, I8, R ]
        - Inst:            MOVSX32rm8
          Size:            3
          Ops:             [ REAX, RRAX, I1, R, I0, R ]
        - Inst:            CMP32rm
          Size:            7
          Ops:             [ REAX, R, I1, R, I72, R ]
        - Inst:            JL_4
          Size:            6
          Ops:             [ I7 ]
    - StartAddress:    0x0000000100000FB0
      Size:            7
      Type:            Text
      Content:
        - Inst:            SUB32rm
          Size:            7
          Ops:             [ REAX, REAX, R, I1, R, I72, R ]
    - StartAddress:    0x0000000100000FB7
      Size:            1
      Type:            Text
      Content:
        - Inst:            RET
          Size:            1
          Ops:             [  ]
  Functions:
    - Name:            __text
      BasicBlocks:
        - Address:         0x0000000100000F9C
          Preds:           [  ]
          Succs:           [ 0x0000000100000FB7, 0x0000000100000FB0 ]
     <snip>
  ...

llvm-svn: 188890
2013-08-21 07:29:02 +00:00
NAKAMURA Takumi b46d3c8995 lli/RecordingMemoryManager.cpp: Make it complain if _GLOBAL_OFFSET_TABLE_ were not provided.
FIXME: Would it be responsible to provide GOT?
llvm-svn: 188855
2013-08-21 02:37:14 +00:00
Alexey Samsonov 3e9997f2c5 llvm-symbolizer: add support for .gnu_debuglink section
llvm-svn: 188386
2013-08-14 17:09:30 +00:00
Arnold Schwaighofer c14b59d1a1 Remove logic that decides whether to vectorize or not depending on O-levels
I have moved this logic into clang and opt.

llvm-svn: 188281
2013-08-13 15:51:25 +00:00
Shuxin Yang 1826ae23ff Revert r188188 and r188200.
In order to appease people (in Apple) who accuse me for committing "huge change" (?) without proper review. 

Thank Eric for fixing a compile-warning. 

llvm-svn: 188204
2013-08-12 21:07:31 +00:00
Eric Christopher d8da06e011 Fix warning about unused member.
llvm-svn: 188200
2013-08-12 20:27:50 +00:00
Shuxin Yang 76d082b5cd Misc enhancements to LTO:
1. Add some helper classes for partitions. They are designed in a
     way such that the top-level LTO driver will not see much difference 
     with or without partitioning.

  2. Introduce work-dir. Now all intermediate files generated during 
     LTO phases will be saved under work-dir. User can specify the workdir
     via -lto-workdir=/path/to/dir. By default the work-dir will be 
     erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1.

    TODO: Erase the workdir, if the linker exit prematurely.  
      We are currently not able to remove directory on signal. The support 
      routines simply ignore directory.

  3. Add one new API lto_codegen_get_files_need_remove().
     Linker and LTO plugin will communicate via this API about which files
    (including directories) need to removed before linker exit.

llvm-svn: 188188
2013-08-12 18:29:43 +00:00
Benjamin Kramer 054f422dc5 Remove byte order mark from source file.
llvm-svn: 188066
2013-08-09 10:31:14 +00:00
Saleem Abdulrasool 4208b61858 [CodeGen] prevent abnormal on invalid attributes
Currently, when an invalid attribute is encountered on processing a .s file,
clang will abort due to llvm_unreachable.  Invalid user input should not cause
an abnormal termination of the compiler.  Change the interface to return a
boolean to indicate the failure as a first step towards improving hanlding of
malformed user input to clang.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 188047
2013-08-09 01:52:03 +00:00
Bill Wendling 2bbbfef243 Revert r185882. This is causing problems with the gold linker and might be better handled by the linker.
llvm-svn: 188029
2013-08-08 23:51:04 +00:00
Michael J. Spencer 126973ba93 [Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment.
* ELFFile.h defines the ELFFile class which provides low level ELF specific access.
* ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface.

llvm-svn: 188022
2013-08-08 22:27:13 +00:00
Shuxin Yang b6696a93c2 Change public functions of LTOCodeGenerator from ret-false-on-succ to ret-true-on-succ.
As of this revision, all functions of LTOCodeGenerator are consistent in
ret-true-on-succ.

Tested on multiple OSes.

llvm-svn: 187864
2013-08-07 05:19:23 +00:00
Shuxin Yang 95866fa7b2 Change private functions of LTOCodeGenerator from ret-false-on-succ to ret-true-on-succ.
llvm-svn: 187819
2013-08-06 21:51:21 +00:00
Tom Stellard aa664d9b92 Factor FlattenCFG out from SimplifyCFG
Patch by: Mei Ye

llvm-svn: 187764
2013-08-06 02:43:45 +00:00
Shuxin Yang 6f7213cb93 Add some comment to LTOCodeGenerator class
llvm-svn: 187761
2013-08-06 00:45:32 +00:00
Michael Gottesman 6964f33fc9 [bugpoint] Allow the user to specify the path to opt on the commandline.
llvm-svn: 187739
2013-08-05 21:07:07 +00:00
Benjamin Kramer 5d62ad2aff Unbreak llvm-rtdyld build.
llvm-svn: 187699
2013-08-03 22:18:45 +00:00
Benjamin Kramer 9ce7708abb llvm-rtdyld: Don't leak memory managers.
Dyld never outlives MemMgr, just put both on the stack.

llvm-svn: 187697
2013-08-03 22:16:31 +00:00
Hal Finkel e9efbf140b Fix invalid function pointers in bugpoint ExtractLoops
The ExtractLoops function tries to reduce the failing test case by extracting
one or more loops from the misoptimized piece of the program. In doing this,
ExtractLoops must keep the MiscompiledFunctions vector up-to-date by ensuring
that the pointers refer to functions in the current failing program.
Unfortunately, this is not trivial because:

 - ExtractLoops is iterative, and there are several early exits (and the
   MiscompiledFunctions vector must be consistent with the current program at
every non-fatal exit point).
 - Several of the utility functions used by ExtractLoops (such as
   TestOptimizer, some of which are called through the TestFn callback
parameter, and Linker::LinkModules) delete their inputs upon success.

This change adds several updates of the MiscompiledFunctions vector at
different points. The first is after the initial call to TestMergedProgram
which checks that the loop-extracted program still works. The second is after
the call to TestFn (TestOptimizer, for example). This function will delete its
inputs (which is why the existing ExtractLoops logic cloned the inputs first).

llvm-svn: 187674
2013-08-02 21:13:42 +00:00
Eric Christopher 3b5ea5178d Use @rpath for libraries rather than @executable_path on OSX.
Patch by Benjamin Scarlet!

llvm-svn: 187641
2013-08-02 01:51:52 +00:00
Bill Wendling a5c536e1ee Use function attributes to indicate that we don't want to realign the stack.
Function attributes are the future! So just query whether we want to realign the
stack directly from the function instead of through a random target options
structure.

llvm-svn: 187618
2013-08-01 21:42:05 +00:00
Rafael Espindola b6b5f52ee8 Add support for the 's' operation to llvm-ar.
If no other operation is specified, 's' becomes an operation instead of an
modifier. The s operation just creates a symbol table. It is the same as
running ranlib.

We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and
if the symbol table is present, then it is current. We use that to optimize
the most common case: a broken build system that thinks it has to run ranlib.

llvm-svn: 187353
2013-07-29 12:40:31 +00:00
Tom Stellard 8b1e021e85 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

llvm-svn: 187278
2013-07-27 00:01:07 +00:00
Rafael Espindola 729866670b Remove the mblaze backend from llvm.
Approval in here http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/064169.html

llvm-svn: 187145
2013-07-25 18:55:05 +00:00
Bill Wendling 440e9d81bf 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.

llvm-svn: 187093
2013-07-25 00:34:29 +00:00