Commit Graph

4107 Commits

Author SHA1 Message Date
Eric Christopher 7c678de861 Add a relocation visitor to lib object. This works via caching relocated
values in a map that can be passed to consumers. Add a testcase that
ensures this works for llvm-dwarfdump.

llvm-svn: 167558
2012-11-07 23:22:07 +00:00
Bill Wendling 3fdaa244e1 Remove accidental commit.
llvm-svn: 167544
2012-11-07 18:39:32 +00:00
Bill Wendling f720bf64d4 Add comment describing what's going on here.
llvm-svn: 167525
2012-11-07 05:19:04 +00:00
Andrew Kaylor a714efc1bd Add a method to indicate section address re-assignment is finished.
Prior to this patch RuntimeDyld attempted to re-apply relocations every time reassignSectionAddress was called (via MCJIT::mapSectionAddress).  In addition to being inefficient and redundant, this led to a problem when a section was temporarily moved too far away from another section with a relative relocation referencing the section being moved.  To fix this, I'm adding a new method (finalizeObject) which the client can call to indicate that it is finished rearranging section addresses so the relocations can safely be applied.

llvm-svn: 167400
2012-11-05 20:57:16 +00:00
Jim Grosbach 2cce3f91f8 lli: Initialize the native asm parser for inline assembly.
MCJIT supports inline assembly, but requires the asm parser to do so.
Make sure to link it in and initialize it.

llvm-svn: 167392
2012-11-05 19:06:05 +00:00
Andrew Kaylor f2c10782ce Streamlined memory manager hierarchy for MCJIT and RuntimeDyld.
Patch by Ashok Thirumurthi

llvm-svn: 167192
2012-11-01 00:46:04 +00:00
Andrew Kaylor 8565e50ad4 Fixed format strings to avoid pointer truncation during 64-bit debugging.
llvm-svn: 167185
2012-11-01 00:17:11 +00:00
Jim Grosbach acd8801e25 MC: Simple example parser for MC assembly markup.
Nothing fancy, just a simple demonstration parser.

llvm-svn: 167181
2012-10-31 23:24:13 +00:00
Andrew Kaylor 66ebd33bd3 Mark code, not data, as executable in lli RemoteTarget simulator.
llvm-svn: 167164
2012-10-31 20:37:14 +00:00
Tim Northover 3643a8f8eb Align the data section correctly when loading an ELF file.
Patch by Amara Emerson.

llvm-svn: 166920
2012-10-29 10:47:07 +00:00
Rafael Espindola 7043858a5b Add -alias and -ralias options to match what we have for functions and
globals.

llvm-svn: 166909
2012-10-29 02:23:07 +00:00
Joerg Sonnenberger 4a0f7becd8 Adjust llvm-ar and llvm-ranlib to not depend on exception handling.
Always use an exit code of 1, but print the help message if useful.
Remove the exception handling tag in llvm-as, llvm-dis and
llvm-bcanalyzer, where it isn't used.

llvm-svn: 166767
2012-10-26 10:49:15 +00:00
Rafael Espindola a339e47689 libLTO has a bug in that it will keep every symbol if none is needed. We used
to hack around this in the gold plugin by deleting a module if no symbol was
needed. Unfortunately, the hack is wrong in the case of o module having no
visible symbols but still having side effects via static constructors.

The bug will have to be fixed in libLTO itself.

llvm-svn: 166745
2012-10-26 00:29:57 +00:00
Nadav Rotem 18d0635339 Opt does not need to initialize the Asm printer/parser
llvm-svn: 166602
2012-10-24 17:55:53 +00:00
Nadav Rotem ac9a344915 Opt needs to initialize the different targets.
llvm-svn: 166595
2012-10-24 17:23:50 +00:00
Kevin Enderby 62183c4e18 Add support for annotated disassembly output for X86 and arm.
Per the October 12, 2012 Proposal for annotated disassembly output sent out by
Jim Grosbach this set of changes implements this for X86 and arm.  The llvm-mc
tool now has a -mdis option to produced the marked up disassembly and a couple
of small example test cases have been added.

rdar://11764962

llvm-svn: 166445
2012-10-22 22:31:46 +00:00
Nadav Rotem 5dc203e8f4 Reapply the TargerTransformInfo changes, minus the changes to LSR and Lowerinvoke.
llvm-svn: 166248
2012-10-18 23:22:48 +00:00
Bob Wilson 3b8d7bc1e8 Revert "We need this symbol after an LTO build."
This reverts commit 165776.  The plug-in uses this symbol; it does not
define it.  It needs to be exported from bugpoint itself, not from the plug-in.

llvm-svn: 166207
2012-10-18 18:52:54 +00:00
Bob Wilson d6d9ccca38 Temporarily revert the TargetTransform changes.
The TargetTransform changes are breaking LTO bootstraps of clang.  I am
working with Nadav to figure out the problem, but I am reverting it for now
to get our buildbots working.

This reverts svn commits: 165665 165669 165670 165786 165787 165997
and I have also reverted clang svn 165741

llvm-svn: 166168
2012-10-18 05:43:52 +00:00
Eric Christopher 3680f8826e Formatting and 80-col.
llvm-svn: 166075
2012-10-16 23:46:21 +00:00
Nadav Rotem 8be2a9adba LTO also needs to initialize the TargetTransform infrastructure.
llvm-svn: 165997
2012-10-15 22:50:02 +00:00
Bob Wilson 3f7e7c061c Set default CPU for Darwin targets with LTO. <rdar://problem/12457841>
This is a temporary hack until Bill's project to record command line options
in the LLVM IR is ready. Clang currently sets a default CPU but that isn't
recorded anywhere and it doesn't get used in the final LTO compilation.

llvm-svn: 165809
2012-10-12 17:39:25 +00:00
Tim Northover d4a2f5bbfa Add float-abi and softfloat options to lli
Patch by Amara Emerson.

llvm-svn: 165791
2012-10-12 09:55:13 +00:00
Bill Wendling c2c6411fac We need this symbol after an LTO build.
llvm-svn: 165776
2012-10-12 01:06:33 +00:00
Nadav Rotem e10328737d Add a new interface to allow IR-level passes to access codegen-specific information.
llvm-svn: 165665
2012-10-10 22:04:55 +00:00
Bill Wendling ff4ddaa9d2 Place temporary LTO files into their own subdirectory.
llvm-svn: 165599
2012-10-10 05:29:15 +00:00
Bob Wilson 8fd10ef0d6 Revert "Use a special path to place the .o files in."
This reverts commit 165428 in an attempt to get our buildbots going.

llvm-svn: 165574
2012-10-09 23:59:01 +00:00
Bill Wendling 03783ff3d8 Use a special path to place the .o files in.
llvm-svn: 165428
2012-10-08 21:17:45 +00:00
Micah Villmow 9cfc13d46c Move TargetData to DataLayout.
llvm-svn: 165403
2012-10-08 16:39:34 +00:00
NAKAMURA Takumi a549b51a32 lli: [MCJIT] Suppress "__main" for cygming in LLIMCJITMemoryManager::getPointerToNamedFunction(), like legacy JITMemoryManager's.
CRT's __main (aka premain) invokes global ctors on cygming. See also PR3897.

llvm-svn: 165312
2012-10-05 14:10:23 +00:00
Bill Wendling 7dee2557ef Add an explicit -object_path_lto flag during linking with a uniquified temporary
file name if building Apple-style.

llvm-svn: 165185
2012-10-03 23:52:10 +00:00
Andrew Kaylor adc70568f9 Clean-up of memory buffer and object ownership model in MCJIT
llvm-svn: 165053
2012-10-02 21:18:39 +00:00
Jordan Rose 3c837abd2b Re-enable support for --program-prefix.
The Apple buildbots have been modified not to pass --target,
so they shouldn't choke on a default program prefix anymore.

Patch by Rick Foos!

llvm-svn: 164956
2012-10-01 18:40:32 +00:00
Andrew Kaylor 5808c7d828 Removing dependency on third party library for Intel JIT event support.
Patch committed on behalf of Kirill Uhanov

llvm-svn: 164831
2012-09-28 17:35:20 +00:00
Sylvestre Ledru 91ce36c986 Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767
llvm-svn: 164768
2012-09-27 10:14:43 +00:00
Sylvestre Ledru 721cffd53a Fix a typo 'iff' => 'if'
llvm-svn: 164767
2012-09-27 09:59:43 +00:00
Jordan Rose 2998d25a6e Revert "Add --program-prefix support to build"
The Apple buildbots are set up to pass --target to configure for both
cross- and non-cross-compile builds, and the standard autoconf response
to this is to set the program prefix to '<target>-'. Until we can figure
out the proper way to handle this (don't pass --target? pass an explicit
--program-prefix=""? don't auto-populate program_prefix with target_alias?)
it's more important to keep the buildbots running.

This reverts r164633 / ba48ceb1a3802e20e781ef04ea2573ffae2ac414.

llvm-svn: 164651
2012-09-26 00:01:00 +00:00
Sebastian Pop 17e118b79c Add --program-prefix support to build
llvm-svn: 164633
2012-09-25 21:15:08 +00:00
Tim Northover 572d0698d2 Make sure lli compiles all code before invalidating instruction caches.
Patch from Amara Emerson.

llvm-svn: 164296
2012-09-20 08:46:30 +00:00
Andrew Trick becbbbe112 Silence -Wnon-virtual-dtor in llvm-stress.
This was making it hard to scan my builds for new warnings. The
warning still fires with ToT clang. But if my workaround is unnecessary
for whatever reason, feel free to revert.

llvm-svn: 164201
2012-09-19 05:08:30 +00:00
Jan Sjödin 4d0c299f39 Add hidden flag to exclude aliases from output.
llvm-svn: 164158
2012-09-18 18:47:58 +00:00
Roman Divacky 5dd4ccb402 When creating MCAsmBackend pass the CPU string as well. In X86AsmBackend
store this and use it to not emit long nops when the CPU is geode which
doesnt support them.

Fixes PR11212.

llvm-svn: 164132
2012-09-18 16:08:49 +00:00
Craig Topper bc40d7e023 Fix includes of llvm files that used angle brackets.
llvm-svn: 163979
2012-09-15 18:45:38 +00:00
Eli Friedman 713bbb78c6 Don't include stdint.h directly.
llvm-svn: 163354
2012-09-06 22:55:11 +00:00
Bill Wendling 33fa1df67d Explicitly erase the file from disk if something bad happened. <rdar://problem/12184899>
llvm-svn: 163349
2012-09-06 21:07:57 +00:00
Eli Friedman e07b1bbaae Don't include stdint.h directly.
llvm-svn: 163276
2012-09-06 00:12:55 +00:00
Roman Divacky ad06cee239 Stop casting away const qualifier needlessly.
llvm-svn: 163258
2012-09-05 22:26:57 +00:00
Jan Wen Voung 5020dd35e5 Fix a bug.
llvm-svn: 163242
2012-09-05 20:56:00 +00:00
Jan Wen Voung 05ff570139 revert the additional stuff.
llvm-svn: 163241
2012-09-05 20:55:57 +00:00
Jan Wen Voung 52ad208146 Clean up llvm-bcanalyzer to print to consistent streams.
Avoid interleaving fprintf(stderr,...) and outs() << ...;

Also add a column to show "bytes-per" for each record.

llvm-svn: 163240
2012-09-05 20:55:54 +00:00
Jim Grosbach 5d3913f189 Update CMakeList.txt for new lli sources.
llvm-svn: 163228
2012-09-05 18:15:08 +00:00
Jim Grosbach 0f435d0851 MCJIT: Add faux remote target execution to lli for the MCJIT.
Simulate a remote target address space by allocating a seperate chunk of
memory for the target and re-mapping section addresses to that prior to
execution. Later we'll want to have a truly remote process, but for now
this gets us closer to being able to test the remote target
functionality outside LLDB.

rdar://12157052

llvm-svn: 163216
2012-09-05 16:50:34 +00:00
Alexey Samsonov c942e6b781 Add support for fetching inlining context (stack of source code locations)
by instruction address from DWARF.

Add --inlining flag to llvm-dwarfdump to demonstrate and test this functionality,
so that "llvm-dwarfdump --inlining --address=0x..." now works much like
"addr2line -i 0x...", provided that the binary has debug info
(Clang's -gline-tables-only *is* enough).

llvm-svn: 163128
2012-09-04 08:12:33 +00:00
Logan Chien cfac480aa4 Code cleanup: tools/opt/opt.cpp
Remove unused local variable.

llvm-svn: 163061
2012-09-01 14:43:30 +00:00
Jim Grosbach 748b947849 LLI: move instruction cache tweaks.
Invalidate the instruction cache right before we start actually executing code, otherwise
we can miss some that came later. This is still not quite right for a truly lazilly
compiled environment, but it's closer.

llvm-svn: 162803
2012-08-28 23:22:30 +00:00
Jack Carter 551efd7fd9 Some of the instructions in the Mips instruction set are revision
delimited. llvm-mc -disassemble access these through the -mattr
option.

llvm-objdump -disassemble had no such way to set the attribute so
some instructions were just not recognized for disassembly.

This patch accepts llvm-mc mechanism for specifying the attributes.

llvm-svn: 162781
2012-08-28 19:24:49 +00:00
Alexey Samsonov 034e57a297 Add basic support for .debug_ranges section to LLVM's DebugInfo library.
This section (introduced in DWARF-3) is used to define instruction address
ranges for functions that are not contiguous and can't be described
by low_pc/high_pc attributes (this is the usual case for inlined subroutines).
The patch is the first step to support fetching complete inlining info from DWARF.

Reviewed by Benjamin Kramer.

llvm-svn: 162657
2012-08-27 07:17:47 +00:00
Rafael Espindola 5e892a7a03 Pass -lLTO after gold-plugin.o so that it gets used in systems that default to
--as-needed.
Patch by Felix Geyer. Fixes pr13262.

llvm-svn: 162652
2012-08-27 03:03:07 +00:00
Chad Rosier d269bd8c24 Add support for the --param ssp-buffer-size= driver option.
PR9673

llvm-svn: 162284
2012-08-21 16:15:24 +00:00
Bill Wendling 34bc34ecae Change the `linker_private_weak_def_auto' linkage to `linkonce_odr_auto_hide' to
make it more consistent with its intended semantics.

The `linker_private_weak_def_auto' linkage type was meant to automatically hide
globals which never had their addresses taken. It has nothing to do with the
`linker_private' linkage type, which outputs the symbols with a `l' (ell) prefix
among other things.

The intended semantic is more like the `linkonce_odr' linkage type.

Change the name of the linkage type to `linkonce_odr_auto_hide'. And therefore
changing the semantics so that it produces the correct output for the linker.

Note: The old linkage name `linker_private_weak_def_auto' will still parse but
is not a synonym for `linkonce_odr_auto_hide'. This should be removed in 4.0.
<rdar://problem/11754934>

llvm-svn: 162114
2012-08-17 18:33:14 +00:00
Rafael Espindola 740a6bc8a0 Remove references to compression in llvm-ar. It has been a long time since we
switched from a bytecode+bzip2 to the current bitcode.

llvm-svn: 161651
2012-08-10 01:57:52 +00:00
Bill Wendling 6a0abed97c Remove some coding violations. No functionality change.
llvm-svn: 161530
2012-08-08 22:03:50 +00:00
Bill Wendling 9351b3e7e6 Cache a commonly used reference.
llvm-svn: 161529
2012-08-08 22:01:55 +00:00
Bob Wilson 4c65c505e0 Add test triples to fix win32 failures. Revert workaround from r161292.
I don't have a win32 system to test, so hopefully I got them all fixed here.

llvm-svn: 161519
2012-08-08 20:31:37 +00:00
Jim Grosbach af9aec0cd7 Tidy up a bit.
llvm-svn: 161430
2012-08-07 17:53:14 +00:00
Bill Wendling 45f74e313b Reduce indentation by early exiting.
llvm-svn: 161356
2012-08-06 22:52:45 +00:00
Bill Wendling b8dcda77d9 Add a way to grab the target options from the LTO command line.
When the command line target options were removed from the LLVM libraries, LTO
lost its ability to specify things like `-disable-fp-elim'. Add this back by
adding the command line variables to the `lto' project.
<rdar://problem/12038729>

llvm-svn: 161353
2012-08-06 21:34:54 +00:00
Eric Christopher 22738d00a3 Add support for the OpenBSD for Bitrig.
Patch by David Hill.

llvm-svn: 161344
2012-08-06 20:52:18 +00:00
NAKAMURA Takumi 10b90b45c1 llc: Try to suppress failures since r161262 .
FIXME: Fix several tests on i686-win32 due to lacking of many libraries.
llvm-svn: 161292
2012-08-04 01:29:37 +00:00
Bob Wilson fa59485b94 Fix memcmp code-gen to honor -fno-builtin.
I noticed that SelectionDAGBuilder::visitCall was missing a check for memcmp
in TargetLibraryInfo, so that it would use custom code for memcmp calls even
with -fno-builtin.  I also had to add a new -disable-simplify-libcalls option
to llc so that I could write a test for this.

llvm-svn: 161262
2012-08-03 21:26:18 +00:00
Sylvestre Ledru 35521e2310 Fix a typo (the the => the)
llvm-svn: 160621
2012-07-23 08:51:15 +00:00
Alexey Samsonov e16e16add6 DebugInfo library: add support for fetching absolute paths to source files
(instead of basenames) from DWARF. Use this behavior in llvm-dwarfdump tool.

Reviewed by Benjamin Kramer.

llvm-svn: 160496
2012-07-19 07:03:58 +00:00
Bill Wendling 4e68e0673a Remove tabs.
llvm-svn: 160480
2012-07-19 00:17:40 +00:00
Chad Rosier 09a06c257e Tweak prose.
llvm-svn: 160478
2012-07-19 00:11:45 +00:00
Evan Cheng 39e90029a2 Target option DisableJumpTables is a gross hack. Move it to TargetLowering instead.
llvm-svn: 159611
2012-07-02 22:39:56 +00:00
Bob Wilson cac3b90633 Extend TargetPassConfig to allow running only a subset of the normal passes.
This is still a work in progress but I believe it is currently good enough
to fix PR13122 "Need unit test driver for codegen IR passes".  For example,
you can run llc with -stop-after=loop-reduce to have it dump out the IR after
running LSR.  Serializing machine-level IR is not yet supported but we have
some patches in progress for that.

The plan is to serialize the IR to a YAML file, containing separate sections
for the LLVM IR, machine-level IR, and whatever other info is needed.  Chad
suggested that we stash the stop-after pass in the YAML file and use that
instead of the start-after option to figure out where to restart the
compilation.  I think that's a great idea, but since it's not implemented yet
I put the -start-after option into this patch for testing purposes.

llvm-svn: 159570
2012-07-02 19:48:45 +00:00
Evan Cheng 58aeca0878 Need a space.
llvm-svn: 159565
2012-07-02 19:45:42 +00:00
Alexey Samsonov f4462fa3ca This patch extends the libLLVMDebugInfo which contains a minimalistic DWARF parser:
1) DIContext is now able to return function name for a given instruction address (besides file/line info).
2) llvm-dwarfdump accepts flag --functions that prints the function name (if address is specified by --address flag).
3) test case that checks the basic functionality of llvm-dwarfdump added

llvm-svn: 159512
2012-07-02 05:54:45 +00:00
Bill Wendling e38859dc8e Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and
include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h.

The reasoning is because the DebugInfo module is simply an interface to the
debug info MDNodes and has nothing to do with analysis.

llvm-svn: 159312
2012-06-28 00:05:13 +00:00
Duncan Sands 206fc30ab1 When users ask for -mcpu=help or -mattr=help, just output the help without
requiring a module.  Original patch by Sunay Ismail, simplified by Arnaud
de Grandmaison, then complicated by me (if a triple was specified on the
command line, output help for that triple, not for the default).

llvm-svn: 159268
2012-06-27 16:23:48 +00:00
Rafael Espindola e0eaa043eb Fix llc's -print-before=pass and -print-after=pass.
llvm-svn: 159227
2012-06-26 21:33:36 +00:00
Lang Hames c98ebda325 Rename fp-op fusion option (yet again) for compatibility with GCC option.
llvm-svn: 159042
2012-06-22 22:31:00 +00:00
Evan Cheng 9584799384 Forgot this patch in r159023.
llvm-svn: 159028
2012-06-22 20:30:39 +00:00
Lang Hames b8650f106a Rename -allow-excess-fp-precision flag to -fuse-fp-ops, and switch from a
boolean flag to an enum: { Fast, Standard, Strict } (default = Standard).

This option controls the creation by optimizations of fused FP ops that store
intermediate results in higher precision than IEEE allows (E.g. FMAs). The
behavior of this option is intended to match the behaviour specified by a
soon-to-be-introduced frontend flag: '-ffuse-fp-ops'.

Fast mode - allows formation of fused FP ops whenever they're profitable.

Standard mode - allow fusion only for 'blessed' FP ops. At present the only
blessed op is the fmuladd intrinsic. In the future more blessed ops may be
added.

Strict mode - allow fusion only if/when it can be proven that the excess
precision won't effect the result.

Note: This option only controls formation of fused ops by the optimizers.  Fused
operations that are explicitly requested (e.g. FMA via the llvm.fma.* intrinsic)
will always be honored, regardless of the value of this option.

Internally TargetOptions::AllowExcessFPPrecision has been replaced by
TargetOptions::AllowFPOpFusion.

llvm-svn: 158956
2012-06-22 01:09:09 +00:00
Nadav Rotem 0fb7408144 llvm-stress: Stabalize (by using an ordered container) and add randomness to the order in which loops are generated.
llvm-svn: 158908
2012-06-21 08:58:15 +00:00
Lang Hames 39fb1d08dc Add DAG-combines for aggressive FMA formation.
This patch adds DAG combines to form FMAs from pairs of FADD + FMUL or
FSUB + FMUL. The combines are performed when:
(a) Either
      AllowExcessFPPrecision option (-enable-excess-fp-precision for llc)
        OR
      UnsafeFPMath option (-enable-unsafe-fp-math)
    are set, and
(b) TargetLoweringInfo::isFMAFasterThanMulAndAdd(VT) is true for the type of
    the FADD/FSUB, and
(c) The FMUL only has one user (the FADD/FSUB).

If your target has fast FMA instructions you can make use of these combines by
overriding TargetLoweringInfo::isFMAFasterThanMulAndAdd(VT) to return true for
types supported by your FMA instruction, and adding patterns to match ISD::FMA
to your FMA instructions.

llvm-svn: 158757
2012-06-19 22:51:23 +00:00
Rafael Espindola ca3e0ee8b3 Move the support for using .init_array from ARM to the generic
TargetLoweringObjectFileELF. Use this to support it on X86. Unlike ARM,
on X86 it is not easy to find out if .init_array should be used or not, so
the decision is made via TargetOptions and defaults to off.

Add a command line option to llc that enables it.

llvm-svn: 158692
2012-06-19 00:48:28 +00:00
Bill Wendling 6970fa8287 Remove assignments which aren't used afterwards.
llvm-svn: 158534
2012-06-15 19:28:20 +00:00
Rafael Espindola 9aa1fcce58 Use LTO_CODEGEN_PIC_MODEL_DYNAMIC for PIE. This requirest a git version of
gold to work. Since the enum value LDPO_PIE has just been added to plugin-api.h,
use a numeric constant for now so that we don't require an unreleased
version of gold to build.

llvm-svn: 158402
2012-06-13 13:30:24 +00:00
Benjamin Kramer 2642615c60 Object file output from llc isn't experimental anymore.
llvm-svn: 158305
2012-06-11 09:40:10 +00:00
Michael J. Spencer 838e5add7e [llvm-nm] Update documentation to cover object file support and arguments.
llvm-svn: 158120
2012-06-06 23:34:10 +00:00
Benjamin Kramer 009b1c1cf1 Round 2 of dead private variable removal.
LLVM is now -Wunused-private-field clean except for
- lib/MC/MCDisassembler/Disassembler.h. Not sure why it keeps all those unaccessible fields.
- gtest.

llvm-svn: 158096
2012-06-06 19:47:08 +00:00
Benjamin Kramer 628a39faa3 Remove unused private fields found by clang's new -Wunused-private-field.
There are some that I didn't remove this round because they looked like
obvious stubs. There are dead variables in gtest too, they should be
fixed upstream.

llvm-svn: 158090
2012-06-06 18:25:08 +00:00
David Blaikie 787705ae0d Reinstate -O3 for LTO.
This broke in r144788 when the CodeGenOpt option was moved from everywhere else
(specifically, from addPassesToEmitFile) to createTargetMachine. Since
LTOCodeGenerator wasn't passing the 4th argument, when the 4th parameter became
the 3rd, it silently continued to compile (int->bool conversion) but meant
something completely different.

This change preserves the existing (accidental) and previous (default)
semantics of the addPassesToEmitFile and restores the previous/intended
CodeGenOpt argument by passing it appropriately to createTargetMachine.

(discovered by pending changes to -Wconversion to catch constant->bool
conversions)

llvm-svn: 157705
2012-05-30 18:42:51 +00:00
Bob Wilson 33e5188c27 Add an insertPass API to TargetPassConfig. <rdar://problem/11498613>
Besides adding the new insertPass function, this patch uses it to
enhance the existing -print-machineinstrs so that the MachineInstrs
after a specific pass can be printed.

Patch by Bin Zeng!

llvm-svn: 157655
2012-05-30 00:17:12 +00:00
Stepan Dyatkovskiy 58107dd547 ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
llvm-svn: 157612
2012-05-29 12:26:47 +00:00
Benjamin Kramer 76004e69a6 Plug a leak when using MCJIT.
Found by valgrind.

llvm-svn: 157160
2012-05-20 17:24:08 +00:00
Benjamin Kramer e22b877e20 Remove extra semicolons.
llvm-svn: 157118
2012-05-19 16:44:12 +00:00
Stepan Dyatkovskiy 79a0d80d51 Ordinary PR1255 patch: DifferenceEngine and CPPBackend adopted to the new SwitchInst methods.
llvm-svn: 157112
2012-05-19 13:14:30 +00:00
Jim Grosbach 4b63d2ae1d Refactor data-in-code annotations.
Use a dedicated MachO load command to annotate data-in-code regions.
This is the same format the linker produces for final executable images,
allowing consistency of representation and use of introspection tools
for both object and executable files.

Data-in-code regions are annotated via ".data_region"/".end_data_region"
directive pairs, with an optional region type.

data_region_directive := ".data_region" { region_type }
region_type := "jt8" | "jt16" | "jt32" | "jta32"
end_data_region_directive := ".end_data_region"

The previous handling of ARM-style "$d.*" labels was broken and has
been removed. Specifically, it didn't handle ARM vs. Thumb mode when
marking the end of the section.

rdar://11459456

llvm-svn: 157062
2012-05-18 19:12:01 +00:00
Kevin Enderby badd100c26 Fixed a bug in llvm-objdump when disassembling using -macho option for a binary
containing no symbols.  Fixed the crash and fixed it not disassembling anything.

llvm-svn: 157031
2012-05-18 00:13:56 +00:00
Danil Malyshev 8c17fbd6c1 Added LLIMCJITMemoryManager to the lli. This manager will be used for MCJIT instead of DefaultJIMMemoryManager.
It's more flexible for MCJIT tasks, in addition it's provides a invalidation instruction cache for code sections which will be used before JIT code will be executed.

llvm-svn: 156933
2012-05-16 18:50:11 +00:00
Chandler Carruth d8c08c2111 Teach the 'opt' tool about '-Os' and '-Oz', corresponding to the Clang
options, to enable easier testing of the innards of LLVM that are
enabled by such optimization strategies.

Note that this doesn't provide the (much needed) function attribute
support for -Oz (as opposed to -Os), but still seems like a positive
step to better test the logic that Clang currently relies on.

Patch by Patrik Hägglund.

llvm-svn: 156913
2012-05-16 08:32:49 +00:00
Daniel Dunbar f1ab402ecd llvm-config: Use sys::fs::equivalent instead of string comparison.
- Hopefully fixes PR11600 (untested).

llvm-svn: 156865
2012-05-15 22:07:18 +00:00
Kevin Enderby edd5872f33 Fixed a bug in llvm-objdump when disassembling using -macho option for a binary
that has more than one symbol.  The last symbol was not being disassembled to
the end of the section.

llvm-svn: 156840
2012-05-15 18:57:14 +00:00
Daniel Dunbar c364d68bf2 llvm-build: Add support for non-installed libraries (e.g., gtest).
- These libraries are only reported by llvm-config when run from a development
   tree.

llvm-svn: 156838
2012-05-15 18:44:17 +00:00
Jim Grosbach c3b0427921 Allow MCCodeEmitter access to the target MCRegisterInfo.
Add the MCRegisterInfo to the factories and constructors.

Patch by Tom Stellard <Tom.Stellard@amd.com>.

llvm-svn: 156828
2012-05-15 17:35:52 +00:00
Rafael Espindola 5f4b32f9d7 Fix a use after free when the streamer is destroyed. Fixes pr12622.
llvm-svn: 156606
2012-05-11 03:42:13 +00:00
Bob Wilson 7789aae96d Do not install llvm-config-host for cross-builds of clang. rdar://11317847
My previous change to install llvm-config-host for cross-builds resulted
in that file being installed even when the normal llvm-config was not
installed, e.g., when building the install-clang target.  Daniel suggested
this alternative, which solves the immediate problem and also avoids the gunk
in the top-level makefile.

llvm-svn: 156448
2012-05-09 00:07:02 +00:00
Kevin Enderby fe3d005ca5 Fix it so llvm-objdump -arch does accept x86 and x86-64 as valid arch names.
PR12731.  Patch by Meador Inge!

llvm-svn: 156444
2012-05-08 23:38:45 +00:00
Chandler Carruth 0fde00150d Move the CodeExtractor utility to a dedicated header file / source file,
and expose it as a utility class rather than as free function wrappers.

The simple free-function interface works well for the bugpoint-specific
pass's uses of code extraction, but in an upcoming patch for more
advanced code extraction, they simply don't expose a rich enough
interface. I need to expose various stages of the process of doing the
code extraction and query information to decide whether or not to
actually complete the extraction or give up.

Rather than build up a new predicate model and pass that into these
functions, just take the class that was actually implementing the
functions and lift it up into a proper interface that can be used to
perform code extraction. The interface is cleaned up and re-documented
to work better in a header. It also is now setup to accept the blocks to
be extracted in the constructor rather than in a method.

In passing this essentially reverts my previous commit here exposing
a block-level query for eligibility of extraction. That is no longer
necessary with the more rich interface as clients can query the
extraction object for eligibility directly. This will reduce the number
of walks of the input basic block sequence by quite a bit which is
useful if this enters the normal optimization pipeline.

llvm-svn: 156163
2012-05-04 10:18:49 +00:00
Pete Cooper 28fb4fc91b PR12729: Change 'llvm-objdump' to display the available targets.
Patch by Meador Inge.

llvm-svn: 156128
2012-05-03 23:20:10 +00:00
John McCall 2a78400664 Fix unintentional use of operator bool.
llvm-svn: 155978
2012-05-02 05:39:10 +00:00
Eli Bendersky 968b63c72d Remove redundant line (the memory manager is set above to the same object
if !ForceInterpreteri). It has no effect (apart from a memory leak...)

llvm-svn: 155792
2012-04-29 11:14:59 +00:00
Evan Cheng 86bd889942 DumpSegment64Command() wasn't returning correct result. Caught by static analyzer. rdar://11329354
llvm-svn: 155669
2012-04-26 22:07:28 +00:00
Michael J. Spencer e734f5417f [CMake] Restructure how Clang, Polly and other external projects get included.
While making lld build under the tools directory I decided to refactor how this
works.

There is now a macro, add_llvm_external_project, which takes the name of the
expected subdirectory. This sets up two CMake options.

 * LLVM_EXTERNAL_${NAME}_SOURCE_DIR
     This is the path to the source. It defaults to
     ${CMAKE_CURRENT_SOURCE_DIR}/${name}.
 * LLVM_EXTERNAL_${NAME}_BUILD
     Enable and disable building the tool as part of LLVM.

I chose LLVM_EXTERNAL_${NAME} as a prefix so they all show up together in the
GUI.

llvm-svn: 155654
2012-04-26 19:43:35 +00:00
Chris Lattner 07d9073df2 openbsd doesn't support soname, patch by Brad Smith!
llvm-svn: 155536
2012-04-25 06:37:20 +00:00
Michael J. Spencer 9125493efe Remove llvm-ld and llvm-stub (which is only used by llvm-ld).
llvm-ld is no longer useful and causes confusion and so it is being removed.

* Does not work very well on Windows because it must call a gcc like driver to
  assemble and link.
* Has lots of hard coded paths which are wrong on many systems.
* Does not understand most of ld's options.
* Can be partially replaced by llvm-link | opt | {llc | as, llc -filetype=obj} |
  ld, or fully replaced by Clang.

I know of no production use of llvm-ld, and hacking use should be
replaced by Clang's driver.

llvm-svn: 155147
2012-04-19 19:27:54 +00:00
Nick Lewycky b0e9789899 Move the JIT flags from llc to lli. These flags showed up as part of moving
backend flags in TargetOptions.h into their own class in r145714.

llvm-svn: 154993
2012-04-18 08:34:12 +00:00
Joe Groff 1b73869a9b allow opt to take a -mtriple option
llvm-svn: 154959
2012-04-17 23:05:48 +00:00
Richard Barton def81b9155 Add -disassemble support for -show-inst and -show-encode capability llvm-mc. Also refactor so all MC paraphernalia are created once for all uses as much as possible.
The test change is to account for the fact that the default disassembler behaviour has changed with regards to specifying the assembly syntax to use.

llvm-svn: 154809
2012-04-16 11:32:10 +00:00
Rafael Espindola 0ecb8faa7c Remove lto_codegen_set_whole_program_optimization. It is a work in progress,
so we don't want it to show up in the stable 3.1 interface.

While at it, add a comment about why LTOCodeGenerator manually creates the
internalize pass.

llvm-svn: 154807
2012-04-16 10:58:38 +00:00
Craig Topper a6e377f34f Make member variables of AsmToken private. Remove unnecessary forward declarations. Remove an unnecessary include.
llvm-svn: 154775
2012-04-15 22:00:22 +00:00
Nadav Rotem aeacc17d50 Do not convert between fp128 <-> ppc_fp128 since there is no legal cast conversion between the two.
Patch by nobled <nobled@dreamwidth.org>

llvm-svn: 154772
2012-04-15 20:17:14 +00:00
Sylvestre Ledru 14ada94682 Fix the build under Debian GNU/Hurd.
Thanks to Pino Toscano for the patch

llvm-svn: 154500
2012-04-11 15:35:36 +00:00
Dylan Noblesmith 68f310df58 llvm-stress: stop abusing ConstantFP::get()
ConstantFP::get(Type*, double) is unreliably host-specific:
it can't handle a type like PPC128 on an x86 host. It even
has a comment to that effect: "This should only be used for
simple constant values like 2.0/1.0 etc, that are
known-valid both as host double and as the target format."

Instead, use APFloat. While we're at it, randomize the floating
point value more thoroughly; it was previously limited
to the range 0 to 2**19 - 1.

PR12451.

llvm-svn: 154446
2012-04-10 22:44:51 +00:00
Dylan Noblesmith 2a592dcc46 llvm-stress: don't make vectors of x86_mmx type
LangRef.html says:
"There are no arrays, vectors or constants of this type."

This was hitting assertions when passing the -generate-x86-mmx
option.

PR12452.

llvm-svn: 154445
2012-04-10 22:44:49 +00:00
Bill Wendling b5cedde66d Revert the 'EnableInitializing' flag. There is debate on whether we should run that pass by default in LTO.
llvm-svn: 154356
2012-04-09 23:16:51 +00:00
Bill Wendling 383fda29be Apply the scope restrictions after parsing the command line options. There may be some which are used in that function.
llvm-svn: 154348
2012-04-09 22:18:01 +00:00
Bill Wendling deffc42d63 s/lto_codegen_whole_program_optimization/lto_codegen_set_whole_program_optimization/
llvm-svn: 154312
2012-04-09 08:32:21 +00:00
Bill Wendling 8a49d049e1 Add a hook to turn on the internalize pass through the LTO interface.
llvm-svn: 154306
2012-04-09 05:26:48 +00:00
Chandler Carruth ede4a8aa2b Teach LLVM about a PIE option which, when enabled on top of PIC, makes
optimizations which are valid for position independent code being linked
into a single executable, but not for such code being linked into
a shared library.

I discussed the design of this with Eric Christopher, and the decision
was to support an optional bit rather than a completely separate
relocation model. Fundamentally, this is still PIC relocation, its just
that certain optimizations are only valid under a PIC relocation model
when the resulting code won't be in a shared library. The simplest path
to here is to expose a single bit option in the TargetOptions. If folks
have different/better designs, I'm all ears. =]

I've included the first optimization based upon this: changing TLS
models to the *Exec models when PIE is enabled. This is the LLVM
component of PR12380 and is all of the hard work.

llvm-svn: 154294
2012-04-08 17:51:45 +00:00
Bill Wendling 4f60125dd8 The internalize pass can be dangerous for LTO.
Consider the following program:

$ cat main.c
void foo(void) { }

int main(int argc, char *argv[]) {
    foo();
    return 0;
}
$ cat bundle.c 
extern void foo(void);

void bar(void) {
     foo();
}
$ clang -o main main.c
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
$ nm -m bundle.so
0000000000000f40 (__TEXT,__text) external _bar
                 (undefined) external _foo (from executable)
                 (undefined) external dyld_stub_binder (from libSystem)
$ clang -o main main.c -O4
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
Undefined symbols for architecture x86_64:
  "_foo", referenced from:
      _bar in bundle-elQN6d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The linker was told that the 'foo' in 'main' was 'internal' and had no uses, so
it was dead stripped.

Another situation is something like:

define void @foo() {
  ret void
}

define void @bar() {
  call asm volatile "call _foo" ...
  ret void
}

The only use of 'foo' is inside of an inline ASM call. Since we don't look
inside those for uses of functions, we don't specify this as a "use."

Get around this by not invoking the 'internalize' pass by default. This is an
admitted hack for LTO correctness.
<rdar://problem/11185386>

llvm-svn: 154124
2012-04-05 21:26:44 +00:00
Anton Korobeynikov d0b458d694 Set soname for FreeBSD as well.
Patch by Bernard Cafarelli!

llvm-svn: 153965
2012-04-03 19:48:31 +00:00
Bill Wendling 32867652c9 Reformatting. No functionality change.
llvm-svn: 153928
2012-04-03 03:56:52 +00:00
Bill Wendling 932b992888 Add an option to turn off the expensive GVN load PRE part of GVN.
llvm-svn: 153902
2012-04-02 22:16:50 +00:00
Bill Wendling 71b19bbdc8 Hack the hack. If we have a situation where an ASM object is defined but isn't
reflected in the LLVM IR (as a declare or something), then treat it like a data
object.

N.B. This isn't 100% correct. The ASM parser should supply more information so
that we know what type of object it is, and what attributes it should have.

llvm-svn: 153870
2012-04-02 10:01:21 +00:00
Craig Topper 54bfde79db Make MCInstrInfo available to the MCInstPrinter. This will be used to remove getInstructionName and the static data it contains since the same tables are already in MCInstrInfo.
llvm-svn: 153860
2012-04-02 06:09:36 +00:00
Bill Wendling 3a0bcf06ef It could come about that we parse the inline ASM before we get a potential
definition for it. In that case, we want to wait for the potential definition
before we create a symbol for it.

llvm-svn: 153859
2012-04-02 03:33:31 +00:00
Bill Wendling 62152e7389 Move trivial functions into the class definition.
llvm-svn: 153810
2012-03-31 11:25:18 +00:00
Bill Wendling 4f87c4fdff Trim headers.
llvm-svn: 153809
2012-03-31 11:22:30 +00:00
Bill Wendling 0e1824cb9e Indent according to LLVM's style guide.
llvm-svn: 153808
2012-03-31 11:15:43 +00:00
Bill Wendling dbc02d84ce Cleanup whitespace and trim some of the #includes.
llvm-svn: 153807
2012-03-31 11:10:35 +00:00
Bill Wendling 5c15044f47 These strings aren't 'const char *' but 'char *'.
llvm-svn: 153805
2012-03-31 10:51:45 +00:00
Bill Wendling 39d942bf91 Cleanup whitespace.
llvm-svn: 153804
2012-03-31 10:50:14 +00:00
Bill Wendling 534a6588f2 Free the codegen options when deleting LTO code generator object.
llvm-svn: 153803
2012-03-31 10:49:43 +00:00
Bill Wendling 152e4739a2 Cleanup whitespace and remove unneeded 'extern' keyword on function definitions.
llvm-svn: 153802
2012-03-31 10:44:20 +00:00
Bill Wendling 8f6c8a971a * Set the scope attributes for the ASM symbol we added to be the value passed
into the function.
* Reorder some header files.

llvm-svn: 153783
2012-03-30 23:26:06 +00:00
Danil Malyshev 70d22ccb22 Re-factored RuntimeDyLd:
1. The main works will made in the RuntimeDyLdImpl with uses the ObjectFile class. RuntimeDyLdMachO and RuntimeDyLdELF now only parses relocations and resolve it. This is allows to make improvements of the RuntimeDyLd more easily. In addition the support for COFF can be easily added.

2. Added ARM relocations to RuntimeDyLdELF.

3. Added support for stub functions for the ARM, allowing to do a long branch.

4. Added support for external functions that are not loaded from the object files, but can be loaded from external libraries. Now MCJIT can correctly execute the code containing the printf, putc, and etc.

5. The sections emitted instead functions, thanks Jim Grosbach. MemoryManager.startFunctionBody() and MemoryManager.endFunctionBody() have been removed.
6. MCJITMemoryManager.allocateDataSection() and MCJITMemoryManager. allocateCodeSection() used JMM->allocateSpace() instead of JMM->allocateCodeSection() and JMM->allocateDataSection(), because I got an error: "Cannot allocate an allocated block!" with object file contains more than one code or data sections.

llvm-svn: 153754
2012-03-30 16:45:19 +00:00
Bill Wendling 36cbf03b9b Cleanup whitespace. Doxygenize comments. And indent to llvm coding standards.
llvm-svn: 153740
2012-03-30 10:29:38 +00:00
Bill Wendling 76fdc4b885 Revert r153694. It was causing failures in the buildbots.
llvm-svn: 153701
2012-03-29 23:23:59 +00:00
Danil Malyshev 3548eaf896 Re-factored RuntimeDyld.
Added ExecutionEngine/MCJIT tests.

llvm-svn: 153694
2012-03-29 21:46:18 +00:00
Bill Wendling 9ee2d338fb Make some headway towards compiling all of LLVM.
Module-level ASM may contain definitions of functions and globals. However, we
were not telling the linker that these globals had definitions. As far as it was
concerned, they were just declarations.

Attempt to resolve this by inserting module-level ASM functions and globals into
the '_symbol' set so that the linker will know that they have values.

This gets us further towards our goal of compiling LLVM, but it still has
problems when linking libLTO.dylib because of the `-dead_strip' flag that's
passed to the linker.

<rdar://problem/11124216>

llvm-svn: 153638
2012-03-29 08:27:32 +00:00
Bill Wendling 2b743c3f8a Cleanup whitespace.
llvm-svn: 153634
2012-03-29 04:28:00 +00:00
Bill Wendling 763acfcb8a Cache the end() iterator.
llvm-svn: 153632
2012-03-29 03:34:57 +00:00
Bill Wendling 7e58b3862a Cleanup some whitespaces.
llvm-svn: 153612
2012-03-28 23:12:18 +00:00
Danil Malyshev bfee542cce Move getPointerToNamedFunction() from JIT/MCJIT to JITMemoryManager.
llvm-svn: 153607
2012-03-28 21:46:36 +00:00
Bill Wendling d58ed73288 Inline function into its one caller.
llvm-svn: 153598
2012-03-28 20:48:49 +00:00
Bill Wendling fb44050e8a Reformat the LTOModule code to be more inline with LLVM's coding standards. Add
a bunch of comments for the various functions. No intended functionality change.

llvm-svn: 153595
2012-03-28 20:46:54 +00:00
Bill Wendling 2337cb7e6e Some whitespace cleanup.
llvm-svn: 153567
2012-03-28 04:17:34 +00:00
Benjamin Kramer a5177e63a6 Include cctype for std::isprint.
This should unbreak the msvc build.

llvm-svn: 153329
2012-03-23 11:49:32 +00:00
Anton Korobeynikov 17327b5852 Add soname to LLVM shared library on Linux. Probably the same stuff is necessary for *BSD.
Patch from Mageia!

llvm-svn: 153324
2012-03-23 10:00:42 +00:00
Eric Christopher 64a232343a Remove the C backend.
llvm-svn: 153307
2012-03-23 05:50:46 +00:00
Chandler Carruth e26dafeb79 Revert a series of commits to MCJIT to get the build working in CMake
(and hopefully on Windows). The bots have been down most of the day
because of this, and it's not clear to me what all will be required to
fix it.

The commits started with r153205, then r153207, r153208, and r153221.
The first commit seems to be the real culprit, but I couldn't revert
a smaller number of patches.

When resubmitting, r153207 and r153208 should be folded into r153205,
they were simple build fixes.

llvm-svn: 153241
2012-03-22 05:44:06 +00:00
Danil Malyshev 70186bef8b Re-factored RuntimeDyld.
Added ExecutionEngine/MCJIT tests.

llvm-svn: 153221
2012-03-21 21:06:29 +00:00
Danil Malyshev 25753cd972 (no commit message)
llvm-svn: 153208
2012-03-21 19:13:08 +00:00
Chris Lattner 0a2ac90525 Fix two bugpoint bugs:
1) opt is not usually in the same path as the target program. Even for
the bugpoint as a standalone app, it should be more portable to search
in PATH, isn't it?
2) bugpoint driver accounts opt plugins, but does not list them in the
final output command.

Patch by Dmitry Mikushin!

llvm-svn: 153066
2012-03-19 23:42:11 +00:00
Chris Lattner 633ab168a8 fix PR12301 - llvm-bcanalyze should print to stdout, not stderr (except for errors).
llvm-svn: 153065
2012-03-19 23:40:48 +00:00
Eli Bendersky 5262ad2afa Add profiling support for Intel Parallel Amplifier XE (VTune) for JITted code in LLVM.
Also refactor the existing OProfile profiling code to reuse the same interfaces with the VTune profiling code.
In addition, unit tests for the profiling interfaces were added.

This patch was prepared by Andrew Kaylor and Daniel Malea, and reviewed in the llvm-commits list by Jim Grosbach

llvm-svn: 152620
2012-03-13 08:33:15 +00:00
Stepan Dyatkovskiy 97b02fc1b3 llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.

llvm-svn: 152532
2012-03-11 06:09:17 +00:00
Benjamin Kramer 82803112da Fix uses of the C99 PRI format macros not to conflict with C++11 UDLs.
llvm-svn: 152474
2012-03-10 02:04:38 +00:00
David Meyer 6c614bf717 Support reading GNU symbol versions in ELFObjectFile
* Add enums and structures for GNU version information.
* Implement extraction of that information on a per-symbol basis (ELFObjectFile::getSymbolVersion).
* Implement a generic interface, GetELFSymbolVersion(), for getting the symbol version from the ObjectFile (hides the templating).
* Have llvm-readobj print out the version, when available.
* Add a test for the new feature: readobj-elf-versioning.test

llvm-svn: 152436
2012-03-09 20:59:52 +00:00
Duncan Sands 48992554cc Have llvm-mc --version print the list of registered targets like llc does.
Patch by jey.

llvm-svn: 152315
2012-03-08 14:24:32 +00:00
Stepan Dyatkovskiy 5b648afb4d Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152297
2012-03-08 07:06:20 +00:00
Jim Grosbach fd93a59557 Make MCRegisterInfo available to the the MCInstPrinter.
Used to allow context sensitive printing of super-register or sub-register
references.

llvm-svn: 152043
2012-03-05 19:33:20 +00:00
David Meyer ae11a78be2 Fix comments for llvm-readobj, remove extraneous headers
llvm-svn: 151957
2012-03-02 23:43:51 +00:00
David Meyer c429b80da1 [Object]
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object.

llvm-svn: 151845
2012-03-01 22:19:54 +00:00
David Meyer 2fc34c5f84 [Object]
* Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile.
* Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable.
* Implement this new interface completely for ELF, leave stubs for COFF and MachO.
* Add 'llvm-readobj' tool for dumping ObjectFile information.

llvm-svn: 151785
2012-03-01 01:36:50 +00:00
David Meyer 7e4b976c36 [Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ST_Undefined. Implement these completely for ELF.
Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type
is unknown, not that the symbol is undefined. (For that, use ST_Undefined).

llvm-svn: 151696
2012-02-29 02:11:55 +00:00
Derek Schuff 56b662ce0f Make MemoryObject accessor members const again
llvm-svn: 151687
2012-02-29 01:09:06 +00:00
Daniel Dunbar beb342539c Fix some stray semi-colons.
llvm-svn: 151680
2012-02-29 00:20:33 +00:00
David Meyer 1df4b84db4 In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), and isWeak(), with a bitset of flags.
llvm-svn: 151670
2012-02-28 23:47:53 +00:00
Michael J. Spencer 8c4729fd44 [Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.
Add -D option to llvm-nm to dump dynamic symbols.

Patch by David Meyer.

llvm-svn: 151600
2012-02-28 00:40:37 +00:00
Hal Finkel c947412fae Allow llvm-stress to optionally generate the other floating-point types (half, ppcf128, mmx, etc.)
llvm-svn: 151596
2012-02-27 23:59:33 +00:00
Nadav Rotem e4972ddea4 Add support for random constant vectors.
Patch by Joey Gouly.

llvm-svn: 151489
2012-02-26 13:56:18 +00:00
Nadav Rotem 115ec82ec7 Style fix: Remove unneeded parentheses.
llvm-svn: 151488
2012-02-26 12:34:17 +00:00
Nadav Rotem 63ff91d22a Fix a bug in the code that checks if a store value is a vector of i1s
llvm-svn: 151487
2012-02-26 12:00:22 +00:00
Nadav Rotem dc497b6c1c Fix compilation on MSVC. Rename "_BB" to "Block"
Thanks zygoloid.

llvm-svn: 151481
2012-02-26 08:59:25 +00:00
Nadav Rotem 089cf4211c fix a copy-and-paste error in the docs
llvm-svn: 151480
2012-02-26 08:43:43 +00:00
Nadav Rotem 78bda89412 Add a random .LL file generator to stress-test different llvm components.
llvm-svn: 151479
2012-02-26 08:35:53 +00:00
Duncan Sands f320be8521 An easy case where GCC should really be able to work out that the value is only
used if IsInDevelopmentTree is 'true'.  But it doesn't, so help it out.

llvm-svn: 151244
2012-02-23 08:25:25 +00:00
Eli Friedman 9f18ea84af Improve handling of blockaddresses in bugpoint when splitting a module. Patch by Daniel Reynaud.
llvm-svn: 151115
2012-02-22 01:43:47 +00:00
Ahmed Charles 636a3d618c Remove dead code. Improve llvm_unreachable text. Simplify some control flow.
llvm-svn: 150918
2012-02-19 11:37:01 +00:00
Andrew Trick d3f8fe81f4 RegAlloc superpass: includes phi elimination, coalescing, and scheduling.
Creates a configurable regalloc pipeline.

Ensure specific llc options do what they say and nothing more: -reglloc=... has no effect other than selecting the allocator pass itself. This patch introduces a new umbrella flag, "-optimize-regalloc", to enable/disable the optimizing regalloc "superpass". This allows for example testing coalscing and scheduling under -O0 or vice-versa.

When a CodeGen pass requires the MachineFunction to have a particular property, we need to explicitly define that property so it can be directly queried rather than naming a specific Pass. For example, to check for SSA, use MRI->isSSA, not addRequired<PHIElimination>.

CodeGen transformation passes are never "required" as an analysis

ProcessImplicitDefs does not require LiveVariables.

We have a plan to massively simplify some of the early passes within the regalloc superpass.

llvm-svn: 150226
2012-02-10 04:10:36 +00:00
Hal Finkel 61f210b5c0 Allow bugpoint to recognize -bb-vectorize
llvm-svn: 150003
2012-02-07 21:11:12 +00:00
Derek Schuff 8b2dcad4b5 Enable streaming of bitcode
This CL delays reading of function bodies from initial parse until
materialization, allowing overlap of compilation with bitcode download.

llvm-svn: 149918
2012-02-06 22:30:29 +00:00
Bill Wendling b03c224e10 [unwind removal] Remove a the obsolete 'unwind' enum value.
llvm-svn: 149911
2012-02-06 21:55:35 +00:00
Chris Lattner cf9e8f6968 reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul.  Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.

llvm-svn: 149800
2012-02-05 02:29:43 +00:00
Cameron Zwarich 88cc16aeb5 Allow command-line overrides of the target triple with the Mach-O
disassembler, just like the generic disassembler.

llvm-svn: 149681
2012-02-03 06:35:22 +00:00
Cameron Zwarich 54478a514c Do the same fix as r149667, but for the Mach-O disassembler.
llvm-svn: 149674
2012-02-03 05:42:17 +00:00
Cameron Zwarich 07f0f77629 Fix llvm-objdump disassembly for interesting Mach-O binaries, e.g. any MacOS
dylib. This regressed with r145408. I will try to make a test case and add it
so that this doesn't happen again.

llvm-svn: 149667
2012-02-03 04:13:37 +00:00
Stepan Dyatkovskiy 513aaa5691 SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
llvm-svn: 149481
2012-02-01 07:49:51 +00:00
Argyrios Kyrtzidis 17c981a45b Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are:

r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365

llvm-svn: 149470
2012-02-01 04:51:17 +00:00
Hal Finkel c34e51132c Add a basic-block autovectorization pass.
This is the initial checkin of the basic-block autovectorization pass along with some supporting vectorization infrastructure.
Special thanks to everyone who helped review this code over the last several months (especially Tobias Grosser).

llvm-svn: 149468
2012-02-01 03:51:43 +00:00
Chris Lattner f1179025ae eliminate the "string" form of ConstantArray::get, using
ConstantDataArray::getString instead.

llvm-svn: 149365
2012-01-31 06:18:43 +00:00
Chris Lattner 841d7a2434 update this to ConstantDataArray. There are no tests and this isn't using the preferred functionality for ripping apart strings, so I have no way to test this.
llvm-svn: 149361
2012-01-31 06:03:46 +00:00
Chris Lattner 372dd1ea18 Add bitcode reader and writer support for ConstantDataAggregate, which
should be feature complete now.  Lets see if it works.

llvm-svn: 149215
2012-01-30 00:51:16 +00:00
Jim Grosbach b591277c4a Better diagnostic for malformed .org assembly directive.
Provide source line number information.

llvm-svn: 149101
2012-01-27 00:37:08 +00:00
Jim Grosbach 8ff25d6968 llvm-mc pass through SourceMgr to MCContext.
llvm-svn: 149091
2012-01-26 23:20:07 +00:00
Peter Collingbourne 76e1c8c9ae llvm-config: Add support for CMake build trees in which the build
mode does not form part of the path.

llvm-svn: 149010
2012-01-26 01:31:38 +00:00
David Blaikie 46a9f016c5 More dead code removal (using -Wunreachable-code)
llvm-svn: 148578
2012-01-20 21:51:11 +00:00
Nick Lewycky ecc0084f72 Add a TargetOption for disabling tail calls.
llvm-svn: 148442
2012-01-19 00:34:10 +00:00
David Blaikie b48ed1a4cb Remove unreachable code. (replace with llvm_unreachable to help GCC where necessary)
llvm-svn: 148284
2012-01-17 04:43:56 +00:00
Jim Grosbach eff0a40d7e MCJIT support for non-function sections.
Move to a by-section allocation and relocation scheme. This allows
better support for sections which do not contain externally visible
symbols.

Flesh out the relocation address vs. local storage address separation a
bit more as well. Remote process JITs use this to tell the relocation
resolution code where the code will live when it executes.

The startFunctionBody/endFunctionBody interfaces to the JIT and the
memory manager are deprecated. They'll stick around for as long as the
old JIT does, but the MCJIT doesn't use them anymore.

llvm-svn: 148258
2012-01-16 22:26:39 +00:00
Eli Bendersky 4c647587b1 Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches.
Patch developed by Andy Kaylor and Daniel Malea. Reviewed on llvm-commits.

llvm-svn: 148231
2012-01-16 08:56:09 +00:00
Jim Grosbach 9ac4562bea 80 columns.
llvm-svn: 147970
2012-01-11 21:23:35 +00:00
Jim Grosbach 93076bc83f lli should only create memmgr when JITing.
llvm-svn: 147969
2012-01-11 21:19:49 +00:00
Jim Grosbach bf570b98f2 lli should create a JIT memory manager.
Previously let the JITEmitter do it. That's rather odd, and doesn't play nice
with the MCJIT, so move the (trivial) logic up.

llvm-svn: 147967
2012-01-11 21:12:51 +00:00
David Blaikie edbb58c577 Remove unnecessary default cases in switches that cover all enum values.
llvm-svn: 147855
2012-01-10 16:47:17 +00:00
Rafael Espindola 5cb98f1062 Remove the logging streamer.
llvm-svn: 147820
2012-01-10 00:40:39 +00:00
Rafael Espindola 0708209642 Split Finish into Finish and FinishImpl to have a common place to do end of
file error checking. Use that to error on an unfinished cfi_startproc.

The error is not nice, but is already better than a segmentation fault.

llvm-svn: 147717
2012-01-07 03:13:18 +00:00
Nick Lewycky 5079e4dd0b Remove extraneous ".get()->" which is just "->". No functionality change.
llvm-svn: 147379
2011-12-30 19:17:23 +00:00
Bill Wendling 2990ec6e92 Add braces to remove silly warning.
llvm-svn: 147264
2011-12-25 06:56:22 +00:00
Rafael Espindola 2d3dac3e87 Remove unused variables.
llvm-svn: 147261
2011-12-25 01:20:19 +00:00
Dylan Noblesmith 9e5b178ecc drop unneeded config.h includes
llvm-svn: 147197
2011-12-22 23:04:07 +00:00
David Blaikie a379b18173 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146960
2011-12-20 02:50:00 +00:00
Daniel Dunbar 30a8976127 llvm-config: Fix --targets-built, I changed this to use the registry but wasn't
properly initializing the target infos. I decided it wasn't worth linking them
in for this, so just switched back to using the Makefile variable for now. We
can reconsider later if we ever get pluggable targets.

llvm-svn: 146711
2011-12-16 00:04:43 +00:00
Daniel Dunbar c7037f3f81 llvm-config: Update help text for removal of "backend" pseudo component.
llvm-svn: 146708
2011-12-15 23:43:17 +00:00
Michael J. Spencer bc96f37253 llvm-nm: refactor in order to support reading files from stdin.
llvm-svn: 146524
2011-12-13 23:17:29 +00:00
Daniel Dunbar 8889bb08b8 LLVMBuild: Introduce a common section which currently has a list of the
subdirectories to traverse into.
 - Originally I wanted to avoid this and just autoscan, but this has one key
   flaw in that new subdirectories can not automatically trigger a rerun of the
   llvm-build tool. This is particularly a pain when switching back and forth
   between trees where one has added a subdirectory, as the dependencies will
   tend to be wrong. This will also eliminates FIXME implicitly.

llvm-svn: 146436
2011-12-12 22:45:54 +00:00
Daniel Dunbar 27a7489a03 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Daniel Dunbar fbc6a892a7 llvm-config: Default to "all" if no components are specified.
- Fixes PR11530.

llvm-svn: 146388
2011-12-12 18:22:04 +00:00
Kevin Enderby e7739d484f The second part of support for generating dwarf for assembly source files. This
generates the dwarf Compile Unit DIE and a dwarf subprogram DIE for each
non-temporary label.

The next part will be to get the clang driver to enable this when assembling
a .s file.  rdar://9275556

llvm-svn: 146262
2011-12-09 18:09:40 +00:00
Chad Rosier dd4ffaec8f Update bcanalyzer to handle new USELIST_BLOCK/USELIST_CODE_ENTRY.
llvm-svn: 146079
2011-12-07 21:45:13 +00:00
Duncan Sands 851e948362 Have cmake build llvm-cov. Patch by arrowdodger.
llvm-svn: 146071
2011-12-07 20:54:41 +00:00
Duncan Sands 0f19e91a79 When doing "opt -O2" verify the bitcode like is done for
"opt -std-compile-opts".

llvm-svn: 146036
2011-12-07 17:14:20 +00:00
Jim Grosbach 78309c47c7 Tidy up.
llvm-svn: 145870
2011-12-05 23:20:14 +00:00
Nick Lewycky 50f02cb21b Move global variables in TargetMachine into new TargetOptions class. As an API
change, now you need a TargetOptions object to create a TargetMachine. Clang
patch to follow.

One small functionality change in PTX. PTX had commented out the machine
verifier parts in their copy of printAndVerify. That now calls the version in
LLVMTargetMachine. Users of PTX who need verification disabled should rely on
not passing the command-line flag to enable it.

llvm-svn: 145714
2011-12-02 22:16:29 +00:00
Daniel Dunbar ab0ad4ed1e llvm-config: Replace with C++ version (was llvm-config-2).
- Another reapply of r144300, with hopefully one last fix.

llvm-svn: 145623
2011-12-01 20:18:09 +00:00
Daniel Dunbar 5a78bb5686 llvm-config-2: Fix --cflags and --includedir which pointed at the wrong
directory when running from a build directory.

llvm-svn: 145622
2011-12-01 20:00:19 +00:00
Duncan Sands b8e6cee9ca Revert commit 145449 (ddunbar) since it is breaking the dragonegg buildbots.
Original commit message:
llvm-config: Replace with C++ version (was llvm-config-2).
 - Reapply of r144300, with lots of fixes/migration easement in between.

llvm-svn: 145582
2011-12-01 10:50:19 +00:00
Daniel Dunbar 8d5cc33ad8 llvm-config: Replace with C++ version (was llvm-config-2).
- Reapply of r144300, with lots of fixes/migration easement in between.

llvm-svn: 145449
2011-11-29 22:56:31 +00:00
Danil Malyshev cbe72fc959 Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

llvm-svn: 145408
2011-11-29 17:40:10 +00:00
Daniel Dunbar b074d102a3 edis: Sink EDMain.cpp into lib/MC/MCDisassembler.
- This fixes some layering violations and matches how we handle the llvm-c lib,
   for example.

llvm-svn: 145338
2011-11-29 00:25:57 +00:00
Daniel Dunbar d690111dd4 edis: Don't do the target initialization in EDGetDisassembler, this is contrary
to the way we currently expect target selection to work -- clients are supposed
to have control over what targets are available.

llvm-svn: 145331
2011-11-29 00:06:58 +00:00
Daniel Dunbar 2266cfcc77 build/Make: edis isn't built as a shared library anymore, remove related cruft from the Makefile.
llvm-svn: 145329
2011-11-29 00:06:53 +00:00
Chandler Carruth 37ab257b88 Revert r145180 as it is causing test failures on all the bots.
Original commit message:
Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

llvm-svn: 145182
2011-11-27 10:37:47 +00:00
Danil Malyshev 2631f93f7d Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

llvm-svn: 145180
2011-11-27 10:12:52 +00:00
Chris Lattner 1c9e5678b8 remove support for reading llvm 2.9 .bc files. LLVM 3.1 is only compatible back to 3.0
llvm-svn: 145164
2011-11-27 05:48:27 +00:00
Rafael Espindola 5d03d46127 Point to libLTO with -L/PATH/ -lLTO so that it is found in the install
directory.
Patch by Markus Trippelsdorf.

llvm-svn: 145095
2011-11-23 03:07:25 +00:00