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

24 Commits

Author SHA1 Message Date
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