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

46 Commits

Author SHA1 Message Date
Bill Wendling
7469ccb3bd Inline check that's used only once.
llvm-svn: 128465
2011-03-29 17:12:55 +00:00
Bill Wendling
47b8e67328 Rework the logic (and removing the bad check for an unreachable block) so that
the FailBB dominator is correctly calculated. Believe it or not, there isn't a
functionality change here.

llvm-svn: 128455
2011-03-29 07:28:52 +00:00
Bill Wendling
ded022ad8b Don't try to add stack protector logic to a dead basic block. It messes up
dominator information.

llvm-svn: 128452
2011-03-29 05:15:48 +00:00
Bill Wendling
cb8447ad52 In some cases, the "fail BB dominator" may be null after the BB was split (and
becomes reachable when before it wasn't). Check to make sure that it's not null
before trying to use it.

llvm-svn: 128434
2011-03-28 23:02:18 +00:00
Cameron Zwarich
39a49276db Fix the GCC test suite issue exposed by r127477, which was caused by stack
protector insertion not working correctly with unreachable code. Since that
revision was rolled out, this test doesn't actual fail before this fix.

llvm-svn: 127497
2011-03-11 21:51:56 +00:00
Cameron Zwarich
a40df277f1 Make more passes preserve dominators (or state that they preserve dominators if
they all ready do). This removes two dominator recomputations prior to isel,
which is a 1% improvement in total llc time for 403.gcc.

The only potentially suspect thing is making GCStrategy recompute dominators if
it used a custom lowering strategy.

llvm-svn: 123064
2011-01-08 17:01:52 +00:00
Owen Anderson
46990c17f7 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Owen Anderson
69cbf2e8b7 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Owen Anderson
f8addbb0a1 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Chris Lattner
18ba4703b0 tighten up this code.
llvm-svn: 107670
2010-07-06 15:59:27 +00:00
Eric Christopher
e873e9978c Fix up -fstack-protector on linux to use the segment
registers.  Split out testcases per architecture and os
now.

Patch from Nelson Elhage.

llvm-svn: 107640
2010-07-06 05:18:56 +00:00
Duncan Sands
2acaf3609c Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Benjamin Kramer
0ba7479f2c Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Nick Lewycky
711c726c97 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Bill Wendling
283fb69c0a Neuter stack protectors by only checking character arrays. This is what GCC
does.

llvm-svn: 84916
2009-10-23 00:01:05 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
4483fbda5e Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Owen Anderson
8c85061ee6 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Owen Anderson
49226b1075 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +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
Bill Wendling
5ddde1a24c When we split a basic block, there's a default branch to the newly created BB.
Delete this default branch, because we're going to generate our own.

llvm-svn: 66234
2009-03-06 01:41:15 +00:00
Duncan Sands
bcdbfb63dc Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Bill Wendling
3460a79979 Rename stackprotector_create intrinsic to stackprotector.
llvm-svn: 59519
2008-11-18 11:01:33 +00:00
Bill Wendling
485d094231 Remove the stackprotector_check intrinsic. Use a volatile load instead.
llvm-svn: 59504
2008-11-18 07:30:57 +00:00
Bill Wendling
3a50ecd70f - Use "moveAfter" instead of "remove/insert" of a basic block.
- Use less indentation in coding.
- Shorten description.
- Update comments.
- Move code around

llvm-svn: 59496
2008-11-18 05:32:11 +00:00
Bill Wendling
f5b264a64b Implement stack protectors as function attributes: "ssp" and "sspreq".
llvm-svn: 59202
2008-11-13 01:02:14 +00:00
Bill Wendling
d3c149eb90 Small simplification. Use the iterator already present as the insertion point.
llvm-svn: 59008
2008-11-10 23:38:59 +00:00
Bill Wendling
0421da9e9e - Make sure that we don't over-increment the iterator when going through the
basic blocks.
- Minor code clean-up.

llvm-svn: 59002
2008-11-10 21:13:10 +00:00
Bill Wendling
3fe9fef0da - 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
54a5c87823 Remove unneeded header file.
llvm-svn: 58823
2008-11-06 23:56:59 +00:00
Bill Wendling
70e06738b4 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
Bill Wendling
1e6576e1e0 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
b6e2d60e7a - 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
489791a127 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
08905ed703 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
986e386794 Remove dead variable.
llvm-svn: 58741
2008-11-05 00:56:35 +00:00
Bill Wendling
8c86d20576 Simplify the allocated size calculation.
llvm-svn: 58740
2008-11-05 00:54:27 +00:00
Bill Wendling
2461aaa183 Fix comment
llvm-svn: 58739
2008-11-05 00:46:15 +00:00
Bill Wendling
e73f31f526 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
214f515922 Small simplification of the stack guard type.
llvm-svn: 58728
2008-11-04 22:54:43 +00:00
Bill Wendling
79a8798e07 - 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
Bill Wendling
ae168b2c83 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
Bill Wendling
0f3f36688b 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