Commit Graph

265 Commits

Author SHA1 Message Date
Dan Gohman
ecb7a77885 Change uses of Function::front to Function::getEntryBlock for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35265 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 16:38:57 +00:00
Reid Spencer
590b3c559f For PR1258:
Radically simplify the SlotMachine. There is no need to keep Value planes
around any more. This change causes slot numbering to number all un-named,
non-void values starting at 0 and incrementing monotonically through the
function, regardless of type (including BasicBlocks). Getting slot numbers
is now a single lookup operation instead of a double lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35171 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-19 18:32:53 +00:00
Reid Spencer
914c3bca87 Adjust to changes in the APInt interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34681 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 20:25:25 +00:00
Reid Spencer
940685ecf5 Allow the AsmWriter to print out arbitrary precision integers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-27 08:34:09 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Reid Spencer
ef9b9a7939 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:47:22 +00:00
Reid Spencer
ebe57e36df Fix a comment that needed to change after SHIFT patch landed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33781 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 13:54:55 +00:00
Reid Spencer
832254e1c2 Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 02:16:23 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Anton Korobeynikov
b10308e440 Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-28 13:31:35 +00:00
Reid Spencer
3702d265b8 For PR645:
Implement new syntax for local and global symbols. Types and local
symbols use the % prefix. Global variables and functions use the @ prefix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33523 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 08:02:52 +00:00
Chris Lattner
9a40c023cc make this more efficient in release builds (time and space)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33239 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 18:28:18 +00:00
Chris Lattner
42a7551725 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Anton Korobeynikov
7f70559bc4 * PIC codegen for X86/Linux has been implemented
* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33136 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 19:20:47 +00:00
Reid Spencer
15ee935fc5 Always write 1 bit integers as i1 not "bool".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33115 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 07:25:20 +00:00
Reid Spencer
a54b7cbd45 For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 07:05:14 +00:00
Reid Spencer
579dca12c2 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Reid Spencer
11b910c71f Shut up a warning about signed/unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33071 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 07:58:19 +00:00
Chris Lattner
ac618e6a9d simplify some logic further
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33069 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 04:30:21 +00:00
Chris Lattner
22379bc7bb Recommit my previous patch with a bugfix: printInfoComment works on both
local and global values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33068 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 03:54:27 +00:00
Reid Spencer
162b02e327 Back out the last patch which is a nightly test killer. The assertion
in getLocalSlot fires on many, many values. It broke nearly all of
the dejagnu tests. Simple changes to the assertion did not fix the
problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33054 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-10 09:18:16 +00:00
Chris Lattner
b2b442f06d Last refactoring before PR645: split up getSlot into getLocalSlot and getGlobalSlot.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33053 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-10 07:01:46 +00:00
Chris Lattner
55e73a5493 eliminate some iterator gymnastics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33052 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-10 06:43:26 +00:00
Chris Lattner
cf8790aaff Inline insertValue into CreateModuleSlot/CreateFunctionSlot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-09 08:04:59 +00:00
Chris Lattner
22990aae5c Remove a bunch of complex logic that is completely dead: duplicates can
never be inserted!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33037 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-09 07:58:11 +00:00
Chris Lattner
9446bbe7d4 Split CreateSlot into two versions, one for globals and one for function-local
values


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33036 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-09 07:55:49 +00:00
Chris Lattner
3a4621c5f6 Remove extraneous return value from insertValue and getOrCreateSlot. Since
getOrCreateSlot no longer gets the slot, rename it to CreateSlot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33035 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-09 07:46:21 +00:00
Andrew Lenharth
43f344a266 And asm writing for packed struct initializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33016 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-08 18:21:30 +00:00
Reid Spencer
78d033e086 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 07:24:44 +00:00
Reid Spencer
2c261789d3 Change the syntax for parameter attributes:
1. The @ sign is no longer necessary.
2. We now support "function attributes" as parameter attribute 0.
3. Instead of locating the return type attributes after the type of a
   function result, they are now located after the function header's
   closing paranthesis and before any alignment or section options.
4. The way has been prepared for a new "noreturn" function attribute but
   there is no support for recognizing it in the lexer nor doing anything
   with it if it does get set.
5. The FunctionType::getParamAttrsText method now has support for
   returning multiple attributes. This required a change in its interface.

I'm unhappy that this change leads to 6 new shift/reduce conflicts, but
in each case bison's decision to choose the shift is correct so there
shouldn't be any damage from these conflicts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32904 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 17:06:19 +00:00
Reid Spencer
6359618e43 Fix a cut-and-paste bug for processing of InvokeInst parameter attributes.
The lookup of parameter attributes was offset by two because of the
additional operands in an invoke instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32801 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 22:17:01 +00:00
Reid Spencer
bd5db8e29b For PR950:
* Change integer type name from signed to signless
* Implement printing of FunctionType parameter attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32778 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 05:24:50 +00:00
Reid Spencer
b951bc0283 For PR950:
Remove all grammar conflicts from assembly parsing.  This change involves:
1. Making the "type" keyword not a primitive type (removes several
   reduce/reduce conflicts)
2. Being more specific about which linkage types are allowed for functions
   and global variables. In particular "appending" can no longer be
   specified for a function. A differentiation was made between the various
   internal and external linkage types.
3. Introduced the "define" keyword which is now required when defining a
   function. This disambiguates several cases where a named function return
   type could get confused with the definition of a new type. Using the
   keyword eliminates all shift/reduce conflicts and the remaining
   reduce/reduce conflicts.

These changes are necessary to implement the function parameter attributes
that will be introduced soon. Adding the function parameter attributes in
the presence of the shift/reduce and reduce/reduce conflicts led to severe
ambiguities that caused the parser to report syntax errors that needed to
be resolved. This patch resolves them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32770 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-29 20:29:48 +00:00
Reid Spencer
9d908e8ca0 Now that ConstantInt::isValueValidForType can handle signed and unsigned
values regardless of the signedness of the constant's type, it is okay to
always make the AsmWriter.cpp print constant ints as signed values. The
AsmParser will automatically handle things like: uint -1 as a result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32686 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 21:16:35 +00:00
Andrew Lenharth
38ecbf18eb Packed Structures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32361 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-08 18:06:16 +00:00
Bill Wendling
832171cb97 Removing even more <iostream> includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32320 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 20:04:42 +00:00
Bill Wendling
e81561909d Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 01:30:32 +00:00
Chris Lattner
82c4bc7153 Remove the dead CachedWriter class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32271 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 06:40:49 +00:00
Chris Lattner
2fcfdb79d0 printName is almost always true. In the cases that mattered where it was false,
it was effectively set to true by this:

-  if ((PrintName || isa<GlobalValue>(V)) && V->hasName())
+  if (V->hasName())

Delete printname entirely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32265 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 06:24:27 +00:00
Chris Lattner
a6b1ffcfaa The hasSlot methods are gone.
Remove the 'PrintName' argument to WriteAsOperand, as it is always true.
Only call getOrCreateSlot on things that are valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32263 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 06:15:43 +00:00
Chris Lattner
4932a5a335 remove unused api, simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32260 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 05:55:41 +00:00
Chris Lattner
919e70c3ff remove more code that was only used by the bc writer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32259 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 05:50:41 +00:00
Chris Lattner
c3e56e20e4 remove dead code left over from when this functionality was shared with the
bcwriter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32258 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 05:42:32 +00:00
Chris Lattner
de891a6c35 rename createSlot -> getOrCreateSlot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32256 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 05:27:40 +00:00
Chris Lattner
c96ce89c97 clean up some sloppy and inconsistent spacing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32255 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 05:12:21 +00:00
Chris Lattner
d6d826cdad wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32254 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 04:41:52 +00:00
Reid Spencer
81dfeb3264 For PR950: Implement ICmp/FCmp predicate printing for constant expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32168 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-04 05:19:18 +00:00
Reid Spencer
87e8ec9a50 Shorten the FCmp predicate mnemonics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32150 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-03 06:35:48 +00:00