Commit Graph

74 Commits

Author SHA1 Message Date
Chris Lattner
3bd5fac76f Fix printing of the instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-14 22:01:07 +00:00
Andrew Lenharth
0fccc74103 This solves the problem of the CBE renaming symbols that start with . but the assembly side still trying to reference them by their old names. Should be safe untill we hit a language front end that lets you specify such a name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24626 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-06 20:51:30 +00:00
Jeff Cohen
66c5fd6c53 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23888 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 04:37:20 +00:00
Chris Lattner
aed98fa886 If the user interrupts bugpoint, don't extract loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22603 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 23:25:56 +00:00
Chris Lattner
f9aaae06cd When the user hits ctrl-c, bugpoint should attempt to stop reduction as
quickly as possible and output what it has so far.  If they hit it twice,
bugpoint is killed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:16:17 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Chris Lattner
a3efca16f2 Fix PR576.
Instead of emitting a JIT stub that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
header:
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=1]
        call void %resolverCast( int %0 )
        ret void
}

Emit one that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
Entry:
	%fpcache = load void (int)** %l1_main_entry_2E_ce.fpcache               ; <void (int)*> [#uses=2]
        %isNull = seteq void (int)* %fpcache, null              ; <bool> [#uses=1]
        br bool %isNull, label %lookupfp, label %usecache

usecache:               ; preds = %lookupfp, %Entry
        %fp = phi void (int)* [ %resolverCast, %lookupfp ], [ %fpcache, %Entry ]            ; <void (int)*> [#uses=1]
        call void %fp( int %0 )
        ret void

lookupfp:               ; preds = %Entry
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=2]
        store void (int)* %resolverCast, void (int)** %l1_main_entry_2E_ce.fpcache
        br label %usecache
}


This makes the JIT debugger *MUCH* faster on large programs, as
getPointerToNamedFunction takes time linear with the size of the program, and
before we would call it every time a function in the text module was called from
the safe module (ouch!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22387 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:00:32 +00:00
Reid Spencer
a229c5cce7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 03:08:58 +00:00
Reid Spencer
dd04df0ec3 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Chris Lattner
56c418676a If loopextract breaks the program provide output so that we can repro the
problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21790 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 21:54:56 +00:00
Jeff Cohen
ea3e5e56fd Eliminate tabs and trailing spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21441 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 04:13:13 +00:00
Misha Brukman
3da94aec4d Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21428 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 00:00:37 +00:00
Chris Lattner
852b4d4bf4 Replace more a*'s with arg_*'s, thanks to Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20615 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 15:48:06 +00:00
Alkis Evlogimenos
5a1c58d009 Use arg_iterator and arg_begin and arg_end functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20608 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 07:02:26 +00:00
Chris Lattner
da895d6337 Fix spelling, patch contributed by Gabor Greif!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20343 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-27 06:18:25 +00:00
Chris Lattner
59615f0f85 Improve output precision.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19564 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 00:07:19 +00:00
Reid Spencer
5f76760c88 For PR351:
* removeFile() -> sys::Path::destroyFile()
* remove extraneous toString() calls
* convert local variables representing path names from std::string to
  sys::Path
* Use sys::Path objects with FileRemove instead of std::string
* Use sys::Path methods for construction of path names


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19001 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 23:04:20 +00:00
Reid Spencer
97182985d5 For PR351:
* Convert use of getUniqueFilename to sys::Path::makeUnique();


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18949 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 01:53:08 +00:00
Reid Spencer
e4874029c3 LinkModules is now in the Linker class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18863 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:01:03 +00:00
Chris Lattner
fa1af13449 Fix a bug in the checkin where I adjusted this code to work when
LinkModules nukes the second module argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17986 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 07:09:40 +00:00
Chris Lattner
90c18c5c69 Make this code not depend on LinkModules leaving the second argument unmolested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17874 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:31:38 +00:00
Reid Spencer
605b9e2c5b Linker.h has a new home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:00:08 +00:00
Reid Spencer
551ccae044 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Misha Brukman
eed80e2375 * Convert "\n" -> '\n'
* Print out another '\n' after printing out program execution status
* Make sure code wraps at 80 cols


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15123 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-23 01:30:49 +00:00
Reid Spencer
518310cb0d bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:44:37 +00:00
Misha Brukman
008248f2c0 Linker.h moved to include/llvm/Support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14351 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-23 17:33:09 +00:00
Chris Lattner
7507c297d0 Turn the block extractor on by default now that it basically works, eliminating the option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13502 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 19:02:44 +00:00
Chris Lattner
68bee938e5 Check to see if all blocks are extractible first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13491 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 16:08:01 +00:00
Chris Lattner
2290e75406 Implement the final missing bits for block extractor support. Now bugpoint
can extract basic blocks up to the limit of the block extractor implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13475 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-12 02:43:24 +00:00
Chris Lattner
5e783ab0b5 Implement basic block extraction for the miscompilation debugger. This still needs
two things: the FIXME in ExtractBlocks needs to be implemented, and the basic block
extractor itself needs to have enough bugs fixed for this to be more or less
useful.

Until the time that this is generally useful, it is hidden behind the new bugpoint
-enable-block-extraction option.  I hope to get the FIXME done tonight.

Also of note, this patch adds a -extract-bbs option to bugpoint which can be used
to debug the block extractor.  (hint hint Misha :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13471 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-11 21:54:13 +00:00
Chris Lattner
f4789e6d04 Teach bugpoint to be a little bit smarter and avoid repeating work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13132 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 20:36:51 +00:00
Misha Brukman
123f8fec94 Add a space before result for readability on the command line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-22 20:02:09 +00:00
Misha Brukman
8c194eaa05 Add doxygenified comments to functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13097 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-21 18:36:43 +00:00
Misha Brukman
de4803d0af As per Chris, greatly simplify handling of external functions by using the
wrapper idea uniformly: we can use Value::replaceAllUsesWith() instead of
special-casing by class of user.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:36:47 +00:00
Misha Brukman
dc7fef83dc Finally implement rewriting global initializers which use external functions
by creating an internal wrapper function with same signature as the external
function, and use it instead of the "real" function.

The wrapper then calls the external function using the same JIT function
resolution API that has been used before for rewriting instructions, since the
wrapper has an explicit call instruction which we can rewrite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13054 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 01:12:01 +00:00
Chris Lattner
36ee07ff9d Disambiguate symbols after loop extraction so that we can diagnose a code
generator bug if multiple loops are extracted from a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12847 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-11 23:52:35 +00:00
Chris Lattner
2423db0e85 Fix an obvious bug in the refactoring I did a few days ago
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12797 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 22:28:33 +00:00
Chris Lattner
a57d86b436 Merge the code generator miscompilation code into the optimizer miscompilation
code.  This "instantly" gives us loop-extractor power to assist with the
debugment of our nasty codegen issues.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12678 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-05 22:58:16 +00:00
Chris Lattner
b15825b0a2 Refactor and genericize code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12675 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-05 21:37:38 +00:00
Chris Lattner
02bb481881 minor formatting change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12606 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-02 06:32:45 +00:00
Chris Lattner
5313f23b8c Fix two pretty serious bugs:
1. Each time the loop extractor extracted a loop, we would leak a module.
  2. When we extracted a loop, we didn't add the new function to the list of
     miscompiled functions.  Thus if the bug was in a loop nest and we
     extracted it, we could actually *LOSE THE BUG*, which is very bad.

With these patches, bugpoint has successfully found a bug for me in a function
with several nested loops, and cut it down to just one of them. :) :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12605 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-02 06:32:17 +00:00
Chris Lattner
d3a533d94d When loop extraction succeeds, make sure to map the function pointers over
to avoid dangling references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12470 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-17 17:42:09 +00:00
Chris Lattner
002dbddccd Fix thinko, and PR292
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12426 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-16 01:51:54 +00:00
Chris Lattner
a1cf1c8c87 After reducing a miscompiled program down to the functions which are being
miscompiled, try to use the loop extractor to reduce the program down to a
loop nest that is being miscompiled.  In practice, the loop extractor appears
to have too many bugs for this to be useful, but hopefully they will be fixed
soon...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12398 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 22:08:00 +00:00
Chris Lattner
efdc0b5057 Refactor and clean up a bunch more code. No major functionality changes.
* Make several methods of bugdriver global functions (ParseInputFile, PrintFunctionList)
 * Make PrintFunctionList truncate the output after 10 entries, like the crash debugger
   did.  This allows code sharing.
 * Add a couple of methods to BugDriver that allows us to eliminate some friends
 * Improve comments in ExtractFunction.cpp
 * Make classes that used to be friends up bugdriver now live in anon namespaces
 * Rip a bunch of functionality in the miscompilation tester into a new
   TestMergedProgram function for future code sharing.
 * Fix a bug in the miscompilation tester induced in my last checkin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12393 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 20:50:42 +00:00
Chris Lattner
be21ca54e0 Refactor all of the "splitting a module into two pieces" code to avoid
code duplication.  Also, don't use ReduceMiscompilingFunctions::TestFuncs
to print out the final message.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12387 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-14 19:27:19 +00:00
Chris Lattner
f913f40be8 A couple of minor cleanups: don't forward declare private classes, put private
classes in an anon namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11604 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 21:29:46 +00:00
Chris Lattner
025262692a Add a stub for debugging code generator crashes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11602 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-18 21:02:04 +00:00
Chris Lattner
fa76183e8e finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 03:38:37 +00:00
Chris Lattner
de9750def7 Bugpoint had appalingly bad grammar. Fix some of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10308 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-07 02:43:09 +00:00