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

15107 Commits

Author SHA1 Message Date
Chris Lattner
011a5bf0aa remove autoupgrade support for really old-style debug info intrinsics.
I think this is the last of autoupgrade that can be removed in 3.1.
Can the atomic upgrade stuff also go?

llvm-svn: 145169
2011-11-27 06:18:33 +00:00
Chris Lattner
321e2eedcc remove autoupgrade support for LLVM 2.9 exception stuff. Mainline supports
LLVM 3.0 and later.

llvm-svn: 145165
2011-11-27 05:56:16 +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
Bruno Cardoso Lopes
626d04cc6f This patch contains support for encoding FMA4 instructions and
tablegen patterns for scalar FMA4 operations and intrinsic. Also
add tests for vfmaddsd.

Patch by Jan Sjodin

llvm-svn: 145133
2011-11-25 19:33:42 +00:00
Benjamin Kramer
4fab3375a7 Devirtualize Pass::getPassID, overriding it isn't useful and it gets called a lot.
While at it pull the trivial ctor in line.

llvm-svn: 145124
2011-11-24 21:14:11 +00:00
Akira Hatanaka
9071684dcf This patch addresses gp relative fixups/relocations for jump tables.
llvm-svn: 145112
2011-11-23 22:18:04 +00:00
Benjamin Kramer
7120c3ef01 Add configure checking for pread(2) and use it to save a syscall when reading files.
llvm-svn: 145061
2011-11-22 12:31:53 +00:00
Sebastian Pop
d35ee1a61a fix typo in comment
llvm-svn: 145048
2011-11-21 20:46:55 +00:00
Nick Lewycky
1eb3e73f1d Add virtual destructor. Whoops!
llvm-svn: 145044
2011-11-21 18:32:21 +00:00
Nick Lewycky
5cadaed864 Less template, more virtual! Refactoring suggested by Chris in code review.
llvm-svn: 145014
2011-11-20 19:37:06 +00:00
Nick Lewycky
39c6f0a5d5 Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.
Suggested in code review by Eli.

That code in InstCombine looks kinda suspicious.

llvm-svn: 145013
2011-11-20 19:09:04 +00:00
Chandler Carruth
f191cab95f Make an obviously const interface actually be marked as const.
llvm-svn: 145009
2011-11-20 11:22:03 +00:00
Devang Patel
a0973b0c53 DISubrange supports unsigned lower/upper array bounds, so let's not fake it in the end while emitting DWARF. If a FE needs to encode signed lower/upper array bounds then we need to extend DISubrange or ad DISignedSubrange.
llvm-svn: 144937
2011-11-17 23:43:15 +00:00
Ted Kremenek
5b61764405 Fix bug in RefCountedBase/RefCountedBaseVPTR where the reference count was accidentally copied as part of the copy constructor. This could result in objects getting leaked because there reference count was too high.
llvm-svn: 144931
2011-11-17 23:02:14 +00:00
Eli Friedman
d02d82d355 Add support for custom names for library functions in TargetLibraryInfo. Add a custom name for fwrite and fputs on x86-32 OSX. Make SimplifyLibCalls honor the custom
names for fwrite and fputs.

Fixes <rdar://problem/9815881>.

llvm-svn: 144876
2011-11-17 01:27:36 +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
d410d36be0 Remove extra ,.
llvm-svn: 144759
2011-11-16 01:36:50 +00:00
Kostya Serebryany
4105068ea9 AddressSanitizer, first commit (compiler module only)
llvm-svn: 144758
2011-11-16 01:35:23 +00:00
Michael J. Spencer
8e33446699 Object/Archive: Give Child a operator < for map.
llvm-svn: 144757
2011-11-16 01:25:13 +00:00
Michael J. Spencer
796bb719a3 Support/COFF: Add structs and enums from the standard for image files.
llvm-svn: 144756
2011-11-16 01:24:57 +00:00
Owen Anderson
48a129b50e Rename MVT::untyped to MVT::Untyped to match similar nomenclature.
llvm-svn: 144747
2011-11-16 01:02:57 +00:00
Benjamin Kramer
4a8534a158 StringRefize and simplify.
llvm-svn: 144675
2011-11-15 19:12:09 +00:00
Benjamin Kramer
ea43fbc528 Remove Value::getNameStr. It has been deprecated for a while and provides no additional value over getName().
llvm-svn: 144657
2011-11-15 18:30:12 +00:00
Benjamin Kramer
de467fc4df Missed some users of Value::getNameStr.
llvm-svn: 144656
2011-11-15 18:30:06 +00:00
Benjamin Kramer
a2f57dee6d Remove all remaining uses of Value::getNameStr().
llvm-svn: 144648
2011-11-15 16:27:03 +00:00
Benjamin Kramer
3eeef2e739 Twinify GraphWriter a little bit.
llvm-svn: 144647
2011-11-15 16:26:38 +00:00
NAKAMURA Takumi
c26f35afea include/llvm/Support/Compiler.h: Invalidate LLVM_ATTRIBUTE_WEAK on cygming for now.
It triggers generating insane executables with both binutils-2.19.1(msysgit) and 2.22.51.20111013(cygwin).

llvm-svn: 144621
2011-11-15 05:24:26 +00:00
Nick Lewycky
3858fb95b7 Move WEAK marking to the declaration.
llvm-svn: 144603
2011-11-15 01:23:22 +00:00
Jakob Stoklund Olesen
2709f65821 Break false dependencies before partial register updates.
Two new TargetInstrInfo hooks lets the target tell ExecutionDepsFix
about instructions with partial register updates causing false unwanted
dependencies.

The ExecutionDepsFix pass will break the false dependencies if the
updated register was written in the previoius N instructions.

The small loop added to sse-domains.ll runs twice as fast with
dependency-breaking instructions inserted.

llvm-svn: 144602
2011-11-15 01:15:30 +00:00
Nick Lewycky
a68ade6ccc Fix linking for some users who already have tsan enabled code and are trying to
link it against llvm code, by making our definitions weak. "Some users."

llvm-svn: 144596
2011-11-15 00:14:04 +00:00
Nick Lewycky
a0b2f7ca1d Refactor capture tracking (which already had a couple flags for whether returns
and stores capture) to permit the caller to see each capture point and decide
whether to continue looking.

Use this inside memdep to do an analysis that basicaa won't do. This lets us
solve another devirtualization case, fixing PR8908!

llvm-svn: 144580
2011-11-14 22:49:42 +00:00
Nick Lewycky
53185e9016 Add support for tsan annotations (thread sanitizer, a valgrind-based tool).
These annotations are disabled entirely when either ENABLE_THREADS is off, or
building a release build. When enabled, they add calls to functions with no
statements to ManagedStatic's getters.

Use these annotations to inform tsan that the race used inside ManagedStatic
initialization is actually benign. Thanks to Kostya Serebryany for helping
write this patch!

llvm-svn: 144567
2011-11-14 20:50:16 +00:00
Benjamin Kramer
720b712c77 Fold ConstantVector::isAllOnesValue into Constant::isAllOnesValue and simplify it.
llvm-svn: 144555
2011-11-14 19:12:20 +00:00
Benjamin Kramer
bff5aaee3f Make headers standalone.
llvm-svn: 144537
2011-11-14 17:45:03 +00:00
Benjamin Kramer
6d85bbc486 Make headers standalone, move a virtual method out of line.
llvm-svn: 144536
2011-11-14 17:22:45 +00:00
Chandler Carruth
f89087744e Under the hood, MBPI is doing a linear scan of every successor every
time it is queried to compute the probability of a single successor.
This makes computing the probability of every successor of a block in
sequence... really really slow. ;] This switches to a linear walk of the
successors rather than a quadratic one. One of several quadratic
behaviors slowing this pass down.

I'm not really thrilled with moving the sum code into the public
interface of MBPI, but I don't (at the moment) have ideas for a better
interface. My direction I'm thinking in for a better interface is to
have MBPI actually retain much more state and make *all* of these
queries cheap. That's a lot of work, and would require invasive changes.
Until then, this seems like the least bad (ie, least quadratic)
solution. Suggestions welcome.

llvm-svn: 144530
2011-11-14 09:12:57 +00:00
Chandler Carruth
09418993f8 Reuse the logic in getEdgeProbability within getHotSucc in order to
correctly handle blocks whose successor weights sum to more than
UINT32_MAX. This is slightly less efficient, but the entire thing is
already linear on the number of successors. Calling it within any hot
routine is a mistake, and indeed no one is calling it. It also
simplifies the code.

llvm-svn: 144527
2011-11-14 08:55:59 +00:00
Chandler Carruth
462bb16130 Fix an overflow bug in MachineBranchProbabilityInfo. This pass relied on
the sum of the edge weights not overflowing uint32, and crashed when
they did. This is generally safe as BranchProbabilityInfo tries to
provide this guarantee. However, the CFG can get modified during codegen
in a way that grows the *sum* of the edge weights. This doesn't seem
unreasonable (imagine just adding more blocks all with the default
weight of 16), but it is hard to come up with a case that actually
triggers 32-bit overflow. Fortuately, the single-source GCC build is
good at this. The solution isn't very pretty, but its no worse than the
previous code. We're already summing all of the edge weights on each
query, we can sum them, check for an overflow, compute a scale, and sum
them again.

I've included a *greatly* reduced test case out of the GCC source that
triggers it. It's a pretty lame test, as it clearly is just barely
triggering the overflow. I'd like to have something that is much more
definitive, but I don't understand the fundamental pattern that triggers
an explosion in the edge weight sums.

The buggy code is duplicated within this file. I'll colapse them into
a single implementation in a subsequent commit.

llvm-svn: 144526
2011-11-14 08:50:16 +00:00
Chandler Carruth
5d03d0351f Add a cautionary note to this API. It was not at all obvious to me how
expensive the most useful interface to this analysis is.

Fun story -- it's also not correct. That's getting fixed in another
patch.

llvm-svn: 144523
2011-11-14 06:51:49 +00:00
Craig Topper
8f22b6d95a Fix comment for LegalizeTypeAction enum.
llvm-svn: 144511
2011-11-13 22:11:24 +00:00
Jakob Stoklund Olesen
9b34607bdf Rename SlotIndexes to match how they are used.
The old naming scheme (load/use/def/store) can be traced back to an old
linear scan article, but the names don't match how slots are actually
used.

The load and store slots are not needed after the deferred spill code
insertion framework was deleted.

The use and def slots don't make any sense because we are using
half-open intervals as is customary in C code, but the names suggest
closed intervals.  In reality, these slots were used to distinguish
early-clobber defs from normal defs.

The new naming scheme also has 4 slots, but the names match how the
slots are really used.  This is a purely mechanical renaming, but some
of the code makes a lot more sense now.

llvm-svn: 144503
2011-11-13 20:45:27 +00:00
NAKAMURA Takumi
fca0bc8d54 Prune more RALinScan. RALinScan was also here!
llvm-svn: 144487
2011-11-13 01:33:10 +00:00
Jakob Stoklund Olesen
5a265aeb70 Delete the old spilling framework from LiveIntervalAnalysis.
This is dead code, all register allocators use InlineSpiller.

llvm-svn: 144478
2011-11-12 23:57:05 +00:00
Jakob Stoklund Olesen
78902f9088 Delete the linear scan register allocator.
RegAllocGreedy has been the default for six months now.

Deleting RegAllocLinearScan makes it possible to also delete
VirtRegRewriter and clean up the spiller code.

llvm-svn: 144475
2011-11-12 22:39:45 +00:00
Eli Friedman
8563e57e38 Don't try to form pre/post-indexed loads/stores until after LegalizeDAG runs. Fixes PR11029.
llvm-svn: 144438
2011-11-12 00:35:34 +00:00
Nicolas Geoffray
98ef58406c Add a custom safepoint method, in order for language implementers to decide which machine instruction gets to be a safepoint.
llvm-svn: 144399
2011-11-11 18:32:52 +00:00
Daniel Dunbar
c2bd09b47b Fix typo.
llvm-svn: 144334
2011-11-10 23:33:18 +00:00
Owen Anderson
50d2e054f9 Add additional checking to ensure that MachineMemOperands are never set to null, which can happen in weird circumstances where target intrinsic hooks are implemented incorrectly.
llvm-svn: 144303
2011-11-10 19:25:09 +00:00
Eric Christopher
3ef909ef86 Fix typo.
llvm-svn: 144198
2011-11-09 18:53:37 +00:00
Eric Christopher
c916a28d7f Remove the pubnames section, no one consumes it.
llvm-svn: 144169
2011-11-09 05:24:07 +00:00
Eli Friedman
3a47854e40 Enhance verifyLoop so that it can reliably verify that every block in a loop is reachable from the loop header.
llvm-svn: 144166
2011-11-09 04:16:01 +00:00
Pete Cooper
224434deec Added invariant field to the DAG.getLoad method and changed all calls.
When this field is true it means that the load is from constant (runt-time or compile-time) and so can be hoisted from loops or moved around other memory accesses

llvm-svn: 144100
2011-11-08 18:42:53 +00:00
Richard Osborne
87ed868306 Don't introduce custom nodes after legalization in TargetLowering::BuildSDIV()
and TargetLowering::BuildUDIV(). Fixes PR11283

llvm-svn: 143964
2011-11-07 17:09:05 +00:00
Eric Christopher
f9c4db49bd Add the support code to enable the dwarf accelerator tables. Upcoming patches
to fix the types section (all types, not just global types), and testcases.

The code to do the final emission is disabled by default.

llvm-svn: 143923
2011-11-07 09:24:32 +00:00
Craig Topper
7eab73f510 Add AVX2 variable shift instructions and intrinsics.
llvm-svn: 143915
2011-11-07 08:26:24 +00:00
Craig Topper
b1ef950217 Add AVX2 VPMOVMASK instructions and intrinsics.
llvm-svn: 143904
2011-11-07 03:20:35 +00:00
Craig Topper
d422190c0f Add AVX2 VEXTRACTI128 and VINSERTI128 instructions. Fix VPERM2I128 to be qualified with HasAVX2 instead of HasAVX. Mark VINSERTF128 and VEXTRACTF128 as never having side effects.
llvm-svn: 143902
2011-11-07 02:00:04 +00:00
Craig Topper
2773b8846e Fix accidental edit to __builtin_ia32_vperm2f128_ps256's name
llvm-svn: 143901
2011-11-07 00:54:28 +00:00
Craig Topper
01b852b95a More AVX2 instructions and their intrinsics.
llvm-svn: 143895
2011-11-06 23:04:08 +00:00
Benjamin Kramer
c597902ecc Replace (Lower|Upper)caseString in favor of StringRef's newest methods.
llvm-svn: 143891
2011-11-06 20:37:06 +00:00
Daniel Dunbar
7b66487335 ADT/StringRef: Add ::lower() and ::upper() methods.
llvm-svn: 143880
2011-11-06 18:04:43 +00:00
Craig Topper
31b1d79474 Add more AVX2 instructions and intrinsics.
llvm-svn: 143861
2011-11-06 06:12:20 +00:00
Benjamin Kramer
4c8932e3b8 Add an option to pad an uleb128 to MCObjectWriter and remove the uleb128 encoding from the DWARF asm printer.
As a side effect we now print dwarf ulebs with .ascii directives.

llvm-svn: 143809
2011-11-05 11:52:44 +00:00
Benjamin Kramer
351ccbc5d4 Fix pasto.
llvm-svn: 143802
2011-11-05 09:45:17 +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
Daniel Dunbar
799f4bb723 build/cmake: Use tblgen macro directly instead of llvm_tablegen, which just
added a layer of indirection with no value (not even conciseness).

llvm-svn: 143727
2011-11-04 19:04:23 +00:00
Eli Friedman
e140806c4c Add missing includes/decls.
llvm-svn: 143722
2011-11-04 18:45:34 +00:00
Eli Friedman
ed37686ef1 Add missing includes/class declaration.
llvm-svn: 143718
2011-11-04 18:30:30 +00:00
Eli Friedman
71f4153b87 Add missing forward declarations.
llvm-svn: 143717
2011-11-04 18:29:09 +00:00
Eli Friedman
ef8abc0e6d Add a couple missing includes; found while analyzing LLVM headers.
llvm-svn: 143716
2011-11-04 18:19:43 +00:00
Eli Friedman
afdb17e3d2 Delete names for unused parameters in inline function definitions in headers, so LLVM users can compile with -Wunused-parameter. PR11257; based on patch by Kevin Harris.
llvm-svn: 143715
2011-11-04 18:11:56 +00:00
Chad Rosier
2605e6c51a Remove declarations for functions that don't exist (and never have).
Patch by Anders Waldenborg <anders@0x63.nu>.

llvm-svn: 143705
2011-11-04 17:07:11 +00:00
Craig Topper
80cdc1ee12 Add intrinsics for X86 vcvtps2ph and vcvtph2ps instructions
llvm-svn: 143683
2011-11-04 06:59:49 +00:00
Craig Topper
124b2fd08c Add new X86 AVX2 VBROADCAST instructions.
llvm-svn: 143612
2011-11-03 07:35:53 +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
Michael J. Spencer
2619be7610 object: Add operator < for SymbolRef and SectionRef.
llvm-svn: 143563
2011-11-02 19:33:41 +00:00
Michael J. Spencer
c059c6c5b9 Object/Archive: Add symbol table iteration.
llvm-svn: 143561
2011-11-02 19:33:12 +00:00
Chandler Carruth
f95461f23b Begin collecting some of the statistics for block placement discussed on
the mailing list. Suggestions for other statistics to collect would be
awesome. =]

Currently these are implemented as a separate pass guarded by a separate
flag. I'm not thrilled by that, but I wanted to be able to collect the
statistics for the old code placement as well as the new in order to
have a point of comparison. I'm planning on folding them into the single
pass if / when there is only one pass of interest.

llvm-svn: 143537
2011-11-02 07:17:12 +00:00
Craig Topper
a2a55bd0b4 More AVX2 instructions and intrinsics.
llvm-svn: 143536
2011-11-02 06:54:17 +00:00
Craig Topper
c5482eb697 Add a bunch more X86 AVX2 instructions and their corresponding intrinsics.
llvm-svn: 143529
2011-11-02 04:42:13 +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
Sebastian Pop
69b2b86143 rename LLVM_HOSTTRIPLE into LLVM_DEFAULT_TARGET_TRIPLE
llvm-svn: 143501
2011-11-01 21:31:44 +00:00
Daniel Dunbar
e79d25dd7a Support/Compiler: Add LLVM_EXTENSION for use where we want to hide pedantic diags.
llvm-svn: 143468
2011-11-01 17:46:12 +00:00
Craig Topper
361c873b52 Fix operand type for x86 pmadd_ub_sw intrinsic.
llvm-svn: 143455
2011-11-01 07:25:22 +00:00
Eli Friedman
62794425dd Remove a couple unused methods. PR11201.
llvm-svn: 143452
2011-11-01 05:11:01 +00:00
Devang Patel
85caca9190 Add utility to append a function to the list of global constructors.
Patch by Kostya Serebryany.

llvm-svn: 143405
2011-10-31 23:58:51 +00:00
Craig Topper
dbf10927d7 Fix operand type for int_x86_ssse3_phadd_sw_128 intrinsic
llvm-svn: 143336
2011-10-31 07:16:37 +00:00
Craig Topper
6eaf58df7c Begin adding AVX2 instructions. No selection support yet other than intrinsics.
llvm-svn: 143331
2011-10-31 02:15:10 +00:00
Craig Topper
f2a9bd3a4a Add intrinsics and feature flag for read/write FS/GS base instructions. Also add AVX2 feature flag.
llvm-svn: 143319
2011-10-30 19:57:21 +00:00
Craig Topper
daa1bc1e9a Mark X86 pcmpeq b/w/d intrinsics as being Commutative. pcmpeqq is already marked as Commutative.
llvm-svn: 143317
2011-10-30 18:33:35 +00:00
Craig Topper
e77289b243 Fix return type for X86 mpsadbw instrinsic. The instruction takes in a vector of 8-bit integers, but produces a vector of 16-bit integers.
llvm-svn: 143313
2011-10-30 17:22:45 +00:00
Dan Gohman
892b86e74c Remove the Alpha backend.
llvm-svn: 143164
2011-10-27 22:56:32 +00:00
Peter Collingbourne
24c42c8534 Add a pinned metadata name for fpaccuracy, and document it
llvm-svn: 143135
2011-10-27 19:19:14 +00:00
Jim Grosbach
ee31b72246 Trailing whitespace.
llvm-svn: 143113
2011-10-27 17:44:01 +00:00
Owen Anderson
997d323baa Expose relocation accessors through the libObject C API.
llvm-svn: 143109
2011-10-27 17:32:36 +00:00
Owen Anderson
ece66e91f2 Add relocation iterators to the libObject C API.
llvm-svn: 143107
2011-10-27 17:15:47 +00:00
Nick Lewycky
651475977d Teach our Dwarf emission to use the string pool.
llvm-svn: 143097
2011-10-27 06:44:11 +00:00
Lang Hames
e8bb71f80d Rename NonScalarIntSafe to something more appropriate.
llvm-svn: 143080
2011-10-26 23:50:43 +00:00
Nick Lewycky
4aa5a52a80 Reflow lines, fix comments for doxygen style, fix whitespace. No functionality
change.

llvm-svn: 143074
2011-10-26 22:55:33 +00:00
Duncan Sands
5c8fa99c32 The maximum power of 2 dividing a power of 2 is itself. This occurs
in 403.gcc and was spotted by my super-optimizer.

llvm-svn: 143054
2011-10-26 20:55:21 +00:00
Owen Anderson
11396b575d Add support for scattered relocations to the MachO relocatation pretty printer.
llvm-svn: 143051
2011-10-26 20:42:54 +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
Eric Christopher
b14f867444 Handle newer cases for freebsd which is approaching 10.0 and not 1.0.
Patch by Dimitry Andric!

llvm-svn: 142995
2011-10-26 00:42:12 +00:00
Michael J. Spencer
6f6b8f7b4d Object/Archive: Add BSD style long file name support and skip internal members.
llvm-svn: 142981
2011-10-25 22:30:42 +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
Bruno Cardoso Lopes
c7102172e1 This is the first of several patches for Mips direct object generation.
This first patch is for expression variable kinds.

Patch by Jack Carter!

llvm-svn: 142934
2011-10-25 18:13:20 +00:00
Dan Gohman
77125e4240 Remove the Blackfin backend.
llvm-svn: 142880
2011-10-25 00:05:42 +00:00
Dan Gohman
b54d296fd4 Remove the SystemZ backend.
llvm-svn: 142878
2011-10-24 23:48:32 +00:00
Owen Anderson
3bfe29265a More fixes and improvements to MachO relocation pretty-printing, particular for x86 and x86_64 relocations with addends.
llvm-svn: 142875
2011-10-24 23:20:07 +00:00
Dan Gohman
91adc96acd Delete the top-down "Latency" scheduler. Top-down scheduling doesn't handle
physreg dependencies, and upcoming codegen changes will require proper
physreg dependence handling.

llvm-svn: 142816
2011-10-24 18:01:06 +00:00
Dan Gohman
5d5a540002 Delete the Latency scheduling preference.
llvm-svn: 142815
2011-10-24 17:56:48 +00:00
Benjamin Kramer
0638353f56 Implement comparison operators for BranchProbability in a way that can't overflow INT64_MAX.
Add a test case for the edge case that triggers this. Thanks to Chandler for bringing this to my attention.

llvm-svn: 142794
2011-10-24 13:50:56 +00:00
Chandler Carruth
d04f838629 Remove return heuristics from the static branch probabilities, and
introduce no-return or unreachable heuristics.

The return heuristics from the Ball and Larus paper don't work well in
practice as they pessimize early return paths. The only good hitrate
return heuristics are those for:
 - NULL return
 - Constant return
 - negative integer return

Only the last of these three can possibly require significant code for
the returning block, and even the last is fairly rare and usually also
a constant. As a consequence, even for the cold return paths, there is
little code on that return path, and so little code density to be gained
by sinking it. The places where sinking these blocks is valuable (inner
loops) will already be weighted appropriately as the edge is a loop-exit
branch.

All of this aside, early returns are nearly as common as all three of
these return categories, and should actually be predicted as taken!
Rather than muddy the waters of the static predictions, just remain
silent on returns and let the CFG itself dictate any layout or other
issues.

However, the return heuristic was flagging one very important case:
unreachable. Unfortunately it still gave a 1/4 chance of the
branch-to-unreachable occuring. It also didn't do a rigorous job of
finding those blocks which post-dominate an unreachable block.

This patch builds a more powerful analysis that should flag all branches
to blocks known to then reach unreachable. It also has better worst-case
runtime complexity by not looping through successors for each block. The
previous code would perform an N^2 walk in the event of a single entry
block branching to N successors with a switch where each successor falls
through to the next and they finally fall through to a return.

Test case added for noreturn heuristics. Also doxygen comments improved
along the way.

llvm-svn: 142793
2011-10-24 12:01:08 +00:00
Chandler Carruth
e443224c31 Doxygen-ify the comments on the public interface for BPI. Also, move the
two more subtle routines to the bottom and expand on their cautionary
comments a bit. No functionality or actual interface change here.

llvm-svn: 142789
2011-10-24 05:55:58 +00:00
Chandler Carruth
c5722dbec0 Simplify the design of BranchProbabilityInfo by collapsing it into
a single class. Previously it was split between two classes, one
internal and one external. The concern seemed to center around exposing
the weights used, but those can remain confined to the implementation
file.

Having a single class to maintain the state and analyses in use will
also simplify several of the enhancements I want to make to our static
heuristics.

llvm-svn: 142783
2011-10-24 01:40:45 +00:00
Chandler Carruth
151d4fc273 Teach the BranchProbabilityInfo pass to print its results, and use that
to bring it under direct test instead of merely indirectly testing it in
the BlockFrequencyInfo pass.

The next step is to start adding tests for the various heuristics
employed, and to start fixing those heuristics once they're under test.

llvm-svn: 142778
2011-10-23 21:21:50 +00:00
Chandler Carruth
c10018cd49 Now that we have comparison on probabilities, add some static functions
to get important constant branch probabilities and use them for finding
the best branch out of a set of possibilities.

llvm-svn: 142762
2011-10-23 20:10:34 +00:00
Benjamin Kramer
9adc582e35 Add compare operators to BranchProbability and use it to determine if an edge is hot.
llvm-svn: 142751
2011-10-23 11:19:14 +00:00
Owen Anderson
0d40d283e9 Use LLVMBool for a function that logically returns a boolean value.
llvm-svn: 142683
2011-10-21 20:35:58 +00:00
Owen Anderson
7faa1c3317 Fix typo.
llvm-svn: 142681
2011-10-21 20:28:19 +00:00
Owen Anderson
da28398bb6 Bind libObject API for obtaining the section containing a Symbol.
llvm-svn: 142667
2011-10-21 18:21:22 +00:00
Owen Anderson
33b5868dab Expand the coverage of the libObject C bindings to include more SectionRef accessors as well as Symbol iterators.
llvm-svn: 142661
2011-10-21 17:50:59 +00:00
Craig Topper
fd96157f13 Remove intrinsics for X86 BLSI, BLSMSK, and BLSR intrinsics and replace with custom isel lowering code.
llvm-svn: 142642
2011-10-21 06:55:01 +00:00
Chandler Carruth
380e0d5013 Implement a block placement pass based on the branch probability and
block frequency analyses. This differs substantially from the existing
block-placement pass in LLVM:

1) It operates on the Machine-IR in the CodeGen layer. This exposes much
   more (and more precise) information and opportunities. Also, the
   results are more stable due to fewer transforms ocurring after the
   pass runs.
2) It uses the generalized probability and frequency analyses. These can
   model static heuristics, code annotation derived heuristics as well
   as eventual profile loading. By basing the optimization on the
   analysis interface it can work from any (or a combination) of these
   inputs.
3) It uses a more aggressive algorithm, both building chains from tho
   bottom up to maximize benefit, and using an SCC-based walk to layout
   chains of blocks in a profitable ordering without O(N^2) iterations
   which the old pass involves.

The pass is currently gated behind a flag, and not enabled by default
because it still needs to grow some important features. Most notably, it
needs to support loop aligning and careful layout of loop structures
much as done by hand currently in CodePlacementOpt. Once it supports
these, and has sufficient testing and quality tuning, it should replace
both of these passes.

Thanks to Nick Lewycky and Richard Smith for help authoring & debugging
this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm
forgetting for reviewing and answering all my questions. Writing
a backend pass is *sooo* much better now than it used to be. =D

llvm-svn: 142641
2011-10-21 06:46:38 +00:00
Dan Gohman
666f749afc Delete the list-tdrr scheduler. Top-down schedulers are going away
because they don't support physical register dependencies.

llvm-svn: 142620
2011-10-20 21:44:34 +00:00
Lang Hames
747fa3d477 Haven't yet found a nice way to handle TargetData verification in the
AsmParser. This patch adds validation for target data layout strings upon
construction of TargetData objects. An attempt to construct a TargetData object
from a malformed string will trigger an assertion.

llvm-svn: 142605
2011-10-20 19:24:44 +00:00
Duncan Sands
a18fd5ecb4 Comment out or remove unused parameter names so as to avoid a slew of
compiler warnings.

llvm-svn: 142574
2011-10-20 08:57:54 +00:00
Duncan Sands
4afb312617 Avoid warnings about the parameter G being unused.
llvm-svn: 142573
2011-10-20 08:56:41 +00:00
Eli Friedman
e8f8cf1f33 Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180.
llvm-svn: 142572
2011-10-20 05:23:42 +00:00
Eli Friedman
ba48f316b1 Remove useless code.
llvm-svn: 142570
2011-10-20 04:33:44 +00:00
David Greene
09fc0034ab Add NAME Member
Add a Value named "NAME" to each Record.  This will be set to the def or defm
name when instantiating multiclasses.  This will replace the #NAME# processing
hack once paste functionality is in place.

llvm-svn: 142518
2011-10-19 13:04:13 +00:00
David Greene
68668c01b0 Call Record Initializer
Call the common Record initializer code from constructors.

llvm-svn: 142509
2011-10-19 13:03:21 +00:00
David Greene
76a2654db8 Add Name Init Record Constructor
Add a Record constructor that takes the Record name as an Init.  This
is more work toward paste functionality.

llvm-svn: 142508
2011-10-19 13:03:15 +00:00
David Greene
2c6b483c06 Fix 80-col Violation
Split up the initializer list for Record to avoid 80-col issues.

llvm-svn: 142507
2011-10-19 13:03:10 +00:00
David Greene
07316ea195 Fix Name Check
Avoid a potential assert by asking for record names as strings explicitly.

llvm-svn: 142503
2011-10-19 13:02:48 +00:00
David Greene
188f077e31 Fix Name Check
Record names may not be fully resolved at this point so ask for the
record name as a string explicitly.  This avoids a potential assert.

llvm-svn: 142502
2011-10-19 13:02:47 +00:00
David Greene
237d471a3b Add Record Init
Add an init function to be shared among Record constructors.

llvm-svn: 142501
2011-10-19 13:02:45 +00:00
David Greene
19302d2140 Make Template Arg Names Inits
Allow template arg names to be Inits.  This is further work to
implement paste as it allows template names to participate in paste
operations.

llvm-svn: 142500
2011-10-19 13:02:42 +00:00
David Greene
91eb76c04d Add Utility to Scope Names
Add a couple of utility functions to take a variable name and qualify
it with the namespace of the enclosing class and/or multiclass.  This
is inpreparation for making template arg names first-class Inits.

llvm-svn: 142498
2011-10-19 13:02:36 +00:00
David Greene
60ceab4b63 Make VarInit Name an Init
Make the VarInit name an Init itself.  We need this to implement paste
functionality so we can reference variables whose names are not yet
completely resolved.

llvm-svn: 142497
2011-10-19 13:02:33 +00:00
David Greene
1c66ed43c1 Add Value Accessors
Add accessors to get Record values by Init name.  This lets us look up
Record values whose names are not yet fully resolved.  More work
toward paste.

llvm-svn: 142496
2011-10-19 13:02:29 +00:00
David Greene
557cd75d47 Add Name Init Accessors
Add a utility to get the name init and get the string representation
of the name.  This will be used for paste functionality.

llvm-svn: 142495
2011-10-19 13:02:28 +00:00
David Greene
f6a28e6e87 Add Init Accessors
Add a couple of utility functions to get at the name init and return
the name init as a string.  This will be used for paste functionality.

llvm-svn: 142494
2011-10-19 13:02:22 +00:00
Chandler Carruth
13b475d4f6 Add pass printing support to BlockFrequencyInfo pass. The implementation
layer already had support for printing the results of this analysis, but
the wiring was missing.

Now that printing the analysis works, actually bring some of this
analysis, and the BranchProbabilityInfo analysis that it wraps, under
test! I'm planning on fixing some bugs and doing other work here, so
having a nice place to add regression tests and a way to observe the
results is really useful.

llvm-svn: 142491
2011-10-19 10:12:41 +00:00
Craig Topper
b1fa647871 Rename PEXTR to PEXT. Add intrinsics for BMI instructions.
llvm-svn: 142480
2011-10-19 07:48:35 +00:00
Eric Christopher
341c5b689a Whitespace.
llvm-svn: 142438
2011-10-18 22:50:13 +00:00
Michael J. Spencer
cdfd6ee8bc Object/COFF: Change type from a struct to a uint16_t. The struct would be
incorrect for bigendian systems.

llvm-svn: 142403
2011-10-18 19:31:59 +00:00
Andrew Trick
1b84db85e7 Use ARM/t2PseudoInst class from ARM/Thumb2 special adds/subs patterns.
Clean up the patterns, fix comments, and avoid confusing both tools
and coders. Note that the special adds/subs SelectionDAG nodes no
longer have the dummy cc_out operand.

llvm-svn: 142397
2011-10-18 19:18:52 +00:00
Andrew Trick
5e61a8e533 whitespace
llvm-svn: 142394
2011-10-18 18:40:53 +00:00
Lang Hames
dfb145da26 Backing out patch. Will refactor to remove the AsmParser dependency on Target.
llvm-svn: 142323
2011-10-18 00:23:49 +00:00
Michael J. Spencer
adc33b805a Object: Add some types to SymbolRef::Type.
Some of these can be true at the same time and there are a lot to add,
so this should be turned into a bitfield. Some of the other accessors
should probably be folded into this.

llvm-svn: 142318
2011-10-17 23:55:06 +00:00
Michael J. Spencer
25b0873d7f Object: Add isSymbolAbsolute and getSymbolSection.
llvm-svn: 142317
2011-10-17 23:54:46 +00:00
Michael J. Spencer
3f458c5498 Object: Add isSymbolWeak.
llvm-svn: 142316
2011-10-17 23:54:22 +00:00
Michael J. Spencer
a9bbb5d675 Object/COFF: Expose more data in the public API.
llvm-svn: 142315
2011-10-17 23:53:56 +00:00
Michael J. Spencer
3a7d4d9fe0 Object: Implement casting for concrete classes.
llvm-svn: 142314
2011-10-17 23:53:37 +00:00
Michael J. Spencer
b1efc242ea 80-col.
llvm-svn: 142309
2011-10-17 23:37:43 +00:00
Lang Hames
4370882b22 Re-applying the target data layout verification patch from r142288, plus appropriate CMake dependencies.
Thanks to Raphael Espindola for tracking down the CMake issues.

llvm-svn: 142306
2011-10-17 23:24:48 +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
Rafael Espindola
a40b412c70 142288 broke the build:
Linking CXX executable ../../bin/llvm-as
../../lib/libLLVMAsmParser.a(LLParser.cpp.o):/home/espindola/llvm/llvm/lib/AsmParser/LLParser.cpp:function llvm::LLParser::ParseTargetDefinition(): error: undefined reference to 'llvm::TargetData::parseSpecifier(llvm::StringRef, llvm::TargetData*)'
clang-3: error: linker command failed with exit code 1 (use -v to see invocation)

Revert "Validate target data layout strings."

This reverts commit 599d2d4c25d3aee63a21d9c67a88cd43bd971b7e.

llvm-svn: 142296
2011-10-17 22:37:51 +00:00
Lang Hames
416d4f3f36 Validate target data layout strings.
Invalid strings in asm files will result in parse errors. Invalid string literals passed to TargetData constructors will result in an assertion.

llvm-svn: 142288
2011-10-17 22:05:34 +00:00
Owen Anderson
92666534ad Add an accessor to get the underlying MachO representation.
llvm-svn: 142261
2011-10-17 21:37:03 +00:00
Owen Anderson
d13ef506e2 Use the correct predicate for determining if a branch is conditional or not.
llvm-svn: 142257
2011-10-17 21:21:44 +00:00
Benjamin Kramer
a470ea0828 MCOperand is pod-like.
llvm-svn: 142253
2011-10-17 21:18:03 +00:00
Michael J. Spencer
c787cb4441 Object: Fix redundant name.
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Bill Wendling
584c5f9c62 Correct over-zealous removal of hack.
Some code want to check that *any* call within a function has the 'returns
twice' attribute, not just that the current function has one.

llvm-svn: 142221
2011-10-17 18:43:40 +00:00
Hal Finkel
e8091aad04 Add comments to TargetLowering.h indicating that the set*Alignment functions take arguments in log2(bytes)
llvm-svn: 142213
2011-10-17 18:23:13 +00:00
Bill Wendling
2ee7de36b8 Now that we have the ReturnsTwice function attribute, this method is
obsolete. Check the attribute instead.
<rdar://problem/8031714>

llvm-svn: 142212
2011-10-17 18:22:52 +00:00
Jakob Stoklund Olesen
1910496fb4 Admonish that MI is not IR and virtual registers have constraints.
In machine code, you can't just replaceRegWith() the same way you can
replaceAllUsesWith() in IR.  Virtual registers may have different
register classes that need to be merged first.

llvm-svn: 142201
2011-10-17 17:33:39 +00:00
Devang Patel
8f9c569a13 svn mv Target/ARM/ARMGlobalMerge.cpp Transforms/Scalar/GlobalMerge.cpp
There is no reason to have simple IR level pass in lib/Target.

llvm-svn: 142200
2011-10-17 17:17:43 +00:00
Chandler Carruth
9c33ff8a8b Add a routine to swap branch instruction operands, and update any
profile metadata at the same time. Use it to preserve metadata attached
to a branch when re-writing it in InstCombine.

Add metadata to the canonicalize_branch InstCombine test, and check that
it is tranformed correctly.

Reviewed by Nick Lewycky!

llvm-svn: 142168
2011-10-17 01:11:57 +00:00
Benjamin Kramer
3fed5faf01 Add AsmToken::getEndLoc and use it to add ranges to x86 asm register parsing.
<stdin>:1:12: error: register %rax is only available in 64-bit mode
   incl    %rax
           ^~~~

llvm-svn: 142137
2011-10-16 12:10:27 +00:00
Benjamin Kramer
8f3fa2bc50 PR11143: Save the old diagnostic handler and call it when munging diagnostics for #line directives.
This reenables proper inline asm diagnostics in clang

llvm-svn: 142132
2011-10-16 10:48:29 +00:00
Chris Lattner
0ab0d49640 remove the dead 'ShowLine' argument from SMDiagnostic.
llvm-svn: 142108
2011-10-16 05:47:55 +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
Nick Lewycky
a0e18fb857 Fix extra whitespace in comment.
llvm-svn: 142079
2011-10-15 19:36:45 +00:00
Andrew Trick
0ef2965563 Fix SCEVExpander assert during LSR: "argument of incompatible type".
Just because we're dealing with a GEP doesn't mean we can assert the
SCEV has a pointer type. The fix is simply to ignore the SCEV pointer
type, which we really didn't need.
Fixes PR11138 webkit crash.

llvm-svn: 142058
2011-10-15 06:19:55 +00:00
Torok Edwin
5ea77f1df2 ocaml bindings: introduce classify_value
llvm-svn: 141991
2011-10-14 20:37:56 +00:00
Torok Edwin
47a6a6a1fc ocaml bindings: add getopcode for constant and instruction, and int64_of_const.
llvm-svn: 141990
2011-10-14 20:37:49 +00:00
Akira Hatanaka
32fd6013f5 Add ELF relocation types for Mips.
Patch by Jack Carter and Reed Kotler at Mips. 

llvm-svn: 141935
2011-10-14 02:43:18 +00:00
Eli Friedman
e702d68556 Enhance the memdep interface so that users can tell the difference between a dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases.
Patch by Xiaoyi Guo.

llvm-svn: 141896
2011-10-13 22:14:57 +00:00
Richard Osborne
72a63ff457 Update IntrinsicsXCore.td with the normal LLVM notice at the top of the file.
llvm-svn: 141889
2011-10-13 21:08:11 +00:00
Michael J. Spencer
fe0e806423 Fix incorrect ELF typedefs.
llvm-svn: 141871
2011-10-13 17:33:52 +00:00
Michael J. Spencer
162052e2b2 Add missing ELF constants.
llvm-svn: 141840
2011-10-13 00:16:25 +00:00
Jakob Stoklund Olesen
9349890ed8 Add MachineInstr::getRegClassConstraint().
Most instructions have some requirements for their register operands.
Usually, this is expressed as register class constraints in the
MCInstrDesc, but for inline assembly the constraints are encoded in the
flag words.

llvm-svn: 141835
2011-10-12 23:37:36 +00:00
Jakob Stoklund Olesen
d406c95461 Extract a method for finding the inline asm flag operand.
llvm-svn: 141834
2011-10-12 23:37:33 +00:00
Jakob Stoklund Olesen
3d62f52b22 Encode register class constreaints in inline asm instructions.
The inline asm operand constraint is initially encoded in the virtual
register for the operand, but that register class may change during
coalescing, and the original constraint is lost.

Encode the original register class as part of the flag word for each
inline asm operand.  This makes it possible to recover the actual
constraint required by inline asm, just like we can for normal
instructions.

llvm-svn: 141833
2011-10-12 23:37:29 +00:00
Eli Friedman
400fe75ba1 Use unsigned multiply to hash integers, so we don't end up with undefined behavior for large signed integers. Based on patch by Ahmed Charles.
llvm-svn: 141827
2011-10-12 22:25:45 +00:00
Kevin Enderby
974c799a5a Finish supporting cpp #file/line comments in assembler for error messages. So
for cpp pre-processed assembly we give correct filename and line numbers when
reporting errors in assembly files when using clang and -integrated-as on .s
files. rdar://8998895

llvm-svn: 141814
2011-10-12 21:38:39 +00:00
Eric Christopher
c3eac5109a Make this use a public accessor too.
llvm-svn: 141752
2011-10-12 00:38:05 +00:00
Eric Christopher
f19ddd9ae9 Use public accessors on the scope that is returned.
llvm-svn: 141739
2011-10-11 23:19:35 +00:00
Chris Lattner
9795434c0b improve some of the documentation around target data layout strings.
llvm-svn: 141733
2011-10-11 23:01:39 +00:00
Eric Christopher
57c57a3260 Add a new wrapper node for a DILexicalBlock that encapsulates it and a
file. Since it should only be used when necessary propagate it through
the backend code generation and tweak testcases accordingly.

This helps with code like in clang's test/CodeGen/debug-info-line.c where
we have multiple #line directives within a single lexical block and want
to generate only a single block that contains each file change.

Part of rdar://10246360

llvm-svn: 141729
2011-10-11 22:59:11 +00:00
Daniel Dunbar
2b6c2310cd Support/DataTypes.h: Clean up some types and add matching (but presumably
unused) code from .cmake to DataTypes.h.in so that the files are essentially in
sync module differences in autoconf/cmake replacement syntax.

llvm-svn: 141702
2011-10-11 20:02:49 +00:00
Owen Anderson
85292f7b5d Expose MachOObjectFile externally, like we do for COFF. First step in reducing the amount of special-purpose code needed for llvm-objdump.
llvm-svn: 141684
2011-10-11 17:32:27 +00:00
NAKAMURA Takumi
162abf56c1 Add -D__STDC_FORMAT_MACROS to use PRIx64.
llvm-svn: 141663
2011-10-11 12:51:44 +00:00
Nick Lewycky
c8160ebc71 Add support for .symtab_shnidx. Unfortunately, doing this required breaking a
layer of abstraction around SymbolRef where you can read its private
SymbolPimpl member.

llvm-svn: 141636
2011-10-11 02:57:48 +00:00
Andrew Trick
d36852e6b1 Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"
IVs.

Indvars previously chose randomly between congruent IVs. Now it will
bias the decision toward IVs that SCEVExpander likes to create. This
was not done to fix any problem, it's just a welcome side effect of
factoring code.

llvm-svn: 141633
2011-10-11 02:28:51 +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