Commit Graph

150 Commits

Author SHA1 Message Date
Devang Patel 0939595711 Record variable debug info at ISel time directly.
llvm-svn: 79742
2009-08-22 17:12:53 +00:00
Jakob Stoklund Olesen 4af3c864bc Don't setCalleeSavedInfoValid() until spills are interted.
In a naked function, the flag is never set and getPristineRegs() returns an
empty list. That means naked functions are able to clobber callee saved
registers, but that is the whole point of naked functions.

This fixes PR4716.

llvm-svn: 79096
2009-08-15 13:10:46 +00:00
Jakob Stoklund Olesen 3de4a60e1e Add MachineFrameInfo::getPristineRegisters(MBB) method.
llvm-svn: 78911
2009-08-13 16:19:33 +00:00
Dan Gohman 0402315d41 Use setPreservesAll and setPreservesCFG in CodeGen passes.
llvm-svn: 77754
2009-07-31 23:37:33 +00:00
Dan Gohman 5ea74d55ce Reapply r77654 with a fix: MachineFunctionPass's getAnalysisUsage
shouldn't do AU.setPreservesCFG(), because even though CodeGen passes
don't modify the LLVM IR CFG, they may modify the MachineFunction CFG,
and passes like MachineLoop are registered with isCFGOnly set to true.

llvm-svn: 77691
2009-07-31 18:16:33 +00:00
Daniel Dunbar 5434756585 Revert r77654, it appears to be causing llvm-gcc bootstrap failures, and many
failures when building assorted projects with clang.

--- Reverse-merging r77654 into '.':
U    include/llvm/CodeGen/Passes.h
U    include/llvm/CodeGen/MachineFunctionPass.h
U    include/llvm/CodeGen/MachineFunction.h
U    include/llvm/CodeGen/LazyLiveness.h
U    include/llvm/CodeGen/SelectionDAGISel.h
D    include/llvm/CodeGen/MachineFunctionAnalysis.h
U    include/llvm/Function.h
U    lib/Target/CellSPU/SPUISelDAGToDAG.cpp
U    lib/Target/PowerPC/PPCISelDAGToDAG.cpp
U    lib/CodeGen/LLVMTargetMachine.cpp
U    lib/CodeGen/MachineVerifier.cpp
U    lib/CodeGen/MachineFunction.cpp
U    lib/CodeGen/PrologEpilogInserter.cpp
U    lib/CodeGen/MachineLoopInfo.cpp
U    lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
D    lib/CodeGen/MachineFunctionAnalysis.cpp
D    lib/CodeGen/MachineFunctionPass.cpp
U    lib/CodeGen/LiveVariables.cpp

llvm-svn: 77661
2009-07-31 03:02:41 +00:00
Dan Gohman bcb44baa57 Manage MachineFunctions with an analysis Pass instead of the Annotable
mechanism. To support this, make MachineFunctionPass a little more
complete.

llvm-svn: 77654
2009-07-31 01:52:50 +00:00
Anton Korobeynikov c8ce7b08ba Add support for naked functions
llvm-svn: 76198
2009-07-17 18:07:26 +00:00
Dale Johannesen c4148c4ec7 Assume an inline asm might be a call, so we get
stack alignment right when it is.  This is not
ideal but conservatively correct.  Adjust a test
to compensate for changed stack offset value.
gcc.apple/asm-block-57.c

llvm-svn: 76120
2009-07-16 22:34:45 +00:00
Anton Korobeynikov b638a8fd73 Scan for presence of calls and determine max callframe size early. To allow ProcessFunctionBeforeCalleeSaveScan() use this information
llvm-svn: 75942
2009-07-16 13:50:40 +00:00
Evan Cheng 7452c968e4 Targets sometimes assign fixed stack object to spill certain callee-saved
registers based on dynamic conditions. For example, X86 EBP/RBP, when used as
frame register has to be spilled in the first fixed object. It should inform
PEI this so it doesn't get allocated another stack object. Also, it should not
be spilled as other callee-saved registers but rather its spilling and restoring
are being handled by emitPrologue and emitEpilogue. Avoid spilling it twice.

llvm-svn: 75116
2009-07-09 06:53:48 +00:00
Bill Wendling 9242ff34c6 Use interators instead of counters for loops.
llvm-svn: 75046
2009-07-08 20:57:27 +00:00
Jim Grosbach 4f915313ed Removing the HasBuiltinSetjmp flag and associated bits. Flagging the presence
of exception handling builtin sjlj targets in functions turns out not to 
be necessary. Marking the intrinsic implementation in the .td file as 
defining all registers is sufficient to get the context saved properly by 
the containing function.

llvm-svn: 71743
2009-05-13 23:50:53 +00:00
John Mosby ce06bb8a53 PEI: rename PEI.h to PrologEpilogInserter.h to adhere to file naming standard
llvm-svn: 71678
2009-05-13 17:52:11 +00:00
Jim Grosbach aeca45dd6f Add support for GCC compatible builtin setjmp and longjmp intrinsics. This is
a supporting preliminary patch for GCC-compatible SjLJ exception handling. Note that these intrinsics are not designed to be invoked directly by the user, but
rather used by the front-end as target hooks for exception handling.

llvm-svn: 71610
2009-05-12 23:59:14 +00:00
John Mosby faec4fd030 Restructure PEI code:
- moved shrink wrapping code from PrologEpilogInserter.cpp to
  new file ShrinkWrapping.cpp.

- moved PEI pass definition into new shared header PEI.h.

llvm-svn: 71588
2009-05-12 20:33:29 +00:00
Evan Cheng 1988352fbd Apply patch review feedback.
llvm-svn: 71472
2009-05-11 20:53:52 +00:00
Evan Cheng 2b1b92189d Unbreak non-debug build.
llvm-svn: 71457
2009-05-11 18:40:52 +00:00
John Mosby dd437d3a26 Shrink wrapping in PEI:
- reduces _static_ callee saved register spills
  and restores similar to Chow's original algorithm.
- iterative implementation with simple heuristic
  limits to mitigate compile time impact.
- handles placing spills/restores for multi-entry,
  multi-exit regions in the Machine CFG without
  splitting edges.
- passes test-suite in LLCBETA mode.

Added contains() method to ADT/SparseBitVector.

llvm-svn: 71438
2009-05-11 17:04:19 +00:00
John Mosby a1be2dcd63 Shrink wrapping in PEI: initial release. Finishing development, enable with --shrink-wrap.
llvm-svn: 67828
2009-03-27 06:09:40 +00:00
Evan Cheng f413a88839 Fix PR3845: Avoid stale MachineInstruction pointer reference.
llvm-svn: 67649
2009-03-24 20:33:17 +00:00
Chris Lattner f0db9b6321 Apply the patch requested in PR3846.
llvm-svn: 67364
2009-03-20 05:08:24 +00:00
Chris Lattner 58bd3dccf9 Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block.  This is PR3842.

llvm-svn: 67304
2009-03-19 17:15:43 +00:00
Duncan Sands 5a913d61e3 Rename getAnalysisToUpdate to getAnalysisIfAvailable.
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Bill Wendling 1af23b035f Refactor code that adjusts the offsets of stack objects.
llvm-svn: 58829
2008-11-07 01:48:58 +00:00
Bill Wendling 8b47c1e0a2 Don't recalculate the stack position of the stack protector.
llvm-svn: 58815
2008-11-06 21:37:09 +00:00
Bill Wendling b3f7a39877 - Rename stackprotector_{prologue,epilogue} to stackprotector_{create,check}.
- Get rid of "HasStackProtector" in MachineFrameInfo.
- Modify intrinsics to tell which are doing what with memory.

llvm-svn: 58799
2008-11-06 07:23:03 +00:00
Bill Wendling d970ea3eac Implement the stack protector stack accesses via intrinsics:
- stackprotector_prologue creates a stack object and stores the guard there.

- stackprotector_epilogue reads the stack guard from the stack position created
  by stackprotector_prologue.

- The PrologEpilogInserter was changed to make sure that the stack guard is
  first on the stack frame.

llvm-svn: 58791
2008-11-06 02:29:10 +00:00
Bill Wendling d2bc13380f Revert r58489. It isn't correct for all cases.
llvm-svn: 58523
2008-10-31 18:30:19 +00:00
Bill Wendling 6d70df0b05 Don't skip over all "terminator" instructions when determining where to put the
callee-saved restore code. It could skip over conditional jumps
accidentally. Instead, just skip the "return" instructions.

llvm-svn: 58489
2008-10-31 04:00:23 +00:00
Dan Gohman 0d1e9a8e04 Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.

llvm-svn: 57006
2008-10-03 15:45:36 +00:00
Evan Cheng 962c2cf17a Instead of setPreservesAll, just mark them preseving machine loop info and machine dominators.
llvm-svn: 56475
2008-09-22 22:21:38 +00:00
Evan Cheng 168f8f3916 Mark several codegen passes as preserving all analysis.
llvm-svn: 56469
2008-09-22 20:58:04 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Dan Gohman 26ffe2bea6 Fix a comment to say nonnegative instead of positive.
llvm-svn: 53681
2008-07-16 15:57:10 +00:00
Dale Johannesen 659aeb6186 No need to align the stack if there are no stack
objects.  Fixes a couple of tests on Linux.

llvm-svn: 52921
2008-06-30 20:40:16 +00:00
Dale Johannesen a2de8eab61 Fixes the last x86-64 test failure in compat.exp:
<16 x float> is 64-byte aligned (for some reason),
which gets us into the stack realignment code.  The
computation changing FP-relative offsets to SP-relative
was broken, assiging a spill temp to a location
also used for parameter passing.  This
fixes it by rounding up the stack frame to a multiple
of the largest alignment (I concluded it wasn't fixable
without doing this, but I'm not very sure.)

llvm-svn: 52750
2008-06-26 01:51:13 +00:00
Bruno Cardoso Lopes 2dd8fdc78a Fixed bug in bad behavior in calculateFrameObjectOffsets,
the solution commited is different from the previous patch to
avoid int and unsigned comparison

llvm-svn: 51899
2008-06-03 08:46:59 +00:00
Anton Korobeynikov 41334635cc Use precomputed value, if any
llvm-svn: 50164
2008-04-23 18:21:50 +00:00
Anton Korobeynikov f49bc9f8ed Cleanup
llvm-svn: 50160
2008-04-23 18:19:47 +00:00
Chris Lattner a7cca362af detabify llvm, patch by Mike Stump!
llvm-svn: 48577
2008-03-20 01:22:40 +00:00
Bill Wendling 0e541ea730 Miscellaneous clean-ups based on Evan's feedback:
- Cleaned up how the prologue-epilogue inserter loops over the instructions.
- Instead of restarting the processing of an instruction if we remove an
  implicit kill, just update the end iterator and make sure that the iterator
  isn't incremented.

llvm-svn: 47870
2008-03-03 23:57:28 +00:00
Bill Wendling 4836d58f89 Multiple instructions can be inserted when eliminating frame indexes. We need
the register scavenger to process all of those new instructions instead of just
the last one inserted.

llvm-svn: 47860
2008-03-03 22:11:16 +00:00
Evan Cheng 8ae8e2d50b Don't track max alignment during stack object allocations since they can be deleted later. Let PEI compute it.
llvm-svn: 47668
2008-02-27 10:04:56 +00:00
Evan Cheng 6d56368caf Spiller now remove unused spill slots.
llvm-svn: 47657
2008-02-27 03:04:06 +00:00
Bill Wendling 963192f40b Adjust the MaxAlignment for the special register scavenging spill slot.
llvm-svn: 47452
2008-02-21 19:33:53 +00:00
Dan Gohman 3a4be0fdef Rename MRegisterInfo to TargetRegisterInfo.
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Evan Cheng efd142a920 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.

llvm-svn: 46659
2008-02-02 04:07:54 +00:00
Evan Cheng d6e44ab5ec Remove the nasty LABEL hack with a much less evil one. Now llvm.dbg.func.start implies a stoppoint is set. SelectionDAGISel records a new source line but does not create a ISD::LABEL node for this special stoppoint. Asm printer will magically print this label. This ensures nothing is emitted before.
llvm-svn: 46635
2008-02-01 09:10:45 +00:00
Evan Cheng 1c6c16ea11 Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
llvm-svn: 46609
2008-01-31 09:59:15 +00:00