Commit Graph

1961 Commits

Author SHA1 Message Date
Chris Lattner 0399758b5f very early support for analyzing a bitstream. This opens the file, starts
reading the stream, and detects whether it is LLVM IR or not.

llvm-svn: 36556
2007-04-29 08:12:22 +00:00
Chris Lattner 6694f60bec Switch the bitcode reader interface to take a MemoryBuffer instead of knowing
anything about disk I/O itself.  This greatly simplifies its interface -
eliminating the need for the ReaderWrappers.cpp file.

This adds a new option to llvm-dis (-bitcode) which instructs it to read
the input file as bitcode.  Until/unless the bytecode reader is taught to
read from MemoryBuffer, there is no way to handle stdin reading without it.

I don't plan to switch the bytecode reader over, I'd rather delete it :),
so the option will stay around temporarily.

llvm-svn: 36554
2007-04-29 07:54:31 +00:00
Chris Lattner cc18989c14 fit in 80 cols
llvm-svn: 36551
2007-04-29 05:51:00 +00:00
Chris Lattner 4c522b9434 reset errno to zero on entry to the application's main function. This fixes
MultiSource/Applications/minisat in the JIT.

Note that the libsystem stuff should ideally never modify errno.  :(

llvm-svn: 36508
2007-04-27 17:02:33 +00:00
Jeff Cohen bb693dcfb1 Add new option to usage help.
llvm-svn: 36347
2007-04-22 18:33:20 +00:00
Chris Lattner 8ca41bfb57 don't break reading from stdin
llvm-svn: 36336
2007-04-22 06:35:20 +00:00
Chris Lattner 69892b79ce link in bitwriter library
llvm-svn: 36335
2007-04-22 06:31:35 +00:00
Chris Lattner e224446728 teach llvm-dis to read bitcode files
llvm-svn: 36334
2007-04-22 06:31:02 +00:00
Chris Lattner 52e1f0f297 add a temporary -bitcode option, which instructs llvm-as to produce a bitcode file instead of a bytecode file
llvm-svn: 36333
2007-04-22 06:28:58 +00:00
Reid Spencer 4388f0b4fa For PR1146:
Make ParamAttrsList objects unique. You can no longer directly create or
destroy them but instead must go through the ParamAttrsList::get()
interface.

llvm-svn: 36327
2007-04-22 05:46:44 +00:00
Reid Spencer d1c1ed1cb9 Add the --host-target option.
llvm-svn: 36326
2007-04-22 05:05:36 +00:00
Chris Lattner 8cc95f24a7 remove cruft
llvm-svn: 36268
2007-04-20 04:45:58 +00:00
Reid Spencer 52e4e91284 Regenerate.
llvm-svn: 36106
2007-04-16 03:05:01 +00:00
Reid Spencer 78dffdc5d1 For PR1336:
Functions without names deserve to be created too. This fixes:
test/CodeGen/Generic/vector-constantexpr.ll

llvm-svn: 36105
2007-04-16 03:04:13 +00:00
Reid Spencer 3da4004c34 For PR1336:
When upgrading global vars, look for conflicts with functions as well. This
fixes test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll

llvm-svn: 36103
2007-04-16 02:56:33 +00:00
Reid Spencer 4f7e511a8e Regenerate.
llvm-svn: 36096
2007-04-16 00:40:57 +00:00
Reid Spencer 19a0ff01f9 For PR1336:
Rewrite the upgrade of GEP indices to be a little less obtuse. This fixes
test/Assembler/2002-08-19-BytecodeReader.llx
test/Assembler/2003-08-21-ConstantExprCast-Fold.llx
test/Assembler/2004-01-11-getelementptrfolding.llx

llvm-svn: 36095
2007-04-16 00:39:39 +00:00
Reid Spencer 5899dd1dc3 Make the generated code for ConstantInt nicer.
llvm-svn: 35902
2007-04-11 13:02:56 +00:00
Reid Spencer 56ea4e8ad3 Teach llvm2cpp about packed structure types.
llvm-svn: 35899
2007-04-11 12:41:49 +00:00
Reid Spencer ff6e0eda94 Fix several bugs relating to changes in the LLVM IR API or just outright
typos in the output. This is sufficient to get most of the llvm2cpp tests
working again.

llvm-svn: 35898
2007-04-11 12:28:56 +00:00
Reid Spencer d73f84ed7b Regenerate.
llvm-svn: 35897
2007-04-11 12:10:58 +00:00
Reid Spencer 2844b0a225 Fix a crash-by-unknown-exception caused by attempting to use a null pointer
as the key for a map insertion.

llvm-svn: 35896
2007-04-11 12:10:08 +00:00
Reid Spencer 77df76a3f5 Fix some issues with param attrs.
llvm-svn: 35894
2007-04-11 10:01:32 +00:00
Reid Spencer 3318579108 Add support for parameter attributes.
llvm-svn: 35893
2007-04-11 09:54:08 +00:00
Reid Spencer a472f66dd0 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.

llvm-svn: 35877
2007-04-11 02:44:20 +00:00
Devang Patel ada3ca2234 Enable loop rotate pass.
llvm-svn: 35863
2007-04-10 15:43:36 +00:00
Reid Spencer f51a7050dd Regenerate
llvm-svn: 35813
2007-04-09 06:16:21 +00:00
Reid Spencer 4d4d3f9682 For PR1146:
Adapt handling of parameter attributes to use ParamAttrsList class.

llvm-svn: 35812
2007-04-09 06:15:59 +00:00
Reid Spencer 69e6062f31 Make TempDir a PathWithStatus so we don't have to cast it to one.
llvm-svn: 35772
2007-04-08 20:08:01 +00:00
Reid Spencer 5fb6ee9d6b Avoid temporary construction and potential for corrupted data access.
llvm-svn: 35771
2007-04-08 20:06:05 +00:00
Reid Spencer f20eacbc78 Don't rely on destructed local storage. Thanks, Chris.
llvm-svn: 35769
2007-04-08 19:59:07 +00:00
Reid Spencer 21b76a9b99 For PR1291:
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.

llvm-svn: 35743
2007-04-07 18:53:16 +00:00
Reid Spencer 25603318ff Regenerate.
llvm-svn: 35736
2007-04-07 16:14:01 +00:00
Reid Spencer 33766f8eba For PR1312:
For the short CALL/INVOKE syntax, the signedness of the result type is two
extractions away from the type argument because its a POINTER to function
type, not a function type.

llvm-svn: 35735
2007-04-07 16:10:37 +00:00
Chris Lattner c7de6e0a75 run a late dce pass to clean up extra cruft.
llvm-svn: 35684
2007-04-05 16:50:20 +00:00
Reid Spencer d7799fd17d For PR1302:
Rename LinkItems as NativeLinkItems since it is filled out by the Linker
library to contain only those items deemed to be native.

llvm-svn: 35654
2007-04-04 06:34:22 +00:00
Reid Spencer 69e56c3461 Regenerate
llvm-svn: 35579
2007-04-02 02:08:35 +00:00
Reid Spencer 940fccb088 Upgrade the bit count intrinsics to have an i32 result.
llvm-svn: 35578
2007-04-02 02:08:05 +00:00
Reid Spencer 1bd88bdab3 Regenerate
llvm-svn: 35571
2007-04-02 01:14:00 +00:00
Reid Spencer 86207ee54d Don't upgrade functions that look like a bswap intrinsic but aren't.
llvm-svn: 35570
2007-04-02 01:13:36 +00:00
Reid Spencer ef592214e2 Handle upgrade of llvm.bswap.iXX to llvm.bswap.iXX.iXX per new naming
rules for overloaded intrinsic functions.

llvm-svn: 35565
2007-04-02 00:50:28 +00:00
Reid Spencer d232f311cb Remove some non-sensical logic that prevented llvm-nm from working on any
file other than one named "-".

llvm-svn: 35478
2007-03-29 19:49:07 +00:00
Reid Spencer 200c6f9c3d For PR789:
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.

llvm-svn: 35476
2007-03-29 19:05:44 +00:00
Jeff Cohen 54a781be7d getFileStatus has a new parameter (caught by VC++).
llvm-svn: 35466
2007-03-29 17:29:59 +00:00
Jeff Cohen d578f1f87f Fix problem with llvm-config that prevented JIT from being used on x86_64
systems.

llvm-svn: 35416
2007-03-28 04:45:02 +00:00
Reid Spencer f3200ef9ac For PR1277:
Implement error handling for bytecode parsing.

Patch by Scott Michel.

llvm-svn: 35364
2007-03-26 22:38:01 +00:00
Evan Cheng 085b8d7ae2 Unbreak non-debug builds.
llvm-svn: 35264
2007-03-22 07:43:51 +00:00
Reid Spencer 2f8fa50bb3 Regenerate.
llvm-svn: 35237
2007-03-21 17:27:53 +00:00
Reid Spencer 20337a5e76 For PR1243:
Okay, really fix it this time. Make sure the CurFun.Linkage is set early
and consolidate some duplicate code.

llvm-svn: 35236
2007-03-21 17:26:41 +00:00
Reid Spencer 77e0bba30c Regenerate.
llvm-svn: 35235
2007-03-21 17:15:50 +00:00
Reid Spencer 6ae04faffb For PR1256:
Make Signedness information pervasive throughout all types and values.
There is no easy way to get around this. Because the GEP instruction can
index through an arbitrarily complex value structure, it is necessary to
keep track of signedness information throughout that structure. This change
makes Signedness a full class, capable of representing Signedness in
arbitrarily shaped types. The class is then used throughout llvm-upgrade to
track signedness and differentiate between globals, locals, and functions
based on their signedness.

For PR1243:
This patch also removes bogus warnings about renaming internal globals. It
now only emits such warnings when renaming non-internal globals because
they may affect linkage.

llvm-svn: 35234
2007-03-21 17:14:36 +00:00
Reid Spencer 17e9e8b9af Regenerate.
llvm-svn: 35116
2007-03-15 03:26:42 +00:00
Reid Spencer 74d4d172bd Revert last changes as they introduced other problems.
llvm-svn: 35115
2007-03-15 03:25:34 +00:00
Reid Spencer 2ece31b4ce Regenerate.
llvm-svn: 35113
2007-03-14 23:13:06 +00:00
Reid Spencer c2dd8280e2 The sign information was not propagating into the rename map so only the
last entry stored in the map could be retrieved for a given integer type.
Propagating the sign information required an invasive change to ensure that
all ValueRef (ValID) instances get the right sign information as well. Also,
put in some assertions to ensure the RenameMap always gives us out the type
that is expected.

This fixes PR1256 and
test/Assembler/2007-03-14-UgpradeLocalSignless.ll

llvm-svn: 35112
2007-03-14 23:11:45 +00:00
Reid Spencer 4040130a86 For PR1256:
Carry sign with ValID and make TypeInfo sortable (useful in a map).

llvm-svn: 35111
2007-03-14 23:08:04 +00:00
Jeff Cohen eb9dccf63d Make older versions of bison happy.
llvm-svn: 35099
2007-03-14 15:27:17 +00:00
Devang Patel 69730c96db Now LICM is a LoopPass.
llvm-svn: 35001
2007-03-07 04:41:30 +00:00
Devang Patel 901a27d892 Now LoopUnswitch is a LoopPass.
llvm-svn: 34992
2007-03-07 00:26:10 +00:00
Reid Spencer fe5550b2cf Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.

llvm-svn: 34953
2007-03-06 03:12:55 +00:00
Jeff Cohen b622c11f77 Unbreak VC++ build.
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Reid Spencer e586f2e7f7 1. Handle errors around the ModuleProvider. This is necessary since it is
reading bytecode.
2. The interpreter can delete the ModuleProvider and replace it with
   another so don't depend on it being around after the EE is created.
3. Don't just run llvm_shutdown on exit but actually delete the EE as well.
   This cleans up a vast amount of memory (but not all) that EE retained
   through exit.

llvm-svn: 34888
2007-03-03 18:21:44 +00:00
Reid Spencer 07761199e0 Make output for ConstantInt construction correct for any bitwidth.
llvm-svn: 34809
2007-03-01 20:55:43 +00:00
Chris Lattner 86e36db1bf remove use of deprecated apis
llvm-svn: 34418
2007-02-19 07:41:31 +00:00
Chris Lattner 80b65db862 remove use of deprecated api
llvm-svn: 34416
2007-02-19 07:34:02 +00:00
Anton Korobeynikov d01defedf6 Add possibility to set memory limit for binaries run via libSystem. This
is especially needed for bugpoint. This partly implements PR688

llvm-svn: 34349
2007-02-16 19:11:07 +00:00
Reid Spencer e1d2bcf8ce Add missing break statements!
llvm-svn: 34341
2007-02-16 06:34:39 +00:00
Reid Spencer 09575bac2e For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.

llvm-svn: 34300
2007-02-15 03:39:18 +00:00
Reid Spencer d84d35ba70 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Chris Lattner 55fa988d25 eliminate use of vector-related ctors
llvm-svn: 34226
2007-02-13 06:05:43 +00:00
Chris Lattner cb4b07b0b3 regenerate
llvm-svn: 34225
2007-02-13 06:04:17 +00:00
Chris Lattner d37c5ee316 remove use of vector-related ctors
llvm-svn: 34224
2007-02-13 06:03:48 +00:00
Chris Lattner 9788ec53af stop using me thods that take a vector
llvm-svn: 34206
2007-02-12 22:58:38 +00:00
Lauro Ramos Venancio 15f463c291 Fix build error on ARM.
Since CompilerDriver.cpp revision 1.44, llvmc must be linked against LLVMCore.a (llvm::Module::~Module) and LLVMBCReader.a
(llvm::getBytecodeModuleProvider).

llvm-svn: 34196
2007-02-12 18:31:46 +00:00
Chris Lattner ac26f3853a regenerate
llvm-svn: 34188
2007-02-11 21:40:10 +00:00
Chris Lattner 988278c3c3 add #include
llvm-svn: 34187
2007-02-11 21:39:35 +00:00
Reid Spencer bc73875898 Align make log output with the rest of llvm.
llvm-svn: 34150
2007-02-10 15:14:00 +00:00
Reid Spencer 82f223475d Get the use of \ right.
llvm-svn: 34100
2007-02-09 17:18:42 +00:00
Reid Spencer 49785b92f0 Now that gccas and gccld are just schell scripts, adjust the build ordering
for parallel builds so that we space out the large links.

llvm-svn: 34098
2007-02-09 17:02:07 +00:00
Reid Spencer ba09f90ddc End of life for gccld. Remove its source code and enable the generation
of a shell script to stand in its place. The shell script just pawns the
execution off to llvm-ld.

llvm-svn: 34090
2007-02-09 15:21:02 +00:00
Reid Spencer a7bbb0ed70 Write the deprecation message to stderr instead of stdout so that it
doesn't get mingled with the output bytecode.

llvm-svn: 34089
2007-02-09 15:16:59 +00:00
Reid Spencer 2193b85ab0 Write the deprecation message to stderr instead of stdout so that it
doesn't get mingled with the output bytecode.

llvm-svn: 34087
2007-02-09 15:10:26 +00:00
Reid Spencer 690a9f105f Put in a disabled template for when gccld is replaced by the shell script.
llvm-svn: 34076
2007-02-09 03:15:18 +00:00
Reid Spencer 7eca5e3d19 Get the right warning message.
llvm-svn: 34075
2007-02-09 03:12:21 +00:00
Reid Spencer 6c302d8403 New shell script to replace gccld, eventually.
llvm-svn: 34074
2007-02-09 03:09:26 +00:00
Reid Spencer 1ed974aded Clean up error handling.
llvm-svn: 34073
2007-02-09 03:08:06 +00:00
Reid Spencer 5d211e24d9 For PR1153:
Copy a couple more missing options from gccld to llvm-ld.

llvm-svn: 34061
2007-02-08 19:03:11 +00:00
Reid Spencer 55717ece1e For PR1153:
Make llvm-ld more gccld-like by having it run the same set of passes. The
delta was probably due to lack of llvm-ld being maintained. Just another
reason to have only one optimizing linker in in LLVM.

llvm-svn: 34058
2007-02-08 18:13:59 +00:00
Reid Spencer f79d0c2ad8 Regenerate.
llvm-svn: 34050
2007-02-08 09:08:52 +00:00
Reid Spencer f43749d144 Rename a field so there's less confusion between fields of the same name.
llvm-svn: 34049
2007-02-08 09:08:23 +00:00
Reid Spencer 91a76a443f For PR1187:
Rename function scope names that conflict with basic block names.

llvm-svn: 34048
2007-02-08 09:07:25 +00:00
Reid Spencer 47b6d12ef1 For PR1187:
Always rename, never give a redef error. We could check for collapsed type
planes and generate an error if that's not the cause, but the 99.9999
percentile case will be that its the result of collapsed type planes. So,
rather than doing an expensive check, just rename.

llvm-svn: 34047
2007-02-08 08:47:38 +00:00
Reid Spencer c10e463ea7 For PR1187:
Some changes to get the smbd.ll test case working:
1. Move the logic for CSRETCC->sret attribute out of the ResolveDefinitions
   code and into getExistingValue. This resolves it much earlier and works
   in function scope as well.
2. Fix handling of CSRETCC->sret for the store instruction.
3. Rewrite the code for handling renaming to factor in linkage types.
4. Rename a structure filed for a PATypeInfo* so it doesn't get confused
   with a field for a Type*.

llvm-svn: 34043
2007-02-08 08:09:36 +00:00
Bill Wendling 1fef06db82 Avoid assert() in lto. Let linker handle all failures. Use LTO_WRITE_FAILURE
instead of LTO_UNKNOWN.

llvm-svn: 34036
2007-02-08 01:48:28 +00:00
Bill Wendling fe5ee14bdf The new version of how to add passes to emit files. We explicitly call a
function to add the file writers between calls to add the passes.

llvm-svn: 34035
2007-02-08 01:41:07 +00:00
Reid Spencer 709750c3d3 Regenerate for recent changes.
llvm-svn: 34025
2007-02-08 00:21:40 +00:00
Reid Spencer 4095df45db For PR1187:
When a naming conflict arises, allow internal linkage functions to be
renamed without warning or error.

llvm-svn: 34024
2007-02-08 00:21:06 +00:00
Reid Spencer aff5bd0a78 For PR1187:
Allow @ before identifer names. Recognize the i1, i8, i16, i32, i64 keywords
as type names corresponding to bool, ubyte, ushort, uint, and ulong
respectively. While these aren't LLVM 1.9 constructs, permitting the syntax
allows post-1.9 assembly files to be upgraded.

llvm-svn: 34023
2007-02-08 00:19:40 +00:00
Chris Lattner d220dc1426 move an llvmc-specific function out of the bcreader into llvmc.
llvm-svn: 34021
2007-02-07 23:48:32 +00:00
Chris Lattner a0e49f2ead push bytecode decompressor out through APIs. Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,      ///< Optional error message holder
  BytecodeHandler* H = 0        ///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.

llvm-svn: 34012
2007-02-07 21:41:02 +00:00
Chris Lattner 216835d688 add an option for timing bc file reading.
llvm-svn: 33977
2007-02-07 04:39:35 +00:00
Reid Spencer 1241d6d5ab For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)

llvm-svn: 33922
2007-02-05 21:19:13 +00:00
Reid Spencer 3c52e275ea For PR411:
Change getNamedFunction -> getFunction
Make llvm-extract run the StripDeadPrototypes pass.

llvm-svn: 33921
2007-02-05 21:17:53 +00:00
Reid Spencer 3aaaa0b2bd 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.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer 7b4d83c252 Fix grammaro in output message.
llvm-svn: 33885
2007-02-04 22:08:16 +00:00
Reid Spencer bc7e614093 Regenerate.
llvm-svn: 33859
2007-02-04 01:12:11 +00:00
Reid Spencer d9f7298477 For PR1151:
Make llvm-upgrade valgrind clean. Deleting type instances is a really
nasty thing to do to LLVM. This was a hold-over from the re-write.
This fixes test/Assembler/2007-01-22-UpgradeTypeMapInvalidMemory.ll and
potentially many other bugs.

llvm-svn: 33858
2007-02-04 01:05:23 +00:00
Reid Spencer d751385a7a Make sure the gccas script is executable.
llvm-svn: 33851
2007-02-04 00:23:51 +00:00
Reid Spencer 8de97bba5a For PR1072:
Removing -raise has neglible positive or negative side effects so we are
opting to remove it. See the PR for comparison details.

llvm-svn: 33844
2007-02-03 23:15:56 +00:00
Chris Lattner 7ccf30bb17 add an instcombine pass to clean up after heavy-lifting IP passes
llvm-svn: 33843
2007-02-03 23:06:03 +00:00
Reid Spencer 5458e0e135 Clean this up a bit: hide command unless verbose output requested, echo
a useful comment line, add a clean target.

llvm-svn: 33834
2007-02-03 16:09:12 +00:00
Reid Spencer 697f1104e7 Two improvements:
1. Allow -- as well as - options (Bill Wendling)
2. Pass unrecognized options to opt and let it handle the errors, if any
   (Chris Lattner).

llvm-svn: 33798
2007-02-02 21:49:27 +00:00
Reid Spencer 583c90d4c2 For PR1152:
Step 2: Make plug compatible shell script to replace gccas binary.

llvm-svn: 33787
2007-02-02 15:50:58 +00:00
Reid Spencer 22dbfb626f For PR1152:
Step 1: Copy gccas functionality to opt. This endows opt with a new
-std-compile-opts option to get the set of optimization passes that
gccas used. It also adds -disable-inlining and -disable-opt which
both apply only if -std-compile-opts is given. The -strip-debug option
was also removed. It just makes sure that "-strip" gets done early and
is mostly there for compatibility with gccas. Finally, a new
-verify-each option will cause the verify pass to be run after each pass.

llvm-svn: 33786
2007-02-02 14:46:29 +00:00
Reid Spencer 2341c22ec7 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.

llvm-svn: 33776
2007-02-02 02:16:23 +00:00
Devang Patel df4e992af8 Add printVersion(). Linker can use it to print LLVM version number.
llvm-svn: 33738
2007-02-01 01:46:06 +00:00
Devang Patel ea0568392e Include Makefile.config before testing OS.
llvm-svn: 33735
2007-02-01 01:18:57 +00:00
Chris Lattner adb4954d9c shutdown the app when done.
llvm-svn: 33716
2007-01-31 20:10:54 +00:00
Chris Lattner d700d9dde4 shutdown at end of run
llvm-svn: 33697
2007-01-31 04:45:28 +00:00
Reid Spencer 5301e7c605 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Reid Spencer bae85637c7 Regenerate.
llvm-svn: 33624
2007-01-29 19:08:46 +00:00
Reid Spencer e87c917a69 For PR1142:
When an unresolved definition is found, check to see if it is only unresolved
because the csretcc was upgraded to the sret param attribute. Such changes
change the function type and lead to unresolved definitions. In such cases, just
cast the function to the type expected by the CallInst. That is, cast to the
version of the function that has the sret param attribute.

llvm-svn: 33623
2007-01-29 19:07:18 +00:00
Reid Spencer c3eba3fc93 Regenerate.
llvm-svn: 33615
2007-01-29 05:41:34 +00:00
Reid Spencer 8714f0025c Upgrade old csret calling convention into sret parameter attribute.
llvm-svn: 33614
2007-01-29 05:41:09 +00:00
Nick Lewycky eba26e463a Drop CSRET from here too.
llvm-svn: 33604
2007-01-28 15:51:15 +00:00
Anton Korobeynikov 15f3028ba1 Merge error at my side. Fixed.
llvm-svn: 33601
2007-01-28 15:25:24 +00:00
Anton Korobeynikov 75e8a144d4 Regenerate
llvm-svn: 33599
2007-01-28 13:37:39 +00:00
Anton Korobeynikov 4bca4d157f Drop CSRET CC
llvm-svn: 33598
2007-01-28 13:36:18 +00:00
Anton Korobeynikov 037c867b54 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.
llvm-svn: 33597
2007-01-28 13:31:35 +00:00
Reid Spencer 07af391927 Regenerate.
llvm-svn: 33595
2007-01-28 00:52:05 +00:00
Reid Spencer dfa78fba8e For PR1137:
When a value is found to have the same name as another, try harder to
disambiguate when its a type plane collapse issue and when it isn't. We
traverse the type to see if it contains an integer. If it does not then
we issue the error because it can't be resulting from integer type planes
collapsing. Otherwise we just rename it, even if that's a bit of overkill.

llvm-svn: 33594
2007-01-28 00:51:40 +00:00
Reid Spencer 9f4cdd5d18 Regenerate.
llvm-svn: 33547
2007-01-26 20:31:18 +00:00
Reid Spencer 62b741dc4c Make sure that an upgraded index is also inserted into the VIndices
otherwise it gets ignored.

This fixes test/CodeGen/X86/2006-05-11-InstrSched.ll

Thanks to Evan Cheng for noticing this.

llvm-svn: 33546
2007-01-26 20:29:52 +00:00
Reid Spencer 41210fb2dc Regenerate.
llvm-svn: 33545
2007-01-26 19:59:25 +00:00
Reid Spencer 0bad131b17 Ensure that gep_upgrade zext instructions we insert have unique names.
llvm-svn: 33544
2007-01-26 19:58:59 +00:00
Reid Spencer aecf935dc9 Remove extraneous ; to make some versions of bison happy.
llvm-svn: 33541
2007-01-26 18:26:23 +00:00
Devang Patel a426fcd681 Order createSimplifyLibCallsPass() after a set of function level passes
so that these function passes are managed by CallGraphPassManager.

llvm-svn: 33540
2007-01-26 18:17:59 +00:00
Reid Spencer 697ba1a507 Remove the SignedType class and other dead code. Improve comments.
llvm-svn: 33538
2007-01-26 17:13:53 +00:00
Reid Spencer 4f95f1ab08 Regenerate.
llvm-svn: 33532
2007-01-26 08:19:09 +00:00
Reid Spencer 00a7c7f85a For All These Bugs:
PR645
PR761
PR1082
PR1122

Completely rewrite llvm-upgrade. This should be its final design. Any future
changes will use this same design.  The changes involve the following:

1. Make this work very much like the 1.9 AsmParser
2. Retain old upgrades dating back to release 1.2 time frame.
3. Merge in some of the upgrades between 1.9 and 2.0 (e.g. icmp/fcmp).
4. Attach a Signedness value (Signless, Unsigned, Signed) to every type,
   Value, Constant, Instruction, and list of those things in the Parser.
   Use these to make signedness decisions for instruction upgrades.
5. Implement unique name upgrade for function values and global values.
6. Identify rename cases that might cause problems and warn about them.
   For example: renaming a global variable with external linkage.
7. Generate a 2.0 IR using VMCore. This is necessary for numerous
   reasons and has the advantage that it never goes out of date.
8. Use the AsmPrinter to make the output nice.
9. Clean up error and warning messages from 1.9 form.

llvm-svn: 33531
2007-01-26 08:18:34 +00:00
Jeff Cohen e977757ca9 Fix a bunch of missing semicolon parse errors from bison.
llvm-svn: 33426
2007-01-21 19:30:52 +00:00
Reid Spencer fd3085bc3f Run GenLibDeps.pl with the configured PERL path to handle different install
locations for Perl on different systems.

llvm-svn: 33424
2007-01-21 15:53:18 +00:00
Chris Lattner 19bb6b996b default to emiting an uncompressed .bc file
llvm-svn: 33420
2007-01-21 06:34:18 +00:00
Chris Lattner faa060878b Run an instcombine pass after inlining but before scalarrepl. This allows
instcombine to clean up the code, which makes more code suitable for SRoA.
This helps C++ code in particular, e.g. speeding up tramp3d by 31%.

llvm-svn: 33235
2007-01-15 07:41:51 +00:00
Reid Spencer 6eb2990810 Regenerate.
llvm-svn: 33227
2007-01-15 02:41:46 +00:00
Reid Spencer 8307a54baa For PR1113:
Increment the counter after the second use, not after the first use. This
fixes PR1113.

Also, rename some classes for simplicity and to more naturally be
reminscient of LLVM 1.9. This in preparation for additional classes that
will provide a scaled down model of the LLVM 1.9 IR.

llvm-svn: 33226
2007-01-15 02:40:33 +00:00
Chris Lattner 03c4953cdd 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! :)

llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Reid Spencer 7ef3e49193 Regenerate
llvm-svn: 33212
2007-01-15 00:26:18 +00:00
Reid Spencer 04a03f2075 Reorganize things a bit in preparation for rewrite. Although this looks
like a lot, its really only two changes:

1. Move stuff that should be private to .y out of the .h file.
2. Make all semantic values pointers.

This cleans up the silly destroy methods and changes them to delete. It
also moves the TypeInfo and ValueInfo classes into the .y where we can
modify them more readily because they have no clients any more.

This shouldn't result in any functional changes in llvm-upgrade.

llvm-svn: 33211
2007-01-15 00:25:53 +00:00
Reid Spencer d18708fce0 Regenerate.
llvm-svn: 33180
2007-01-13 04:40:16 +00:00
Reid Spencer 876bc59822 Can't generate "bool" any more. Change to i1
llvm-svn: 33179
2007-01-13 04:39:47 +00:00
Reid Spencer eb30497472 Regenerate.
llvm-svn: 33172
2007-01-13 00:23:06 +00:00
Reid Spencer 316ffe33fd Don't attempt to upgrade argument to va.start and va.end if there are none.
llvm-svn: 33171
2007-01-13 00:22:40 +00:00
Reid Spencer 93ef7ee4d1 Regenerate.
llvm-svn: 33169
2007-01-13 00:13:49 +00:00
Reid Spencer ae7e9c5b35 Regenerate.
llvm-svn: 33165
2007-01-13 00:03:30 +00:00
Reid Spencer 15f159b00d For PR1093:
Implement upgrading of the varargs intrinsics. These must now have i8*
arguments. This patch bitcasts arguments to i8* and fixes the prototypes.

llvm-svn: 33163
2007-01-13 00:02:00 +00:00
Reid Spencer 4d06a85487 Regenerate.
llvm-svn: 33140
2007-01-12 20:10:51 +00:00
Reid Spencer 2dd0c0b27f Remove support for upgrading NOT. The llvm-upgrade lexer didn't recognize
it either. NOT is just plain illegal now.

llvm-svn: 33139
2007-01-12 20:09:48 +00:00
Chris Lattner d99bff4ef6 unbreak i1 constants with the cpp writer, eliminate special case.
llvm-svn: 33133
2007-01-12 18:37:29 +00:00
Reid Spencer 7a9c62baa6 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.

llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Chris Lattner 899a89b11b Fix persistent conflict madness by removing these from cvs.
llvm-svn: 33111
2007-01-12 05:35:13 +00:00
Reid Spencer cddc9dfe97 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.

llvm-svn: 33110
2007-01-12 04:24:46 +00:00
Reid Spencer 542964f55b Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng 75b871fb1e For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.

llvm-svn: 33073
2007-01-11 12:24:14 +00:00
Chandler Carruth 15719d08cc Fixing a ">" redirect to be a ">>" redirect, so a sed command doesn't get clobbered.
llvm-svn: 33032
2007-01-09 02:38:29 +00:00
Devang Patel 73d40ac101 Modules are consumed when they are merged together by Linker.
Clear modules vector so that destructure does not try to
delete these modules again. Patch by Chandler Carruth.

llvm-svn: 33017
2007-01-08 18:42:27 +00:00
Chris Lattner e05182cd1e fix atexit. This is an overcomplex way of calling exit, but it is required,
as the jit intercepts exit calls to implement atexit handlers.  This
fixes SingleSource/UnitTests/2003-05-14-AtExit

llvm-svn: 33008
2007-01-08 07:36:34 +00:00
Chandler Carruth b2d4caaaa8 Build libLLVMlto on non-Darwin architectures. Resolves PR1055: http://llvm.org/PR1055
llvm-svn: 33006
2007-01-08 06:25:29 +00:00
Chris Lattner 7b864c0d9e relax type
llvm-svn: 32990
2007-01-07 08:13:39 +00:00
Reid Spencer 1d48a8b9fb Regenerate.
llvm-svn: 32987
2007-01-07 08:07:39 +00:00
Reid Spencer 2af5100b53 Upgrade the llvm.isunordered intrinsics to "fcmp uno" instruction.
llvm-svn: 32986
2007-01-07 08:07:10 +00:00
Chris Lattner bc3ffdda4c this is an overcomplex way to call exit :)
llvm-svn: 32978
2007-01-07 06:43:08 +00:00
Chris Lattner 7fab842b1f Add C wrappers for the LTO library (PR1081). Patch by Chandler Carruth!
llvm-svn: 32966
2007-01-06 23:53:43 +00:00
Chris Lattner 350563eba7 fix typo
llvm-svn: 32965
2007-01-06 23:51:31 +00:00
Reid Spencer 32af9e8cc5 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.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Reid Spencer ebbbbf6273 Regenerate.
llvm-svn: 32955
2007-01-06 06:04:32 +00:00
Reid Spencer cf025ad44a For PR1082:
Solve several related problems by making variable names more unique and
dealing with recursive phi nodes. Unfortunately, this doesn't solve the
main issue reported in the PR, but its a step in that direction.

llvm-svn: 32953
2007-01-06 06:03:09 +00:00
Reid Spencer 780d4abb8c Add an option for getting the C compiler flags, --cflags.
Patch contributed by Chandler Carruth

llvm-svn: 32950
2007-01-06 02:48:03 +00:00
Reid Spencer 5f92611284 Regenerate
llvm-svn: 32944
2007-01-06 00:23:53 +00:00
Reid Spencer bfa5df2604 For PR1080:
Emit the correct syntax for icmp and fcmp constant expressions. The
predicate goes outside the parentheses not inside. This was a change made
in the assembler without the corresponding change made in llvm-upgrade.

llvm-svn: 32942
2007-01-06 00:12:05 +00:00
Reid Spencer 9329c5f06b Fix dependencies. The lexer depends on the grammar for the UpgradeParser.h
file so make it depend on the .y file as well. This ensures that in
parallel builds the lexer is built after bison runs.

llvm-svn: 32937
2007-01-05 22:03:42 +00:00
Reid Spencer 02165c634e Regenerate
llvm-svn: 32908
2007-01-05 17:20:02 +00:00
Reid Spencer 9ca1b589af Adjust to new header file name.
llvm-svn: 32907
2007-01-05 17:19:32 +00:00
Reid Spencer 6ee573f523 Major update of llvm-upgrade:
1. Completely revise the type system so that types are handled as const
   objects and not created multiple times, cloned, or otherwise copied.
   This gets around memory issues, saves memory, and also emulates LLVM's
   no-two-types-of-the-same-shape-created semantics.
2. Adjust the handling of global names. Basically, we cannot rename them
   for a variety of reasons: linking, forward references, etc.
3. Detect global names that have name conflicts as the result of collapsed
   type planes or redefinitions that llvm-as no longer accepts. These will
   produce warnings on stderr and one of the globals will be renamed.
4. Rename ParserInternals.h as UpgradeInternals.h so it doesn't conflict
   in the debugger with ParserInternals.h from lib/AsmParser.
5. Move the guts of the TypeInfo class into the grammar so we aren't
   implementing large functions in a header file. This also helps with
   debugging a bit.

llvm-svn: 32906
2007-01-05 17:18:58 +00:00
Chris Lattner c205585943 regenerate
llvm-svn: 32880
2007-01-04 18:46:42 +00:00
Chris Lattner a0058929bc If we hit a parse error, emit something bad to the output stream. This ensures that
llvm-upgrade < foo | llvm-as | llvm-dis

will fail if llvm-upgrade fails.

llvm-svn: 32879
2007-01-04 18:45:51 +00:00
Reid Spencer 844c7121c7 Regenerate.
llvm-svn: 32848
2007-01-03 23:45:42 +00:00
Reid Spencer 66ed21c213 Implement many new type features including upreferences, proper retention
of structure contents, counts of packed and array types, etc.

llvm-svn: 32847
2007-01-03 23:45:17 +00:00
Reid Spencer c13fac5526 Finish implementation of variable renaming to handle collapsed type planes
by correctly handling up references and enumerated types. Previously there
was some confusion of these two. Thanks to Chris Lattner for demistifying
llvm up references.

llvm-svn: 32846
2007-01-03 23:43:55 +00:00
Evan Cheng a50e3919b1 A bit more debugging printf's.
llvm-svn: 32832
2007-01-03 07:44:30 +00:00
Reid Spencer 03c80e72d1 Regenerate.
llvm-svn: 32817
2007-01-02 06:34:08 +00:00
Reid Spencer 77283c18a1 Permit signed and unsigned integer constants to be used with either signed
or unsigned integer types.

llvm-svn: 32816
2007-01-02 06:33:02 +00:00
Reid Spencer 62ad3bbd4c Regenerate.
llvm-svn: 32811
2007-01-02 05:45:11 +00:00
Reid Spencer 25f4cd093b For PR1070:
Revise the upgrade parser to keep track of types more faithfully and use
this information to resolve name conflicts resulting from collapsed type
planes. The type planes have collapsed because the integer types are now
signless so that uint and int became i32. Where two planes existed for uint
and int, only i32 exists. Any variable names depending on the type planes
to pmake the identifier unique would cause a conflict. This patch resolves
that conflict for many but not all cases.

Situations involving the integer types and pointers to them are handled
by this patch.  However, there are corner cases that are not handled
well, such as:

%t1 = type { uint, int }
%t2 = type { int, uint }

void %myfunc(%t1* one, %t2* two) {
  %var = load %t1* one
  %var = load %t2* two
}

In the scenario above, %t1 and %t2 are really the same type: { i32, i32 }
Consequently attempting to name %var twice will yield a redefinition error
when assembled.

While this patch is sufficien to allow the llvm/test suite to pass, More
work needs to be to complete the handling of these corner cases.

llvm-svn: 32810
2007-01-02 05:44:33 +00:00
Reid Spencer 97f4ee7e93 Regenerate.
llvm-svn: 32805
2007-01-01 01:20:41 +00:00
Reid Spencer 1a5d6f56e2 For PR1070:
Remove useless bitcasts by commenting them out.

llvm-svn: 32804
2007-01-01 01:20:16 +00:00
Reid Spencer eb14edc646 For PR950:
Convert signed integer types to signless.

llvm-svn: 32790
2006-12-31 06:02:26 +00:00
Reid Spencer be5fd4a771 For PR950:
Don't attempt to parse both the old and new grammars. It is near impossible
to get it right. Remove support for the new define keyword and don't
attempt to insert parameter attributes because there isn't enough
contextual information for it.

llvm-svn: 32784
2006-12-31 05:45:57 +00:00
Reid Spencer dc0a3a2fd2 Regenerate.
llvm-svn: 32772
2006-12-29 20:35:03 +00:00
Reid Spencer 0a53afe5ba For PR950:
Fix several bugs and update for new assembly syntax. Changes made include:
1. Fixing rules for icmp/fcmp instructions to not require a closing paren
   at the end. This was a cut-and-paste error from a previous commit.
2. Changing things like Out << " " to Out << ' '
3. Adding the "define" keyword for function definitions
4. Adding support for packed structures

llvm-svn: 32771
2006-12-29 20:33:37 +00:00