Commit Graph

79250 Commits

Author SHA1 Message Date
Filipe Cabecinhas
8b2199e2a2 Make sure Op->getType() is a PointerType before we cast<> it.
Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236193 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 01:13:31 +00:00
Hans Wennborg
49baa9f896 Switch lowering: use profile info to build weight-balanced binary search trees
This will cause hot nodes to appear closer to the root.

The literature says building the tree like this makes it a near-optimal (in
terms of search time given key frequencies) binary search tree. In LLVM's case,
we can do up to 3 comparisons in each leaf node, so it might be better to opt
for lower tree height in some cases; that's something to look into in the
future.

Differential Revision: http://reviews.llvm.org/D9318

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 00:57:37 +00:00
Filipe Cabecinhas
a607be94ca Make sure we don't resize(0) when we get a fwdref with Idx == UINT_MAX
Make it an error instead.

Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 00:52:42 +00:00
Rafael Espindola
4689501178 Store relocations in a map from MCSectionELF.
Saves finding the MCSectionData just to do a map lookup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 00:45:46 +00:00
Rafael Espindola
1e95f2152f Write relocations directly to the output stream. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236187 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 00:30:40 +00:00
Pete Cooper
224f06e5dd Change x86 CMOVE_F to read it source, not write it.
This was breaking sqlite with the machine verifier because operand 0 was a def according to tablegen, but didn't have the 'isDef' flag set.

Looking at the ISA, its clear that this operand is a source as writing to st(0) is implicit.  So move the operand to the correct place in the td file.

rdar://problem/20751584

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236183 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 23:51:33 +00:00
David Blaikie
3453e8bfe1 [opaque pointer type] Store the value type of an alloca
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236175 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 23:00:35 +00:00
Reid Kleckner
85b9ebb7e8 [WinEH] Start EH preparation for 32-bit x86, it uses no arguments
32-bit x86 MSVC-style exceptions are functionaly similar to 64-bit, but
they take no arguments. Instead, they implicitly use the value of EBP
passed in by the caller as a pointer to the parent's frame. In LLVM, we
can represent this as llvm.frameaddress(1), and feed that into all of
our calls to llvm.framerecover.

The next steps are:
- Add an alloca to the fs:00 linked list of handlers
- Add something like llvm.sjlj.lsda or generalize it to store in the
  alloca
- Move state number calculation to WinEHPrepare, arrange for
  FunctionLoweringInfo to call it
- Use the state numbers to insert explicit loads and stores in the IR

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236172 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 22:49:54 +00:00
Sanjay Patel
3c2da524a6 generalize binop reassociation; NFC
Move the fold introduced in r236031:
http://reviews.llvm.org/rL236031

to its own helper function, so we can use it for other binops.

This is a preliminary step before partially solving:
https://llvm.org/bugs/show_bug.cgi?id=21768
https://llvm.org/bugs/show_bug.cgi?id=23116



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 22:30:02 +00:00
Pat Gavlin
ec4a389039 Run StatepointLowering.{cpp,h} through clang-format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236166 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:52:45 +00:00
Chris Bieneman
054c79645c [NFC] Converting to range-based for.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:45:22 +00:00
David Blaikie
39e7388a19 [opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space
Many of the callers already have the pointer type anyway, and for the
couple of callers that don't it's pretty easy to call PointerType::get
on the pointee type and address space.

This avoids LLParser from using PointerType::getElementType when parsing
GlobalAliases from IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:22:39 +00:00
Rafael Espindola
a19abeb7ab Inline FragmentWriter into the only user.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236158 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:13:30 +00:00
Rafael Espindola
5fc3769ddc Write the symbol table directly to the output file.
There is no need to first accumulate it in fragments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236157 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:09:32 +00:00
Sanjay Patel
90d98d86c2 tidy up; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236156 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 21:01:41 +00:00
Rafael Espindola
840bb0f332 Use pwrite to write the number of sections.
This avoids having to compute the number upfront, which will be used in the
next patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236153 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:39:37 +00:00
Sanjay Patel
35684a13d4 too much space again; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236150 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:38:02 +00:00
Rafael Espindola
4fa3a17472 Write the string table directly to the output file.
There is no need to accumulate it in fragments first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236148 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:34:31 +00:00
Sanjay Patel
d08b65a38f too much space; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236147 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:32:57 +00:00
Douglas Katzman
1b88927253 [Sparc] Really add sparcel architecture support.
Mostly copy-and-paste from Sparc v8 architecture.

Differential Revision: http://reviews.llvm.org/D8741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236146 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:30:57 +00:00
Rafael Espindola
58a854d447 Write the section header string table directly to the output stream.
Instead of accumulating the content in a fragment first, just write it
to the output stream.

Also put it first in the section table, so that we never have to worry
about its index being >= SHN_LORESERVE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:25:24 +00:00
Manman Ren
38f2883ff9 [AArch64] Refactor out codes that depend on specific CS save sequence.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236143 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 20:03:38 +00:00
Rafael Espindola
4a43cd24af Avoid a few const_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 19:20:10 +00:00
Tim Northover
304d8fb5ca ARM: mark branch-like instructions with correct flags.
There's probably no way to test BXJ, but if the compiler ever did emit it
during CodeGen it would have to be a block terminator so "isBranch" is
appropriate.

BLX is more tricky. Clearly a call, but it affects surprisingly little.

rdar://18719544

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236140 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 19:16:38 +00:00
Douglas Katzman
f74703a44f New architecture name - 'sparcel' for Sparc little-endian.
Differential Revision: http://reviews.llvm.org/D9263

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236139 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 19:15:08 +00:00
Douglas Katzman
484da4100d Make Sparc assembler accept parenthesized constant expressions.
Differential Revision: http://reviews.llvm.org/D9087

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 18:48:29 +00:00
Zoran Jovanovic
6b6dc8a1f6 [mips][microMIPSr6] Implement MUL, MUH, MULU and MUHU instructions
Differential Revision: http://reviews.llvm.org/D8894


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236131 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 17:23:22 +00:00
Andrew Kaylor
a147b2575b [WinEH] Fix minor bug in begincatch block splitting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236129 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 17:21:26 +00:00
Adrian Prantl
b3b655c5a3 Temporarily relax a check in the debug info verifier.
The clang frontend helps out GDB by emitting the members of local anonymous
unions as artificial local variables with shared storage. When SROA splits
the storage for artificial local variables that are smaller than the entire
union, the overhang piece will be outside of the allotted space for the
variable and this check fails.

rdar://problem/20730771

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236124 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:52:17 +00:00
Reid Kleckner
86b699c278 [X86] Avoid mangling frameescape labels
x86 Windows uses the '_' prefix for all global symbols, and this was
mistakenly being applied to frameescape labels, which are not externally
visible global symbols. They use the private global prefix 'L'.

The *right* way to fix this is probably to stop masquerading this label
as an ExternalSymbol and create a new SDNode type. These labels are not
"external", and we know they will be resolved by assembly time. Having a
custom SDNode type would allow us to do better X86 address mode
matching, so it's probably worth doing eventually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236123 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:46:01 +00:00
Duncan P. N. Exon Smith
e56023a059 IR: Give 'DI' prefix to debug info metadata
Finish off PR23080 by renaming the debug info IR constructs from `MD*`
to `DI*`.  The last of the `DIDescriptor` classes were deleted in
r235356, and the last of the related typedefs removed in r235413, so
this has all baked for about a week.

Note: If you have out-of-tree code (like a frontend), I recommend that
you get everything compiling and tests passing with the *previous*
commit before updating to this one.  It'll be easier to keep track of
what code is using the `DIDescriptor` hierarchy and what you've already
updated, and I think you're extremely unlikely to insert bugs.  YMMV of
course.

Back to *this* commit: I did this using the rename-md-di-nodes.sh
upgrade script I've attached to PR23080 (both code and testcases) and
filtered through clang-format-diff.py.  I edited the tests for
test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns
were off-by-three.  It should work on your out-of-tree testcases (and
code, if you've followed the advice in the previous paragraph).

Some of the tests are in badly named files now (e.g.,
test/Assembler/invalid-mdcompositetype-missing-tag.ll should be
'dicompositetype'); I'll come back and move the files in a follow-up
commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:38:44 +00:00
Jan Vesely
42eeb1d91f CodeGen: Default overflow operations to expand so we don't have to assume targets are lying
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: ab
Differential Revision: http://reviews.llvm.org/D9265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:30:46 +00:00
Zoran Jovanovic
3cf9e970d3 [mips][microMIPSr6] Implement SUB and SUBU instructions
Differential Revision: http://reviews.llvm.org/D8764


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236118 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 16:22:46 +00:00
Zoran Jovanovic
b26cc705b0 [mips][microMIPSr6] Implement ADD, ADDU and ADDIU instructions
Differential Revision: http://reviews.llvm.org/D8704


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236111 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 15:11:07 +00:00
James Y Knight
0e13ba8208 Sparc: Prefer reg+reg address encoding when only one register used.
Reg+%g0 is preferred to Reg+imm0 by the manual, and is what GCC produces.

Futhermore, reg+imm is invalid for the (not yet supported) "alternate
address space" instructions.

Differential Revision: http://reviews.llvm.org/D8753

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 14:54:44 +00:00
Vasileios Kalintiris
56d0e00515 Mips fast-isel - handle functions which return i8 or i6 .
Summary: Allow Mips fast-isel to handle functions which return i8/i16 signed/unsigned.

Test Plan:
Make check tests are forthcoming.
Already passes test-suite at O0/O2 for Mips 32 r1/r2

Reviewers: dsanders, rkotler

Subscribers: llvm-commits, rfuhler

Differential Revision: http://reviews.llvm.org/D6765

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236103 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 14:17:14 +00:00
Daniel Sanders
b6d2c5a952 [mips] Correct 128-bit shifts on 64-bit targets.
Summary:
The existing code was correct for 32-bit GPR's but not 64-bit GPR's. It now
accounts for both cases.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits, mohit.bhakkad, sagar

Differential Revision: http://reviews.llvm.org/D9337

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236099 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 12:28:58 +00:00
Toma Tabacu
5be17c48fb [mips] [IAS] Inline assemble-time shifting out of createLShiftOri. NFC.
Summary:
Do the assemble-time shifts from createLShiftOri at the source, which groups all the shifting together, closer to the main logic path, and
store the results in concisely-named variables to improve code clarity.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8973

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 10:19:56 +00:00
Elena Demikhovsky
fbb2bab1e4 fixed 80-chars; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 08:49:57 +00:00
Elena Demikhovsky
5470fb0338 Fixed masked gather/scatter switch-case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236092 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 08:38:53 +00:00
Craig Topper
40048e70d7 [TableGen] Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236089 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:14 +00:00
Craig Topper
ac9abe5e99 [TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:12 +00:00
Craig Topper
134e2e75b3 [TableGen] Replace some dyn_casts followed by an assert with just a regular cast which asserts internally. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:05 +00:00
Elena Demikhovsky
a2b90dc078 fixed comments, blanks, nullptr; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 06:49:50 +00:00
Craig Topper
ed5293c2e9 [TableGen] Use range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 04:43:36 +00:00
Filipe Cabecinhas
fe7b873743 Use an "early return" idiom for the error case. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 02:36:08 +00:00
Filipe Cabecinhas
99ebc9e004 Check that we have a valid PointerType element type before calling get()
Same as r236073 but for PointerType.

Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 02:27:28 +00:00
Filipe Cabecinhas
5c9b6dbb73 Use the ArrayType member function for array element types.
ArrayType and StructType accept the same types, so no test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 02:27:21 +00:00
Filipe Cabecinhas
7b30f32d3d Turn an assert into report_fatal_error since it's reachable based on user input
Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 01:58:31 +00:00
Filipe Cabecinhas
3b4a565b8a Make sure that isValidElementType(Type) before calling {Array,Struct}Type::get(Type)
Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 01:27:01 +00:00