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

18396 Commits

Author SHA1 Message Date
Rafael Espindola
2b411d1243 Don't use PathV1.h in LTOCodeGenerator.cpp
This patch also adds a simpler version of sys::fs::remove and a tool_output_file
constructor for when we already have an open file.

llvm-svn: 184095
2013-06-17 18:05:35 +00:00
Rafael Espindola
a92eae8cb9 Delete declared but not implemented functions.
llvm-svn: 184087
2013-06-17 17:15:00 +00:00
Rafael Espindola
845bfd3735 Move lib/Archive to tools/llvm-ar.
llvm-ar is the only tool that needs to write archive files. Every other tool
should be able to use the lib/Object interface.

llvm-svn: 184083
2013-06-17 15:47:20 +00:00
Tim Northover
3231ab74d4 AArch64: print relocation addends if present on AArch64
llvm-objdump should provide some way of printing out the addends present in the
.rela sections for debugging purposes if nothing else.

llvm-svn: 184072
2013-06-17 03:03:06 +00:00
David Blaikie
813e6b3974 DebugInfo: remove target-specific Frame Index handling for DBG_VALUE MachineInstrs
Frame index handling is now target-agnostic, so delete the target hooks
for creation & asm printing of target-specific addressing in DBG_VALUEs
and any related functions.

llvm-svn: 184067
2013-06-16 20:34:27 +00:00
David Blaikie
dafb933a3d MachineOperand::setIsDebug should ensure the register is /not/ a definition
This currently unused function appeared to be asserting in the wrong
direction - DebugValues are never definitions of registers, only uses.
Curiously we don't perform any of these checks for the more common (&
actually used) case of MachineOperand::CreateReg (or other Create
functions).

llvm-svn: 184065
2013-06-16 20:34:09 +00:00
Dmitri Gribenko
2c062d2c5f Put back variable names because they are referenced in the documentation
comment.

llvm-svn: 184051
2013-06-16 03:22:56 +00:00
Benjamin Kramer
ac23976335 APInt: Add a fast case for isAllOnesValue.
llvm-svn: 184042
2013-06-15 11:32:09 +00:00
Andrew Trick
768a74cb96 Support BufferSize on ProcResGroup for unified MOp schedulers.
And add Sandybridge/Haswell resource buffers.

llvm-svn: 184034
2013-06-15 04:50:06 +00:00
Andrew Trick
5d13fe97ed Machine Model: Add MicroOpBufferSize and resource BufferSize.
Replace the ill-defined MinLatency and ILPWindow properties with
with straightforward buffer sizes:
MCSchedMode::MicroOpBufferSize
MCProcResourceDesc::BufferSize

These can be used to more precisely model instruction execution if desired.

Disabled some misched tests temporarily. They'll be reenabled in a few commits.

llvm-svn: 184032
2013-06-15 04:49:57 +00:00
Sean Silva
7dafd05c2e [yaml2obj] Add support for sh_link via Link key.
llvm-svn: 184022
2013-06-15 00:25:26 +00:00
Rafael Espindola
daa7f712a2 Remove the LLVM specific archive index.
Archive files (.a) can have a symbol table indicating which object
files in them define which symbols. The purpose of this symbol table
is to speed up linking by allowing the linker the read only the .o
files it is actually going to use instead of having to parse every
object's symbol table.

LLVM's archive library currently supports a LLVM specific format for
such table. It is hard to see any value in that now that llvm-ld is
gone:

* System linkers don't use it: GNU ar uses the same plugin as the
linker to create archive files with a regular index. The OS X ar
creates no symbol table for IL files, I assume the linker just parses
all IL files.

* It doesn't interact well with archives having both IL and native objects.

* We probably don't want to be responsible for yet another archive
format variant.

This patch then:

* Removes support for creating and reading such index from lib/Archive.
* Remove llvm-ranlib, since there is nothing left for it to do.

We should in the future add support for regular indexes to llvm-ar for
both native and IL objects. When we do that, llvm-ranlib should be
reimplemented as a symlink to llvm-ar, as it is equivalent to "ar s".

llvm-svn: 184019
2013-06-14 23:25:53 +00:00
Matt Arsenault
3cc00ba7e7 Add getSelect helper function
Patch by Micah Villmow from last year that was reviewed, but never committed

llvm-svn: 184011
2013-06-14 22:04:32 +00:00
Rafael Espindola
61f7e167f2 Add GetCurrentDirectory back.
It looks like clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp
depends on the behaviour of the old one on Windows. Maybe a difference
between GetCurrentDirectoryA and GetCurrentDirectoryW?

llvm-svn: 184009
2013-06-14 21:41:33 +00:00
Rafael Espindola
9534308a00 Replace use of PathV1.h in MCContext.cpp.
GetCurrentDirectory is now unused. Remove it.

llvm-svn: 184003
2013-06-14 20:26:58 +00:00
Rafael Espindola
109393c56d Replace use of PathV1.h in Program.cpp.
llvm-svn: 183996
2013-06-14 19:38:45 +00:00
Rafael Espindola
4430795d30 Convert a use of sys::Path::GetTemporaryDirectory.
llvm-svn: 183987
2013-06-14 16:43:15 +00:00
Derek Schuff
4c429cad03 Make PrologEpilogInserter save/restore all callee saved registers
in functions which call __builtin_unwind_init()

__builtin_unwind_init() is an undocumented gcc intrinsic which has this effect,
and is used in libgcc_eh.

Goes part of the way toward fixing PR8541.

llvm-svn: 183984
2013-06-14 16:15:29 +00:00
Rafael Espindola
703b03a992 Move PrependMainExecutablePath next to its only user.
llvm-svn: 183980
2013-06-14 15:12:13 +00:00
Sean Silva
221b8835d3 [yaml2obj] Add support for sh_addralign via AddressAlign key.
For consistency, change the address in the test case from 0xDEADBEEF to
0xCAFEBABE since 0xCAFEBABE that actually has a 2-byte alignment.

llvm-svn: 183962
2013-06-14 00:38:02 +00:00
Jakub Staszak
578a445162 Move #include from .h to .cpp file.
llvm-svn: 183960
2013-06-14 00:00:13 +00:00
Jakub Staszak
720d04cf91 Remove forward declaration of MachineBasicBlock. It is #included anyway.
llvm-svn: 183958
2013-06-13 23:53:13 +00:00
Jakub Staszak
bd36771f2d #include <climits> instead of <limits.h> in C++ header file.
llvm-svn: 183957
2013-06-13 23:49:09 +00:00
Sean Silva
51f6318c1e [yaml2obj] Add support for specifying raw section content.
llvm-svn: 183955
2013-06-13 22:20:01 +00:00
Sean Silva
a31cf66d83 [yaml2obj] Add sh_addr via Address key.
llvm-svn: 183954
2013-06-13 22:19:54 +00:00
Sean Silva
c72d9620ea [yaml2obj] Initial ELF section support.
The current functionality is extremely basic and a bit rough around the
edges, but it will flesh out in future commits.

llvm-svn: 183953
2013-06-13 22:19:48 +00:00
Rafael Espindola
6c0ca078e2 Don't use PathV1.h in Signals.h.
llvm-svn: 183947
2013-06-13 21:16:58 +00:00
Rafael Espindola
d94cf8dd17 Add a RemoveFileOnSignal that takes a StringRef.
llvm-svn: 183943
2013-06-13 21:01:17 +00:00
Rafael Espindola
1cc376fe6a Don't use PathV1.h in FileUtilities.h.
llvm-svn: 183941
2013-06-13 20:41:00 +00:00
Rafael Espindola
ef0d0d8b0b Avoid using PathV1.h in Program.h.
llvm-svn: 183940
2013-06-13 20:25:38 +00:00
Rafael Espindola
eed3b256ab Add a version of sys::ExecuteAndWait that takes StringRefs.
llvm-svn: 183934
2013-06-13 20:06:28 +00:00
Rafael Espindola
332b3ad6f7 Have sys::FindProgramByName return a std::string.
llvm-svn: 183928
2013-06-13 19:25:37 +00:00
Reid Kleckner
cd4d94dfeb Merge changes to clang's Driver code into LLVM's Option library
This is in preparation for switching the clang driver over to using LLVM's
Option library.  Richard Smith introduced most of these changes to the clang
driver in r167638.

Reviewers: espindola on IRC

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

llvm-svn: 183925
2013-06-13 18:12:12 +00:00
Rafael Espindola
df08289cf9 Reduce usage of sys::Path in the graph writer.
Now PathV1.h is not needed in GraphWriter.h.

llvm-svn: 183919
2013-06-13 17:20:48 +00:00
Rafael Espindola
a01a0af557 Add a version of DisplayGraph that takes a StringRef.
llvm-svn: 183915
2013-06-13 16:56:13 +00:00
Rafael Espindola
5b921b1aa1 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

llvm-svn: 183864
2013-06-12 20:58:35 +00:00
Rafael Espindola
c2d993a144 Add global versions of some Program static methods.
This is a temporary stepping stone for moving them out of Program.

llvm-svn: 183860
2013-06-12 20:42:59 +00:00
Rui Ueyama
9fac39d7e4 readobj: Dump PE/COFF optional records.
These records are mandatory for executables and are used by the loader.

Reviewers: rafael

CC: llvm-commits

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

llvm-svn: 183852
2013-06-12 19:10:33 +00:00
Rafael Espindola
7690460b6c Inline Path::isBitcodeFile into only use and remove it.
llvm-svn: 183840
2013-06-12 15:13:57 +00:00
Rafael Espindola
eda0643880 Remove Path::getMagicNumber.
llvm-svn: 183839
2013-06-12 15:07:11 +00:00
Rafael Espindola
21dc9d4207 Remove Path::hasMagicNumber.
llvm-svn: 183838
2013-06-12 15:04:59 +00:00
Rafael Espindola
f2b87aba29 Remove Path::isAbsolute.
llvm-svn: 183836
2013-06-12 15:02:39 +00:00
Rafael Espindola
800537be0d Remove Path::isAbsolute().
llvm-svn: 183835
2013-06-12 14:47:33 +00:00
Ulrich Weigand
2666834190 [MC/DWARF] Support .debug_frame / .debug_line code alignment factors
I've been comparing the object file output of LLVM's integrated
assembler against the external assembler on PowerPC, and one
area where differences still remain are in DWARF sections.

In particular, the GNU assembler generates .debug_frame and
.debug_line sections using a code alignment factor of 4, since
all PowerPC instructions have size 4 and must be aligned to a
multiple of 4.  However, current MC code hard-codes a code
alignment factor of 1.

This patch changes this by adding a "minimum instruction alignment"
data element to MCAsmInfo and using this as code alignment factor.

This requires passing a MCContext into MCDwarfLineAddr::Encode
and MCDwarfLineAddr::EncodeAdvanceLoc.  Note that one caller,
MCDwarfLineAddr::Write, didn't actually have that information
available.  However, it turns out that this routine is in fact
never used in the whole code base, so the patch simply removes
it.  If it turns out to be needed again at a later time, it
could be re-added with an updated interface.

llvm-svn: 183834
2013-06-12 14:46:54 +00:00
Rafael Espindola
0aa6ee2d41 Remove Path::getSuffix.
llvm-svn: 183833
2013-06-12 14:32:51 +00:00
Rafael Espindola
89d2e1921d Remove sys::CopyFile.
llvm-svn: 183831
2013-06-12 14:16:52 +00:00
Patrik Hagglund
2c2535b8d0 Fix 'gcc -flto' builds for unittest binaries (undefined reference to
`typeinfo for llvm:🆑:GenericOptionValue').

Remove an "anchor" method for an abstract class. (This does not
increase the number of vtables.)

llvm-svn: 183830
2013-06-12 14:15:21 +00:00
Rafael Espindola
528e53f9f1 Remove the old file memory mapping functions.
llvm-svn: 183828
2013-06-12 14:11:15 +00:00
Rafael Espindola
072d5a2178 Remove Path::createFileOnDisk.
llvm-svn: 183827
2013-06-12 13:59:17 +00:00
Rafael Espindola
dc7cb4d0c4 Remove Path::makeExecutableOnDisk.
llvm-svn: 183826
2013-06-12 13:55:07 +00:00
Rafael Espindola
191f66d683 Move PathV2.h to Path.h
Most clients have already been moved from Path V1 to V2. The ones using V1
now include PathV1.h explicitly.

llvm-svn: 183801
2013-06-11 22:21:28 +00:00
Rui Ueyama
f9939fdb3c [PECOFF] Remove COFF header from PE header for simplicity.
COFF header is always present both in executable and in object file. PE header
is present only in executable. So the natural way to handle PE/COFF file is
treating COFF is mandatory header and PE is optional. Current data structre
does not allow it, because PE header includes COFF header. Removing COFF
header will simplify the code to handle PE/COFF files.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183788
2013-06-11 21:39:48 +00:00
Rafael Espindola
968c6bbebf Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183782
2013-06-11 20:00:56 +00:00
Rafael Espindola
993b0c88c5 Remove Path::getDirname.
llvm-svn: 183780
2013-06-11 19:32:57 +00:00
Rafael Espindola
3eb11a9b44 Remove Path::getBasename.
llvm-svn: 183779
2013-06-11 19:29:48 +00:00
Rafael Espindola
0ee1fd1460 Remove Path::getLast.
llvm-svn: 183778
2013-06-11 19:25:17 +00:00
Rafael Espindola
cd1368e1db Remove GetDLLSuffix.
llvm-svn: 183777
2013-06-11 19:18:05 +00:00
Rafael Espindola
35b7309704 Remove GetRootDirectory.
llvm-svn: 183775
2013-06-11 19:13:52 +00:00
Rafael Espindola
e45b026a12 Remove GetUserHomeDirectory.
llvm-svn: 183773
2013-06-11 19:08:15 +00:00
Rafael Espindola
0ff7ea94a2 Don't define LTDL_SHLIBPATH_VAR.
llvm-svn: 183771
2013-06-11 19:04:13 +00:00
Rafael Espindola
30fee8bd79 Remove GetSystemLibraryPaths.
llvm-svn: 183770
2013-06-11 18:58:47 +00:00
Rafael Espindola
bafac8bf69 Don't define LLVM_LIBDIR, it is not used anymore.
llvm-svn: 183769
2013-06-11 18:52:11 +00:00
Rafael Espindola
018002f465 Remove Path::GetBitcodeLibraryPaths.
llvm-svn: 183765
2013-06-11 18:45:35 +00:00
Rafael Espindola
c5d8c2560a Remove unused FindLibrary function.
llvm-svn: 183764
2013-06-11 18:41:07 +00:00
Rafael Espindola
d506a5e174 Remove sys::identifyFileType.
llvm-svn: 183763
2013-06-11 18:18:02 +00:00
Rafael Espindola
3ae9fcd908 Fix variable name style. Don't cast to and from int.
This enables the compiler to see the enum and produce warnings about a switch
not being fully covered. Fix one of these warnings.

llvm-svn: 183749
2013-06-11 15:29:10 +00:00
Sean Silva
0145eeb66d Fix dubious type name similar to member name.
Should bring bots back to life.

llvm-svn: 183715
2013-06-11 00:13:52 +00:00
Sean Silva
f1bbb8885a Fix spurious semicolons.
Apparently these macros have semicolons inside of them already.

llvm-svn: 183712
2013-06-10 23:48:38 +00:00
Sean Silva
141d676063 [yaml2obj] Initial ELF support.
Currently, only emitting the ELF header is supported (no sections or
segments).

The ELFYAML code organization is broadly similar to the COFFYAML code.

llvm-svn: 183711
2013-06-10 23:44:15 +00:00
Rafael Espindola
1df3f4fedd Add a missing 'e'.
llvm-svn: 183692
2013-06-10 20:32:27 +00:00
Rafael Espindola
053c8c898f Remove the old IdentifyFileType now that lld was updated.
llvm-svn: 183671
2013-06-10 15:37:29 +00:00
Rafael Espindola
64def1c6ed Pass a StringRef to sys::identifyFileType.
llvm-svn: 183669
2013-06-10 15:27:39 +00:00
Rafael Espindola
3db8a7c316 Update for current naming conventions.
I will change identifyFileType to use a StringRef in the next patch.

llvm-svn: 183664
2013-06-10 14:56:16 +00:00
Duncan Sands
5f79506fd3 Avoid warnings about unused parameters that tend to come up a lot when
building outside projects with a different compiler than that used to build
LLVM itself (eg switching between gcc and clang).

llvm-svn: 183650
2013-06-10 12:09:30 +00:00
Benjamin Kramer
c8444f6f89 Add a const version of findNearestCommonDominator to PostDom for convenience.
PR16283.

llvm-svn: 183629
2013-06-09 15:09:30 +00:00
Aaron Ballman
8be7652e28 sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
llvm-svn: 183621
2013-06-08 20:29:03 +00:00
Manman Ren
c327cbd696 No functionality change.
Constify a few member functions.

llvm-svn: 183546
2013-06-07 18:53:29 +00:00
Manman Ren
a9cbca5c30 DIBuilder: No functionality change.
Use the correct DIType when creating types in DIBuilder.

llvm-svn: 183543
2013-06-07 18:35:53 +00:00
Rafael Espindola
81fff91aac Make operator== non-member for greater symmetry.
Thanks to David Blaikie for the suggestion.

llvm-svn: 183539
2013-06-07 18:00:04 +00:00
Rui Ueyama
8be98a268d [Object/COFF] BaseOfData field should be absent in PE32+.
llvm-svn: 183534
2013-06-07 16:58:30 +00:00
Benjamin Kramer
2fbc7287e4 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
llvm-svn: 183525
2013-06-07 15:14:31 +00:00
Benjamin Kramer
5f752c703f Optimize BitVector::all().
llvm-svn: 183521
2013-06-07 14:14:38 +00:00
Manman Ren
177367f799 DIBuilder: No functionality change.
Use the correct DIType when creating vector types.

llvm-svn: 183484
2013-06-07 03:13:46 +00:00
Jakub Staszak
df12041c3b Remove unneeded #include.
llvm-svn: 183460
2013-06-06 23:34:11 +00:00
Kevin Enderby
644e3fc29e Teach llvm-objdump with the -macho parser how to use the data in code table
from the LC_DATA_IN_CODE load command.  And when disassembling print
the data in code formatted for the kind of data it and not disassemble those
bytes.

I added the format specific functionality to the derived class MachOObjectFile
since these tables only appears in Mach-O object files. This is my first
attempt to modify the libObject stuff so if folks have better suggestions
how to fit this in or suggestions on the implementation please let me know.

rdar://11791371

llvm-svn: 183424
2013-06-06 17:20:50 +00:00
Rafael Espindola
a1d5ce4045 Print symbol names in relocations when dumping COFF as YAML.
llvm-svn: 183403
2013-06-06 13:06:17 +00:00
Sean Silva
92096509dc Add some class documentation to BinaryRef.
llvm-svn: 183362
2013-06-06 00:47:12 +00:00
Bill Wendling
2cca7e5acd Cache the TargetLowering info object as a pointer.
Caching it as a pointer allows us to reset it if the TargetMachine object
changes.

llvm-svn: 183361
2013-06-06 00:43:09 +00:00
Bill Wendling
62a5cc40ee Don't cache the TargetLoweringInfo object inside of the FunctionLowering object.
The TargetLoweringInfo object is owned by the TargetMachine. In the future, the
TargetMachine object may change, which may also change the TargetLoweringInfo
object.

llvm-svn: 183356
2013-06-06 00:11:39 +00:00
Sean Silva
262d1afcd6 Rename operator== parameter to RHS.
The previous name `Ref` is overly generic.

llvm-svn: 183354
2013-06-05 23:58:14 +00:00
Sean Silva
e61870890f Remove error-prone methods of BinaryRef.
A user shouldn't care about the internal state, and these methods by
their very nature require asserting a predicate on the internal state.
As such, they cannot be used safely without introducing hidden
long-distance dependencies on the manner of construction of the
BinaryRef.

Use writeAsBinary(raw_ostream &) and writeAsHex(raw_ostream &) if you
need to access the data in a binary or hex format.

llvm-svn: 183353
2013-06-05 23:55:26 +00:00
Sean Silva
66fceb99ee Add writeAsHex(raw_ostream &) method to BinaryRef.
This hides the implementation. A future commit will remove the
error-prone getHex() and getBinary() methods.

llvm-svn: 183352
2013-06-05 23:47:23 +00:00
Sean Silva
58f67d3878 Rename BinaryRef::isBinary to more descriptive DataIsHexString.
And add a doxygen comment.

llvm-svn: 183350
2013-06-05 23:32:31 +00:00
Sean Silva
5d76fe26c7 Add BinaryRef binary_size() method.
This avoids making assumptions about the data representation.

llvm-svn: 183349
2013-06-05 23:32:27 +00:00
Sean Silva
016cf70a05 Comment BinaryRef::Data.
Also, state an invariant.

llvm-svn: 183348
2013-06-05 23:32:23 +00:00
Sean Silva
58c8bd07e6 Add writeAsBinary(raw_ostream &) method to BinaryRef.
Previously, yaml2coff.cpp had a writeHexData static helper function to
do this, but it is generally useful functionality.

Also, validate hex strings up-front to avoid running having to handle
errors "deep inside" the yaml2obj code (it also gives better diagnostics
than it used to).

llvm-svn: 183345
2013-06-05 22:59:00 +00:00
Sean Silva
1df320230d [ELF] Add ELFOSABI_GNU.
ELFOSABI_LINUX is a historical alias for ELFOSABI_GNU according to
<http://www.sco.com/developers/gabi/latest/ch4.eheader.html>.

llvm-svn: 183339
2013-06-05 20:55:58 +00:00
Rafael Espindola
a3def11c27 Don't hide the first ELF symbol.
The first symbol on ELF is dummy, but it has a defined content and readelf
normally displays it. With this change llvm-readobj also displays it and we
can check that llvm-mc output is correct according to the standard.

llvm-svn: 183337
2013-06-05 20:33:54 +00:00
Rafael Espindola
0070e26a1c Represent symbols with a SymbolIndex,SectionIndex pair.
With this patch we use the SectionIndex directly, instead of counting the
number of symbol tables. This saves a DenseMap lookup every time we want to
find which symbol a relocation refers to.

Also simplify based on the fact that there is at most one SHT_SYMTAB and one
SHT_DYNSYM.

llvm-svn: 183326
2013-06-05 17:54:19 +00:00
Sylvestre Ledru
27eb6421e9 The GNU/HURD is also using the libc. Therefor, endian.h should be included, not machine/endian.h. See full build log https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-3.3&arch=hurd-i386&ver=1%3A3.3~%2Brc3-1~exp1&stamp=1370358869
llvm-svn: 183303
2013-06-05 09:17:26 +00:00
Rafael Espindola
eea6425b38 Don't print default values for NumberOfAuxSymbols and AuxiliaryData.
llvm-svn: 183293
2013-06-05 03:20:13 +00:00
Rafael Espindola
fa93962fd0 Move BinaryRef to a new include/llvm/Object/YAML.h file.
It will be used for ELF dumping too.

llvm-svn: 183287
2013-06-05 02:32:26 +00:00
Rafael Espindola
6f41305fd8 Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this
properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj
ELF's dumper to handle relocatios without symbols.

llvm-svn: 183284
2013-06-05 01:33:53 +00:00
Michael Gottesman
b152f55b6e IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

llvm-svn: 183179
2013-06-04 03:46:25 +00:00
Manuel Klimek
77c6916919 Introduce needsCleanup() for APFloat and APInt.
This is needed in clang so one can check if the object needs the
destructor called after its memory was freed. This is useful when
creating many APInt/APFloat objects with placement new, where the
overhead of tracking the pointers for cleanup is significant.

llvm-svn: 183100
2013-06-03 13:03:05 +00:00
Rui Ueyama
91b0546532 [Object/COFF] Add dos_header, pe32{,plus}_header and data_directory.
Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183087
2013-06-02 21:08:45 +00:00
Jim Grosbach
9777b1540e Whitespace.
llvm-svn: 183086
2013-06-02 19:51:54 +00:00
Benjamin Kramer
13dba6bf7c Move getRealLinkageName to a common place and remove all the duplicates of it.
Also simplify code a bit while there. No functionality change.

llvm-svn: 183076
2013-06-01 17:51:14 +00:00
Benjamin Kramer
d88c18ff6c DenseMap: Move the key into place when we use the move version of operator[].
llvm-svn: 183074
2013-06-01 16:37:55 +00:00
Michael Gottesman
0863d85015 Removed a comment above an include which is unnecessary and added a missing closing @} for a doxygen comment.
llvm-svn: 183065
2013-06-01 00:48:24 +00:00
Michael Gottesman
b3a5774ce3 Added method comments for getZero,getInf.
llvm-svn: 183064
2013-06-01 00:44:29 +00:00
Michael Gottesman
54dda81429 Updated APFloat's comments to fit the LLVM style guide.
Also added a few more method comments and performed some copy editing.

llvm-svn: 183063
2013-06-01 00:44:05 +00:00
Ahmed Bougacha
2263547c8f Make SubRegIndex size mandatory, following r183020.
This also makes TableGen able to compute sizes/offsets of synthesized
indices representing tuples.

llvm-svn: 183061
2013-05-31 23:45:26 +00:00
Eric Christopher
67d642450e Add support for adding the contents of a StringRef to the MD5 hash.
llvm-svn: 183054
2013-05-31 22:34:56 +00:00
Eric Christopher
5877c8cf30 Move "unsigned char" -> "uint8_t".
llvm-svn: 183051
2013-05-31 22:34:34 +00:00
Quentin Colombet
3e2682d134 Loop Strength Reduce: Scaling factor cost.
Account for the cost of scaling factor in Loop Strength Reduce when rating the
formulae. This uses a target hook.

The default implementation of the hook is: if the addressing mode is legal, the
scaling factor is free.

<rdar://problem/13806271>

llvm-svn: 183045
2013-05-31 21:29:03 +00:00
Rafael Espindola
3209887408 Use just a ArrayRef<uint8_t> to store both hex string and binary data.
llvm-svn: 183043
2013-05-31 21:03:51 +00:00
Rafael Espindola
64fb26327c Rename COFFYaml.h to COFFYAML.h for consistency.
llvm-svn: 183042
2013-05-31 20:38:27 +00:00
Rafael Espindola
3a1a41caee Remove union to fix build in c++03.
llvm-svn: 183041
2013-05-31 20:35:58 +00:00
Rafael Espindola
2f8e5cb38d Don't allocate temporary string for section data.
llvm-svn: 183040
2013-05-31 20:26:44 +00:00
Ahmed Bougacha
5df932894e Add a way to define the bit range covered by a SubRegIndex.
NOTE: If this broke your out-of-tree backend, in *RegisterInfo.td, change
the instances of SubRegIndex that have a comps template arg to use the
ComposedSubRegIndex class instead.

In TableGen land, this adds Size and Offset attributes to SubRegIndex,
and the ComposedSubRegIndex class, for which the Size and Offset are
computed by TableGen. This also adds an accessor in MCRegisterInfo, and
Size/Offsets for the X86 and ARM subreg indices.

llvm-svn: 183020
2013-05-31 17:08:36 +00:00
Andrew Trick
872083f8bf Fix ScalarEvolution::ComputeExitLimitFromCond for 'or' conditions.
Fixes PR16130 - clang produces incorrect code with loop/expression at -O2.

This is a 2+ year old bug that's now holding up the release. It's a
case where we knowingly made aggressive assumptions about undefined
behavior. These assumptions are wrong when SCEV is computing a
subexpression that does not directly control the branch. With this
fix, we avoid making assumptions in those cases but still optimize the
common case. SCEV's trip count computation for exits controlled by
'or' expressions is now analagous to the trip count computation for
loops with multiple exits. I had already fixed the multiple exit case
to be conservative.

llvm-svn: 182989
2013-05-31 06:43:25 +00:00
Matt Arsenault
67844568c6 Fix wrong comment. Null is not acceptable.
llvm-svn: 182979
2013-05-31 01:40:30 +00:00
Eric Christopher
a16a93b865 Fix a couple of typos and 80-col.
llvm-svn: 182954
2013-05-30 18:59:11 +00:00
Ahmed Bougacha
e848455425 MCObjectSymbolizer: Switch from IntervalMap to sorted vector, following r182625.
This removes the need for the missing SectionRef operator< workaround, and fixes
an IntervalMap assert about alignment on MSVC.

llvm-svn: 182949
2013-05-30 18:18:36 +00:00
Michael Gottesman
2adb2144bb Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

llvm-svn: 182945
2013-05-30 18:07:13 +00:00
Daniel Jasper
3fb2fd6c69 Fix warning on varialbe unused in opt builds.
llvm-svn: 182914
2013-05-30 07:01:43 +00:00
Rafael Espindola
5b34d5a3c7 Change how we iterate over relocations on ELF.
For COFF and MachO, sections semantically have relocations that apply to them.
That is not the case on ELF.

In relocatable objects (.o), a section with relocations in ELF has offsets to
another section where the relocations should be applied.

In dynamic objects and executables, relocations don't have an offset, they have
a virtual address. The section sh_info may or may not point to another section,
but that is not actually used for resolving the relocations.

This patch exposes that in the ObjectFile API. It has the following advantages:

* Most (all?) clients can handle this more efficiently. They will normally walk
all relocations, so doing an effort to iterate in a particular order doesn't
save time.

* llvm-readobj now prints relocations in the same way the native readelf does.

* probably most important, relocations that don't point to any section are now
visible. This is the case of relocations in the rela.dyn section. See the
updated relocation-executable.test for example.

llvm-svn: 182908
2013-05-30 03:05:14 +00:00
Rafael Espindola
ecf5cbb5aa Remove dead return.
llvm-svn: 182898
2013-05-30 00:29:46 +00:00
Andrew Trick
aec414c298 Order CALLSEQ_START and CALLSEQ_END nodes.
Fixes PR16146: gdb.base__call-ar-st.exp fails after
pre-RA-sched=source fixes.

Patch by Xiaoyi Guo!

This also fixes an unsupported dbg.value test case. Codegen was
previously incorrect but the test was passing by luck.

llvm-svn: 182885
2013-05-29 22:03:55 +00:00
Bill Wendling
e5fb3dbcbb Don't reach into the middle of TargetMachine and cache one of its ivars.
Not only does this break encapsulation, it's gross.

llvm-svn: 182876
2013-05-29 20:37:19 +00:00
Adrian Prantl
b6dada0e6e Simplify logic by using the appropriate functions.
llvm-svn: 182869
2013-05-29 17:33:31 +00:00
David Blaikie
9f5c0b787b Debug Info: Reorder accessor to match field order.
llvm-svn: 182816
2013-05-29 02:05:07 +00:00
Simon Atanasyan
dd2b2c12e5 [Mips] Add Mips specific dynamic table entry tags.
llvm-svn: 182803
2013-05-28 20:48:56 +00:00
Paul Redmond
0eb4837b24 Add support for llvm.vectorizer metadata
- llvm.loop.parallel metadata has been renamed to llvm.loop to be more generic
  by making the root of additional loop metadata.
  - Loop::isAnnotatedParallel now looks for llvm.loop and associated
    llvm.mem.parallel_loop_access
  - document llvm.loop and update llvm.mem.parallel_loop_access
- add support for llvm.vectorizer.width and llvm.vectorizer.unroll
  - document llvm.vectorizer.* metadata
  - add utility class LoopVectorizerHints for getting/setting loop metadata
  - use llvm.vectorizer.width=1 to indicate already vectorized instead of
    already_vectorized
- update existing tests that used llvm.loop.parallel and
  llvm.vectorizer.already_vectorized

Reviewed by: Nadav Rotem

llvm-svn: 182802
2013-05-28 20:00:34 +00:00
Michael Gottesman
2a51955f08 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

llvm-svn: 182801
2013-05-28 19:50:20 +00:00
Chad Rosier
40d29a8a9d Remove the MCRegAliasIterator tables and compute the aliases dynamically.
The size reduction in the RegDiffLists are rather dramatic.  Here are a few
size differences for MCTargetDesc.o files (before and after) in bytes:
R600 - 36160B - 11184B - 69% reduction
ARM - 28480B - 8368B - 71% reduction
Mips - 816B - 576B - 29% reduction

One side effect of dynamically computing the aliases is that the iterator does
not guarantee that the entries are ordered or that duplicates have been removed.
The documentation implies this is a safe assumption and I found no clients that
requires these attributes (i.e., strict ordering and uniqueness).

My local LNT tester results showed no execution-time failures or significant
compile-time regressions (i.e., beyond what I would consider noise) for -O0g,
-O2 and -O3 runs on x86_64 and i386 configurations.
rdar://12906217

llvm-svn: 182783
2013-05-28 18:08:48 +00:00
James Molloy
5ba1094838 Extend RemapInstruction and friends to take an optional new parameter, a ValueMaterializer.
Extend LinkModules to pass a ValueMaterializer to RemapInstruction and friends to lazily create Functions for lazily linked globals. This is a big win when linking small modules with large (mostly unused) library modules.

llvm-svn: 182776
2013-05-28 15:17:05 +00:00
Michael Kuperstein
ad5bd9ce5a Make BasicAliasAnalysis recognize the fact a noalias argument cannot alias another argument, even if the other argument is not itself marked noalias.
llvm-svn: 182755
2013-05-28 08:17:48 +00:00
Preston Gurd
8be7e42cc2 Convert sqrt functions into sqrt instructions when -ffast-math is in effect.
When -ffast-math is in effect (on Linux, at least), clang defines
__FINITE_MATH_ONLY__ > 0 when including <math.h>. This causes the
preprocessor to include <bits/math-finite.h>, which renames the sqrt functions.
For instance, "sqrt" is renamed as "__sqrt_finite". 

This patch adds the 3 new names in such a way that they will be treated
as equivalent to their respective original names.

llvm-svn: 182739
2013-05-27 15:44:35 +00:00
Chris Lattner
65e3f520d4 Disable the StringMapEntry copy constructor, to make sure we
reject things like: "for (auto Entry : SomeStringMap)".  Previously
this would copy the value but not the tail allocated string data
(the key).

llvm-svn: 182713
2013-05-25 22:28:22 +00:00
Eric Christopher
d9794c735b Add some comments to the stringify function.
llvm-svn: 182710
2013-05-25 05:13:17 +00:00
Andrew Trick
34c31df32a Track IR ordering of SelectionDAG nodes 3/4.
Remove the old IR ordering mechanism and switch to new one.  Fix unit
test failures.

llvm-svn: 182704
2013-05-25 03:08:10 +00:00
Andrew Trick
2790ee3a8e Track IR ordering of SelectionDAG nodes 2/4.
Change SelectionDAG::getXXXNode() interfaces as well as call sites of
these functions to pass in SDLoc instead of DebugLoc.

llvm-svn: 182703
2013-05-25 02:42:55 +00:00
Andrew Trick
c54d8fb436 Track IR ordering of SelectionDAG nodes 1/4.
Use a field in the SelectionDAGNode object to track its IR ordering.
This adds fields and utility classes without changing existing
interfaces or functionality.

llvm-svn: 182701
2013-05-25 02:20:36 +00:00
Andrew Trick
9fff5d4a18 Fix RecyclingAllocator::PrintStats to print the underlying allocator's stats.
llvm-svn: 182700
2013-05-25 01:47:42 +00:00
Eric Christopher
ad99dcf36c ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.

llvm-svn: 182692
2013-05-24 23:08:17 +00:00
Michael J. Spencer
02fa6608fd [Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
llvm-svn: 182690
2013-05-24 22:58:37 +00:00
Jim Grosbach
b2f4f2ae6d Tidy up. Whitespace.
llvm-svn: 182689
2013-05-24 22:53:06 +00:00
Quentin Colombet
a360776566 Follow up of the introduction of MCSymbolizer.
- Ressurect old MCDisassemble API to soften transition.
- Extend MCTargetDesc to set target specific symbolizer.

llvm-svn: 182688
2013-05-24 22:51:52 +00:00
Michael Gottesman
83a8ea86d4 clang formatted APFloat.h
llvm-svn: 182686
2013-05-24 22:40:37 +00:00
Michael Gottesman
379e42d31f clang-formatted APInt.h
llvm-svn: 182685
2013-05-24 22:38:49 +00:00
Benjamin Kramer
08bbd1ab69 MathExtras: Return the result of find(First|Last)Set in the input type.
Otherwise ZB_Max returns a wrong result when sizeof(T) > sizeof(size_t).

llvm-svn: 182684
2013-05-24 22:25:20 +00:00
Michael J. Spencer
c195b8a813 Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.
llvm-svn: 182680
2013-05-24 22:23:49 +00:00
Michael J. Spencer
9da977410d [Support][MathExtras] Add missing include and disable _BitScan{Forward,Reverse}64 on non x64 MSVC systems.
llvm-svn: 182671
2013-05-24 20:51:59 +00:00
Michael J. Spencer
dbf83dd515 [Support] Add type generic bit utilities to MathExtras.h
llvm-svn: 182667
2013-05-24 20:29:47 +00:00
Diego Novillo
d1f091f169 Add a new function attribute 'cold' to functions.
Other than recognizing the attribute, the patch does little else.
It changes the branch probability analyzer so that edges into
blocks postdominated by a cold function are given low weight.

Added analysis and code generation tests.  Added documentation for the
new attribute.

llvm-svn: 182638
2013-05-24 12:26:52 +00:00
Benjamin Kramer
fcb0899e18 Remove the Copied parameter from MemoryObject::readBytes.
There was exactly one caller using this API right, the others were relying on
specific behavior of the default implementation. Since it's too hard to use it
right just remove it and standardize on the default behavior.

Defines away PR16132.

llvm-svn: 182636
2013-05-24 10:54:58 +00:00
Ahmed Bougacha
eedbfb8aab MC: Disassembled CFG reconstruction.
This patch builds on some existing code to do CFG reconstruction from
a disassembled binary:
- MCModule represents the binary, and has a list of MCAtoms.
- MCAtom represents either disassembled instructions (MCTextAtom), or
  contiguous data (MCDataAtom), and covers a specific range of addresses.
- MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is
  backed by an MCTextAtom, and has the usual successors/predecessors.
- MCObjectDisassembler creates a module from an ObjectFile using a
  disassembler. It first builds an atom for each section. It can also
  construct the CFG, and this splits the text atoms into basic blocks.

MCModule and MCAtom were only sketched out; MCFunction and MCBB were
implemented under the experimental "-cfg" llvm-objdump -macho option.
This cleans them up for further use; llvm-objdump -d -cfg now generates
graphviz files for each function found in the binary.

In the future, MCObjectDisassembler may be the right place to do
"intelligent" disassembly: for example, handling constant islands is just
a matter of splitting the atom, using information that may be available
in the ObjectFile. Also, better initial atom formation than just using
sections is possible using symbols (and things like Mach-O's
function_starts load command).

This brings two minor regressions in llvm-objdump -macho -cfg:
- The printing of a relocation's referenced symbol.
- An annotation on loop BBs, i.e., which are their own successor.

Relocation printing is replaced by the MCSymbolizer; the basic CFG
annotation will be superseded by more related functionality.

llvm-svn: 182628
2013-05-24 01:07:04 +00:00
Ahmed Bougacha
6979d48fa4 Add MCSymbolizer for symbolic/annotated disassembly.
This is a basic first step towards symbolization of disassembled
instructions. This used to be done using externally provided (C API)
callbacks. This patch introduces:
- the MCSymbolizer class, that mimics the same functions that were used
  in the X86 and ARM disassemblers to symbolize immediate operands and
  to annotate loads based off PC (for things like c string literals).
- the MCExternalSymbolizer class, which implements the old C API.
- the MCRelocationInfo class, which provides a way for targets to
  translate relocations (either object::RelocationRef, or disassembler
  C API VariantKinds) to MCExprs.
- the MCObjectSymbolizer class, which does symbolization using what it
  finds in an object::ObjectFile. This makes simple symbolization (with
  no fancy relocation stuff) work for all object formats!
- x86-64 Mach-O and ELF MCRelocationInfos.
- A basic ARM Mach-O MCRelocationInfo, that provides just enough to
  support the C API VariantKinds.

Most of what works in otool (the only user of the old symbolization API
that I know of) for x86-64 symbolic disassembly (-tvV) works, namely:
- symbol references: call _foo; jmp 15 <_foo+50>
- relocations:       call _foo-_bar; call _foo-4
- __cf?string:       leaq 193(%rip), %rax ## literal pool for "hello"
Stub support is the main missing part (because libObject doesn't know,
among other things, about mach-o indirect symbols).

As for the MCSymbolizer API, instead of relying on the disassemblers
to call the tryAdding* methods, maybe this could be done automagically
using InstrInfo? For instance, even though PC-relative LEAs are used
to get the address of string literals in a typical Mach-O file, a MOV
would be used in an ELF file. And right now, the explicit symbolization
only recognizes PC-relative LEAs. InstrInfo should have already have
most of what is needed to know what to symbolize, so this can
definitely be improved.

I'd also like to remove object::RelocationRef::getValueString (it seems
only used by relocation printing in objdump), as simply printing the
created MCExpr is definitely enough (and cleaner than string concats).

llvm-svn: 182625
2013-05-24 00:39:57 +00:00
Daniel Malea
22adabba07 Re-implement DebugIR in a way that does not subclass AssemblyWriter:
- move AsmWriter.h from public headers into lib
- marked all AssemblyWriter functions as non-virtual; no need to override them
- DebugIR now "plugs into" AssemblyWriter with an AssemblyAnnotationWriter helper
- exposed flags to control hiding of a) debug metadata b) debug intrinsic calls

C/R: Paul Redmond

llvm-svn: 182617
2013-05-23 22:34:33 +00:00
Ulrich Weigand
482a595fca [PowerPC] Clean up generation of ha16() / lo16() markers
When targeting the Darwin assembler, we need to generate markers ha16() and
lo16() to designate the high and low parts of a (symbolic) immediate.  This
is necessary not just for plain symbols, but also for certain symbolic
expression, typically along the lines of ha16(A - B).  The latter doesn't
work when simply using VariantKind flags on the symbol reference.
This is why the current back-end uses hacks (explicitly called out as such
via multiple FIXMEs) in the symbolLo/symbolHi print methods.

This patch uses target-defined MCExpr codes to represent the Darwin
ha16/lo16 constructs, following along the lines of the equivalent solution
used by the ARM back end to handle their :upper16: / :lower16: markers.
This allows us to get rid of special handling both in the symbolLo/symbolHi
print method and in the common code MCExpr::print routine.  Instead, the
ha16 / lo16 markers are printed simply in a custom print routine for the
target MCExpr types.  (As a result, the symbolLo/symbolHi print methods
can now replaced by a single printS16ImmOperand routine that also handles
symbolic operands.)

The patch also provides a EvaluateAsRelocatableImpl routine to handle
ha16/lo16 constructs.  This is not actually used at the moment by any
in-tree code, but is provided as it makes merging into David Fang's
out-of-tree Mach-O object writer simpler.

Since there is no longer any need to treat VK_PPC_GAS_HA16 and
VK_PPC_DARWIN_HA16 differently, they are merged into a single
VK_PPC_ADDR16_HA (and likewise for the _LO16 types).

llvm-svn: 182616
2013-05-23 22:26:41 +00:00
Michael Gottesman
68fb914f3d Fixed trailing whitespace.
llvm-svn: 182556
2013-05-23 02:03:05 +00:00
Michael Gottesman
30e0b67afd Updated the comments of APInt.h to match the llvm style guide and be consistent. No functionality change.
llvm-svn: 182555
2013-05-23 02:00:03 +00:00
Chad Rosier
e67a19eff8 Minor fix to comment from my previous commit.
llvm-svn: 182536
2013-05-22 23:25:59 +00:00
Chad Rosier
5a81a5816e Simplify the logic described in the comment.
llvm-svn: 182534
2013-05-22 23:23:14 +00:00
David Blaikie
d6f48e3a73 Solidify the assumption that a DW_TAG_subprogram's type is a DW_TAG_subroutine_type
There were bits & pieces of code lying around that may've given the
impression that debug info metadata supported the possibility that a
subprogram's type could be specified by a non-subroutine type describing
the return type of a void function. This support was incomplete &
unnecessary. Asserts & API have been changed to make the desired usage
more clear.

llvm-svn: 182532
2013-05-22 23:22:18 +00:00
Reid Kleckner
bd18c96e9c Remove unneeded call to a base default ctor
llvm-svn: 182503
2013-05-22 19:07:26 +00:00
Reid Kleckner
206b977507 Fix StringMapIterator compile errors for non-MSVC compilers.
llvm-svn: 182493
2013-05-22 17:32:15 +00:00
Chad Rosier
d450a8f086 Add the IncludeSelf parameter to the MCSubRegIterator and MCSuperRegIterator
constructors.  No functional change.
Part of rdar://12906217

llvm-svn: 182490
2013-05-22 17:26:26 +00:00
Reid Kleckner
d552e7cd95 [Support] Add StringMap::swap() and a default ctor for iterators
This makes StringMap<> more compatible with std::map<std::string, ...>.

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

llvm-svn: 182487
2013-05-22 17:10:11 +00:00
Owen Anderson
5a2e4b2e02 Create an FPOW SDNode opcode def in the target independent .td file rather than in a specific backend.
llvm-svn: 182450
2013-05-22 06:36:09 +00:00
Filip Pizlo
26d10a1d63 Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182448
2013-05-22 02:46:43 +00:00
Jakob Stoklund Olesen
acd362b5ff Define BYTE_ORDER on Solaris.
Solaris doesn't have an endian.h header, but SPARC is the only
big-endian architecture that runs Solaris, so just use that to detect
endianness at compile time.

llvm-svn: 182419
2013-05-21 20:36:13 +00:00
Filip Pizlo
4640fd7653 Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

This is a fixed version of r182407 and r182411. That first revision 
broke builds because I forgot to move the conditional includes of 
various POSIX headers from SectionMemoryManager into 
RTDyldMemoryManager. Those includes are necessary because of how 
getPointerToNamedFunction works around the glibc libc_nonshared.a thing. 
The latter revision still broke things because I forgot to include 
llvm/Config/config.h.

llvm-svn: 182418
2013-05-21 20:24:07 +00:00
Filip Pizlo
1c9d15ee4e Roll out r182411 and 182412 because it's still broken.
llvm-svn: 182415
2013-05-21 20:17:14 +00:00
Filip Pizlo
cb086f2a4f Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

This is a fixed version of r182407. That revision broke builds because I 
forgot to move the conditional includes of various POSIX headers from 
SectionMemoryManager into RTDyldMemoryManager. Those includes are 
necessary because of how getPointerToNamedFunction works around the 
glibc libc_nonshared.a thing.

llvm-svn: 182411
2013-05-21 20:07:12 +00:00
Filip Pizlo
40c1832484 Roll out r182407 and r182408 because they broke builds.
llvm-svn: 182409
2013-05-21 20:03:01 +00:00
Filip Pizlo
46c8b4222c Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).

llvm-svn: 182408
2013-05-21 20:00:56 +00:00
Filip Pizlo
2f5df80a2d Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

llvm-svn: 182407
2013-05-21 19:56:00 +00:00
Benjamin Kramer
b0285fb57a Remove duplicated comment.
Found by -Wdocumentation.

llvm-svn: 182402
2013-05-21 18:06:33 +00:00
Justin Holewinski
2a53cbfbe1 [NVPTX] Add @llvm.nvvm.sqrt.f() intrinsic
llvm-svn: 182394
2013-05-21 16:51:30 +00:00
Eric Christopher
9b050277c3 Add an md5 library derived from a public domain implementation for dwarf4
type signature computation.

llvm-svn: 182348
2013-05-21 01:28:35 +00:00
Richard Smith
6a4438b7ff Comment update: these things are called "configuration names" these days, not
"triples". Also remove the implication that they're only used for specifying a
target.

llvm-svn: 182335
2013-05-20 23:55:41 +00:00
David Blaikie
107b1a9b43 PR14606: Debug Info for namespace aliases/DW_TAG_imported_module
This resolves the last of the PR14606 failures in the GDB 7.5 test
suite by implementing an optional name field for
DW_TAG_imported_modules/DIImportedEntities and using that to implement
C++ namespace aliases (eg: "namespace X = Y;").

llvm-svn: 182328
2013-05-20 22:50:35 +00:00
Bill Wendling
3688f3fab9 The DWARF EH pass doesn't need the TargetMachine, only the TargetLoweringBase like the other EH passes.
llvm-svn: 182321
2013-05-20 21:54:18 +00:00
Hal Finkel
cf203aeadb Rename LoopSimplify.h to LoopUtils.h
As discussed, LoopUtils.h is a better name.

llvm-svn: 182314
2013-05-20 20:46:30 +00:00
Hal Finkel
4692993a01 Expose InsertPreheaderForLoop from LoopSimplify to other passes
Other passes, PPC counter-loop formation for example, also need to add loop
preheaders outside of the regular loop simplification pass. This makes
InsertPreheaderForLoop a global function so that it can be used by other
passes.

No functionality change intended.

llvm-svn: 182299
2013-05-20 16:47:07 +00:00
Benjamin Kramer
216200bec5 Enable pod-like optimizations for pred and succ iterators.
llvm-svn: 182257
2013-05-20 13:12:58 +00:00
Benjamin Kramer
08711da7a1 Add basic support for ELF32-ppc relocations to llvm-dwarfdump.
Should help the ppc32 buildbot.

llvm-svn: 182194
2013-05-18 16:00:35 +00:00
Matt Arsenault
118196f0ca Add LLVMContext argument to getSetCCResultType
llvm-svn: 182180
2013-05-18 00:21:46 +00:00
Rafael Espindola
c0de1ee01b Convert obj2yaml to use yamlio.
llvm-svn: 182169
2013-05-17 22:58:42 +00:00
Matt Arsenault
7a573d2632 Add missing -*- C++ -*- to headers
llvm-svn: 182164
2013-05-17 21:43:39 +00:00
Derek Schuff
15609ee438 Add missing verb to comment in PassNameParser.h
Patch by Mark Seaborn.

llvm-svn: 182131
2013-05-17 16:51:32 +00:00
Sylvestre Ledru
051e77feb2 Fix a typo (ouput => output)
llvm-svn: 182090
2013-05-17 12:31:43 +00:00
David Tweed
ccbb603f31 Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.

llvm-svn: 182085
2013-05-17 10:01:46 +00:00
Rafael Espindola
21effc7220 Remove addFrameMove.
Now that we have good testing, remove addFrameMove and create cfi
instructions directly.

llvm-svn: 182052
2013-05-16 21:02:15 +00:00
Jakob Stoklund Olesen
4d48e01000 Add TargetRegisterInfo::getCoveringLanes().
This lane mask provides information about which register lanes
completely cover super-registers. See the block comment before
getCoveringLanes().

llvm-svn: 182034
2013-05-16 18:03:08 +00:00
Lang Hames
b0c9552559 Fix PBQP graph iterator typedefs.
llvm-svn: 181973
2013-05-16 02:20:41 +00:00
Eli Bendersky
c0e010b564 Remove dead code.
This method is not being used/tested anywhere.

llvm-svn: 181943
2013-05-15 22:41:28 +00:00
Hal Finkel
91bd48d046 Implement PPC counter loops as a late IR-level pass
The old PPCCTRLoops pass, like the Hexagon pass version from which it was
derived, could only handle some simple loops in canonical form. We cannot
directly adapt the new Hexagon hardware loops pass, however, because the
Hexagon pass contains a fundamental assumption that non-constant-trip-count
loops will contain a guard, and this is not always true (the result being that
incorrect negative counts can be generated). With this commit, we replace the
pass with a late IR-level pass which makes use of SE to calculate the
backedge-taken counts and safely generate the loop-count expressions (including
any necessary max() parts). This IR level pass inserts custom intrinsics that
are lowered into the desired decrement-and-branch instructions.

The most fragile part of this new implementation is that interfering uses of
the counter register must be detected on the IR level (and, on PPC, this also
includes any indirect branches in addition to function calls). Also, to make
all of this work, we need a variant of the mtctr instruction that is marked
as having side effects. Without this, machine-code level CSE, DCE, etc.
illegally transform the resulting code. Hopefully, this can be improved
in the future.

This new pass is smaller than the original (and much smaller than the new
Hexagon hardware loops pass), and can handle many additional cases correctly.
In addition, the preheader-creation code has been copied from LoopSimplify, and
after we decide on where it belongs, this code will be refactored so that it
can be explicitly shared (making this implementation even smaller).

The new test-case files ctrloop-{le,lt,ne}.ll have been adapted from tests for
the new Hexagon pass. There are a few classes of loops that this pass does not
transform (noted by FIXMEs in the files), but these deficiencies can be
addressed within the SE infrastructure (thus helping many other passes as well).

llvm-svn: 181927
2013-05-15 21:37:41 +00:00
Rafael Espindola
5ef2f39b92 Cleanup relocation sorting for ELF.
We want the order to be deterministic on all platforms. NAKAMURA Takumi
fixed that in r181864. This patch is just two small cleanups:

* Move the function to the cpp file. It is only passed to array_pod_sort.
* Remove the ppc implementation which is now redundant

llvm-svn: 181910
2013-05-15 18:22:01 +00:00
Douglas Gregor
8fdda97cb6 Add missing #include
llvm-svn: 181900
2013-05-15 17:41:02 +00:00
Ulrich Weigand
3a366f06c6 Remove MCELFObjectTargetWriter::adjustFixupOffset hack
Now that PowerPC no longer uses adjustFixupOffset, and no other
back-end (ever?) did, we can remove the infrastructure itself
(incidentally addressing a FIXME to that effect).

llvm-svn: 181895
2013-05-15 15:07:42 +00:00
David Blaikie
898763a097 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

llvm-svn: 181868
2013-05-15 07:36:59 +00:00
NAKAMURA Takumi
11831ffe02 ELFRelocationEntry::operator<(): Try to stabilize the order. r_offset was insufficient to sort Relocs.
It should fix llvm/test/CodeGen/ARM/ehabi-mc-compact-pr*.ll on some hosts.

  RELOCATION RECORDS FOR [.ARM.exidx]:
  0 R_ARM_PREL31 .text
  0 R_ARM_NONE __aeabi_unwind_cpp_pr0

FIXME: I am not sure of the directions of extra comparators, in Type and Index.
For now, they are different from the direction in r_offset.

llvm-svn: 181864
2013-05-15 02:16:23 +00:00
Filip Pizlo
585f35b5a0 SectionMemoryManager shouldn't be a JITMemoryManager. Previously, the
EngineBuilder interface required a JITMemoryManager even if it was being used 
to construct an MCJIT. But the MCJIT actually wants a RTDyldMemoryManager. 
Consequently, the SectionMemoryManager, which is meant for MCJIT, derived 
from the JITMemoryManager and then stubbed out a bunch of JITMemoryManager 
methods that weren't relevant to the MCJIT.

This patch fixes the situation: it teaches the EngineBuilder that 
RTDyldMemoryManager is a supertype of JITMemoryManager, and that it's 
appropriate to pass a RTDyldMemoryManager instead of a JITMemoryManager if 
we're using the MCJIT. This allows us to remove the stub methods from 
SectionMemoryManager, and make SectionMemoryManager a direct subtype of 
RTDyldMemoryManager.

llvm-svn: 181820
2013-05-14 19:29:00 +00:00
Rafael Espindola
237980d752 Remove the MachineMove class.
It was just a less powerful and more confusing version of
MCCFIInstruction. A side effect is that, since MCCFIInstruction uses
dwarf register numbers, calls to getDwarfRegNum are pushed out, which
should allow further simplifications.

I left the MachineModuleInfo::addFrameMove interface unchanged since
this patch was already fairly big.

llvm-svn: 181680
2013-05-13 01:16:13 +00:00
David Blaikie
7ac4191339 Correct parameter name in doc comment to match declaration.
(review feedback on r181632 from Dmitri)

llvm-svn: 181664
2013-05-11 19:14:10 +00:00
Rafael Espindola
245de3a31f Change getFrameMoves to return a const reference.
To add a frame now there is a dedicated addFrameMove which also takes
care of constructing the move itself.

llvm-svn: 181657
2013-05-11 02:38:11 +00:00
David Blaikie
685380da68 PR14492: Debug Info: Support for values of non-integer non-type template parameters.
This is only tested for global variables at the moment (& includes tests
for the unnamed parameter case, since apparently this entire function
was completely untested previously)

llvm-svn: 181632
2013-05-10 21:52:07 +00:00
Rafael Espindola
d05c5e1727 Remove unused argument.
llvm-svn: 181618
2013-05-10 18:16:59 +00:00
Dmitri Gribenko
df16514210 Documentation warning: \param, not \parm
llvm-svn: 181549
2013-05-09 21:15:03 +00:00
Jordan Rose
e4258d9007 Rewrite assert to avoid warning when the record element type is byte-sized.
BitstreamWriter asserts that when blob data is written from the record
element vector, each element fits in a byte. However, if the record
elements are specified as a SmallVector of 'char', this causes a warning
from -Wtautological-constant-out-of-range-compare. Fix this by using
llvm::isUInt<8> instead of a plain comparison against 256.

llvm-svn: 181545
2013-05-09 21:07:43 +00:00
Rafael Espindola
2e056f9798 Avoid runtime type checks.
In most cases the relocation type implies the object word size and
endianness.

llvm-svn: 181515
2013-05-09 15:10:36 +00:00
Rafael Espindola
8d7780bd2b Introduce convenience typedefs for the 4 ELF object types.
llvm-svn: 181509
2013-05-09 13:13:28 +00:00
Rafael Espindola
56fa3ce519 Change getRelocationAdditionalInfo to be ELF only.
It was only implemented for ELF where it collected the Addend, so this
patch also renames it to getRelocationAddend.

llvm-svn: 181502
2013-05-09 03:39:05 +00:00
Dmitri Gribenko
ef0880a7c0 Use correct parameter names in comments [-Wdocumentation]
llvm-svn: 181478
2013-05-08 22:28:48 +00:00
Daniel Malea
5d26af5c26 Add DebugIR pass -- emits IR file and replace source lines with IR lines in MD
- requires existing debug information to be present
- fixes up file name and line number information in metadata
- emits a "<orig_filename>-debug.ll" succinct IR file (without !dbg metadata
  or debug intrinsics) that can be read by a debugger
- initialize pass in opt tool to enable the "-debug-ir" flag
- lit tests to follow

llvm-svn: 181467
2013-05-08 20:44:14 +00:00
Daniel Malea
864bcbd2ef Pull up AssemblyWriter interface into header to allow subclassing
- made all functions virtual so that subclasses can specialize them
- add printInstructionLine so that subclasses can choose whether or not to
  print the newline character (without having to implement printBasicBlock()
- added a second constructor to AssemblyWriter that does not require a
  SlotTracker, as required in order to keep the SlotTracker helper class outside
  AsmWriter.h and buried in the implementation.

llvm-svn: 181466
2013-05-08 20:38:31 +00:00
Daniel Malea
85afac7f62 Add line tracking support to FormattedStream
- previously formatted_raw_ostream tracked columns, now it tracks lines too
- used by (upcoming) DebugIR pass to know the line number to connect to each IR
  instruction

llvm-svn: 181463
2013-05-08 20:29:10 +00:00
Ulrich Weigand
29d82e6f00 [PowerPC] Add some missing PPC64 relocs
All R_PPC_... relocs should also be present (using the same number)
under the corresponding R_PPC64_... name.   The latter were missing
for a couple of cases, which this patch adds.

This is not a big problem when emitting the reloc, because we can
just use the R_PPC_... define instead.  But it is a problem when
*dumping* relocations e.g. using llvm-readobj, because this will
expect only R_PPC64_... values when inspecting a ppc64 ELF file.

llvm-svn: 181451
2013-05-08 17:50:57 +00:00
David Blaikie
0e8a5b9d09 Rename DIImportedModule to DIImportedEntity and allow imported declarations
DIBuilder::createImportedDeclaration isn't fully plumbed through (note,
lacking in AsmPrinter/DwarfDebug support) but this seemed like a
sufficiently useful division of code to make the subsequent patch(es)
easier to follow.

llvm-svn: 181364
2013-05-07 21:35:53 +00:00
Rafael Espindola
b0598a0361 Remove exception handling support from the old JIT.
llvm-svn: 181354
2013-05-07 20:53:59 +00:00
Andrew Trick
66c37e7321 Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

llvm-svn: 181254
2013-05-06 21:56:35 +00:00
Andrew Trick
7cf2347306 Support command line option categories.
Patch by Dan Liew!

llvm-svn: 181253
2013-05-06 21:56:23 +00:00
Jean-Luc Duprat
5607a72e21 Provide InstCombines for the following 3 cases:
A * (1 - (uitofp i1 C)) -> select C, 0, A
B * (uitofp i1 C) -> select C, B, 0
select C, 0, A + select C, B, 0 -> select C, B, A

These come up in code that has been hand-optimized from a select to a linear blend, 
on platforms where that may have mattered. We want to undo such changes 
with the following transform:
A*(1 - uitofp i1 C) + B*(uitofp i1 C) -> select C, A, B

llvm-svn: 181216
2013-05-06 16:55:50 +00:00
Duncan Sands
03217dbc22 Fix formatting. Patch by o11c.
llvm-svn: 181189
2013-05-06 08:55:45 +00:00
Rafael Espindola
15a39ed0e8 Fix const merging when an alias of a const is llvm.used.
We used to disable constant merging not only if a constant is llvm.used, but
also if an alias of a constant is llvm.used. This change fixes that.

llvm-svn: 181175
2013-05-06 01:48:55 +00:00
Rafael Espindola
297c5a1e10 Add EH support to the MCJIT.
This gets exception handling working on ELF and Macho (x86-64 at least).
Other than the EH frame registration, this patch also implements support
for GOT relocations which are used to locate the personality function on
MachO.

llvm-svn: 181167
2013-05-05 20:43:10 +00:00
Stepan Dyatkovskiy
c06cd03f6e For ARM backend, fixed "byval" attribute support.
Now even the small structures could be passed within byval (small enough
to be stored in GPRs).
In regression tests next function prototypes are checked:

PR15293:
  %artz = type { i32 }
  define void @foo(%artz* byval %s)
  define void @foo2(%artz* byval %s, i32 %p, %artz* byval %s2)
foo: "s" stored in R0
foo2: "s" stored in R0, "s2" stored in R2.

Next AAPCS rules are checked:
5.5 Parameters Passing, C.4 and C.5,
"ParamSize" is parameter size in 32bit words:
-- NSAA != 0, NCRN < R4 and NCRN+ParamSize > R4.
   Parameter should be sent to the stack; NCRN := R4.
-- NSAA != 0, and NCRN < R4, NCRN+ParamSize < R4.
   Parameter stored in GPRs; NCRN += ParamSize.

llvm-svn: 181148
2013-05-05 07:48:36 +00:00
Arnold Schwaighofer
804d6f0d4b PatternMatch: Fix documentation - 'function' not 'attribute'
llvm-svn: 181146
2013-05-05 02:01:41 +00:00
Arnold Schwaighofer
83cedfffb0 PatternMatch: Matcher for (un)ordered floating point min/max
Add support for matching 'ordered' and 'unordered' floating point min/max
constructs.

In LLVM we can express min/max functions as a combination of compare and select.
We have support for matching such constructs for integers but not for floating
point. In floating point math there is no total order because of the presence of
'NaN'. Therefore, we have to be careful to preserve the original fcmp semantics
when interpreting floating point compare select combinations as a minimum or
maximum function. The resulting 'ordered/unordered' floating point maximum
function has to select the same value as the select/fcmp combination it is based
on.

 ordered_max(x,y)   = max(x,y) iff x and y are not NaN, y otherwise
 unordered_max(x,y) = max(x,y) iff x and y are not NaN, x otherwise
 ordered_min(x,y)   = min(x,y) iff x and y are not NaN, y otherwise
 unordered_min(x,y) = min(x,y) iff x and y are not NaN, x otherwise

This matches the behavior of the underlying select(fcmp(olt/ult/.., L, R), L, R)
construct.

Any code using this predicate has to preserve this semantics.

A follow-up patch will use this to implement floating point min/max reductions
in the vectorizer.

radar://13723044

llvm-svn: 181143
2013-05-05 01:54:46 +00:00
Dmitri Gribenko
82c92dc3dd Add ArrayRef constructor from None, and do the cleanups that this constructor enables
Patch by Robert Wilhelm.

llvm-svn: 181138
2013-05-05 00:40:33 +00:00
Tim Northover
f5d9c9ba13 Allow host triple to be correctly overridden in CMake builds
The intended semantics mirror autoconf, where the user is able to
specify a host triple, but if it's left to the build system then
"config.guess" is invoked for the default.

This also renames the LLVM_HOSTTRIPLE define to LLVM_HOST_TRIPLE to
fit in with the style of the surrounding defines.

llvm-svn: 181112
2013-05-04 07:36:23 +00:00
Rafael Espindola
f14bf5454c Fix a performance bug in the Linker.
Now that we hava a convinient place to keep it, remeber the set of
identified structs as we merge modules.

This speeds up the linking of all the bitcode files in clang with the
gold plugin and -plugin-opt=emit-llvm (i.e., link only, no codegen) from
5:25 minutes to 13.6 seconds!

Patch by Xiaofei Wan!

llvm-svn: 181104
2013-05-04 05:05:18 +00:00
Rafael Espindola
9167321551 Last batch of cleanups to Linker.h.
Update comments, fix * placement, fix method names that are not
used in clang, add a linkInModule that takes a Mode and put it
in Linker.cpp.

llvm-svn: 181099
2013-05-04 03:06:50 +00:00
Rafael Espindola
139524848e Don't construct or delete a module on the Linker.
The linker is now responsible only for actually linking the modules, it
is up to the clients to create and destroy them.

llvm-svn: 181098
2013-05-04 02:43:00 +00:00
Rafael Espindola
89ced966f0 Don't store the context in the Linker.
llvm-svn: 181097
2013-05-04 02:34:41 +00:00
Rafael Espindola
4b25444049 Remove unused members and constructor arguments.
llvm-svn: 181096
2013-05-04 02:28:57 +00:00
Rafael Espindola
30eeaa37e2 Delete dead code from the linker.
llvm-svn: 181094
2013-05-04 02:13:18 +00:00
Amara Emerson
036eb4649d Revert r181009.
llvm-svn: 181079
2013-05-03 23:57:17 +00:00
Amara Emerson
863672f436 Add support for reading ARM ELF build attributes.
Build attribute sections can now be read if they exist via ELFObjectFile, and
the llvm-readobj tool has been extended with an option to dump this information
if requested. Regression tests are also included which exercise these features.

Also update the docs with a fixed ARM ABI link and a new link to the Addenda
which provides the build attributes specification.

llvm-svn: 181009
2013-05-03 11:36:35 +00:00
Richard Sandiford
78396a723e [SystemZ] Add ELF relocation support
Another step towards reinstating the SystemZ backend.  Tests will be
included in the main backend patch.

llvm-svn: 181008
2013-05-03 11:11:15 +00:00
Richard Sandiford
cdda427595 [SystemZ] Add llvm::Triple::systemz
First step towards reinstating the SystemZ backend.  Tests will be
included in the main backend patch.

llvm-svn: 181007
2013-05-03 11:05:17 +00:00
Akira Hatanaka
e615afe086 [mips] Remove "Commutative" from property list of non-commutative intrinsics.
llvm-svn: 180988
2013-05-03 01:29:31 +00:00
John McCall
a69fa9df25 In MC asm parsing, account for the possibility of whitespace within
the "identifier" parsed by the frontend callback by skipping forward
until we've consumed a token that ends at the point dictated by the
callback.

In addition, inform the callback when it's parsing an unevaluated
operand (e.g. mov eax, LENGTH A::x) as opposed to an evaluated one
(e.g. mov eax, [A::x]).

This commit depends on a clang commit.

llvm-svn: 180978
2013-05-03 00:15:41 +00:00
Aaron Ballman
db11d84e26 Replaced usages of size_type with size_t to be more consistent.
llvm-svn: 180947
2013-05-02 20:30:27 +00:00
Adrian Prantl
9d3bc41173 Provide an API to temporarily suppress DebugLocations from being attached
to emitted instructions.  Use this if you want an instruction to be
counted towards the prologue or if there is no useful source location.

rdar://problem/13442648

llvm-svn: 180929
2013-05-02 17:27:49 +00:00
Filip Pizlo
9f6e32ea72 This exposes more MCJIT options via the C API:
CodeModel: It's now possible to create an MCJIT instance with any CodeModel you like.  Previously it was only possible to 
create an MCJIT that used CodeModel::JITDefault.

EnableFastISel: It's now possible to turn on the fast instruction selector.

The CodeModel option required some trickery.  The problem is that previously, we were ensuring future binary compatibility in 
the MCJITCompilerOptions by mandating that the user bzero's the options struct and passes the sizeof() that he saw; the 
bindings then bzero the remaining bits.  This works great but assumes that the bitwise zero equivalent of any field is a 
sensible default value.

But this is not the case for LLVMCodeModel, or its internal equivalent, llvm::CodeModel::Model.  In both of those, the default 
for a JIT is CodeModel::JITDefault (or LLVMCodeModelJITDefault), which is not bitwise zero.

Hence this change introduces LLVMInitializeMCJITCompilerOptions(), which will initialize the user's options struct with
defaults. The user will use this in the same way that they would have previously used memset() or bzero(). MCJITCAPITest.cpp
illustrates the change, as does the comment in ExecutionEngine.h.

llvm-svn: 180893
2013-05-01 22:58:00 +00:00