1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

11077 Commits

Author SHA1 Message Date
Chris Lattner
641dab84e4 add target hooks for emitting random gunk before and after the function body.
llvm-svn: 94732
2010-01-28 01:58:58 +00:00
Jim Grosbach
7474937004 Update of 94055 to track the IR level call site information via an intrinsic.
This allows code gen and the exception table writer to cooperate to make sure
landing pads are associated with the correct invoke locations.

llvm-svn: 94726
2010-01-28 01:45:32 +00:00
Chris Lattner
95118672e3 Give AsmPrinter the most common expected implementation of
runOnMachineFunction, and switch PPC to use EmitFunctionBody.
The two ppc asmprinters now don't heave to define 
runOnMachineFunction.

llvm-svn: 94722
2010-01-28 01:28:58 +00:00
Chris Lattner
8411a9084e Remove the argument from EmitJumpTableInfo, because it doesn't need it.
Move the X86 implementation of function body emission up to 
AsmPrinter::EmitFunctionBody, which works by calling the virtual
EmitInstruction method.

llvm-svn: 94716
2010-01-28 01:02:27 +00:00
Chris Lattner
6a127932c1 Drop the argument to AsmPrinter::EmitConstantPool and make it virtual.
Overload it in the ARM backend to do nothing, since is does insane
constant pool emission.

llvm-svn: 94708
2010-01-28 00:19:24 +00:00
Chris Lattner
de4b09beb9 rename printVisibility to EmitVisibility and make it private,
constify EmitLinkage.

llvm-svn: 94705
2010-01-28 00:05:10 +00:00
Chris Lattner
fad5ea4f89 add a helper function for bumping up the alignment of a machine function.
llvm-svn: 94700
2010-01-27 23:35:43 +00:00
Sean Callanan
d9a2a982fc Changed constants to an enum so as not to pollute the
global namespace needlessly.

llvm-svn: 94697
2010-01-27 23:20:51 +00:00
Sean Callanan
4325701296 Added a header file defining the externally-visible C API
for the LLVM disassemblers.

llvm-svn: 94696
2010-01-27 23:03:46 +00:00
Jeffrey Yasskin
fb10587e50 Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Benjamin Kramer
cfe07fadc7 Don't bother with sprintf, just pass the Twine through.
llvm-svn: 94684
2010-01-27 19:58:47 +00:00
Mikhail Glushenkov
5d02574734 Make SMDiagnostic::Print a const method.
llvm-svn: 94672
2010-01-27 10:13:28 +00:00
Mikhail Glushenkov
a5a618a417 Trailing whitespace.
llvm-svn: 94671
2010-01-27 10:13:11 +00:00
Chris Lattner
d20734ccba add a new AsmPrinter::EmitFunctionEntryLabel virtual function,
which allows targets to override function entry label emission.
Use it to convert linux/ppc to use EmitFunctionHeader().

llvm-svn: 94667
2010-01-27 07:21:55 +00:00
Evan Cheng
a5cb4213ac Remove a dead target hook.
llvm-svn: 94646
2010-01-27 01:44:40 +00:00
Evan Cheng
237629e476 Eliminate target hook IsEligibleForTailCallOptimization.
Target independent isel should always pass along the "tail call" property. Change
target hook LowerCall's parameter "isTailCall" into a refernce. If the target
decides it's impossible to honor the tail call request, it should set isTailCall
to false to make target independent isel happy.

llvm-svn: 94626
2010-01-27 00:07:07 +00:00
Chris Lattner
ae28b4785d pull linkage emission code out to a new EmitLinkage function.
llvm-svn: 94621
2010-01-26 23:47:12 +00:00
Chris Lattner
8fe5535cec remove a noop function.
llvm-svn: 94616
2010-01-26 23:26:29 +00:00
Jakob Stoklund Olesen
5d298fdb4c Fix inline cost predictions with SCIENCE.
After running a batch of measurements, it is clear that the inliner metrics
need some adjustments:

Own argument bonus:       20 -> 5
Outgoing argument penalty: 0 -> 5
Alloca bonus:             10 -> 5
Constant instr bonus:      7 -> 5
Dead successor bonus:     40 -> 5*(avg instrs/block)

The new cost metrics are generaly 25 points higher than before, so we may need
to move thresholds.

With this change, InlineConstants::CallPenalty becomes a political correction:

if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction()))
  NumInsts += InlineConstants::CallPenalty + CS.arg_size();

The code size is accurately modelled by CS.arg_size(). CallPenalty is added
because calls tend to take a long time, so it may not be worth it to inline a
function with lots of calls.

All of the political corrections are in the InlineConstants namespace:
IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty,
NoreturnPenalty.

llvm-svn: 94615
2010-01-26 23:21:56 +00:00
Chris Lattner
a0df0a28fa now that enough stuff is constified, move function header printing
logic up from X86 into the common code.  The other targets will 
hopefully start using this soon.

llvm-svn: 94614
2010-01-26 23:18:44 +00:00
Chris Lattner
7dbd5458b2 constify a bunch of dwarf stuff now that the registerinfo method
is constified.

llvm-svn: 94613
2010-01-26 23:18:02 +00:00
Chris Lattner
278075333e constify a method argument.
llvm-svn: 94612
2010-01-26 23:15:09 +00:00
Devang Patel
03be031c4c Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.
llvm-svn: 94600
2010-01-26 22:03:41 +00:00
Devang Patel
81ca658dae Remve unnecessary include.
llvm-svn: 94594
2010-01-26 21:42:58 +00:00
Devang Patel
9e6549db1d Add extra element to composite type. This new element will be used to record c++ class that holds current class's vtable.
llvm-svn: 94586
2010-01-26 21:14:59 +00:00
Chris Lattner
325a36c358 Eliminate SetDirective, and replace it with HasSetDirective.
Default HasSetDirective to true, since most targets have it.

The targets that claim to not have it probably do, or it is
spelled differently. These include Blackfin, Mips, Alpha, and
PIC16.  All of these except pic16 are normal ELF targets, so
they almost certainly have it.

llvm-svn: 94585
2010-01-26 20:40:54 +00:00
Rafael Espindola
f46baf3304 Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
Original patch by Sandeep Patel and updated by me.

llvm-svn: 94582
2010-01-26 20:21:43 +00:00
Chris Lattner
044439c9bc eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
that has it.

llvm-svn: 94581
2010-01-26 20:20:43 +00:00
Duncan Sands
3622f9d328 Tweak the way appendModuleInlineAsm works, so you aren't obliged
to append a newline when using setModuleInlineAsm in case later
someone calls appendModuleInlineAsm - make newline handling fully
automatic.  In case anyone is wondering there is only one user of
appendModuleInlineAsm: the dragonegg plugin.

llvm-svn: 94539
2010-01-26 11:58:04 +00:00
Torok Edwin
0ce6500bfd Regenerate configure.
With the previous cleanup to configure.ac, configure is now only 393k, instead of 1.1M!

llvm-svn: 94535
2010-01-26 08:50:50 +00:00
Bill Wendling
d4a402c2aa Remove warning about non return on a non-void function.
llvm-svn: 94532
2010-01-26 08:27:24 +00:00
Chris Lattner
967a37fb26 eliminate the TargetLowering::UsesGlobalOffsetTable bool, which is
subsumed by TargetLowering::getJumpTableEncoding().  Change uses of
it to be more specific.

llvm-svn: 94529
2010-01-26 06:53:37 +00:00
Chris Lattner
b711ded671 Now that printPICJumpTableSetLabel is not overloaded,
inline it into its only caller, allowing us to simplify it
and hoist bits out of the loop.

llvm-svn: 94528
2010-01-26 06:42:44 +00:00
Chris Lattner
d87c50833a Move getJTISymbol from MachineJumpTableInfo to MachineFunction,
which is more convenient, and change getPICJumpTableRelocBaseExpr
to take a MachineFunction to match.

Next, move the X86 code that create a PICBase symbol to
X86TargetLowering::getPICBaseSymbol from 
X86MCInstLower::GetPICBaseSymbol, which was an asmprinter specific 
library.  This eliminates a 'gross hack', and allows us to
implement X86ISelLowering::getPICJumpTableRelocBaseExpr which now
calls it.

This in turn allows us to eliminate the 
X86AsmPrinter::printPICJumpTableSetLabel method, which was the
only overload of printPICJumpTableSetLabel.

llvm-svn: 94526
2010-01-26 06:28:43 +00:00
Chris Lattner
a9b1ea03e9 add a new MachineJumpTableInfo::getJTISymbol method,
use it to implement the default TargetLowering::getPICJumpTableRelocBaseExpr

llvm-svn: 94523
2010-01-26 05:58:28 +00:00
Chris Lattner
3b2bf7ab66 stub out a new target hook, need some refactoring before I can
implement it.

llvm-svn: 94521
2010-01-26 05:30:30 +00:00
Chris Lattner
945bbf606f rename printPICJumpTableEntry -> EmitJumpTableEntry,
make it private and non-virtual.  It handles the non-pic
case too, so just use it, simplifying EmitJumpTableInfo.

llvm-svn: 94517
2010-01-26 05:10:10 +00:00
Chris Lattner
b4a5d00176 add a new MachineBasicBlock::getSymbol method, replacing
the AsmPrinter::GetMBBSymbol.

llvm-svn: 94515
2010-01-26 04:55:51 +00:00
Chris Lattner
d25ec1b3bd make MachineFunction keep track of its ID and make
MachineFunctionAnalysis dole them out, instead of having
AsmPrinter do both.  Have the AsmPrinter::SetupMachineFunction
method set the 'AsmPrinter::MF' variable.

llvm-svn: 94509
2010-01-26 04:35:26 +00:00
Chris Lattner
41f661d2c2 this hook should be const.
llvm-svn: 94508
2010-01-26 04:19:00 +00:00
Chris Lattner
5ee5b62838 Add support for target-specific 32-bit custom-lowered
jump table entries.

llvm-svn: 94505
2010-01-26 04:05:28 +00:00
Victor Hernandez
ab3ebb1a4a Add MDNode::getIfExists(), an efficient way to determine if a value is used by metadata (since metadata does not appear in a value's use list)
llvm-svn: 94492
2010-01-26 02:36:35 +00:00
Chris Lattner
efdc572e44 Rearrange handling of jump tables. Highlights:
1. MachineJumpTableInfo is now created lazily for a function the first time
   it actually makes a jump table instead of for every function.
2. The encoding of jump table entries is now described by the
   MachineJumpTableInfo::JTEntryKind enum.  This enum is determined by the
   TLI::getJumpTableEncoding() hook, instead of by lots of code scattered
   throughout the compiler that "knows" that jump table entries are always
   32-bits in pic mode (for example).
3. The size and alignment of jump table entries is now calculated based on
   their kind, instead of at machinefunction creation time.

Future work includes using the EntryKind in more places in the compiler,
eliminating other logic that "knows" the layout of jump tables in various
situations.

llvm-svn: 94470
2010-01-25 23:26:13 +00:00
Chris Lattner
00ba9a5343 add a method to get the alignment of an integer type even
when we don't have one laying around.  Useful if you don't
have an llvmcontext handy.

llvm-svn: 94468
2010-01-25 23:18:11 +00:00
Chris Lattner
1e05dd3446 eliminate redundant argument to EmitJumpTableInfo
llvm-svn: 94464
2010-01-25 22:41:33 +00:00
Chris Lattner
3559d9a38a mcstreamerize gprel32 emission.
llvm-svn: 94452
2010-01-25 21:28:50 +00:00
Chris Lattner
27d1a6fed5 handle the _set_ symbol with an MCSymbol.
llvm-svn: 94449
2010-01-25 21:17:10 +00:00
Chris Lattner
ac1144c110 rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
make it clear what it is, instead of how it is used.

llvm-svn: 94448
2010-01-25 21:10:10 +00:00
Chris Lattner
fafb52a75a remove JumpTableDirective, it is always null.
llvm-svn: 94445
2010-01-25 20:52:54 +00:00
Chris Lattner
1cd2ba1c3a sink an arm specific method out of asmprinter into the ARMAsmPrinter and
rename it to avoid shadowing.

llvm-svn: 94440
2010-01-25 19:39:52 +00:00
Chris Lattner
20d89c382c mcstreamerize .file and .file. This also fixes an issue where the
normal form of .file would fail if the filename had a weird character
in it.

llvm-svn: 94437
2010-01-25 18:58:59 +00:00
Chris Lattner
7a5c8c15bd add symbol attribute support for the ELF .type directive.
llvm-svn: 94435
2010-01-25 18:30:45 +00:00
Bob Wilson
1882fba746 Change Value::getUnderlyingObject to have the MaxLookup value specified as a
parameter with a default value, instead of just hardcoding it in the
implementation.  The limit of MaxLookup = 6 was introduced in r69151 to fix
a performance problem with O(n^2) behavior in instcombine, but the scalarrepl
pass is relying on getUnderlyingObject to go all the way back to an AllocaInst.
Making the limit part of the method signature makes it clear that by default
the result is limited and should help avoid similar problems in the future.
This fixes pr6126.

llvm-svn: 94433
2010-01-25 18:26:54 +00:00
Chris Lattner
9834b7f300 emit the .size directive for global variables on ELF through
mcstreamer.

llvm-svn: 94416
2010-01-25 07:52:13 +00:00
Chris Lattner
474395e815 all supported target now have aligned common support.
llvm-svn: 94413
2010-01-25 07:29:13 +00:00
Chris Lattner
91fafbd4e8 change the canonical form of "cond ? -1 : 0" to be
"sext cond" instead of a select.  This simplifies some instcombine
code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows
us to generate better code for a testcase on ppc.

llvm-svn: 94339
2010-01-24 00:09:49 +00:00
Bill Wendling
7449bb010b Remove the '-disable-scheduling' flag and replace it with the 'source' option of
the '-pre-RA-sched' flag. It actually makes more sense to do it this way. Also,
keep track of the SDNode ordering by default. Eventually, we would like to make
this ordering a way to break a "tie" in the scheduler. However, doing that now
breaks the "CodeGen/X86/abi-isel.ll" test for 32-bit Linux.

llvm-svn: 94308
2010-01-23 10:26:57 +00:00
Chris Lattner
617e6fb889 mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
llvm-svn: 94299
2010-01-23 07:47:02 +00:00
Chris Lattner
7e1fa376cc resolve a fixme: the "nonexecutable stack directive" is actually
a .section.  Switch to it with SwitchSection.

However, I think that this directive should be safe on any ELF target.
If so, we should hoist it up out of the X86 and SystemZ targets.

llvm-svn: 94298
2010-01-23 07:21:06 +00:00
Chris Lattner
56c318f344 mcize visibility directives.
llvm-svn: 94295
2010-01-23 06:53:23 +00:00
Chris Lattner
60edc92e39 move the various directive enums out of the MCStreamer class
into a new MCDirectives.h file.

llvm-svn: 94294
2010-01-23 06:39:22 +00:00
Chris Lattner
1b7c00a4f2 Change constantexpr global variable initializers to convert the constants
to MCExpr then emit them through MCStreamer with EmitValue.  I think all
global variable initializers are now going through mcstreamer.

llvm-svn: 94293
2010-01-23 06:17:14 +00:00
Chris Lattner
62d08f5577 mcstreamerize .no_dead_strip and .reference for static ctors/dtors.
llvm-svn: 94290
2010-01-23 05:51:36 +00:00
Chris Lattner
2ee0376c42 mcize jump table and constant pool entry labels, .local on elf,
and some .weak directives.

llvm-svn: 94284
2010-01-23 05:19:23 +00:00
Chris Lattner
20a336f1df emit .ascii and .asciz through MCStreamer.
llvm-svn: 94282
2010-01-23 04:54:10 +00:00
Chris Lattner
e6801b7c24 remove one form of EmitString, just use EmitBytes instead. We must
be careful to add a \0 at the end though, because EmitString didn't
do this.

llvm-svn: 94277
2010-01-23 03:11:46 +00:00
Devang Patel
280d341d36 Avoid using "Type" as the variable name.
llvm-svn: 94262
2010-01-23 00:26:28 +00:00
Chris Lattner
f703377447 move "EOL" from asmprinter to dwarfprinter. It should eventually
be completely eliminated, but today is not that day.

llvm-svn: 94253
2010-01-22 23:47:11 +00:00
Chris Lattner
de2a14c724 move uleb printing from asmprinter to dwarfprinter, mcize,
cleanup and eliminate a bunch more uses of "EOL".

llvm-svn: 94250
2010-01-22 23:18:42 +00:00
Chris Lattner
6b1e1bb9e9 move sleb printing out of asmprinter into dwarf printer, make clients
handle the comment better, MCize the non-.sleb case.

llvm-svn: 94244
2010-01-22 22:56:55 +00:00
Devang Patel
81f0fa06d7 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Sean Callanan
d1eb63a340 Added a Register token to AsmToken and the appropriate
accessor method for its value.

llvm-svn: 94241
2010-01-22 22:42:22 +00:00
Sean Callanan
7b52485bbd Filled out the skeleton of the TargetAsmLexer to behave
exactly like an MCAsmLexer.  (The difference is that the
TargetAsmLexer knows how to handle target-specific stuff
like registers, whereas the MCAsmLexer is fully generic.)

llvm-svn: 94237
2010-01-22 22:35:01 +00:00
Chris Lattner
2fa5f5ce56 inline away the trivial AsmPrinter::EOL() method.
llvm-svn: 94230
2010-01-22 22:09:00 +00:00
Chris Lattner
19abca37d2 inline AsmPrinter::PrintHex into its two trivial callers.
llvm-svn: 94228
2010-01-22 21:57:56 +00:00
Chris Lattner
0347671f14 change this to be a static function instead of a method on asmprinter.
llvm-svn: 94227
2010-01-22 21:50:41 +00:00
Chris Lattner
639c136993 Changes to fix buffering that I forgot to commit with previous patch.
llvm-svn: 94222
2010-01-22 21:16:10 +00:00
Chris Lattner
bc01d5b148 Convert some more random-comment-printing stuff to use
AddComment and GetCommentOS.  Add a blank line between globals
(even in non-verbose mode) to make the assembly more readable.

llvm-svn: 94202
2010-01-22 19:52:01 +00:00
Chris Lattner
20390f5205 add a new MCAsmStreamer::GetCommentOS method to simplify stuff
that doesn't want to use twines.

llvm-svn: 94199
2010-01-22 19:17:48 +00:00
Chris Lattner
784036d536 rename addComment -> AddComment for consistency.
llvm-svn: 94190
2010-01-22 18:21:35 +00:00
Benjamin Kramer
13b3fa1f36 Simplify some uses of str(n)cmp with StringRef.
llvm-svn: 94189
2010-01-22 18:21:23 +00:00
Chris Lattner
df1b7b6164 Add the ability for MCStreamer to emit comments on the same line as directives.
Switch over the asm-verbose comment for double values to use it.  We now get:

_x:
	.long	343597384                                   ## double 1.231200e+02
	.long	1079953326

For example, note that the comment is on the same line as the .long.  Woo.

llvm-svn: 94166
2010-01-22 07:29:22 +00:00
Chris Lattner
5eb0c8a2bd pass "-fasm-verbose" into createAsmStreamer.
llvm-svn: 94165
2010-01-22 07:06:15 +00:00
Chris Lattner
276811b58a Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner
437827ceb5 give PassNameParser a home.
llvm-svn: 94162
2010-01-22 06:29:25 +00:00
Chris Lattner
cb9776c350 add an out-of-line virtual method to CmpInst to give it a home.
llvm-svn: 94161
2010-01-22 06:25:37 +00:00
Chris Lattner
c07d7f41e3 elimiante the dynamic_cast's from opt.
llvm-svn: 94160
2010-01-22 06:03:06 +00:00
Chris Lattner
1bd9c3ec88 eliminate a bunch of dynamic_cast's.
llvm-svn: 94155
2010-01-22 05:24:46 +00:00
Chris Lattner
997ad42b6d eliminate a bunch of dynamic_cast's.
llvm-svn: 94154
2010-01-22 04:55:08 +00:00
Evan Cheng
8e25244a48 Add two target hooks to determine whether two loads are near and should be scheduled together.
llvm-svn: 94147
2010-01-22 03:34:51 +00:00
Evan Cheng
4045e89a8f Add DenseMapInfo for signed long long.
llvm-svn: 94146
2010-01-22 03:33:01 +00:00
Chris Lattner
c0e2ef62fa move some files out of the llvm-mc tool into the MCParser library so
other tools can link it.

llvm-svn: 94131
2010-01-22 01:58:08 +00:00
Chris Lattner
9a84d96edf create a new MCParser library and move some stuff into it.
llvm-svn: 94129
2010-01-22 01:44:57 +00:00
Chris Lattner
8cd569a4b0 allow registering target lexers.
llvm-svn: 94127
2010-01-22 01:10:40 +00:00
Chris Lattner
2b19da4fa0 stub out a new TargetAsmLexer interface.
llvm-svn: 94125
2010-01-22 00:58:59 +00:00
Dan Gohman
525f7d7833 Revert LoopStrengthReduce.cpp to pre-r94061 for now.
llvm-svn: 94123
2010-01-22 00:46:49 +00:00
Ted Kremenek
20b78f8eef Store flags in bitfields instead of masking them into the pointer for the left child. This leads to some nice conceptually cleanups.
llvm-svn: 94121
2010-01-22 00:28:27 +00:00
Ted Kremenek
30dee16eed Tidy up assertion syntax. No functionality change.
llvm-svn: 94117
2010-01-21 23:42:57 +00:00
Victor Hernandez
d44671b931 DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics()
llvm-svn: 94111
2010-01-21 23:05:53 +00:00
Jim Grosbach
57ca094a52 back this out for now. Growing Function is not good.
llvm-svn: 94097
2010-01-21 20:10:22 +00:00