Commit Graph

607 Commits

Author SHA1 Message Date
Chris Lattner 3d40daa474 Change the ModuleProvider interface to not throw exceptions.
llvm-svn: 29024
2006-07-06 21:35:01 +00:00
Chris Lattner 5734e8d7c3 Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway.
llvm-svn: 29017
2006-07-06 18:02:27 +00:00
Reid Spencer ab97f22ccc For PR787:
Provide new llvm::sys::Program facilities for converting the stdout and
stdin to binary mode. There is no standard way to do this and the available
mechanisms are platform specific. Adjust the bytecode reader and writer to
use these methods when their input is stdin or output is stdout. THis avoids
the problem with \n writing CRLF to a bytecode file on windows.

Patch Contributed by Michael Smith.

llvm-svn: 28722
2006-06-07 23:18:34 +00:00
Chris Lattner 5ff8b962c8 Fix a bug where the types for inlineasm nodes were not properly entered into
the compaction table for a function.  This broke compilation of hexxagon
on darwin/x86 with recent changes.

llvm-svn: 28717
2006-06-07 22:20:03 +00:00
Reid Spencer a647c7ff42 Use archive libraries instead of object files for VMCore, BCReader,
BCWriter, and bzip2 libraries. Adjust the various makefiles to accommodate
these changes. This was done to speed up link times.

llvm-svn: 28610
2006-06-01 01:30:27 +00:00
Chris Lattner 44a793c3a6 Fix a bug in the bc reader/writer: we were not correctly encoding varargs
nonccc calls (we were dropping the CC and tail flag).  This broke several
FORTRAN programs.

Testcase here: Regression/Assembler/2006-05-26-VarargsCallEncode.ll

llvm-svn: 28501
2006-05-26 18:42:34 +00:00
Chris Lattner 620895a47a Fix misencoding of calling conventions
llvm-svn: 28411
2006-05-19 21:57:37 +00:00
Reid Spencer 69fb378858 When reading the symbol table, make sure to delete the ArchiveMember
created by reading the symbol table.

llvm-svn: 28251
2006-05-12 17:56:20 +00:00
Jeff Cohen 9978476c14 Apply bug fix supplied by Greg Pettyjohn for a bug he found: '<invalid>' is not a legal path on Windows.
llvm-svn: 28153
2006-05-06 23:25:53 +00:00
Chris Lattner fc72a6b72d use isValidOperands instead of duplicating checks
llvm-svn: 27527
2006-04-08 04:09:19 +00:00
Chris Lattner 161e7cfc17 Add shufflevector reading support
llvm-svn: 27509
2006-04-08 01:17:59 +00:00
Chris Lattner 92b1a57010 We have an assertion that checks that we do not encode null values into the
.bc file if they are supposed to be implicit.  This is cool, except that it
checked *after* constant expr folding: improving constant expr folding could
cause the .bc reader to assert out on old .bc files.  Move the check so that
it checks all simple constants, but no constantexprs.

llvm-svn: 27480
2006-04-07 05:00:02 +00:00
Jim Laskey acb6e34277 Handle the removal of the debug chain.
llvm-svn: 26729
2006-03-13 13:07:37 +00:00
Chris Lattner 259d680c15 Simplify the autoupgrade interface
llvm-svn: 26475
2006-03-02 23:59:12 +00:00
Reid Spencer 76a8d45e32 Fix auto-upgrade of intrinsics to work properly with both assembly and
bytecode reading. This code is crufty, the result of much hacking to get things
working correctly. Cleanup patches will follow.

llvm-svn: 25682
2006-01-27 11:49:27 +00:00
Chris Lattner 4470691999 add bc reader/writer support for inline asm
llvm-svn: 25621
2006-01-25 23:08:15 +00:00
Jeff Cohen c3cafb8a67 Make it even more portable.
llvm-svn: 25605
2006-01-25 17:18:50 +00:00
Jeff Cohen a292744ecc Portably cast a pointer to an integer.
llvm-svn: 25594
2006-01-25 02:40:10 +00:00
Chris Lattner 8ebd2164eb Rename method
llvm-svn: 25571
2006-01-24 04:14:29 +00:00
Chris Lattner bc7b2581cb Add support for reading/writing inline asm
llvm-svn: 25564
2006-01-23 23:43:17 +00:00
Reid Spencer 455d1217ea Revert last patch because it messes up the JIT, amongst other things.
llvm-svn: 25541
2006-01-23 08:11:03 +00:00
Reid Spencer 95c05bf1b4 For PR411:
Don't try to be smart about fixing intrinsic functions when they're read
in, just fix them after the module is read when all names are resolved.

llvm-svn: 25539
2006-01-23 07:39:03 +00:00
Reid Spencer bf31906660 1. Identify bytecode modules that have upgraded intrinsics by setting a
boolean flag if we read a function prototype that needs upgrading.
2. Don't upgrade the CallInst instruction until after its been inserted
   into the basic block, and only if we know that we have seen an
   upgraded intrinsic function.

llvm-svn: 25448
2006-01-19 07:02:16 +00:00
Reid Spencer 7e63a456a0 Add a flag to identify bytecode files that have intrinsic functions that
need to be upgraded.

llvm-svn: 25445
2006-01-19 06:57:58 +00:00
Reid Spencer c8a9fafcfc Make sure intrinsic auto-upgrade is invoked correctly.
llvm-svn: 25434
2006-01-19 01:21:04 +00:00
Robert Bocchino c744cbe160 Reader support for the insertelement operation.
llvm-svn: 25404
2006-01-17 20:06:35 +00:00
Reid Spencer b4f9a6f110 For PR411:
This patch is an incremental step towards supporting a flat symbol table.
It de-overloads the intrinsic functions by providing type-specific intrinsics
and arranging for automatically upgrading from the old overloaded name to
the new non-overloaded name. Specifically:
  llvm.isunordered -> llvm.isunordered.f32, llvm.isunordered.f64
  llvm.sqrt -> llvm.sqrt.f32, llvm.sqrt.f64
  llvm.ctpop -> llvm.ctpop.i8, llvm.ctpop.i16, llvm.ctpop.i32, llvm.ctpop.i64
  llvm.ctlz -> llvm.ctlz.i8, llvm.ctlz.i16, llvm.ctlz.i32, llvm.ctlz.i64
  llvm.cttz -> llvm.cttz.i8, llvm.cttz.i16, llvm.cttz.i32, llvm.cttz.i64
New code should not use the overloaded intrinsic names. Warnings will be
emitted if they are used.

llvm-svn: 25366
2006-01-16 21:12:35 +00:00
Robert Bocchino bec39ee4e5 Added bytecode support for the extractelement operation.
llvm-svn: 25178
2006-01-10 19:04:39 +00:00
Duraid Madina c58523442a more C++ daintiness
llvm-svn: 25023
2005-12-26 14:31:26 +00:00
Duraid Madina 7859bd2ea4 I bet pinski knows why g++ accepts this stuff
llvm-svn: 25022
2005-12-26 14:23:22 +00:00
Reid Spencer 3fd1b4c9bf Fix a problem with llvm-ranlib that (on some platforms) caused the archive
file to become corrupted due to interactions between mmap'd memory segments
and file descriptors closing. The problem is completely avoiding by using
a third temporary file.

Patch provided by Evan Jones

llvm-svn: 24527
2005-11-30 05:21:10 +00:00
Chris Lattner 026a5ef177 trivial cleanup
llvm-svn: 24330
2005-11-12 18:34:09 +00:00
Chris Lattner b264c5d4dc Fix reading LLVM 1.3 bc files.
llvm-svn: 24329
2005-11-12 18:31:54 +00:00
Chris Lattner 8e1e6117d0 Read and write section info from/to .bc files
llvm-svn: 24321
2005-11-12 01:33:40 +00:00
Jeff Cohen 045f096b18 Wrap long line.
llvm-svn: 24320
2005-11-12 01:01:50 +00:00
Jeff Cohen 93b3d8f415 Fix VC++ warning that bools cannot be ORed.
llvm-svn: 24319
2005-11-12 00:59:39 +00:00
Chris Lattner c5455bcbd2 minor clarity changes, no functionality difference.
llvm-svn: 24223
2005-11-06 08:23:17 +00:00
Chris Lattner 05c64d1496 don't misencode CC#'s
llvm-svn: 24219
2005-11-06 07:46:13 +00:00
Chris Lattner 49d1908af1 encode/decode function alignment in bc files
llvm-svn: 24218
2005-11-06 07:43:39 +00:00
Chris Lattner 547f20c63e Read/write global variable alignments if present
llvm-svn: 24216
2005-11-06 07:11:04 +00:00
Chris Lattner 575e828aa5 Write/read allocation instruction alignment info to .bc files.
llvm-svn: 24203
2005-11-05 22:08:14 +00:00
Chris Lattner bde3845548 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
llvm-svn: 23940
2005-10-24 02:26:13 +00:00
Jeff Cohen 11e26b52b2 When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.

llvm-svn: 23888
2005-10-23 04:37:20 +00:00
Chris Lattner bad09e71d0 Use a map to cache the ModuleType information, so we can do logarithmic
lookups instead of linear time lookups.  This speeds up bc parsing of a
large file from

137.834u 118.256s 4:27.96
to
132.611u 114.436s 4:08.53

with a release build.

llvm-svn: 23611
2005-10-03 21:26:53 +00:00
Chris Lattner 1e3d3148bb speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab.  This speeds up gccld -native on an almost empty .o file
from 1.63s to 0.18s.

llvm-svn: 23406
2005-09-23 06:22:58 +00:00
Jim Laskey b74c666186 Culling out use of unions for converting FP to bits and vice versa.
llvm-svn: 22838
2005-08-17 19:34:49 +00:00
Chris Lattner 5a1d5e30e2 This is a dummy, it doesn't matter what the ValueType is
llvm-svn: 22809
2005-08-16 21:59:52 +00:00
Jeff Cohen 5f4ef3c5a8 Eliminate all remaining tabs and trailing spaces.
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Reid Spencer af48d8643d Final Changes For PR495:
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.

llvm-svn: 22354
2005-07-08 03:08:58 +00:00
Reid Spencer c9c0473fa5 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Andrew Lenharth 253145299b If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.

llvm-svn: 22273
2005-06-22 21:04:42 +00:00
Andrew Lenharth 717f1610f0 va_end fix
llvm-svn: 22262
2005-06-19 14:04:55 +00:00
Andrew Lenharth 9144ec4764 core changes for varargs
llvm-svn: 22254
2005-06-18 18:34:52 +00:00
Andrew Lenharth c3f68473a5 Remove code for conversion from old style va_args. Preparing the way for
returning to the old style :)

llvm-svn: 22199
2005-06-08 00:49:08 +00:00
Chris Lattner 4e63e3f5c8 fix the assertion
llvm-svn: 21994
2005-05-13 23:35:47 +00:00
Jeff Cohen 6dc6672840 Silence VC++ warnings about unsafe mixing of ints and bools with the | operator.
llvm-svn: 21758
2005-05-07 02:44:04 +00:00
Chris Lattner 9bbe58628b remove some dead (always dynamically false) flags
llvm-svn: 21752
2005-05-06 22:35:09 +00:00
Chris Lattner 129535c787 encode calling conventions for call/invoke instructions.
llvm-svn: 21751
2005-05-06 22:34:01 +00:00
Chris Lattner f2e1c1969f encode function calling convs in the bytecode file. invoke and call are
still to come.

llvm-svn: 21749
2005-05-06 20:42:57 +00:00
Chris Lattner b25b6304b7 wrap a longline
llvm-svn: 21747
2005-05-06 20:27:03 +00:00
Chris Lattner fb6f1746f4 add bytecode reader support for tail calls
llvm-svn: 21727
2005-05-06 06:13:34 +00:00
Misha Brukman 291f6b7223 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Chris Lattner 1243e1c9f1 add support for undef values of opaque type, addressing PR541
llvm-svn: 21701
2005-05-05 22:21:19 +00:00
Chris Lattner 7ddaeb448b Add some extra checks. Opaque types don't have a null marker.
llvm-svn: 21700
2005-05-05 20:57:00 +00:00
Misha Brukman 774511633d Convert tabs to spaces
llvm-svn: 21439
2005-04-22 04:01:18 +00:00
Misha Brukman b47d28bfe8 * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21418
2005-04-21 21:48:46 +00:00
Misha Brukman 2ecc34dd3c Remove trailing whitespace
llvm-svn: 21417
2005-04-21 21:44:41 +00:00
Misha Brukman 01808caded Remove trailing whitespace
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Reid Spencer c8b5d60937 Use the actual uid/gid for defaulting the fields in the archive.
llvm-svn: 21405
2005-04-21 17:49:57 +00:00
Reid Spencer ce7ce1628f Eliminate calls to system dependent function getuid by using
the newly implemented sys::Process::GetCurrentUserId function. Replace
similarly for getgid.

llvm-svn: 21402
2005-04-21 16:15:19 +00:00
Misha Brukman 8cd50bf269 Initialize fields mode, uid, and gid.
Patch by Markus Oberhumer.  Thanks!

llvm-svn: 21369
2005-04-20 03:55:35 +00:00
Misha Brukman bebcaeb816 Align comments together for consistency
llvm-svn: 21368
2005-04-20 03:52:59 +00:00
Chris Lattner 531f9e92d4 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner e9328b319c Fix an apparent ambiguity compiling on PPC
llvm-svn: 20507
2005-03-07 02:59:36 +00:00
Chris Lattner 8a982e10be simplify and speed up some code
llvm-svn: 20472
2005-03-06 02:32:00 +00:00
Chris Lattner 6d0a24c608 second argument to Value::setName is now gone.
llvm-svn: 20463
2005-03-05 19:05:20 +00:00
Chris Lattner 0ce80cd542 Fix spelling, patch contributed by Gabor Greif!
llvm-svn: 20343
2005-02-27 06:18:25 +00:00
Reid Spencer 709e10ed92 Implement an isBytecodeArchive method to determine if an archive contains
bytecode file members or not.
Patch Contributed By Adam Treat

llvm-svn: 20338
2005-02-26 22:00:32 +00:00
Chris Lattner 75f5b42624 use more specific cast.
llvm-svn: 20297
2005-02-24 05:26:04 +00:00
Reid Spencer 8d0f126b74 Make the check for global variables the same as the one for functions. In
both cases they are looking for non-external variables/functions that do
not have internal linkage. Using "!isExternal()" is a little more
understandable than "hasInitializer()"

llvm-svn: 20155
2005-02-13 18:12:20 +00:00
Chris Lattner 147c561432 Make sure to clear the LazyFunctionLoadMap after we ParseAllFunctionBodies.
Otherwise, clients who call ParseAllFunctionBodies will attempt to parse
the function bodies twice, which is (uh) very very bad (tm).

This fixes gccld on python.

llvm-svn: 20152
2005-02-13 17:48:18 +00:00
Chris Lattner 1b9f9c5f67 Do not put internal symbols into the symbol table. This shrinks the symbol
table for archives in common cases, and prevents trying to resolve a
external reference with an internal reference.  This shrinks the libpython.a
symbol table from 126302 to 19770 bytes.

llvm-svn: 20151
2005-02-13 17:42:11 +00:00
Chris Lattner ccf22fb182 Fix the regressions my User changes introduced. Apparently some parts of
LLVM make the very reasonable assumption that constant expressions will
have at least one operand! :)

llvm-svn: 19943
2005-01-31 01:11:13 +00:00
Chris Lattner 616b8fc630 Adjust to changes in User class and minor changes in instruction ctors.
llvm-svn: 19894
2005-01-29 00:36:19 +00:00
Jeff Cohen 971e03d74a Properly close mapped files.
llvm-svn: 19863
2005-01-28 01:17:07 +00:00
Jeff Cohen c8f1f4bc8e Use binary mode for reading/writing bytecode files
llvm-svn: 19751
2005-01-22 17:36:17 +00:00
Reid Spencer 9f4bb585f5 Remove potential platform portability issue with size of "int".
llvm-svn: 19172
2004-12-29 01:20:24 +00:00
Reid Spencer 9e7acd465e For PR351:
Remove unix specific code (use of errno and read) from the reader.
Thanks to Jeff Cohen for pointing this out.

llvm-svn: 19081
2004-12-21 07:51:33 +00:00
Reid Spencer b5e10bb05d Remove the #include of llvm/Config/unistd.h as it is no longer needed.
llvm-svn: 19067
2004-12-20 04:52:04 +00:00
Jeff Cohen be92640355 Fix problems uncovered by VC++ (first time compiled by VC++)
llvm-svn: 19056
2004-12-20 03:23:46 +00:00
Reid Spencer 9329172767 For PR351:
* Remove #inclusion of FileUtilities.h, not needed any more.
* Convert getUniqueFilename -> sys::Pat::makeUnique()

llvm-svn: 18948
2004-12-15 01:51:56 +00:00
Reid Spencer cd89ca3040 For PR351:
Use sys::MappedFile instead of ReadFileIntoAddressSpace and
UnmapFileFromAddressSpace. sys::MappedFile has the nice property that it
cleans up after itself so exception handling can be removed.

llvm-svn: 18902
2004-12-13 18:25:27 +00:00
Reid Spencer ac9fe82875 Make sure the Archive gets deleted if there's an error.
llvm-svn: 18869
2004-12-13 03:22:31 +00:00
Reid Spencer a204547e32 Implement error handling in OpenAndLoad* functions so the Linker can handle it.
llvm-svn: 18853
2004-12-13 02:59:03 +00:00
Reid Spencer 5ccfd5a48b Path::get -> Path::toString
llvm-svn: 18785
2004-12-11 00:14:15 +00:00
Chris Lattner 6225146f20 Remove a dead field, make the map go to integer type ID to hash better and
avoid a getType.

llvm-svn: 18691
2004-12-09 06:19:44 +00:00
Chris Lattner 2cdf54c0f0 Remove #include inadvertently added
llvm-svn: 18686
2004-12-09 04:53:17 +00:00
Chris Lattner e44907012a Eliminate this ugly hack. This was put back in when replaceAllUsesOf used
a different algorithm that was extremely inefficient for instructions with
many operands.

This reduces the time of this code snippet from .23s for 176.gcc to 0.03s
in a debug build, which speeds up total llvm-dis time just barely.

It's more of a code cleanup than a speedup.

llvm-svn: 18685
2004-12-09 04:51:50 +00:00
Reid Spencer ef510c0279 Provide more information in the error message that occurs when there are
unresolved constants remaining.

llvm-svn: 18502
2004-12-04 22:19:53 +00:00
Chris Lattner 8145bd5006 Check in some patches for better assertions
llvm-svn: 18500
2004-12-04 21:28:47 +00:00