1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

3100 Commits

Author SHA1 Message Date
Andrew Lenharth
311ec68cf4 Random sampling (aka Arnold and Ryder) profiling. This is still preliminary, but it works on spec on x86 and alpha. The idea is to allow profiling passes to remember what profiling they inserted, then a random sampling framework is inserted which consists of duplicated basic blocks (without profiling), such that at each backedge in the program and entry into every function, the framework chooses whether to use the instrumented code or the instrumentation free code. The goal of such a framework is to make it reasonably cheap to do random sampling of very expensive profiling products (such as load-value profiling).
The code is organized into 3 parts (2 passes)
1) a linked set of profiling passes, which implement an analysis group (linked, like alias analysis are).  These insert profiling into the program, and remember what they inserted, so that at a later time they can be queried about any instruction.

2) a pass that handles inserting the random sampling framework.  This also has options to control how random samples are choosen.  Currently implemented are Global counters, register allocated global counters, and read cycle counter (see? there was a reason for it).

The profiling passes are almost identical to the existing ones (block, function, and null profiling is supported right now), and they are valid passes without the sampling framework (hence the existing passes can be unified with the new ones, not done yet).

Some things are a bit ugly still, but that should be fixed up soon enough.

Other todo? making the counter values not "magic 2^16 -1" values, but dynamically choosable.

llvm-svn: 24493
2005-11-28 00:58:09 +00:00
Andrew Lenharth
79ee761b69 Reg2Mem is something a pass may depend on, so allow that
llvm-svn: 24488
2005-11-22 22:14:23 +00:00
Nate Begeman
a90bb6d9b1 Check in code to scalarize arbitrarily wide packed types for some simple
vector operations (load, add, sub, mul).

This allows us to codegen:
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

on ppc as:
_foo:
        lfs f0, 12(r3)
        lfs f1, 8(r3)
        lfs f2, 4(r3)
        lfs f3, 0(r3)
        fadds f0, f0, f0
        fadds f1, f1, f1
        fadds f2, f2, f2
        fadds f3, f3, f3
        stfs f0, 12(r3)
        stfs f1, 8(r3)
        stfs f2, 4(r3)
        stfs f3, 0(r3)
        blr

llvm-svn: 24484
2005-11-22 18:16:00 +00:00
Chris Lattner
e8b78e73f7 Add a new flag
llvm-svn: 24480
2005-11-21 23:06:08 +00:00
Chris Lattner
e68011991d Add some more directives
llvm-svn: 24474
2005-11-21 19:51:51 +00:00
Chris Lattner
7edfd3138a add two more config directives, add method for printing constant pool
llvm-svn: 24463
2005-11-21 08:24:11 +00:00
Chris Lattner
37cc677f05 Make the AsmPrinter keep track of the notion of a function number.
llvm-svn: 24460
2005-11-21 08:12:47 +00:00
Chris Lattner
29dcb4d3ef Capitalize methods for better consistency
llvm-svn: 24455
2005-11-21 07:51:06 +00:00
Chris Lattner
05782d4087 Add section switching to to common AsmPrinter code.
llvm-svn: 24444
2005-11-21 07:05:42 +00:00
Chris Lattner
cf57490f4c Add a new option.
llvm-svn: 24439
2005-11-21 06:41:08 +00:00
Chris Lattner
f6ae8401db add a new node type
llvm-svn: 24436
2005-11-20 22:55:57 +00:00
Chris Lattner
e9a33d2505 Add two new construction methods, patch by Evan Cheng
llvm-svn: 24417
2005-11-19 01:42:10 +00:00
Nate Begeman
7d513f65ae Teach LLVM how to scalarize packed types. Currently, this only works on
packed types with an element count of 1, although more generic support is
coming.  This allows LLVM to turn the following code:

void %foo(<1 x float> * %a) {
entry:
  %tmp1 = load <1 x float> * %a;
  %tmp2 = add <1 x float> %tmp1, %tmp1
  store <1 x float> %tmp2, <1 x float> *%a
  ret void
}

Into:

_foo:
        lfs f0, 0(r3)
        fadds f0, f0, f0
        stfs f0, 0(r3)
        blr

llvm-svn: 24416
2005-11-19 00:36:38 +00:00
Chris Lattner
a19b6a0800 Fix the dominates method to return true if the two nodes are the same. Add
a new properlyDominates method to do what the old one did.

llvm-svn: 24407
2005-11-18 07:27:33 +00:00
Nate Begeman
5784fb4adf Teach the type lowering code about turning packed types into vector types.
Next step: generating vector dag nodes, and legalizing them into scalar
code.

llvm-svn: 24404
2005-11-17 21:44:42 +00:00
Chris Lattner
efa81a081f add a flag
llvm-svn: 24375
2005-11-16 07:21:15 +00:00
Chris Lattner
389e3bfb0c Teach emitAlignment to handle explicit alignment requests by globals.
llvm-svn: 24354
2005-11-14 19:00:06 +00:00
Chris Lattner
ad22577daf add malloc_zone_statistics, remove mstats
llvm-svn: 24350
2005-11-14 07:24:17 +00:00
Chris Lattner
7e7018b3dc regenerate
llvm-svn: 24348
2005-11-14 06:57:34 +00:00
Chris Lattner
e30379e377 Shrink derived types by 8 bytes each by not having to have 2 vtables pointers
and other MI overhead.

llvm-svn: 24344
2005-11-13 03:26:12 +00:00
Chris Lattner
6204629107 Refactor some code, moving methods and data around. This gets rid of some
virtual methods.

llvm-svn: 24342
2005-11-13 03:13:26 +00:00
Chris Lattner
3a350f3f83 Shrink the Type class from 32 to 28 bytes on Darwin (which has silly 32-bit
bools).

llvm-svn: 24326
2005-11-12 10:07:47 +00:00
Chris Lattner
dec8e7e0aa remove a dead method
llvm-svn: 24325
2005-11-12 08:42:30 +00:00
Chris Lattner
bcf40488a9 Add support for putting globals in a particular section
llvm-svn: 24309
2005-11-12 00:09:49 +00:00
Andrew Lenharth
9b036b1bdb added a chain output
llvm-svn: 24306
2005-11-11 22:48:54 +00:00
Andrew Lenharth
6600f4a1d0 Add support for a cycle counter intrinsic. As basically all processors have
this and have it in about the same form, I think this makes sense.
on X86, you do a RDTSC (64bit result, from any ring since the P5MMX)
on Alpha, you do a RDCC
on PPC, there is a sequence which may or may not work depending on how things
are setup by the OS.  Or something like that.  Maybe someone who knows PPC
can add support.  Something about the time base register.
on Sparc, you read %tick, which in some solaris versions (>=8) is readable by
userspace
on IA64 read ar.itc

So I think the ulong is justified since all of those are 64bit.
Support is slighly flaky on old chips (P5 and lower) and sometimes
depends on OS (PPC, Sparc).  But for modern OS/Hardware (aka this decade),
we should be ok.

I am still not sure what to do about lowering.  I can either see a lower to 0, to
gettimeofday (or the target os equivalent), or loudly complaining and refusing to
continue.

I am commiting an Alpha implementation.  I will add the X86 implementation if I
have to (I have use of it in the near future), but if someone who knows that
backend (and the funky multi-register results) better wants to add it, it would
take them a lot less time ;)

TODO: better lowering and legalizing, and support more platforms
llvm-svn: 24299
2005-11-11 16:45:18 +00:00
Chris Lattner
3a18b19a03 Allow per-character control over what target assemblers allow in symbol
names.  This also changes the default to allow all of "$_." in addition
to letters and numbers as symbol names.  If you don't want this, use
markCharUnacceptable to remove one of these or markCharAcceptable to add
to the set.  This corresponds with what GAS accepts by default.

llvm-svn: 24291
2005-11-10 21:39:12 +00:00
Chris Lattner
2ba7f5a64d Add a new option for targets that accept quoted labels.
llvm-svn: 24283
2005-11-10 19:30:07 +00:00
Chris Lattner
6ce2a3d52e Remove M, which is dead. Eliminate a dead typedef. Add comments.
llvm-svn: 24282
2005-11-10 19:02:52 +00:00
Chris Lattner
5b0d543080 This method is no longer static
llvm-svn: 24280
2005-11-10 18:55:09 +00:00
Chris Lattner
4e377b5d6d minor interface changes.
llvm-svn: 24276
2005-11-10 18:46:57 +00:00
Chris Lattner
bfa198b9f1 add support for .asciz, and enable it by default. If your target assembler
doesn't support .asciz, just set AscizDirective to null in your asmprinter.

This compiles C strings to:

l1__2E_str_1:                           ; '.str_1'
        .asciz  "foo"

instead of:

l1__2E_str_1:                           ; '.str_1'
        .ascii  "foo\000"

llvm-svn: 24271
2005-11-10 18:05:57 +00:00
Andrew Lenharth
ddcbd92b23 needs to go here to apparently.
llvm-svn: 24268
2005-11-10 02:07:45 +00:00
Andrew Lenharth
03d60c3d09 The pass everyone has been waiting for!
Reg2Mem

for fun you can opt -reg2mem -mem2reg

llvm-svn: 24267
2005-11-10 01:58:38 +00:00
Chris Lattner
ce6f7839fe Switch the allnodes list from a vector of pointers to an ilist of nodes.
This eliminates the vector, allows constant time removal of a node from
a graph, and makes iteration over the all nodes list stable when adding
nodes to the graph.

llvm-svn: 24262
2005-11-09 23:46:43 +00:00
Chris Lattner
e1cf681dee Change the ValueList array for each node to be shared instead of individually
allocated.  Further, in the common case where a node has a single value, just
reference an element from a small array.  This is a small compile-time wi.

llvm-svn: 24250
2005-11-08 23:30:11 +00:00
Chris Lattner
12686ba20f Switch the operandlist/valuelist from being vectors to being just an array.
This saves 12 bytes from SDNode, but doesn't speed things up substantially
(our graphs apparently already fit within the cache on my g5).  In any case
this reduces memory usage.

llvm-svn: 24248
2005-11-08 22:06:23 +00:00
Chris Lattner
32dee7201b adjust itf
llvm-svn: 24242
2005-11-08 18:52:57 +00:00
Chris Lattner
bb448515ae Add a new option to indicate we want the code generator to emit code quickly,
not spending tons of time microoptimizing it.  This is useful for an -O0
style of build.

llvm-svn: 24235
2005-11-08 02:12:47 +00:00
Chris Lattner
f0f5449612 Change a comment slightly
llvm-svn: 24226
2005-11-06 17:40:18 +00:00
Nate Begeman
aecebc076b Add the necessary support to the ISel to allow targets to codegen the new
alignment information appropriately.  Includes code for PowerPC to support
fixed-size allocas with alignment larger than the stack.  Support for
arbitrarily aligned dynamic allocas coming soon.

llvm-svn: 24224
2005-11-06 09:00:38 +00:00
Chris Lattner
aa07ab1192 Make sure to initialize the alignment field
llvm-svn: 24222
2005-11-06 08:22:18 +00:00
Chris Lattner
0505c89e9c allow functions and modules to have an explicit alignment
llvm-svn: 24209
2005-11-06 06:44:42 +00:00
Chris Lattner
cfaf9f14c0 add an accessor
llvm-svn: 24201
2005-11-05 21:58:30 +00:00
Nate Begeman
f299b9fb03 Add support alignment of allocation instructions.
Add support for specifying alignment and size of setjmp jmpbufs.

No targets currently do anything with this information, nor is it presrved
in the bytecode representation.  That's coming up next.

llvm-svn: 24196
2005-11-05 09:21:28 +00:00
Jeff Cohen
16669485c1 <cassert> no longer required to make VC++ happy.
llvm-svn: 24177
2005-11-04 02:59:16 +00:00
Duraid Madina
feeaabd6f1 change NULL to 0, unbreaks the ppc target when building on ia64
llvm-svn: 24176
2005-11-04 01:45:04 +00:00
Jim Laskey
42681c1d58 1. Remove ranges from itinerary data.
2. Tidy up the subtarget emittined code.

llvm-svn: 24172
2005-11-03 22:47:41 +00:00
Jeff Cohen
ae39880d3a Keep VC++ happy.
llvm-svn: 24148
2005-11-02 04:03:16 +00:00
Jim Laskey
4cb1e29b27 Allow itineraries to be passed through the Target Machine.
llvm-svn: 24139
2005-11-01 20:06:59 +00:00