Commit Graph

5955 Commits

Author SHA1 Message Date
Chris Lattner bc09b36016 Fix an over aggressive assumption that struct decls will have a pointer to
an array that is empty.  Instead of requiring this array, allow a null pointer.
This shrinks all forward references of structs.

llvm-svn: 58959
2008-11-10 03:48:55 +00:00
Dale Johannesen aa4d82d244 Temporarily revert 58825, which breaks PPC bootstrap.
xs

llvm-svn: 58930
2008-11-09 06:48:10 +00:00
Anton Korobeynikov 9833d8c369 Temporary revert my last commit: it seems it's triggering some subtle bug in backend
and breaks llvm-gcc

llvm-svn: 58926
2008-11-08 23:05:05 +00:00
Duncan Sands 0f3937115d Try to produce better code when scalarizing VSETCC.
llvm-svn: 58920
2008-11-08 18:26:48 +00:00
Anton Korobeynikov 09f51d1fd4 Factor out offset printing code into generic AsmPrinter.
FIXME: it seems, that most of targets don't support
offsets wrt CPI/GlobalAddress', was it intentional?

llvm-svn: 58917
2008-11-08 17:21:38 +00:00
Evan Cheng b31a717527 Rename startFunctionStub to startGVStub since it's also used for GV non-lazy ptr.
llvm-svn: 58897
2008-11-08 08:02:53 +00:00
Dale Johannesen bb5c9b4b68 Make testb optimization work on big-endian targets.
llvm-svn: 58874
2008-11-08 00:01:16 +00:00
Dale Johannesen 160be0ffda Make FP tests requiring two compares work on PPC (PR 642).
This is Chris' patch from the PR, modified to realize that
SETUGT/SETULT occur legitimately with integers, plus
two fixes in LegalizeDAG to pass a valid result type into
LegalizeSetCC.  The argument of TLI.getSetCCResultType is
ignored on PPC, but I think I'm following usage elsewhere.

llvm-svn: 58871
2008-11-07 22:54:33 +00:00
Duncan Sands 2d636b5265 Sign-extend rather than zero-extend when promoting
the condition for a BRCOND, according to what is
returned by getSetCCResultContents.  Since all
targets return the same thing (ZeroOrOneSetCCResult),
this should be harmless!  The point is that all over
the place the result of SETCC is fed directly into
BRCOND.  On machines for which getSetCCResultContents
returns ZeroOrNegativeOneSetCCResult, this is a
sign-extended boolean.  So it seems dangerous to
also feed BRCOND zero-extended booleans in some
circumstances - for example, when promoting the
condition.

llvm-svn: 58861
2008-11-07 20:13:04 +00:00
Dale Johannesen 9016882d67 Fix unsigned->ppcf128 conversion.
llvm-svn: 58856
2008-11-07 19:11:43 +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
Dale Johannesen 7aad542d35 When we're doing a compare of load-AND-constant to 0
(e.g. a bitfield test) narrow the load as much as possible.
The has the potential to avoid unnecessary partial-word
load-after-store conflicts, which cause stalls on several targets.
Also a size win on x86 (testb vs testl).

llvm-svn: 58825
2008-11-07 01:28:02 +00:00
Bill Wendling eb4268d72f - Modify the stack protector algorithm so that the stack slot is allocated in
LLVM IR code and not in the selection DAG ISel. This is a cleaner solution.

- Fix the heuristic for determining if protectors are necessary. The previous
  one wasn't checking the proper type size.

llvm-svn: 58824
2008-11-07 01:23:58 +00:00
Bill Wendling 87d0746e71 Remove unneeded header file.
llvm-svn: 58823
2008-11-06 23:56:59 +00:00
Bill Wendling a0826e1855 Don't build a vector of returns. Just modify the Function in the loop.
llvm-svn: 58822
2008-11-06 23:55:49 +00:00
Mon P Wang 5ca2ec65bd Fixed scalarizing an extract subvector and prevent an infinite loop
when simplify a vector. 

llvm-svn: 58820
2008-11-06 22:52:21 +00:00
Bill Wendling d939a7b305 The size limit is for individual arrays. So if any array has more than 8 bytes
in it, then emit stack protectors.

llvm-svn: 58819
2008-11-06 22:18:44 +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
Devang Patel 8af0a362f1 Emit label for llvm.dbg.func.start of the inlined function.
llvm-svn: 58814
2008-11-06 21:28:20 +00:00
Duncan Sands f178f8300d Formating/comment changes - no functionality change.
llvm-svn: 58801
2008-11-06 08:51:32 +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
Mon P Wang 9a8d60a7c0 Widening cleanup
llvm-svn: 58796
2008-11-06 05:31:54 +00:00
Bill Wendling 43de293d75 Adjust the stack protector heuristic to care about only arrays or calls to
"alloca".

llvm-svn: 58792
2008-11-06 02:38:58 +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
Devang Patel 9e3e776e28 Emit label for llvm.dbg.func.start of the inlined function.
llvm-svn: 58786
2008-11-06 00:30:09 +00:00
Duncan Sands 68035d4076 Fix thinko in ppcf128 expansion of truncating store.
llvm-svn: 58753
2008-11-05 07:17:27 +00:00
Evan Cheng c7b04a12bb Type of shuffle mask has changed.
llvm-svn: 58751
2008-11-05 06:04:18 +00:00
Bill Wendling db045a3048 Remove dead variable.
llvm-svn: 58741
2008-11-05 00:56:35 +00:00
Bill Wendling f1b4e2626b Simplify the allocated size calculation.
llvm-svn: 58740
2008-11-05 00:54:27 +00:00
Bill Wendling 75e38fedc8 Fix comment
llvm-svn: 58739
2008-11-05 00:46:15 +00:00
Owen Anderson 26c10f1b4a Use the new predicate to control when we do prealloc splitting. Fix a small bug.
llvm-svn: 58738
2008-11-05 00:32:13 +00:00
Bill Wendling 782e8346a5 Some code simplification. It now doesn't generate a prologue if the epilogue
isn't going to be generated.

llvm-svn: 58734
2008-11-05 00:00:21 +00:00
Bill Wendling d31fc54f34 Small simplification of the stack guard type.
llvm-svn: 58728
2008-11-04 22:54:43 +00:00
Bill Wendling 2f40956c68 - Add a "getOrInsertGlobal" method to the Module class. This acts similarly to
"getOrInsertFunction" in that it either adds a new declaration of the global
  and returns it, or returns the current one -- optionally casting it to the
  correct type.
- Use the new getOrInsertGlobal in the stack protector code.
- Use "splitBasicBlock" in the stack protector code.

llvm-svn: 58727
2008-11-04 22:51:24 +00:00
Owen Anderson a926ed4b50 First pass at checking for the creation of a new join point when doing pre-alloc splitting. This is not turned on yet.
llvm-svn: 58726
2008-11-04 22:22:41 +00:00
Bill Wendling 64adc71e9a Update in response to feedback from Chris:
- Use enums instead of magic numbers.

- Rework algorithm to use the bytes size from the target to determine when to
  emit stack protectors.

- Get rid of "propolice" in any comments.

- Renamed an option to its expanded form.

- Other miscellanenous changes.

More changes will come after this.

llvm-svn: 58723
2008-11-04 21:53:09 +00:00
Dale Johannesen db6b956585 80 columns
llvm-svn: 58717
2008-11-04 20:52:49 +00:00
Duncan Sands dd571d325e Fix typo. Patch by nlewycky.
llvm-svn: 58709
2008-11-04 18:05:30 +00:00
Duncan Sands d5f935921a Fix PR3011: LegalizeTypes support for scalarizing
SELECT_CC.

llvm-svn: 58706
2008-11-04 17:31:08 +00:00
Nuno Lopes 57c6594e97 fix leakage of IfcvtTokens
llvm-svn: 58690
2008-11-04 13:02:59 +00:00
Oscar Fuentes 8881a91ae8 CMake: Updated list of source files.
llvm-svn: 58676
2008-11-04 03:24:04 +00:00
Bill Wendling 05d8417fa0 Initial checkin for stack protectors. Here's what it does:
* The prologue is modified to read the __stack_chk_guard global and insert it
  onto the stack.

* The epilogue is modified to read the stored guard from the stack and compare
  it to the original __stack_chk_guard value. If they differ, then the
  __stack_chk_fail() function is called.

* The stack protector needs to be first on the stack (after the parameters) to
  catch any stack-smashing activities.

Front-end support will follow after a round of beta testing.

llvm-svn: 58673
2008-11-04 02:10:20 +00:00
Dale Johannesen 08535d2507 Fix some ppcf128 regressions: make ExpandFloatRes_LOAD
work correctly, and bring over a late change to ppcf128
SetCC handling.

llvm-svn: 58642
2008-11-03 20:47:45 +00:00
Duncan Sands 6692dec2a0 Make VAARG promotion work correctly with large funky
sized integers like i129, and also reduce the number
of assumptions made about how vaarg is implemented.
This still doesn't work correctly for small integers
like (eg) i1 on x86, since x86 passes each of them
(essentially an i8) in a 4 byte stack slot, so the
pointer needs to be advanced by 4 bytes not by 1 byte
as now.  But this is no longer a LegalizeTypes problem
(it was also wrong in LT before): it is a bug in the
operation expansion in LegalizeDAG: now LegalizeTypes
turns an i1 vaarg into an i8 vaarg which would work
fine if only the i8 vaarg was turned into correct code
later.

llvm-svn: 58635
2008-11-03 20:22:12 +00:00
Duncan Sands 0207a3f897 Make VAARG work with x86 long double (which is
10 bytes long, but is passed in 12/16 bytes).

llvm-svn: 58608
2008-11-03 11:51:11 +00:00
Matthijs Kooijman 2530f5fe43 Make MachineFrameInfo::print not crash when no TargetFrameInfo is available.
llvm-svn: 58606
2008-11-03 11:16:43 +00:00
Owen Anderson b067843863 Revert my last patch until I consult with Evan about it.
llvm-svn: 58591
2008-11-03 02:33:28 +00:00
Owen Anderson 2bb2aaa775 Don't do pre-splitting if doing so would create a value join that did not
exist before.  Updating the live intervals in that care is tricky in the general
case.

Evan, if you see a tighter guard condition for this, let me know.

llvm-svn: 58560
2008-11-02 08:08:18 +00:00
Mon P Wang 769134be1e Added interface to allow clients to create a MemIntrinsicNode for
target intrinsics that touches memory

llvm-svn: 58548
2008-11-01 20:24:53 +00:00
Anton Korobeynikov 7c5a01f0ec Invalidate debug/eh/gc labels when unreachable MBB is deleted.
Based on patch by Martin Nowack!

llvm-svn: 58536
2008-10-31 20:08:30 +00:00