Micah Villmow
cdfe20b97f
Move TargetData to DataLayout.
...
llvm-svn: 165402
2012-10-08 16:38:25 +00:00
Bill Wendling
863bab689a
Remove the `hasFnAttr' method from Function.
...
The hasFnAttr method has been replaced by querying the Attributes explicitly. No
intended functionality change.
llvm-svn: 164725
2012-09-26 21:48:26 +00:00
Chad Rosier
d269bd8c24
Add support for the --param ssp-buffer-size= driver option.
...
PR9673
llvm-svn: 162284
2012-08-21 16:15:24 +00:00
Bill Wendling
bfb9b7598d
Implement stack protectors for structures with character arrays in them.
...
<rdar://problem/10545247>
llvm-svn: 162131
2012-08-17 20:59:56 +00:00
Bill Wendling
49aeb5cc5d
Whitespace cleanup.
...
llvm-svn: 161788
2012-08-13 21:20:43 +00:00
Bill Wendling
61396b81a4
For non-Darwin platforms, we want to generate stack protectors only for
...
character arrays. This is in line with what GCC does.
<rdar://problem/10529227>
llvm-svn: 161446
2012-08-07 20:59:05 +00:00
Bob Wilson
ebb44646c4
Enable stack protectors for all arrays, not just char arrays. rdar://5875909
...
Patch by Bill Wendling.
llvm-svn: 145097
2011-11-23 07:13:56 +00:00
Chris Lattner
229907cd11
land David Blaikie's patch to de-constify Type, with a few tweaks.
...
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Jay Foad
5bd375a6cc
Convert CallInst and InvokeInst APIs to use ArrayRef.
...
llvm-svn: 135265
2011-07-15 08:37:34 +00:00
Bill Wendling
dd1cf3279e
Inline check that's used only once.
...
llvm-svn: 128465
2011-03-29 17:12:55 +00:00
Bill Wendling
fb63d55fe8
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
220c9f045b
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
96f962fdff
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
4d7d728594
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
84986b298a
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
6c18d1aac0
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
df7a4f2515
Now with fewer extraneous semicolons!
...
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
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
a57b97e7e7
Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
...
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Chris Lattner
dde2ba0b60
tighten up this code.
...
llvm-svn: 107670
2010-07-06 15:59:27 +00:00
Eric Christopher
2ad0c779c3
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
9dff9bec31
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
d2564e3afb
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Nick Lewycky
02d5f77d26
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
6aea1a2a5a
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
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
4fdeba9706
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
b6b2530000
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Owen Anderson
1e5f00e7a7
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
af9eaa830a
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
6d8472b9cc
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
dc020f9c3c
Rename getABITypeSize to getTypePaddedSize, as
...
suggested by Chris.
llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Bill Wendling
13020d22da
Rename stackprotector_create intrinsic to stackprotector.
...
llvm-svn: 59519
2008-11-18 11:01:33 +00:00
Bill Wendling
7235002bd1
Remove the stackprotector_check intrinsic. Use a volatile load instead.
...
llvm-svn: 59504
2008-11-18 07:30:57 +00:00
Bill Wendling
eeb0415980
- 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
ccb67a3d85
Implement stack protectors as function attributes: "ssp" and "sspreq".
...
llvm-svn: 59202
2008-11-13 01:02:14 +00:00
Bill Wendling
cfa3e287bb
Small simplification. Use the iterator already present as the insertion point.
...
llvm-svn: 59008
2008-11-10 23:38:59 +00:00
Bill Wendling
747f59f0f7
- 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
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
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
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
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
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
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
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
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