Commit Graph

3028 Commits

Author SHA1 Message Date
Devang Patel
4b49cd298a Add prefix only if it is needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 23:17:17 +00:00
Owen Anderson
7b7b102023 Privatize the last bits of static type state.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 17:59:35 +00:00
Owen Anderson
36a3eb0aaa Move the TypeMap lock to a member on LLVMContextImpl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 17:34:27 +00:00
Owen Anderson
596c1dc3e2 Add locking around the attributes list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 17:10:58 +00:00
Chris Lattner
8f4b1ec02b the MinPad argument to PadToColumn only really makes sense to be 1,
just remove the argument and replace it with 1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 15:48:08 +00:00
Dan Gohman
48cc73d9c7 Fix printing of instructions with null operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 15:28:08 +00:00
Dan Gohman
e04853ca78 Always print at least one space before adding a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 15:27:30 +00:00
Erick Tryzelaar
e0a1bf64c9 Expose creating constant ints and floats from strings in llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 23:36:46 +00:00
Erick Tryzelaar
0e81f660db Add helper functions to ConstantInt and ConstantFP to accept strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 23:36:33 +00:00
Dan Gohman
3778f21b17 Add a getOffsetOf, for building a target-independent expression for
offsetof, similar to getSizeOf for sizeof.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 21:26:11 +00:00
Erick Tryzelaar
5c1c208296 Add an llvm-c function that lets you insert an instruction with a name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:20:57 +00:00
Erick Tryzelaar
56b22697d8 Expose most of the Constant creation functions to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:20:12 +00:00
Erick Tryzelaar
f72596c04a Expose most of the rest of IRBuilder's functions to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 02:19:59 +00:00
Chris Lattner
20e8d5a8cc switch DominanceFrontier::splitBlock to use a smallvector for
the pred list instead of a vector, saving a boat load of malloc/free's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-15 01:39:28 +00:00
Erick Tryzelaar
22c3f1877d Expose LLVMContext to llvm-c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-14 00:01:31 +00:00
Owen Anderson
0e275dc538 Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 23:27:32 +00:00
Dan Gohman
6c304f2314 Make formatted_raw_ostream restore the buffer settings of the
underlying stream when it is finished, so that clients don't
have to do this manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 23:16:59 +00:00
Dan Gohman
009fc9e5d9 Take the fast path for any named value and any GlobalValue, which doesn't
need TypePrinting despite being a subclass of Constant. This fixes
compile-time problems especially visible on 403.gcc when -asm-verbose is
enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 23:07:11 +00:00
Owen Anderson
1d0be15f89 Push LLVMContexts through the IntegerType APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:58:54 +00:00
Dan Gohman
d6c0f65b53 Fix a 4x slowdown in llc -asm-verbose caused by the use of
WriteAsOperand in more places.

Now that more things are using WriteAsOperand, its behavior of
constructing a TypePrinting object and populating it with strings for all
the numbered types in the Module on each call is a significant bottleneck.
Fancier solutions could be pursued here, but for now, just bypass the
TypePrinting overhead in obvious cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 15:27:57 +00:00
Dan Gohman
01889caf73 Change the indentation for LLVM Assembly files from 1 tab to 2 spaces.
This is vaguely consistent with LLVM's own source code, but more
importantly it lets more lines stay within 80 columns.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 01:41:52 +00:00
Dan Gohman
9bf0b9bd44 Now that numbered types have their number printed, it's no longer
interesting to print the number in a comment. Numbered instructions
don't need their number in a comment either.

Also, tidy up newline printing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 23:54:22 +00:00
Dan Gohman
3845e50ede Extend the AsmWriter to print unnamed numbered types as "%0 = type ..."
and unnamed numbered global variables as "@0 = global ...". Extend the
AsmParser to recognize these forms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 23:32:33 +00:00
Dan Gohman
1220e10f70 Make AsmWriter more careful with formatted_raw_ostream so that
it doesn't leave the underlying stream in unbuffered mode when
the stream was originally buffered.

Also, change WriteAsOperand back to plain raw_ostream. This
lets it work for either formatted_raw_ostream or plain
raw_ostream, so that it doesn't have to force a buffer flush
on a plain raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 20:56:03 +00:00
Dan Gohman
683e922d29 Make LLVM Assembly dramatically easier to read by aligning the comments,
using formatted_raw_ostream's PadToColumn.

Before:

bb1:            ; preds = %bb
  %2 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2         ; <double*> [#uses=1]
  %4 = load double* %3, align 8         ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00             ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6         ; <double*> [#uses=1]

After:

bb1:                                        ; preds = %bb
  %2 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2     ; <double*> [#uses=1]
  %4 = load double* %3, align 8             ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00         ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6     ; <double*> [#uses=1]

Several tests required whitespace adjustments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 17:23:50 +00:00
Dan Gohman
4ae5126d04 Remove a bunch more now-unnecessary Context arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 16:23:25 +00:00
Owen Anderson
23b9b19b1a Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 00:36:31 +00:00
Dan Gohman
c752064894 Simplify this code, and use an in-bounds GEP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 00:32:55 +00:00
Owen Anderson
825b72b057 Split EVT into MVT and EVT, the former representing _just_ a primitive type, while
the latter is capable of representing either a primitive or an extended type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 20:47:22 +00:00
Dan Gohman
d6474fa1f1 Add convenience functions for creating nsw add operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 20:20:39 +00:00
Dan Gohman
26769d5919 Don't set the isexact flag if an sdiv operator has been folded into
something else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 19:56:00 +00:00
Daniel Dunbar
3524bd7551 Simplify ConstantExpr::getInBoundsGetElementPtr and fix a possible crash, if
constant folding eliminated the GEP instruction.
 - clang was hitting this on its test suite (for x86_64, at least).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 18:28:09 +00:00
Daniel Dunbar
3603d7a352 Revert 78680 until I figure out why it completely broke things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 18:11:15 +00:00
Devang Patel
ab67e705f5 Link NamedMDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 18:01:24 +00:00
Dan Gohman
e2574d3215 Add convenience functions for creating inbounds GEPs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:57:01 +00:00
Benjamin Kramer
12ddd40953 Make LLVMContext and LLVMContextImpl classes instead of structs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:45:13 +00:00
Daniel Dunbar
c588d55810 Remove some unnecessary LoadInst constructors, missed during Twinification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:38:47 +00:00
Dan Gohman
59c4f5c2fc Add convenience functions for creating exact sdiv operators, and
use them in CreatePtrDiff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:05:24 +00:00
Dan Gohman
ffef8acc3e Tidy #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 16:02:12 +00:00
Dan Gohman
a124430492 Fix a typo in an assertion string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 15:53:15 +00:00
Devang Patel
9d3627ea27 Remove dead metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 06:31:57 +00:00
Bob Wilson
61fc4cf7aa Add a new overloaded EVT::vAny type for use in TableGen to allow intrinsic
arguments that are vectors of any size and element type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 01:14:02 +00:00
Devang Patel
286d9e4b9d Remove MDNode from ValueMap when MDNode is destroyed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 22:59:46 +00:00
Owen Anderson
e50ed30282 Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 22:56:29 +00:00
Devang Patel
6418a3ca85 Rename MDNodeSet as MDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 22:31:31 +00:00
Daniel Dunbar
e74f3c0ce6 Rename ConvertType to ConvertConstant to avoid a name conflict on llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 20:56:46 +00:00
Devang Patel
d7de19ad7b We are not using FoldingSet for metadata uniquing anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 18:59:07 +00:00
Benjamin Kramer
b2d555b25b g++ 4.0 doesn't have std::vector::data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 18:27:33 +00:00
Owen Anderson
0631fce850 Change the MDNode uniquing to a ValueMap, at Devang's request.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 18:16:08 +00:00
Dan Gohman
7db949df78 Fix a bunch of namespace pollution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-07 01:32:21 +00:00