Commit Graph

8216 Commits

Author SHA1 Message Date
Evan Cheng 1fb8aedd1e Fix some significant problems with constant pools that resulted in unnecessary paddings between constant pool entries, larger than necessary alignments (e.g. 8 byte alignment for .literal4 sections), and potentially other issues.
1. ConstantPoolSDNode alignment field is log2 value of the alignment requirement. This is not consistent with other SDNode variants.
2. MachineConstantPool alignment field is also a log2 value.
3. However, some places are creating ConstantPoolSDNode with alignment value rather than log2 values. This creates entries with artificially large alignments, e.g. 256 for SSE vector values.
4. Constant pool entry offsets are computed when they are created. However, asm printer group them by sections. That means the offsets are no longer valid. However, asm printer uses them to determine size of padding between entries.
5. Asm printer uses expensive data structure multimap to track constant pool entries by sections.
6. Asm printer iterate over SmallPtrSet when it's emitting constant pool entries. This is non-deterministic.


Solutions:
1. ConstantPoolSDNode alignment field is changed to keep non-log2 value.
2. MachineConstantPool alignment field is also changed to keep non-log2 value.
3. Functions that create ConstantPool nodes are passing in non-log2 alignments.
4. MachineConstantPoolEntry no longer keeps an offset field. It's replaced with an alignment field. Offsets are not computed when constant pool entries are created. They are computed on the fly in asm printer and JIT.
5. Asm printer uses cheaper data structure to group constant pool entries.
6. Asm printer compute entry offsets after grouping is done.
7. Change JIT code to compute entry offsets on the fly.

llvm-svn: 66875
2009-03-13 07:51:59 +00:00
Bill Wendling fa54bc2052 Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling b02eadf660 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Gabor Greif af76c34b4b cosmetic change, in preparation of future change
llvm-svn: 66839
2009-03-12 23:13:03 +00:00
Daniel Dunbar db948ffaf0 raw_ostream: unbuffered streams weren't being immediately flushed on
single character writes.

llvm-svn: 66827
2009-03-12 22:02:44 +00:00
Gabor Greif c91aa9b857 Rearrange operands of the BranchInst, to be able to
access each with a fixed negative index from op_end().

This has two important implications:
- getUser() will work faster, because there are less iterations
  for the waymarking algorithm to perform. This is important
  when running various analyses that want to determine callers
  of basic blocks.
- getSuccessor() now runs faster, because the indirection via OperandList
  is not necessary: Uses corresponding to the successors are at fixed
  offset to "this".

The price we pay is the slightly more complicated logic in the operator
User::delete, as it has to pick up the information whether it has to free
the memory of an original unconditional BranchInst or a BranchInst that
was originally conditional, but has been shortened to unconditional.
I was not able to come up with a nicer solution to this problem. (And
rest assured, I tried *a lot*).

Similar reorderings will follow for InvokeInst and CallInst. After that
some optimizations to pred_iterator and CallSite will fall out naturally.

llvm-svn: 66815
2009-03-12 18:34:49 +00:00
Chris Lattner b0a553b925 Fully initialize all ivars, fixing PR3790, patch by Edwin Torok!
llvm-svn: 66798
2009-03-12 17:22:48 +00:00
Daniel Dunbar aa75c9d8d8 Add StringMap::lookup.
llvm-svn: 66750
2009-03-12 01:16:06 +00:00
Bill Wendling 42adc73a2b Add a -no-implicit-float flag. This acts like -soft-float, but may generate
floating point instructions that are explicitly specified by the user.

llvm-svn: 66719
2009-03-11 22:30:01 +00:00
Torok Edwin 5202cc0036 Make Print callable from a pass's print method: add const qualifier. No
functionality change.

llvm-svn: 66700
2009-03-11 20:50:17 +00:00
Duncan Sands 4581bebf2a It makes no sense to have a ODR version of common
linkage, so remove it.

llvm-svn: 66690
2009-03-11 20:14:15 +00:00
Duncan Sands e2881053c9 Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.

llvm-svn: 66650
2009-03-11 08:08:06 +00:00
Evan Cheng 64b3f9d7a7 Two coalescer fixes in one.
1. Use the same value# to represent unknown values being merged into sub-registers.
2. When coalescer commute an instruction and the destination is a physical register, update its sub-registers by merging in the extended ranges.

llvm-svn: 66610
2009-03-11 00:03:21 +00:00
Mon P Wang 1073de0d73 Changed Allocate to use size_t instead of unsigned.
llvm-svn: 66602
2009-03-10 23:48:49 +00:00
Dan Gohman dab7b9355f Add an explicit keyword.
llvm-svn: 66595
2009-03-10 23:10:46 +00:00
Mon P Wang cc51b03a4e Fixed rounding up EltSize
llvm-svn: 66594
2009-03-10 23:04:40 +00:00
Gabor Greif 19393b0064 Give Op<N>() AppleScript-like semantics, i.e. for negative N it indexes relative to op_end.
This is a preliminary to changes to come. No intended functionality change.

llvm-svn: 66593
2009-03-10 23:02:13 +00:00
Bill Wendling 6e6d1b2481 Refine the Dwarf writer timers so that they measure exception writing and debug
writing individually.

llvm-svn: 66577
2009-03-10 21:23:25 +00:00
Bill Wendling e8dd2847ff Add a timer to the DwarfWriter pass that measures the total time it takes to
emit exception and debug Dwarf info.

llvm-svn: 66571
2009-03-10 20:41:52 +00:00
Daniel Dunbar 3da6a7071a PR3478: raw_ostream should not buffer stderr
- Add unbuffered flag to raw_ostream, forwarded by raw_fd_ostream and
   used by raw_stderr_ostream.

llvm-svn: 66545
2009-03-10 16:21:55 +00:00
Daniel Dunbar 2cc05b76ad Add C++ marker.
llvm-svn: 66543
2009-03-10 15:56:48 +00:00
Torok Edwin 51b4a28878 Global variables don't have a corresponding llvm.dbg.declare, yet it is possible
to obtain debug info about them.
Introduce helpers to access debug info for global variables. Also introduce a
helper that works for both local and global variables.

llvm-svn: 66541
2009-03-10 13:41:26 +00:00
Chris Lattner 1522e2498f wire up support for emitting "special" values from inline asm
format strings with the standard ${:foo} syntax.

llvm-svn: 66527
2009-03-10 05:37:13 +00:00
Devang Patel 66f84e7a42 Add helper pass to remove llvm.dbg.declare intrinsics.
llvm-svn: 66454
2009-03-09 20:49:37 +00:00
Gabor Greif c0bee2986c make the Op<N> methods protected, how it was intended to be
llvm-svn: 66430
2009-03-09 19:57:49 +00:00
Bill Wendling c08580af44 Revert r66415. It's causing failures during bootstrap builds:
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__muldi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:567: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__lshrdi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:421: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[5]: *** [libgcc/./_lshrdi3.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [libgcc/./_muldi3.o] Error 1
make[5]: *** [libgcc/./_negdi2.o] Error 1


--- Reverse-merging (from foreign repository) r66415 into '.':
U    include/llvm/BasicBlock.h
U    include/llvm/ADT/ilist_node.h
U    include/llvm/CodeGen/SelectionDAG.h
U    include/llvm/CodeGen/MachineFunction.h
U    include/llvm/CodeGen/MachineBasicBlock.h
U    include/llvm/Function.h

llvm-svn: 66426
2009-03-09 18:01:33 +00:00
Bob Wilson 4718296d64 Add a constructor for BuildVectorSDNode and revert the temporary workaround
from 66280.  I was unable to verify this with gcc-3.4.6, but with gcc-3.3 it
avoids the "base class with only non-default constructor in class without
a constructor" warning.  Apparently that warning was promoted to an error
in gcc-3.4.

llvm-svn: 66424
2009-03-09 17:07:15 +00:00
Gabor Greif f183a3e95b in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels
llvm-svn: 66415
2009-03-09 07:09:01 +00:00
Nick Lewycky 714976b70f Regenerate.
llvm-svn: 66407
2009-03-09 06:16:46 +00:00
Nick Lewycky b2f34f6211 Remove configurey-fu to autodetect hash_map and hash_set now that they are
no longer used in LLVM.

llvm-svn: 66406
2009-03-09 06:16:26 +00:00
Chris Lattner 6f884e07c5 make GlobalValue::removeDeadConstantUsers() const.
llvm-svn: 66403
2009-03-09 05:50:45 +00:00
Chris Lattner 0eab5ecb71 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.

llvm-svn: 66398
2009-03-09 05:11:09 +00:00
Chris Lattner 7c2ab26007 add a #include to improve portability to windows, as requested by
someone on llvmdev.

llvm-svn: 66397
2009-03-09 05:10:08 +00:00
Bill Wendling c6869f4695 Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.

llvm-svn: 66396
2009-03-09 05:04:40 +00:00
Chris Lattner dc35e5b43a change the MemIntrinsic get/setAlignment method to take an unsigned
instead of a Constant*, which is what the clients of it really want.

llvm-svn: 66364
2009-03-08 03:59:00 +00:00
Chris Lattner 334268a211 Introduce a new MemTransferInst pseudo class, which is a common
parent between MemCpyInst and MemMoveInst, simplify some code to
use it.

llvm-svn: 66361
2009-03-08 03:37:16 +00:00
Nick Lewycky add31939ed Fix misaligned whitespace. No functionality change.
llvm-svn: 66355
2009-03-08 00:57:09 +00:00
Mikhail Glushenkov d18088a7b1 Remove some duplication.
llvm-svn: 66347
2009-03-07 20:18:46 +00:00
Duncan Sands 12da8ce3d2 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Gabor Greif 51bbcf834c simplify the way how traits get hold of the symbol table
llvm-svn: 66336
2009-03-07 12:33:24 +00:00
Gabor Greif 6e1ca84d2c further simplifications arising from peruse of the more declarative interface
llvm-svn: 66333
2009-03-07 10:49:57 +00:00
Gabor Greif 5cd1b25822 Remove the burden of dealing with list offsets
from SymbolTableListTraits' clients, and
intead request a nice declarative interface.
Cleans up an IMHO ugly wart.

llvm-svn: 66331
2009-03-07 10:00:35 +00:00
Daniel Dunbar d39e0974fe Add IRBuilder::CreateConstGEP{1, 2}_{32, 64}.
- Names are lame, but it seems better to be explicit.

llvm-svn: 66295
2009-03-06 22:26:07 +00:00
Daniel Dunbar dcf8d3c9eb Add Module::getNamedValue; use to normalize access to Module symbol
table.
 - No functionality change.

llvm-svn: 66289
2009-03-06 22:04:43 +00:00
Tanya Lattner 8498d2dd2b Add default constructor to SDNode to make gcc 3.4.6 happy.
llvm-svn: 66280
2009-03-06 18:17:45 +00:00
Chris Lattner 040ce02174 some nits noticed by Duncan
llvm-svn: 66274
2009-03-06 17:05:04 +00:00
Chris Lattner a59518276e fix header comment and include guard.
llvm-svn: 66273
2009-03-06 16:54:19 +00:00
Chris Lattner e48f897ca7 add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!

llvm-svn: 66272
2009-03-06 16:52:18 +00:00
Chris Lattner 4c1e9541d3 Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort

llvm-svn: 66260
2009-03-06 06:45:05 +00:00
Gabor Greif b3805878d1 do not close friendship with every odd class
llvm-svn: 66229
2009-03-06 01:09:27 +00:00