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

324 Commits

Author SHA1 Message Date
Chris Lattner
9ec640a902 This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.

llvm-svn: 92235
2009-12-28 23:41:32 +00:00
Chris Lattner
cd3aa9d1ff rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
Bill Wendling
008e2e1e7f Remove dead variable.
llvm-svn: 92180
2009-12-28 01:02:21 +00:00
Dan Gohman
c9454cd34f Make TargetSelectInstruction protected and called from FastISel.cpp
instead of SelectionDAGISel.cpp.

llvm-svn: 90636
2009-12-05 01:27:58 +00:00
Chris Lattner
9ce833945e improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Dan Gohman
d23a0a12d9 Rename SelectionDAGLowering to SelectionDAGBuilder, and rename
SelectionDAGBuild.cpp to SelectionDAGBuilder.cpp.

llvm-svn: 89681
2009-11-23 18:04:58 +00:00
Dan Gohman
b0befa7c20 Move some more code out of SelectionDAGBuild.cpp and into
FunctionLoweringInfo.cpp.

llvm-svn: 89674
2009-11-23 17:42:46 +00:00
Devang Patel
c024e96ca3 "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Devang Patel
5c983cb2ab Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Duncan Sands
4fcf6123dd I don't see any point in having both eh.selector.i32 and eh.selector.i64,
so get rid of eh.selector.i64 and rename eh.selector.i32 to eh.selector.
Likewise for eh.typeid.for.  This aligns us with gcc, which always uses a
32 bit value for the selector on all platforms.  My understanding is that
the register allocator used to assert if the selector intrinsic size didn't
match the pointer size, and this was the reason for introducing the two
variants.  However my testing shows that this is no longer the case (I
fixed some bugs in selector lowering yesterday, and some more today in the
fastisel path; these might have caused the original problems).

llvm-svn: 84106
2009-10-14 16:11:37 +00:00
Devang Patel
72f708ec2f s/DebugLoc.CompileUnit/DebugLoc.Scope/g
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g

llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Devang Patel
c97c44b584 Extract scope information from the variable itself, instead of relying on alloca or llvm.dbg.declare location.
While recording beginning of a function, use scope info from the first location entry instead of just relying on first location entry itself.

llvm-svn: 83684
2009-10-09 22:42:28 +00:00
Devang Patel
1639c0e45a Add support to handle debug info attached to an instruction.
This is not yet enabled.

llvm-svn: 83400
2009-10-06 18:37:31 +00:00
Devang Patel
d24ba7a101 If location info is attached with an instruction then keep track of alloca slots used by a variable. This info will be used by AsmPrinter to emit debug info for variables.
llvm-svn: 83189
2009-10-01 01:03:26 +00:00
Dan Gohman
685eb70d06 Make fast-isel try ISD::FNEG before resorting to bitcasts and xors.
llvm-svn: 81493
2009-09-11 00:36:43 +00:00
Dan Gohman
964c0b8333 Reapply r81171 with a fix: don't try to use i64 when it
isn't legal.

llvm-svn: 81492
2009-09-11 00:34:46 +00:00
Bob Wilson
76cffeddd1 Revert r81171 which was causing pr4927.
llvm-svn: 81415
2009-09-10 00:49:22 +00:00
Dan Gohman
572ecc26b6 Fix a thinko: When lowering fneg with xor, bitcast the operands
from floating-point to integer first, and bitcast the result
back to floating-point. Previously, this test was passing by
falling back to SelectionDAG lowering. The resulting code isn't
as nice, but it's correct and CodeGen now stays on the fast path.

llvm-svn: 81171
2009-09-07 23:47:14 +00:00
Dan Gohman
c24fb1af4f LLVM currently represents floating-point negation as -0.0 - x. Fix
FastISel to recognize this pattern and emit a floating-point
negation using xor.

llvm-svn: 80963
2009-09-03 22:53:57 +00:00
Devang Patel
fbaeda732e Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Devang Patel
10c075a316 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Devang Patel
7d42bfab6c Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Devang Patel
c071d6c1b4 Record variable debug info at ISel time directly.
llvm-svn: 79742
2009-08-22 17:12:53 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
dbf9a912fb Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
llvm-svn: 78759
2009-08-12 00:36:31 +00:00
Owen Anderson
75ebfc8728 Fix warnings.
llvm-svn: 78725
2009-08-11 21:59:30 +00:00
Owen Anderson
48f2f0ae72 Split EVT into MVT and EVT, the former representing _just_ a primitive type, while
the latter is capable of representing either a primitive or an extended type.

llvm-svn: 78713
2009-08-11 20:47:22 +00:00
Owen Anderson
b4bce99769 Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
llvm-svn: 78610
2009-08-10 22:56:29 +00:00
Owen Anderson
dcb47bda67 Start moving TargetLowering away from using full MVTs and towards SimpleValueType, which will simplify the privatization of IntegerType in the future.
llvm-svn: 78584
2009-08-10 18:56:59 +00:00
Owen Anderson
1dc40e205b Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
cc33e89571 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Owen Anderson
cc287b28c9 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Owen Anderson
21d2d69727 Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here

llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Owen Anderson
393d8b0a0c Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Devang Patel
5f93a737f6 Simplify debug info intrisinc lowering.
llvm-svn: 74733
2009-07-02 22:43:26 +00:00
Devang Patel
735f7d53ca Simplify.
llvm-svn: 74677
2009-07-02 00:28:03 +00:00
Devang Patel
9149c185a4 llvm.dbg.declare is always used for local variable's debug info.
llvm-svn: 74625
2009-07-01 18:51:07 +00:00
Devang Patel
e2b1c9a530 mv CodeGen/DebugLoc.h Support/DebugLoc.h
llvm-svn: 73786
2009-06-19 22:08:58 +00:00
Devang Patel
1fb2606b12 Gracefully handle imbalanced inline function begin and end markers.
llvm-svn: 73426
2009-06-15 21:45:50 +00:00
Dan Gohman
5f6f8101d5 Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Duncan Sands
bbd03677ee Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.

llvm-svn: 72276
2009-05-22 20:36:31 +00:00
Bill Wendling
9bca78046b Temporarily revert r72191. It was causing an assert during llvm-gcc
bootstrapping.

llvm-svn: 72200
2009-05-21 00:04:55 +00:00
Argyrios Kyrtzidis
c651293fa0 Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.

llvm-svn: 72191
2009-05-20 22:57:17 +00:00
Duncan Sands
f7af13b2d4 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.

llvm-svn: 71349
2009-05-09 07:06:46 +00:00
Dan Gohman
ebacd61d7d Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.

llvm-svn: 71176
2009-05-07 19:46:24 +00:00
Bill Wendling
9f97e4a3dc Temporarily revert r71158. It was causing a failure during a full bootstrap:
checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....

llvm-svn: 71165
2009-05-07 17:26:14 +00:00
Argyrios Kyrtzidis
0f60e636c0 Make DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's methods:
-Have it return a label ID
-Remove the unused Instruction parameter

No functionality change.

llvm-svn: 71132
2009-05-07 00:16:31 +00:00
Argyrios Kyrtzidis
fb958c2b09 -Remove the DwarfWriter::RecordSourceLine calls from the instruction selectors.
-Depend on DebugLocs for source line info.

(Comes with Regression-Be-Gone(tm))

llvm-svn: 70871
2009-05-04 16:23:49 +00:00
Argyrios Kyrtzidis
e68261749e Revert r70803 for now, it causes a regression.
llvm-svn: 70811
2009-05-03 23:27:19 +00:00
Argyrios Kyrtzidis
bb6e4d027c -Remove the DwarfWriter::RecordSourceLine calls from the instruction selectors.
-Depend on DebugLocs for source line info.

llvm-svn: 70803
2009-05-03 22:03:35 +00:00
Argyrios Kyrtzidis
a034549d67 -Move the DwarfWriter::ValidDebugInfo check to a static DIDescriptor::ValidDebugInfo
-Create DebugLocs without the need to have a DwarfWriter around

llvm-svn: 70682
2009-05-03 08:50:41 +00:00
Argyrios Kyrtzidis
9956976b76 Make DebugLoc independent of DwarfWriter.
-Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable*
-Remove DwarfWriter::getOrCreateSourceID
-Make necessary changes for the above (fix callsites, etc.)

llvm-svn: 70520
2009-04-30 23:22:31 +00:00
Bill Wendling
40a162f75f Instead of passing in an unsigned value for the optimization level, use an enum,
which better identifies what the optimization is doing. And is more flexible for
future uses.

llvm-svn: 70440
2009-04-29 23:29:43 +00:00
Bill Wendling
7546bed590 Second attempt:
Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'll change the JIT with a follow-up patch.

llvm-svn: 70343
2009-04-29 00:15:41 +00:00
Bill Wendling
ef47ace92f r70270 isn't ready yet. Back this out. Sorry for the noise.
llvm-svn: 70275
2009-04-28 01:04:53 +00:00
Bill Wendling
2799e916c3 Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'm not 100% sure if it's necessary to change it there...

llvm-svn: 70270
2009-04-28 00:21:31 +00:00
Devang Patel
d324ddbd7b Do not treat beginning of inlined scope as beginning of normal function scope if the location info is missing.
Insetad of doing ...
if (inlined_subroutine && known_location)
  DW_TAG_inline_subroutine
else
  DW_TAG_subprogram

do

if (inlined_subroutine) {
 if (known_location)
   DW_TAG_inline_subroutine
} else {
 DW_TAG_subprogram
}

llvm-svn: 69300
2009-04-16 17:55:30 +00:00
Devang Patel
6052d698f5 Record line number at the beginning of a func.start.
This line was accidently lost yesterday.

llvm-svn: 69286
2009-04-16 15:07:09 +00:00
Devang Patel
c6c6759194 If location where the function was inlined is not know then do not emit debug info describing inlinied region.
llvm-svn: 69252
2009-04-16 01:31:54 +00:00
Devang Patel
21463f4a25 Add DISubprogram is not null check.
This fixes test/CodeGen//2009-01-21-invalid-debug-info.m test case.

llvm-svn: 69210
2009-04-15 20:11:08 +00:00
Devang Patel
f2b9c22687 Construct and emit DW_TAG_inlined_subroutine DIEs for inlined subroutine scopes (only in FastISel mode).
llvm-svn: 69116
2009-04-15 00:10:26 +00:00
Devang Patel
92d79ef835 Right now, Debugging information to encode scopes (DW_TAG_lexical_block) relies on DBG_LABEL. Unfortunately this intefers with the quality of optimized code.
This patch updates dwarf writer to encode scoping information in DWARF only in FastISel mode.

llvm-svn: 68973
2009-04-13 18:13:16 +00:00
Devang Patel
ad7f61c279 Reapply 68847.
Now debug_inlined section is covered by TAI->doesDwarfUsesInlineInfoSection(), which is false by default.

llvm-svn: 68964
2009-04-13 17:02:03 +00:00
Chris Lattner
d1b365fc66 make UpdateValueMap handle the possiblity that we could be
copying into the right register, avoiding a copy.

llvm-svn: 68889
2009-04-12 07:46:30 +00:00
Chris Lattner
ed355b8551 optimize FastISel::UpdateValueMap to avoid duplicate map lookups,
and make it return the assigned register.

llvm-svn: 68888
2009-04-12 07:45:01 +00:00
Dan Gohman
ac11c8d30f Revert r68847. It breaks the build on non-Darwin targets, with this message
from the assembler:

Error: unknown pseudo-op: `.debug_inlined'
llvm-svn: 68863
2009-04-11 15:57:04 +00:00
Devang Patel
6f907173e0 Keep track of inlined functions and their locations. This information is collected when nested llvm.dbg.func.start intrinsics are seen. (Right now, inliner removes nested llvm.dbg.func.start intrinisics during inlining.)
Create debug_inlined dwarf section using these information. This info is used by gdb, at least on Darwin, to enable better experience debugging inlined functions. See DwarfWriter.cpp for more information on structure of debug_inlined section.

llvm-svn: 68847
2009-04-11 00:16:47 +00:00
Devang Patel
500dc5157e Silence unused variable warning.
llvm-svn: 68735
2009-04-09 23:45:17 +00:00
Devang Patel
78fd57741b llvm.dbg.func_start also defines beginning of function scope.
llvm-svn: 68727
2009-04-09 21:42:11 +00:00
Dan Gohman
e98c3b1ea1 Don't attempt to handle aggregate argument values in FastISel; let
SelectionDAG do those. This fixes PR3955.

llvm-svn: 68546
2009-04-07 20:40:11 +00:00
Dan Gohman
fa0a3504ba Improve FastISel's handling of truncates to i1, and implement
ptrtoint and inttoptr in X86FastISel. These casts aren't always
handled in the generic FastISel code because X86 sometimes needs
custom code to do truncation and zero-extension.

llvm-svn: 66988
2009-03-13 23:53:06 +00:00
Dan Gohman
790659c0d6 Fix FastISel's assumption that i1 values are always zero-extended
by inserting explicit zero extensions where necessary. Included
is a testcase where SelectionDAG produces a virtual register
holding an i1 value which FastISel previously mistakenly assumed
to be zero-extended.

llvm-svn: 66941
2009-03-13 20:42:20 +00:00
Bill Wendling
5499163a0a Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling
02a239b837 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Bill Wendling
13fcab1ef3 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
Evan Cheng
befebff8fc Clean up dwarf writer, part 1. This eliminated the horrible recursive getGlobalVariablesUsing and replaced it something readable. It eliminated use of slow UniqueVector and replaced it with StringMap, SmallVector, and DenseMap, etc. It also fixed some non-deterministic behavior.
This is a very minor compile time win.

llvm-svn: 65438
2009-02-25 07:04:34 +00:00
Bill Wendling
9d4eb136da Overhaul my earlier submission due to feedback. It's a large patch, but most of
them are generic changes.

- Use the "fast" flag that's already being passed into the asm printers instead
  of shoving it into the DwarfWriter.

- Instead of calling "MI->getParent()->getParent()" for every MI, set the
  machine function when calling "runOnMachineFunction" in the asm printers.

llvm-svn: 65379
2009-02-24 08:30:20 +00:00
Bill Wendling
0d8316c5e0 - Use the "Fast" flag instead of "OptimizeForSize" to determine whether to emit
a DBG_LABEL or not. We want to fall back to the original way of emitting debug
  info when we're in -O0/-fast mode.
- Add plumbing in to pass the "Fast" flag to places that need it.
- XFAIL DebugInfo/deaddebuglabel.ll. This is finding 11 labels instead of 8. I
  need to investigate still.

llvm-svn: 65367
2009-02-24 02:35:30 +00:00
Bill Wendling
40e4b271af Revert this. It was breaking stuff.
llvm-svn: 64428
2009-02-13 02:16:35 +00:00
Bill Wendling
83b6edd760 Turn off the old way of handling debug information in the code generator. Use
the new way, where all of the information is passed on SDNodes and machine
instructions.

llvm-svn: 64427
2009-02-13 02:01:04 +00:00
Chris Lattner
4e2ed3e5e7 make fast isel fall back to selectiondags for VLA llvm.declare intrinsics.
llvm-svn: 64379
2009-02-12 17:23:20 +00:00
Bill Wendling
5b177df8e9 Create DebugLoc information in FastISel. Several temporary methods were
created. Specifically, those BuildMIs which use
"DebugLoc::getUnknownLoc()". I'll remove them soon.

llvm-svn: 63584
2009-02-03 00:55:04 +00:00
Evan Cheng
c971801ae1 Eliminate a couple of fields from TargetRegisterClass: SubRegClasses and SuperRegClasses. These are not necessary. Also eliminate getSubRegisterRegClass and getSuperRegisterRegClass. These are slow and their results can change if register file names change. Just use TargetLowering::getRegClassFor() to get the right TargetRegisterClass instead.
llvm-svn: 62762
2009-01-22 09:10:11 +00:00
Devang Patel
7c2157602d Verify debug info.
llvm-svn: 62545
2009-01-19 23:21:49 +00:00
Devang Patel
1ee58c7d8c Validate dbg_* intrinsics before lowering them.
llvm-svn: 62286
2009-01-15 23:41:32 +00:00
Devang Patel
eed0505ed8 Use DebugInfo interface to lower dbg_* intrinsics.
llvm-svn: 62127
2009-01-13 00:35:13 +00:00
Duncan Sands
bcdbfb63dc Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Dan Gohman
14d4094968 Factor out the code for sign-extending/truncating gep indices
and use it in x86 address mode folding. Also, make
getRegForValue return 0 for illegal types even if it has a
ValueMap for them, because Argument values are put in the
ValueMap. This fixes PR3181.

llvm-svn: 60696
2008-12-08 07:57:47 +00:00
Evan Cheng
c6797a1379 Eliminate some unused variable compile time warnings.
llvm-svn: 59952
2008-11-24 07:09:49 +00:00
Devang Patel
8640fd500a Emit label for llvm.dbg.func.start of the inlined function.
llvm-svn: 58814
2008-11-06 21:28:20 +00:00
Dan Gohman
c070ffc493 FastISel support for exception-handling constructs.
- Move the EH landing-pad code and adjust it so that it works
   with FastISel as well as with SDISel.
 - Add FastISel support for @llvm.eh.exception and
   @llvm.eh.selector.

llvm-svn: 57539
2008-10-14 23:54:11 +00:00
Chris Lattner
16c0109fd4 calls can be supported.
llvm-svn: 57428
2008-10-13 01:59:13 +00:00
Dale Johannesen
075a62519f Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Dan Gohman
6d98c5ab31 Avoid emitting redundant materializations of integer constants
for things like null pointers, which at this level aren't
different from regular integer constants.

llvm-svn: 57265
2008-10-07 22:03:27 +00:00
Dan Gohman
68e27d0b27 Implement fast-isel support for zero-extending from i1.
It turns out that this is a fairly common operation,
and it's easy enough to handle.

llvm-svn: 56990
2008-10-03 01:28:47 +00:00
Dan Gohman
e75d14f8b0 Optimize conditional branches in X86FastISel. This replaces
sequences like this:
       sete    %al
       testb   %al, %al
       jne     LBB11_1
with this:
       je      LBB11_1

llvm-svn: 56969
2008-10-02 22:15:21 +00:00
Dan Gohman
19530c810d Move the primary fast-isel top-level comments to FastISel.cpp, where
they'll be a little more visible. Also, update and reword them a bit.

llvm-svn: 56877
2008-09-30 20:48:29 +00:00
Dan Gohman
9bb92ce6e9 Support for i1 XOR in FastISel. It is actually safe because
i1 operands are assumed to already by zero-extended.

llvm-svn: 56615
2008-09-25 17:22:52 +00:00
Dan Gohman
b63e6de501 FastISel support for debug info.
llvm-svn: 56610
2008-09-25 17:05:24 +00:00
Dan Gohman
1776533304 Fix a recent fast-isel coverage regression - don't bail out before
giving the target a chance to materialize constants.

llvm-svn: 56605
2008-09-25 01:28:51 +00:00
Dan Gohman
01a070f9c7 Arrange for FastISel code to have access to the MachineModuleInfo
object. This will be needed to support debug info.

llvm-svn: 56508
2008-09-23 21:53:34 +00:00
Dan Gohman
f66b3277d3 Refactor X86SelectConstAddr, folding it into X86SelectAddress. This
results in better code for globals. Also, unbreak the local CSE for
GlobalValue stub loads.

llvm-svn: 56371
2008-09-19 22:16:54 +00:00
Dan Gohman
5a6134a875 FastISel support for i1 constants.
llvm-svn: 56068
2008-09-10 21:01:08 +00:00
Dan Gohman
3ccdde5eef Add X86FastISel support for static allocas, and refences
to static allocas. As part of this change, refactor the
address mode code for laods and stores.

llvm-svn: 56066
2008-09-10 20:11:02 +00:00
Owen Anderson
0bdc9407ca Clean this up, based on Evan's suggestions.
llvm-svn: 56009
2008-09-09 20:47:17 +00:00
Owen Anderson
22debc8bec Check for type legality before materializing integer constants in fast isel. With this change,
all of MultiSource/Applications passes on Darwin/X86 under FastISel.

llvm-svn: 55982
2008-09-09 06:32:02 +00:00
Evan Cheng
dc011a1b10 Fix a constant lowering bug. Now we can do load and store instructions with funky getelementptr embedded in the address operand.
llvm-svn: 55975
2008-09-09 01:26:59 +00:00
Evan Cheng
8cb490d2f3 Add fast isel physical register definition support.
llvm-svn: 55892
2008-09-08 08:38:20 +00:00
Evan Cheng
396c744dfa Indentation.
llvm-svn: 55880
2008-09-07 09:04:52 +00:00
Owen Anderson
453bcfcf8d Revert r55859. This is breaking the build in the abscence of its companion commit.
llvm-svn: 55865
2008-09-05 23:36:01 +00:00
Dan Gohman
b22e9b050f FastISel support for AND and OR with type i1.
llvm-svn: 55846
2008-09-05 18:44:22 +00:00
Dan Gohman
525caf83e5 FastISel support for ConstantExprs.
llvm-svn: 55843
2008-09-05 18:18:20 +00:00
Dan Gohman
e64326ff34 FastISel support for unreachable.
llvm-svn: 55818
2008-09-05 01:08:41 +00:00
Owen Anderson
6d5b72d45a Add initial support for selecting constant materializations that require constant
pool loads on X86 in fast isel.  This isn't actually used yet.

llvm-svn: 55814
2008-09-05 00:06:23 +00:00
Dan Gohman
18f659d804 Do trivial local CSE for constants and other non-Instruction values
in FastISel.

llvm-svn: 55748
2008-09-03 23:32:19 +00:00
Dan Gohman
18cc2a26df Create HandlePHINodesInSuccessorBlocksFast, a version of
HandlePHINodesInSuccessorBlocks that works FastISel-style. This
allows PHI nodes to be updated correctly while using FastISel.

This also involves some code reorganization; ValueMap and
MBBMap are now members of the FastISel class, so they needn't
be passed around explicitly anymore. Also, SelectInstructions
is changed to SelectInstruction, and only does one instruction
at a time.

llvm-svn: 55746
2008-09-03 23:12:08 +00:00
Owen Anderson
d08396955c Oops, I accidentally broke the fallback case with my last commit.
llvm-svn: 55704
2008-09-03 17:51:57 +00:00
Owen Anderson
906c590bb8 Fix an issue where we were reusing materializations of constants in blocks not dominated by the materialization. This is
the simple fix, materializing the constant before every use.  It might be better to either track domination of uses or
to materialize all constants and the beginning of the function and let remat sort when to do materialization at uses.

llvm-svn: 55703
2008-09-03 17:37:03 +00:00
Evan Cheng
5e0e6dfc7f 80 col violations.
llvm-svn: 55668
2008-09-02 21:59:13 +00:00
Owen Anderson
6c8f04643e Fix an issue where a use might be selected before a def, and then we didn't respect the pre-chosen vreg
assignment when selecting the def.  This is the naive solution to the problem: insert a copy to the pre-chosen
vreg.  Other solutions might be preferable, such as:
  1) Passing the dest reg into FastEmit_.  However, this would require the higher level code to know about reg classes, which they don't currently.
  2) Selecting blocks in reverse postorder.  This has some compile time cost for computing the order, and we'd need to measure its impact.

llvm-svn: 55555
2008-08-30 00:38:46 +00:00
Dan Gohman
481731693d Implement null and undef values for FastISel.
llvm-svn: 55500
2008-08-28 21:19:07 +00:00
Owen Anderson
675ace60a1 Hook up support for fast-isel of trunc instructions, using the newly working support for EXTRACT_SUBREG.
llvm-svn: 55482
2008-08-28 18:26:01 +00:00
Owen Anderson
8c991b6f8a FastEmitInst_extractsubreg doesn't need to be passed the register class. It can get it from MachineRegisterInfo instead.
llvm-svn: 55476
2008-08-28 17:47:37 +00:00
Owen Anderson
bb32ae5803 Add a helper method that will be used to support EXTRACT_SUBREG for selecting trunc's in fast-isel.
llvm-svn: 55439
2008-08-27 22:30:02 +00:00
Dan Gohman
9e928e0b1f Fix FastISel's bitcast code for the case where getRegForValue fails.
llvm-svn: 55431
2008-08-27 20:41:38 +00:00
Owen Anderson
0b1a8af290 Use TargetLowering to get the types in fast isel, which handles pointer types correctly for our purposes.
llvm-svn: 55428
2008-08-27 18:58:30 +00:00
Dan Gohman
b76e1ca974 Don't check TLI.getOperationAction. The FastISel way is to
just try to do the action and let the tablegen-generated code
determine if there is target-support for an operation.

llvm-svn: 55427
2008-08-27 18:15:05 +00:00
Dan Gohman
d5e34d9dce Add a new FastISel method, getRegForValue, which takes care of
the details of materializing constants and other values into
registers, and make use of it in several places.

llvm-svn: 55426
2008-08-27 18:10:19 +00:00
Dan Gohman
6174651396 Add a comment about the current floating-point constant code in FastISel.
llvm-svn: 55425
2008-08-27 18:01:42 +00:00
Dan Gohman
5e5f1c9e8f Basic FastISel support for floating-point constants.
llvm-svn: 55401
2008-08-27 01:09:54 +00:00
Owen Anderson
a0b7e0ab93 Fix handling of inttoptr and ptrtoint when unhandled operands are present.
llvm-svn: 55400
2008-08-27 00:35:37 +00:00
Owen Anderson
c5d2fe6354 Add support for fast isel of inttoptr and ptrtoint in the cases where truncation is not needed.
llvm-svn: 55399
2008-08-27 00:31:01 +00:00
Owen Anderson
a8911f33f8 Factor out a large amoutn of the cast handling code in fast isel into helper methods.
This simultaneously makes the code simpler and adds support for sext as well.

llvm-svn: 55398
2008-08-26 23:46:32 +00:00
Owen Anderson
0cee245fdc Add support for fast isel of zext.
llvm-svn: 55396
2008-08-26 23:14:49 +00:00
Owen Anderson
d33f25d615 Add support for fptosi of constants in fast isel.
llvm-svn: 55393
2008-08-26 22:34:28 +00:00
Dan Gohman
57b5f9b931 Refactor the bitcast code into its own function.
llvm-svn: 55387
2008-08-26 21:28:54 +00:00
Dan Gohman
58882d14c4 Make FastISel use the correct argument type when casting GEP indices.
llvm-svn: 55384
2008-08-26 20:57:08 +00:00
Dan Gohman
722e912650 Don't select binary instructions with illegal types.
llvm-svn: 55383
2008-08-26 20:52:40 +00:00
Owen Anderson
b15e88b671 Add support for fast isel of sitofp, and remove some unnecessary and imprecise legality checks.
llvm-svn: 55381
2008-08-26 20:37:00 +00:00
Owen Anderson
821ddf6726 Use a combination of copyRegToReg and ISD::BIT_CONVERT when doing fast isel of bitcasts,
allowing it to support the full range of conversions people might ask for in a correct manner.

llvm-svn: 55378
2008-08-26 18:51:24 +00:00
Owen Anderson
5fef19facf Make TargetInstrInfo::copyRegToReg return a bool indicating whether the copy requested
was inserted or not.  This allows bitcast in fast isel to properly handle the case
where an appropriate reg-to-reg copy is not available.

llvm-svn: 55375
2008-08-26 18:03:31 +00:00
Owen Anderson
76c3c73a7a Add support for fast isel of non-constant fptosi instructions.
llvm-svn: 55373
2008-08-26 17:44:42 +00:00
Owen Anderson
9264f41ef2 Add a RetVT parameter to emitted FastISel methods, so that we will be able to pass the desired return
type down.  This is not currently used.

llvm-svn: 55345
2008-08-25 23:58:18 +00:00
Evan Cheng
45e24233c7 Unbreak build.
llvm-svn: 55342
2008-08-25 22:20:39 +00:00
Owen Anderson
1532aad9a8 Expand bitcast support in fast isel to support bitcasts of non-constant values by emitting reg-reg copies.
llvm-svn: 55340
2008-08-25 21:32:34 +00:00
Owen Anderson
27491bbf2c Add support for fast isel of (integer) immediate materialization pattens, and use them to support
bitcast of constants in fast isel.

llvm-svn: 55325
2008-08-25 20:20:32 +00:00
Dan Gohman
a5ce6c1747 Make MBBMap a DenseMap instead of a std::map.
llvm-svn: 55220
2008-08-23 02:44:46 +00:00
Dan Gohman
071122d2a3 Reapply r55191 and r55192.
llvm-svn: 55205
2008-08-22 21:28:19 +00:00
Bill Wendling
60e176391d Reverting r55190, r55191, and r55192. They broke the build with this error message:
{standard input}:17:bad register name `%sil'
make[4]: *** [libgcc/./_addvsi3.o] Error 1
make[4]: *** Waiting for unfinished jobs....
{standard input}:23:bad register name `%dil'
{standard input}:28:bad register name `%dil'
make[4]: *** [libgcc/./_addvdi3.o] Error 1
{standard input}:18:bad register name `%sil'
make[4]: *** [libgcc/./_subvsi3.o] Error 1

llvm-svn: 55200
2008-08-22 20:51:05 +00:00
Dan Gohman
557a7db2eb Fix the InsertBranch call.
llvm-svn: 55192
2008-08-22 19:26:10 +00:00
Dan Gohman
3b161cdce8 Support non-fallthrough unconditional branches in FastISel.
llvm-svn: 55191
2008-08-22 19:21:41 +00:00
Dan Gohman
92921499ae Add FastISel support for PHINodes. Machine PHI nodes
are not yet updated properly, but that's a separate
task.

llvm-svn: 55187
2008-08-22 17:37:48 +00:00
Dan Gohman
a398d11527 Factor out the predicate check code from DAGISelEmitter.cpp
and use it in FastISelEmitter.cpp, and make FastISel
subtarget aware. Among other things, this lets it work
properly on x86 targets that don't have SSE, where it
successfully selects x87 instructions.

llvm-svn: 55156
2008-08-22 00:20:26 +00:00
Dan Gohman
7c434de476 Have FastISel skip the multiply by 1 for getelementptr on i8*.
llvm-svn: 55129
2008-08-21 17:37:05 +00:00
Dan Gohman
f4269f7bea MVT::getMVT uses iPTR for pointer types, while we need the actual
intptr_t type in this case. FastISel can now select simple
getelementptr instructions.

llvm-svn: 55125
2008-08-21 17:25:26 +00:00
Dan Gohman
a6e647dd7c Basic fast-isel support for instructions with constant int operands.
llvm-svn: 55099
2008-08-21 01:41:07 +00:00
Evan Cheng
45c46520da Type of first GEP operand is always the same as the target pointer type.
llvm-svn: 55097
2008-08-21 01:19:11 +00:00
Dan Gohman
71aa272ac4 Fix unused variable warnings.
llvm-svn: 55089
2008-08-20 23:53:10 +00:00
Evan Cheng
c55f07023a First cut, un-optimized (and untested) fast isel lowering of GetElementPtrInst.
llvm-svn: 55085
2008-08-20 22:45:34 +00:00
Dan Gohman
50af19179b Simplify the BuildMI calls even more.
llvm-svn: 55077
2008-08-20 21:10:53 +00:00
Dan Gohman
ddebe95287 Simplify FastISel's constructor argument list, make the FastISel
class hold a MachineRegisterInfo member, and make the
MachineBasicBlock be passed in to SelectInstructions rather
than the FastISel constructor.

llvm-svn: 55076
2008-08-20 21:05:57 +00:00
Dan Gohman
96efa9606f Make more use of the BuildMI API.
llvm-svn: 55072
2008-08-20 18:16:32 +00:00
Dan Gohman
3606d17592 Minor code reorganization.
llvm-svn: 55071
2008-08-20 18:10:48 +00:00
Dan Gohman
44da988220 Minor whitespace cleanup.
llvm-svn: 55070
2008-08-20 18:09:38 +00:00
Dan Gohman
9e5e42e0d5 Fix 80 column violation.
llvm-svn: 55069
2008-08-20 18:09:02 +00:00
Dan Gohman
d0da06c817 Fix FastISel to recognize that the last block in the function does
not have a fall-through successor.

llvm-svn: 55033
2008-08-20 01:17:01 +00:00
Dan Gohman
f298c31918 Fix FastISel to recognize unhandled operands, such as constants
that aren't available as virtual registers (for now).

llvm-svn: 55026
2008-08-20 00:35:17 +00:00
Dan Gohman
455abe7436 Add FastISel support for floating-point operations.
llvm-svn: 55021
2008-08-20 00:23:20 +00:00
Dan Gohman
ce636764de Add FastISel support for several more binary operators.
llvm-svn: 55020
2008-08-20 00:11:48 +00:00
Dan Gohman
25efe2087b Support unconditional fall-through branches in FastISel.
llvm-svn: 55014
2008-08-19 22:31:46 +00:00
Dan Gohman
7a23fc0fb0 Use the BuildMI overload that sets up a destination register
instead of the one that doesn't and then adding it manually.

llvm-svn: 55006
2008-08-19 20:46:54 +00:00
Dan Gohman
564f3c6773 Handle the case where target-specific fastisel code doesn't have
a desired opcode.

llvm-svn: 55005
2008-08-19 20:43:22 +00:00
Dan Gohman
6b146d5ec3 Make FastISel's constructor protected, and give it a destructor.
llvm-svn: 54793
2008-08-14 21:51:29 +00:00
Dan Gohman
4b1b033f89 Initial checkin of the new "fast" instruction selection support. See
the comments in FastISelEmitter.cpp for details on what this is.
This is currently experimental and unusable.

llvm-svn: 54751
2008-08-13 20:19:35 +00:00