1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

4012 Commits

Author SHA1 Message Date
Stepan Dyatkovskiy
23fa9fd605 ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
llvm-svn: 157612
2012-05-29 12:26:47 +00:00
Benjamin Kramer
e42f976213 Plug a leak when using MCJIT.
Found by valgrind.

llvm-svn: 157160
2012-05-20 17:24:08 +00:00
Benjamin Kramer
ebbaac4318 Remove extra semicolons.
llvm-svn: 157118
2012-05-19 16:44:12 +00:00
Stepan Dyatkovskiy
45e3003f3c 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
343a996ca5 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
ef39671f98 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
6fbce86b24 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
6bc19df503 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
e481053e50 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
a1272a1de8 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
64c706d674 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
2e62e2f664 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
b550a4f952 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
9dd20d5063 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
97a05ec660 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
67c334679c 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
e06a862dec 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
4ceb1d12c4 Fix unintentional use of operator bool.
llvm-svn: 155978
2012-05-02 05:39:10 +00:00
Eli Bendersky
8b32c861e8 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
4be3b28946 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
fbbb8b9593 [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
f492d85ae9 openbsd doesn't support soname, patch by Brad Smith!
llvm-svn: 155536
2012-04-25 06:37:20 +00:00
Michael J. Spencer
e6c28a171e 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
750a5347ef 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
b514a28573 allow opt to take a -mtriple option
llvm-svn: 154959
2012-04-17 23:05:48 +00:00
Richard Barton
9e62efdf5f 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
3c1722e285 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
a6f7e1a202 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
7a2a2ae678 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
40d3066f8b 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
1e0746761c 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
2e2de248b0 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
f43d686dfc 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
34064d63d1 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
756a33b1e6 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
adcb1f1d29 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
11c412fd2c 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
09bb53982f 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
64a47d779a Set soname for FreeBSD as well.
Patch by Bernard Cafarelli!

llvm-svn: 153965
2012-04-03 19:48:31 +00:00
Bill Wendling
f6c626e3a9 Reformatting. No functionality change.
llvm-svn: 153928
2012-04-03 03:56:52 +00:00
Bill Wendling
1db4186413 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
ea61af7ff2 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
dbc259a436 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
8ee5b8754f 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
c0128a5e70 Move trivial functions into the class definition.
llvm-svn: 153810
2012-03-31 11:25:18 +00:00
Bill Wendling
42a700ea8a Trim headers.
llvm-svn: 153809
2012-03-31 11:22:30 +00:00
Bill Wendling
73b6dfb5c9 Indent according to LLVM's style guide.
llvm-svn: 153808
2012-03-31 11:15:43 +00:00
Bill Wendling
9850d17689 Cleanup whitespace and trim some of the #includes.
llvm-svn: 153807
2012-03-31 11:10:35 +00:00
Bill Wendling
3ca3830022 These strings aren't 'const char *' but 'char *'.
llvm-svn: 153805
2012-03-31 10:51:45 +00:00
Bill Wendling
8e34c4eea6 Cleanup whitespace.
llvm-svn: 153804
2012-03-31 10:50:14 +00:00
Bill Wendling
a8d55bf5e5 Free the codegen options when deleting LTO code generator object.
llvm-svn: 153803
2012-03-31 10:49:43 +00:00
Bill Wendling
cbcec066af Cleanup whitespace and remove unneeded 'extern' keyword on function definitions.
llvm-svn: 153802
2012-03-31 10:44:20 +00:00
Bill Wendling
188c9214c3 * 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
df8df843d9 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
619da9f4da Cleanup whitespace. Doxygenize comments. And indent to llvm coding standards.
llvm-svn: 153740
2012-03-30 10:29:38 +00:00
Bill Wendling
86e08bb6de Revert r153694. It was causing failures in the buildbots.
llvm-svn: 153701
2012-03-29 23:23:59 +00:00
Danil Malyshev
d66f6a3b28 Re-factored RuntimeDyld.
Added ExecutionEngine/MCJIT tests.

llvm-svn: 153694
2012-03-29 21:46:18 +00:00
Bill Wendling
88a497a1a9 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
55bef2d34a Cleanup whitespace.
llvm-svn: 153634
2012-03-29 04:28:00 +00:00
Bill Wendling
21b86c9017 Cache the end() iterator.
llvm-svn: 153632
2012-03-29 03:34:57 +00:00
Bill Wendling
591cf2fd07 Cleanup some whitespaces.
llvm-svn: 153612
2012-03-28 23:12:18 +00:00
Danil Malyshev
aba46febe1 Move getPointerToNamedFunction() from JIT/MCJIT to JITMemoryManager.
llvm-svn: 153607
2012-03-28 21:46:36 +00:00
Bill Wendling
02297eee5b Inline function into its one caller.
llvm-svn: 153598
2012-03-28 20:48:49 +00:00
Bill Wendling
3f5e3c9839 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
853517869b Some whitespace cleanup.
llvm-svn: 153567
2012-03-28 04:17:34 +00:00
Benjamin Kramer
48523d5774 Include cctype for std::isprint.
This should unbreak the msvc build.

llvm-svn: 153329
2012-03-23 11:49:32 +00:00
Anton Korobeynikov
9b75081b7f 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
3839c1ffd3 Remove the C backend.
llvm-svn: 153307
2012-03-23 05:50:46 +00:00
Chandler Carruth
8243f2a6d4 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
88676c0b84 Re-factored RuntimeDyld.
Added ExecutionEngine/MCJIT tests.

llvm-svn: 153221
2012-03-21 21:06:29 +00:00
Danil Malyshev
ed57f105a2 (no commit message)
llvm-svn: 153208
2012-03-21 19:13:08 +00:00
Chris Lattner
e3575252ce 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
688f466fd4 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
18a6065211 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
72fdcabd4d 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
4e38a34add 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
d29d7cfe60 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
de5bbfa4d4 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
79f3dd93b7 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
2eea383b12 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
f62e531352 Fix comments for llvm-readobj, remove extraneous headers
llvm-svn: 151957
2012-03-02 23:43:51 +00:00
David Meyer
7f21ecb667 [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
44201a2d17 [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
e9705e2949 [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
db82ff1e09 Make MemoryObject accessor members const again
llvm-svn: 151687
2012-02-29 01:09:06 +00:00
Daniel Dunbar
48cb9f3eb0 Fix some stray semi-colons.
llvm-svn: 151680
2012-02-29 00:20:33 +00:00
David Meyer
31e23de700 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
0aef1b9f18 [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
7b7047a2af 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
6eccbedc5f Add support for random constant vectors.
Patch by Joey Gouly.

llvm-svn: 151489
2012-02-26 13:56:18 +00:00
Nadav Rotem
65d5297fd2 Style fix: Remove unneeded parentheses.
llvm-svn: 151488
2012-02-26 12:34:17 +00:00
Nadav Rotem
2449d16831 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
3680054079 Fix compilation on MSVC. Rename "_BB" to "Block"
Thanks zygoloid.

llvm-svn: 151481
2012-02-26 08:59:25 +00:00
Nadav Rotem
a77007fc95 fix a copy-and-paste error in the docs
llvm-svn: 151480
2012-02-26 08:43:43 +00:00
Nadav Rotem
8ce0029942 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
65edbb72b1 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
87b4f40d41 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
745c53c2a7 Remove dead code. Improve llvm_unreachable text. Simplify some control flow.
llvm-svn: 150918
2012-02-19 11:37:01 +00:00
Andrew Trick
c3cc8fa604 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
0bf758d7ea Allow bugpoint to recognize -bb-vectorize
llvm-svn: 150003
2012-02-07 21:11:12 +00:00
Derek Schuff
f522835510 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
fa3b7c42a8 [unwind removal] Remove a the obsolete 'unwind' enum value.
llvm-svn: 149911
2012-02-06 21:55:35 +00:00
Chris Lattner
9782adedd7 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
bd8668dd55 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
994217da26 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
3bc5d59374 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
856ca370cc 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
492f34016f 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
8cf5de5774 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
a9b3505e9a eliminate the "string" form of ConstantArray::get, using
ConstantDataArray::getString instead.

llvm-svn: 149365
2012-01-31 06:18:43 +00:00
Chris Lattner
3359d8c044 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
d52c923a50 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
6280a1137f 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
28639d4913 llvm-mc pass through SourceMgr to MCContext.
llvm-svn: 149091
2012-01-26 23:20:07 +00:00
Peter Collingbourne
7d52e812ad 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
06ecc99a56 More dead code removal (using -Wunreachable-code)
llvm-svn: 148578
2012-01-20 21:51:11 +00:00
Nick Lewycky
c1e7e2eaf6 Add a TargetOption for disabling tail calls.
llvm-svn: 148442
2012-01-19 00:34:10 +00:00
David Blaikie
2526691971 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
acbad56e7f 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
973d44eb7c 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
6c877fabd5 80 columns.
llvm-svn: 147970
2012-01-11 21:23:35 +00:00
Jim Grosbach
1a1297e93d lli should only create memmgr when JITing.
llvm-svn: 147969
2012-01-11 21:19:49 +00:00
Jim Grosbach
f3cc53b916 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
8d47bb30e3 Remove unnecessary default cases in switches that cover all enum values.
llvm-svn: 147855
2012-01-10 16:47:17 +00:00
Rafael Espindola
6b018e0b1d Remove the logging streamer.
llvm-svn: 147820
2012-01-10 00:40:39 +00:00
Rafael Espindola
2d545fa143 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
ed7856bd5b Remove extraneous ".get()->" which is just "->". No functionality change.
llvm-svn: 147379
2011-12-30 19:17:23 +00:00
Bill Wendling
82ca4569b9 Add braces to remove silly warning.
llvm-svn: 147264
2011-12-25 06:56:22 +00:00
Rafael Espindola
b598485fb9 Remove unused variables.
llvm-svn: 147261
2011-12-25 01:20:19 +00:00
Dylan Noblesmith
40dea4f20c drop unneeded config.h includes
llvm-svn: 147197
2011-12-22 23:04:07 +00:00
David Blaikie
576aba04f1 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
68de82c003 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
f961e224ec 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
02c5e58b03 llvm-nm: refactor in order to support reading files from stdin.
llvm-svn: 146524
2011-12-13 23:17:29 +00:00
Daniel Dunbar
b72534060e 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
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Daniel Dunbar
e6cf061866 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
63cf89d532 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
e3225d38e4 Update bcanalyzer to handle new USELIST_BLOCK/USELIST_CODE_ENTRY.
llvm-svn: 146079
2011-12-07 21:45:13 +00:00
Duncan Sands
cc43a2e4fd Have cmake build llvm-cov. Patch by arrowdodger.
llvm-svn: 146071
2011-12-07 20:54:41 +00:00
Duncan Sands
b5e4020ddb 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
9112c6a3ee Tidy up.
llvm-svn: 145870
2011-12-05 23:20:14 +00:00
Nick Lewycky
7d0d3c2d58 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
3c06b26f09 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
884620418e 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
84beef543d 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
7dcd93d4fa 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
5ce4e1a9d3 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
7c4510b4de 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
85c716fd09 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
f1c738305f 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
e5e455c97f 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
3bbe062799 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
03be469732 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
17a991f91c 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
Evan Cheng
2b239cbcf6 Sink codegen optimization level into MCCodeGenInfo along side relocation model
and code model. This eliminates the need to pass OptLevel flag all over the
place and makes it possible for any codegen pass to use this information.

llvm-svn: 144788
2011-11-16 08:38:26 +00:00
Michael J. Spencer
70bc3d6855 llvm-objdump: Ignore non-objects in archives.
llvm-svn: 144755
2011-11-16 01:24:41 +00:00
Benjamin Kramer
a2f57dee6d Remove all remaining uses of Value::getNameStr().
llvm-svn: 144648
2011-11-15 16:27:03 +00:00
Daniel Dunbar
f7435b501a llvm-config-2: Detect when we are running out of a BuildTools development tree, so that we can always provide library/include information for the real build directory.
llvm-svn: 144420
2011-11-11 22:59:47 +00:00
Daniel Dunbar
efa02a0c3d LLVMBuild: Add description files for the LLVM tools.
llvm-svn: 144417
2011-11-11 22:59:39 +00:00
Benjamin Kramer
a52be4ff03 Clients are responsible for initializing the targets, remove it from the disassembler API.
This will break users of the LLVMCreateDisasm API (not that I know of any). They have to call the 
LLVMInitializeAll* functions from llvm-c/Target.h themselves now. edis' C API in all its horribleness 
should be unaffected.

llvm-svn: 144385
2011-11-11 13:20:40 +00:00
Daniel Dunbar
745409c62f Revert r144300 "llvm-config: Replace with C++ version (was llvm-config-2).",
which didn't appear ready for prime time.

llvm-svn: 144309
2011-11-10 19:59:35 +00:00
Daniel Dunbar
e9f2479115 llvm-config: Replace with C++ version (was llvm-config-2).
llvm-svn: 144300
2011-11-10 18:49:59 +00:00
Daniel Dunbar
61ee56243c llvm-config-2: Use USEDLIBS directly instead of LINK_COMPONENTS, which will
require this tool to resolve (currently).

llvm-svn: 144299
2011-11-10 18:49:50 +00:00
Daniel Dunbar
45b3cafb6a llvm-config-2: Fix thinko in maintenance of visited component set.
llvm-svn: 144291
2011-11-10 14:53:23 +00:00
Daniel Dunbar
c2034ff5ce llvm-config: Drop 'backend' pseudo-component. We don't support/qualify the CBE
enough to have this be useful.

llvm-svn: 144202
2011-11-09 19:23:15 +00:00
Daniel Dunbar
9992ca1c90 llvm-config-2: Switch to using real library dependency table.
- Also, fix a refacto that left extra "all" component in list (this is now
   defined in the groups explicitly)
 - Reapply of r143879 now that Make should see needed deps.

llvm-svn: 144201
2011-11-09 19:14:51 +00:00
John McCall
2eda1daed3 Use isa<> instead of dyn_cast<> as suggested by Nick.
Should've read the patch a bit closer, sorry.

llvm-svn: 144164
2011-11-09 03:26:50 +00:00
John McCall
0accc78829 Fix the printing of constants. Patch by Stepan Dyatkovskiy!
llvm-svn: 144079
2011-11-08 06:53:04 +00:00
Owen Anderson
c6f0814beb Fix llvm-objdump's MachO mode to not depend on the value returned by RelocationRef::getInfo().
llvm-svn: 143966
2011-11-07 17:21:36 +00:00
Daniel Dunbar
aa157a13fe Revert "llvm-config-2: Switch to using real library dependency table." while I
investigate build failure.

llvm-svn: 143888
2011-11-06 19:57:04 +00:00
Daniel Dunbar
26b6fe7292 llvm-config: Users are allowed to provide component names in mixed case.
llvm-svn: 143881
2011-11-06 18:04:49 +00:00
Daniel Dunbar
e3dc39c01b llvm-config-2: Switch to using real library dependency table.
- Also, fix a refacto that left extra "all" component in list (this is now
   defined in the groups explicitly)

llvm-svn: 143879
2011-11-06 18:04:23 +00:00
Benjamin Kramer
3c2ba1a51a Add more PRI.64 macros for MSVC and use them throughout the codebase.
llvm-svn: 143799
2011-11-05 08:57:40 +00:00
Peter Collingbourne
42ebc937cb Now that the linker supports lazily materialising globals, don't
materialise them in LTO.

I observed a ~0.5-1% speedup for an LTO link of opt.

llvm-svn: 143784
2011-11-05 04:17:25 +00:00
Peter Collingbourne
470083dc27 Use absolute path to exportsfile in gold plugin CMake build.
(Ninja generator requirement.)

llvm-svn: 143783
2011-11-05 04:17:20 +00:00
Bill Wendling
83f7f41d72 Reformatting changes to get rid of blank lines, put code on one line, and to
decrease some code indentation. No intended functional changes.

llvm-svn: 143723
2011-11-04 18:48:00 +00:00
Bill Wendling
510b538e32 Move comment to the correct place.
llvm-svn: 143690
2011-11-04 09:34:06 +00:00
Bill Wendling
c339c04e2e Make the Mangler an ivar so that it doesn't have to be passed around everywhere.
llvm-svn: 143689
2011-11-04 09:30:19 +00:00
Bill Wendling
2d3ef29584 Refactor the MCContext so that it's an ivar instead of a local which is passed
around. This is important for some future work as well.

llvm-svn: 143688
2011-11-04 09:24:40 +00:00
Daniel Dunbar
6ed1f79da0 llvm-config-2: Implement build system support for getting the variables we only
know at build time.

llvm-svn: 143649
2011-11-03 21:01:36 +00:00
Daniel Dunbar
3760ebeebb build: Add initial cut at LLVMBuild.txt files.
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Daniel Dunbar
c679323639 llvm-config-2: Implement component dependency traversal, implement support for 'all', and fix a few other minor bugs.
- Still doesn't use actual generated component table, but that is now just a matter of wiring into the build system.

llvm-svn: 143617
2011-11-03 17:30:19 +00:00
Daniel Dunbar
cce5afb483 llvm-config: Start stubbing out a C++ version of llvm-config (as llvm-config-2,
for now).

 - Mostly complete except for the data that needs to come from the build system
   or the dependencies.

 - Has some small improvements from current llvm-config:

   o Uses TargetRegistry directly to get some information.

   o Designed to work correctly when used from a CMake build tree (relatively
     untested currently) (although pcc fixed this recently for old llvm-config).

llvm-svn: 143616
2011-11-03 17:30:16 +00:00
Chad Rosier
1caee0fa23 Remove some cruft from the BitcodeWriter, while still maintaining backward
compatibility in the BitcodeReader.

llvm-svn: 143598
2011-11-03 00:14:01 +00:00
Chandler Carruth
8180de55b4 Add back the top-level target for 'llvm-config' and the dependency edge
to force it to build after all library targets so it has complete
dependency information. This should fix broken 'make install' with
CMake.

This is a partial revert of r143540, but it doesn't revert the most
important part of that change: removing the dependency edge from LLVM
tools to the llvm-config script.

llvm-svn: 143548
2011-11-02 17:22:57 +00:00
Daniel Dunbar
51a1dcaa27 build/Make: Get rid of llvm-config-perobj, which isn't used anymore.
llvm-svn: 143541
2011-11-02 15:56:52 +00:00
Daniel Dunbar
dbae312357 build/CMake: Remove llvm-config.target used to serialize tool builds on
llvm-config build, there is no longer a point to this after Chandler's work.

llvm-svn: 143540
2011-11-02 15:56:38 +00:00
Kevin Enderby
64fe093030 First part of support for generating dwarf for assembly source files with the
-g flag.  In this part we generate the .file for the source being assembled and
the .loc's for the assembled instructions.

The next part will be to generate the dwarf Compile Unit DIE and a dwarf
subprogram DIE for each non-temporary label.

Once the next part is done test cases will be added.  rdar://9275556

llvm-svn: 143509
2011-11-01 22:27:22 +00:00
Sebastian Pop
f72a853709 rename getHostTriple into getDefaultTargetTriple
llvm-svn: 143502
2011-11-01 21:32:20 +00:00
Eli Friedman
038abbd863 A couple misc fixes so that bugpoint doesn't explode reducing code containing landingpads.
llvm-svn: 143435
2011-11-01 04:40:56 +00:00
Nick Lewycky
7308946be2 Switch new .file directive emission off by default, change llc's flag for it to
-enable-dwarf-directory.

llvm-svn: 143326
2011-10-31 01:06:02 +00:00
Stepan Dyatkovskiy
d1216f47ca uint64 formatted output: replaced %llx with PRIx64 macro.
llvm-svn: 143191
2011-10-28 13:07:32 +00:00
Peter Collingbourne
91824cb6ac Have llvm-config --cppflags print correct flags when in CMake build directory
Previously, if invoked from a CMake build directory, 'llvm-config
--cppflags' and friends would only print a -I flag for the build
directory's header search path, because it would assume that it was
already installed, not recognising its parent directory as being the
build directory.  Teach llvm-config about CMake build directories
so that it prints a -I for both the source and build directory's
search paths.

llvm-svn: 143171
2011-10-28 01:02:16 +00:00
Dan Gohman
892b86e74c Remove the Alpha backend.
llvm-svn: 143164
2011-10-27 22:56:32 +00:00
Owen Anderson
c14e970962 Revert r143149, stubbing out symbolic disassembly support. The symbolic disassembly support is too MC-engrained to be useful in llvm-objdump.
llvm-svn: 143152
2011-10-27 21:55:13 +00:00
Owen Anderson
52982d93c4 Stub out support for symbol disassembly in llvm-objdump.
llvm-svn: 143149
2011-10-27 21:46:31 +00:00
Stepan Dyatkovskiy
7942165053 Fixed llvm-objdump uint64_t formatted output.
llvm-svn: 143120
2011-10-27 18:40:45 +00:00
Owen Anderson
7a9bb4d47f Expand relocation type field to 64 bits. MachO scattered relocations require 33 bits of type info.
llvm-svn: 143032
2011-10-26 17:08:49 +00:00
Michael J. Spencer
2ec1e8e92f llvm-nm: Use correct format string. Patch by Stepan Dyatkovskiy!
llvm-svn: 142984
2011-10-25 22:45:47 +00:00
Owen Anderson
69d98376b9 Add support for the notion of "hidden" relocations. On MachO, these are relocation entries that are used as additional information for other, real relocations, rather than being relocations themselves.
I'm not familiar enough with ELF or COFF to know if they should have any relocations marked hidden.

llvm-svn: 142961
2011-10-25 20:35:53 +00:00
Owen Anderson
df9058b98c Fix off-by-one error when printing relocations inline with disassembly.
llvm-svn: 142952
2011-10-25 20:15:39 +00:00
Michael J. Spencer
f21a701890 llvm-objdump: Add static symbol table dumping.
llvm-svn: 142404
2011-10-18 19:32:17 +00:00
Daniel Dunbar
81780d9982 build: Tidy up a bunch of tool Makefiles, and simplify where possible using the
new all-targets pseudo-component.

llvm-svn: 142401
2011-10-18 19:27:24 +00:00
Daniel Dunbar
2299fff72b llvm-ar: Remove local test target, this is no longer useful.
llvm-svn: 142400
2011-10-18 19:27:10 +00:00
Daniel Dunbar
ff8a3694fe llvm-config: Add an all-targets pseudo-component.
llvm-svn: 142399
2011-10-18 19:27:08 +00:00
Michael J. Spencer
00c39291ef Revert "llvm-objdump: Add static symbol table dumping."
This reverts commit 0c30d4e4f5f9110c5a67bd0ca84444dc58697596.

llvm-svn: 142320
2011-10-18 00:17:04 +00:00
Michael J. Spencer
8c590fd08d llvm-objdump: Add static symbol table dumping.
llvm-svn: 142319
2011-10-17 23:55:22 +00:00
Nick Lewycky
c551c1c5f9 Add support for a new extension to the .file directive:
.file filenumber "directory" "filename"

This removes one join+split of the directory+filename in MC internals. Because
bitcode files have independent fields for directory and filenames in debug info,
this patch may change the .o files written by existing .bc files.

llvm-svn: 142300
2011-10-17 23:05:28 +00:00
Owen Anderson
e607004d1b Rewrite most of MachODump to work through the generic libObject interfaces rather than accessing the MachO internals directly.
llvm-svn: 142263
2011-10-17 21:37:35 +00:00
Michael J. Spencer
277eaf9f19 llvm-objdump: Add -s, which prints the contents of each section.
llvm-svn: 142199
2011-10-17 17:13:22 +00:00
NAKAMURA Takumi
782601653d tools/CMakeLists.txt: Fixup r142103. I don't remember why I had missed the line.
llvm-svn: 142136
2011-10-16 11:50:37 +00:00
Chris Lattner
391d90c9a6 Make SMDiagnostic a little more sane. Instead of passing around note/warning/error as a
string, pass it around as an enum.

llvm-svn: 142107
2011-10-16 05:43:57 +00:00
Chris Lattner
321335142c Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang does. Enhance
the X86 asmparser to produce ranges in the one case that was annoying me, for example:

test.s:10:15: error: invalid operand for instruction
movl 0(%rax), 0(%edx)
              ^~~~~~~

It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use 
ranges where appropriate if someone is interested.

llvm-svn: 142106
2011-10-16 04:47:35 +00:00
NAKAMURA Takumi
9ef901972f CMake: Introduce LLVM_CLANG_SOURCE_DIR, "tools/clang" by default. Clang will not be built if LLVM_CLANG_SOURCE_DIR="" or ${LLVM_CLANG_SOURCE_DIR}/CMakeLists.txt is not found.
llvm-svn: 142103
2011-10-16 02:54:33 +00:00
NAKAMURA Takumi
3e8c737ac8 autoconf: Introduce --with-clang-srcdir, to build out-of-tree clang as tools/clang on tools/Makefile.
llvm-svn: 142102
2011-10-16 02:54:26 +00:00
Michael J. Spencer
4ee36e15ad llvm-object: Add inline relocation information to disassembly.
llvm-svn: 141897
2011-10-13 22:17:18 +00:00
Michael J. Spencer
309e0cb513 llvm-objdump: Fix whitespace.
llvm-svn: 141886
2011-10-13 20:37:20 +00:00
Michael J. Spencer
fa3f63c14a llvm-objdump: Fix dumping of multiple symbols with the same address.
This happens in COFF because there is a symbol for the beginning of each
section.

llvm-svn: 141885
2011-10-13 20:37:08 +00:00
NAKAMURA Takumi
bf2fb9b9e2 llvm-objdump.cpp: Use PRIx64 as format specifier for int64_t.
llvm-svn: 141664
2011-10-11 12:51:50 +00:00
Tanya Lattner
0ae574fe2b Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before.
This line, and those below, will be ignored--

M    include/llvm/Linker.h
M    tools/bugpoint/Miscompilation.cpp
M    tools/bugpoint/BugDriver.cpp
M    tools/llvm-link/llvm-link.cpp
M    lib/Linker/LinkModules.cpp

llvm-svn: 141606
2011-10-11 00:24:54 +00:00
Nick Lewycky
73e4d372d0 Add support for dumping section headers to llvm-objdump. This uses the same
flags as binutils objdump but the output is different, not just in format but
also showing different sections. Compare its results against readelf, not
objdump.

llvm-svn: 141579
2011-10-10 21:21:34 +00:00
Benjamin Kramer
05836b12fd llvm-objdump: Take ownership of MCInstrInfos.
llvm-svn: 141535
2011-10-10 13:10:09 +00:00
Benjamin Kramer
357893ba6f llvm-nm: Don't leak bitcode buffers.
llvm-svn: 141534
2011-10-10 13:10:04 +00:00
Michael J. Spencer
e497728e76 llvm-objdump: Add relocation and archive support.
llvm-svn: 141451
2011-10-08 00:18:30 +00:00
Michael J. Spencer
7037dc0b45 Fix a few changes I missed.
llvm-svn: 141392
2011-10-07 19:52:41 +00:00
Michael J. Spencer
3cc26e4c5e Fix GCC again.
llvm-svn: 141389
2011-10-07 19:46:12 +00:00
Michael J. Spencer
022d2639d9 Fix spelling in comment.
llvm-svn: 141386
2011-10-07 19:25:47 +00:00
Michael J. Spencer
34d76cf95b Change relocation API to be per section. This time without breaking GCC.
llvm-svn: 141385
2011-10-07 19:25:32 +00:00
Bill Wendling
ecbddb2b9e Revert 141376 and 141377 due to breaking the build.
--- Reverse-merging r141377 into '.':
U    tools/llvm-objdump/MachODump.cpp
--- Reverse-merging r141376 into '.':
U    include/llvm/Object/COFF.h
U    include/llvm/Object/ObjectFile.h
U    include/llvm-c/Object.h
U    tools/llvm-objdump/llvm-objdump.cpp
U    lib/Object/MachOObjectFile.cpp
U    lib/Object/COFFObjectFile.cpp
U    lib/Object/Object.cpp
U    lib/Object/ELFObjectFile.cpp

llvm-svn: 141379
2011-10-07 18:25:37 +00:00
Michael J. Spencer
8c104f4259 Fix spelling in comment.
llvm-svn: 141377
2011-10-07 18:15:40 +00:00
Michael J. Spencer
14925a859b Change relocation API to be per section.
llvm-svn: 141376
2011-10-07 18:15:25 +00:00
Devang Patel
196ef2ac28 Update cmake list.
llvm-svn: 141104
2011-10-04 19:38:16 +00:00
Devang Patel
90c78f84f2 Put GCOVFile and other related interface in a common header so that llvm-cov tool can share it with GCOV writer.
llvm-svn: 141095
2011-10-04 17:24:48 +00:00
Peter Collingbourne
82881bd04b Exclude libLLVMTableGen.a from the shared library
Unbreaks tools for --enable-shared build.

llvm-svn: 141052
2011-10-04 00:30:34 +00:00
Devang Patel
e5a1e5b655 Simplify.
llvm-svn: 140789
2011-09-29 17:06:40 +00:00
Devang Patel
b1bef6ba30 Clarify comments.
llvm-svn: 140787
2011-09-29 16:52:53 +00:00
Devang Patel
0729c18444 Remove unnecessary and unused data member.
llvm-svn: 140786
2011-09-29 16:48:44 +00:00
Devang Patel
204df6030c Cosmetic changes, as per Nick's review.
llvm-svn: 140785
2011-09-29 16:46:47 +00:00
Andrew Trick
3f3416249a Fix build failures better.
llvm-svn: 140758
2011-09-29 01:22:31 +00:00
Daniel Dunbar
8b3e105420 Fix build failure.
llvm-svn: 140755
2011-09-29 01:14:42 +00:00
Michael J. Spencer
3b747b0b5d llvm-size: Apply Chris's code review fixes.
This doesn't use formated_raw_ostream because it doesn't support the
functionality needed.

llvm-svn: 140751
2011-09-29 00:59:18 +00:00
Michael J. Spencer
4dc1ab6c03 Fix cast.
llvm-svn: 140726
2011-09-28 21:24:44 +00:00
Michael J. Spencer
3e283fe7d4 Add llvm-size.
llvm-svn: 140722
2011-09-28 20:57:46 +00:00
Devang Patel
3605f8423f Introduce llvm-cov.
Add llvm-cov skeleton. It has initial support to read coverage info generated by GCOVProfiling.cpp. 
Today, you can do
prompt> clang a.c -ftest-coverage -fprofile-arcs -o a
prompt> ./a
prompt> llvm-cov -gcno a.gcno -gcda a.gcda 
a.c
 :	#include "a.h"
 :	
 :	int main() {
 :		int i = 0;
 :		if (i) {
1:			int j = 0;
1:			j = 1;
1:		} else {
 :			int k = 1;
 :			k = 2;
 :		}
1:		return 0;
 :	}
 :	
 :	

llvm-svn: 140712
2011-09-28 18:50:00 +00:00
Michael J. Spencer
89e83b38cd Add binary archive support to llvm-nm.
llvm-svn: 140627
2011-09-27 19:37:18 +00:00
Benjamin Kramer
e106715386 llvm-objdump: Detach symbol listing from section enumeration for mach-o.
This reduces memory usage as we don't add the same symbol multiple times anymore.

llvm-svn: 140278
2011-09-21 22:16:43 +00:00
Benjamin Kramer
abc83415a1 llvm-objdump: Take the data from the right object when there's no dSYM around.
llvm-svn: 140269
2011-09-21 18:18:53 +00:00
Benjamin Kramer
e55a93f3a1 llvm-objdump: Fix use after free.
llvm-svn: 140237
2011-09-21 04:01:19 +00:00
Benjamin Kramer
703be6434e llvm-objdump: Output line info next to the disassembly if available.
MachO-only at the moment, sorry.

Usage:
$ llvm-objdump -d -m -g -dsym=a.out.dSYM/Contents/Resources/DWARF/a.out a.out
_main:
100000e90:	55	pushq %rbp	## test.c:11:3
…

llvm-svn: 140224
2011-09-21 01:13:19 +00:00