Commit Graph

7902 Commits

Author SHA1 Message Date
Dan Gohman
4e918b2c8c Use getStoreSize() instead of getStoreSizeInBits()/8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 21:07:02 +00:00
Dan Gohman
8a55ce4a39 Rename several variables from EVT to more descriptive names, now that EVT
is also the name of their type, as declarations like "EVT EVT" look
really odd.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 21:02:20 +00:00
Jakob Stoklund Olesen
39523e2cfb Fix verification of explicit operands.
The machine code verifier did not check for explicit operands correctly. It
used MachineInstr::getNumExplicitOperands, but that method may cheat and use
the declared count in the TargetInstrDesc.

Now we check the explicit operands one at a time in visitMachineOperand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82652 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:57:55 +00:00
Bob Wilson
94188d4e67 Edit a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 18:53:19 +00:00
David Goodwin
8f909345bc Fix bug in kill flag updating for post-register-allocation scheduling. When the kill flag of a superreg needs to be cleared because there are one or more subregs live, we instead add implicit-defs of those subregs and leave the kill flag on the superreg. This allows us to end the live-range of the superreg without ending the live-ranges of the subregs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 16:35:25 +00:00
Evan Cheng
296925dc16 Fix PR5024. LiveVariables physical register defs should *commit* only after all
of the defs are processed.
Also fix a implicit_def propagation bug: a implicit_def of a physical register
should be applied to uses of the sub-registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 06:28:31 +00:00
Evan Cheng
f7cd853071 Fix a obvious logic error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 05:23:19 +00:00
Dan Gohman
cd26ec5f3c Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands.

Drop the virtual from Value::dump and instead give Value a
protected virtual hook that can be overridden by subclasses
to implement custom printing. This lets printing be more
consistent, and simplifies printing of PseudoSourceValue
values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 01:33:16 +00:00
Mike Stump
d75e9aad24 This is overly constraining with respect to clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:13:30 +00:00
David Goodwin
047ae2f2ad Use early returns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 16:47:52 +00:00
Evan Cheng
60c7df2c93 Fix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers that were defined by the last partial def, not just a single sub-register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 08:34:46 +00:00
Evan Cheng
014d624a28 Fix a pasto. Also simplify for Bill's benefit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 01:48:19 +00:00
Evan Cheng
1c17c1bc54 Minor bug fix. LowerSubregs should translate
%S0<def> = EXTRACT_SUBREG %Q0<kill>, 1
to
%S0<def> = IMPLICIT_DEF %Q0<imp-use,kill>

Implicit_def does not *read* any register so the operand should be marked "implicit". The missing "implicit" marker on the operand is wrong, but it doesn't actually break anything.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 00:29:40 +00:00
Evan Cheng
cf985a9545 Clean up spill weight computation. Also some changes to give loop induction
variable increment / decrement slighter high priority. 

This has major impact on some micro-benchmarks. On MultiSource/Applications
and spec tests, it's a minor win. It also reduce 256.bzip instruction count
by 8%, 55 on 164.gzip on i386 / Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82485 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 21:12:25 +00:00
Dan Gohman
28f02fdd76 Change MachineMemOperand's alignment value to be the alignment of
the base pointer, without the offset. This matches MemSDNode's
new alignment behavior, and holds more interesting information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 19:47:04 +00:00
Dan Gohman
a079ff3805 Fix this assertion string to mention subreg_to_reg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 15:18:33 +00:00
Jakob Stoklund Olesen
a5ba07c3d1 Verify that phi instructions refer to MBBs in the CFG.
The machine code verifier no longer tolerates phi instructions with noop
operands. All MBBs on a phi instruction must be in the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 07:19:08 +00:00
Evan Cheng
b0f5973bee Fix PR4986. "r1024 = insert_subreg r1024, undef, 2" cannot be turned in an implicit_def. Instead, it's an identity copy so it should be eliminated. Also make sure to update livevariable kill information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 04:32:32 +00:00
Reid Kleckner
2763217fbd Implement the JIT side of the GDB JIT debugging interface. To enable this
feature, either build the JIT in debug mode to enable it by default or pass
-jit-emit-debug to lli.

Right now, the only debug information that this communicates to GDB is call
frame information, since it's already being generated to support exceptions in
the JIT.  Eventually, when DWARF generation isn't tied so tightly to AsmPrinter,
it will be easy to push that information to GDB through this interface.

Here's a step-by-step breakdown of how the feature works:

- The JIT generates the machine code and DWARF call frame info
  (.eh_frame/.debug_frame) for a function into memory.
- The JIT copies that info into an in-memory ELF file with a symbol for the
  function.
- The JIT creates a code entry pointing to the ELF buffer and adds it to a
  linked list hanging off of a global descriptor at a special symbol that GDB
  knows about.
- The JIT calls a function marked noinline that GDB knows about and has put an
  internal breakpoint in.
- GDB catches the breakpoint and reads the global descriptor to look for new
  code.
- When sees there is new code, it reads the ELF from the inferior's memory and
  adds it to itself as an object file.
- The JIT continues, and the next time we stop the program, we are able to
  produce a proper backtrace.

Consider running the following program through the JIT:

#include <stdio.h>
void baz(short z) {
  long w = z + 1;
  printf("%d, %x\n", w, *((int*)NULL));  // SEGFAULT here
}
void bar(short y) {
  int z = y + 1;
  baz(z);
}
void foo(char x) {
  short y = x + 1;
  bar(y);
}
int main(int argc, char** argv) {
  char x = 1;
  foo(x);
}

Here is a backtrace before this patch:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaabdfbd10 (LWP 25476)]
0x00002aaaabe7d1a8 in ?? ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x0000000000000004 in ?? ()
#3  0x00032aaaabe7cfd0 in ?? ()
#4  0x00002aaaabe7d12c in ?? ()
#5  0x00022aaa00000003 in ?? ()
#6  0x00002aaaabe7d0aa in ?? ()
#7  0x01000002abe7cff0 in ?? ()
#8  0x00002aaaabe7d02c in ?? ()
#9  0x0100000000000001 in ?? ()
#10 0x00000000014388e0 in ?? ()
#11 0x00007fff00000001 in ?? ()
#12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=@0x7fffffffe050)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398,
envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

And a backtrace after this patch:
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabe7d1a8 in baz ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in baz ()
#1  0x00002aaaabe7d12c in bar ()
#2  0x00002aaaabe7d0aa in foo ()
#3  0x00002aaaabe7d02c in main ()
#4  0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=...)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#5  0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#6  0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8,
envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82418 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 23:52:43 +00:00
Chris Lattner
7453f8a68f tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82397 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 17:32:21 +00:00
Bill Wendling
711bb91574 --- Reverse-merging r82282 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp
U    lib/CodeGen/AsmPrinter/DwarfException.h

--- Reverse-merging r82274 into '.':
U    lib/Target/TargetLoweringObjectFile.cpp
G    lib/CodeGen/AsmPrinter/DwarfException.cpp

These revisions were breaking everything.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 09:13:15 +00:00
Daniel Dunbar
a279bc3da5 Tabs -> spaces, and remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:20:51 +00:00
Bill Wendling
5511ffd763 Here's fun! It turns out that these filter functions can be internal. If they're
internal, they shouldn't use the indirect pointer stuff. In the case of
throw_rethrow_test, it was marked as 'internal' and calculated its own offset to
its contents.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:19:49 +00:00
Dale Johannesen
39faac2531 When computing live intervals for earlyclobber operands,
we pushed the beginning of the interval back 1, so the
interval would overlap with inputs that die.  We were
also pushing the end of the interval back 1, though,
which means the earlyclobber didn't overlap with other
output operands.  Don't do this.  PR 4964.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:36:41 +00:00
Daniel Dunbar
0056499549 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:40:14 +00:00
Daniel Dunbar
f612ff6cfb Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:40:05 +00:00
Nick Lewycky
c332fba828 Remove the default value for ConstantStruct::get's isPacked parameter and
update the code which was broken by this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:30:26 +00:00
Evan Cheng
ce31910eae Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic blocks and update CFG, it should also inform sdisel of the changes so the phi source operands will come from the right basic blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 09:51:03 +00:00
Bob Wilson
e31e4e51a9 Fix a comment typo and some whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 21:43:11 +00:00
Bill Wendling
f41b6e5d06 Factor out label difference creation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 21:37:56 +00:00
Bill Wendling
296ab7e544 It's inefficient to have place the exception tables (which contain the LSDA)
into the __DATA section. At launch time, dyld has to update most of the section
to fix up the type info pointers. It's better to place it into the __TEXT
section and use pc-rel indirect pointer encodings. Similar to the personality
routine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 21:14:36 +00:00
Evan Cheng
fb2e752e41 Enhance EmitInstrWithCustomInserter() so target can specify CFG changes that sdisel will use to properly complete phi nodes.
Not functionality change yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 21:02:19 +00:00
Chris Lattner
bd23d5fda8 add a new hook to allow targets to splat stuff at the end of the file.
Overriding doFinalization is pretty lame.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:17:03 +00:00
Chris Lattner
6ba2e87061 duncan points out the EH selector values are signed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:34:29 +00:00
Anton Korobeynikov
c6f729ed55 Allow symbols to start from the digit if target requests it. This allows, e.g. pinning
variables to specified absolute address. Make use of this feature for MSP430.
This unbreaks PR4776.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 16:57:42 +00:00
Evan Cheng
8be58a1186 Revert r82214. It broke 403.gcc on x86_64 / Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:26:06 +00:00
Evan Cheng
f8a56255a5 Fix a bug in sdisel switch lowering code. When it updates the phi nodes in switch successor blocks, it can introduce multiple phi operands of the same value from different blocks (and may not be on the predecessor list).
This can be seen on CodeGen/Generic/2006-09-06-SwitchLowering.ll. But it's not known to cause any real regression (but I have added an assertion for it now).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:16:04 +00:00
Chris Lattner
3a5815f90f tolerate llvm.eh.selector.i64 on 32-bit systems and llvm.eh.selector.i32 on
64-bit systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 23:54:54 +00:00
Chris Lattner
8609c7c931 pass machinemoduleinfo down into getSymbolForDwarfGlobalReference,
currently unused.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:49:52 +00:00
Jim Grosbach
f9ca50e3dc grammar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 17:57:26 +00:00
Evan Cheng
f436463dbd Remove simple regalloc. It has bit rotted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 05:48:07 +00:00
Evan Cheng
5cf732e3b1 Fix PR4910: Broken logic in coalescer means when a physical register liveness is being shortened, the sub-registers were not. The symptom is the register allocator could not find a free register for this particular test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:57:15 +00:00
Devang Patel
713f043c16 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 21:09:07 +00:00
Devang Patel
123eaa71b5 At iSel time, update DebugLoc based on debug info attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:39:11 +00:00
Dan Gohman
6f65d79750 Add a new pass for doing late hoisting of floating-point and vector
constants out of loops. These aren't covered by the regular LICM
pass, because in LLVM IR constants don't require separate
instructions. They're not always covered by the MachineLICM pass
either, because it doesn't know how to unfold folded constant-pool
loads. This is somewhat experimental at this point, and off by
default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:25:11 +00:00
Benjamin Kramer
f4f1b266fd Don't sort the vector when it is empty. This should fix some expensive checking
failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 11:43:12 +00:00
Xerxes Ranby
3314091792 updated lib/CodeGen/CMakeLists.txt to unbreak cmake build after r82018
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 10:18:36 +00:00
Chris Lattner
686cb3df6a add a new MachineModuleInfoMachO class, which is the per-module
stuff common across all macho targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:03:48 +00:00
Chris Lattner
f18545550e the pointer MMI keeps will start out with object-file format specific stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 05:26:00 +00:00
Chris Lattner
4edd187ddd remove the AsmPrinter::printMCInst hook hack now that
we have MCInstPrinter.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 04:57:15 +00:00