Commit Graph

14143 Commits

Author SHA1 Message Date
Charles Davis 6d1c4c73a9 Start keeping track of where the various unwind instructions are in the prolog.
Use them to calculate the offset inside the prolog. Emit this value when
emitting the unwind codes.

llvm-svn: 132177
2011-05-27 03:25:01 +00:00
Chad Rosier b362884ca9 Renamed llvm.x86.sse42.crc32 intrinsics; crc64 doesn't exist.
crc32.[8|16|32] have been renamed to .crc32.32.[8|16|32] and
crc64.[8|16|32] have been renamed to .crc32.64.[8|64].

llvm-svn: 132163
2011-05-26 23:13:19 +00:00
Eric Christopher 017b959ad5 Comment cleanup.
llvm-svn: 132162
2011-05-26 22:54:27 +00:00
Charles Davis 4461beea04 Fix definitions of UOP_SaveXMM128, UOP_SaveXMM128Big, and UOP_PushMachFrame
to match Microsoft's definitions.

llvm-svn: 132112
2011-05-26 05:24:15 +00:00
Charles Davis 006e1c39d0 Test .seh_startchained and .seh_endchained parsing.
Rework how the MCWin64EHUnwindInfo instances are stored. Fix issues with
chained unwind areas exposed by the test that were related to this.

The ChainedParent field had the wrong address, because when the chained unwind
info was added, the addresses shifted around. Now we store the pointers to the
structures, which are now allocated from the MC heap.

llvm-svn: 132106
2011-05-26 02:45:47 +00:00
Charles Davis 2f6ecea19d Add tests for .seh_setframe and .seh_handlerdata parsing. Fix issues with
them.

I had to add a special SwitchSectionNoChange method to MCStreamer just for
.seh_handlerdata. If this isn't OK, please let me know, and I'll find some
other way to fix .seh_handlerdata streaming.

llvm-svn: 132084
2011-05-25 21:43:45 +00:00
Rafael Espindola 33dacdfe66 Fix some issues Duncan found in the previous commit.
I kept the reference to the ABI since that is the common case. The
-fno-asynchronous-unwind-tables option is a user controlled way of breaking
the ABI.

llvm-svn: 132053
2011-05-25 12:54:08 +00:00
Frits van Bommel 308a534431 Fix warning in the CMake build about redefining LLVM_PATH_XDOT_PY by making sure both definitions are identical. This used to produce warnings like
In file included from .../llvm/trunk/tools/lto/LTOCodeGenerator.cpp:45:
In file included from .../llvm/trunk/include/llvm/Support/system_error.h:225:
.../include/llvm/Config/config.h:591:9: warning: 'LLVM_PATH_XDOT_PY' macro redefined
#define LLVM_PATH_XDOT_PY ".../bin/xdot.py"
        ^
.../include/llvm/Config/llvm-config.h:98:9: note: previous definition is here
#define LLVM_PATH_XDOT_PY ""
        ^
1 warning generated.

(Paths edited for clarity)

Note: This only affected people who had xdot.py installed.
llvm-svn: 132050
2011-05-25 06:32:23 +00:00
Rafael Espindola fc9bae6f8b Replace the -unwind-tables option with a per function flag. This is more
LTO friendly as we can now correctly merge files compiled with or without
-fasynchronous-unwind-tables.

llvm-svn: 132033
2011-05-25 03:44:17 +00:00
Charles Davis 7f6176c3f9 Implement the rest of the SEH directive-parsing methods in the COFFAsmParser.
Add a size alignment check to the .seh_stackalloc directive parser. Add a
more descriptive error message to the .seh_handler directive parser.

Add methods to the TargetAsmInfo struct in support of all this.

llvm-svn: 131992
2011-05-24 20:06:30 +00:00
Devang Patel 5de2375db8 Remove dead code.
llvm-svn: 131974
2011-05-24 18:27:52 +00:00
Charles Davis 97019c709d Add a method to TargetRegisterInfo to get the register number that the Win64 EH
scheme uses internally. Implement it for x86 (the only architecture that LLVM
supports for which this matters right now).

llvm-svn: 131969
2011-05-24 16:57:53 +00:00
Cameron Zwarich 46e1ebf367 Clean up the lazy initialization of DIBuilder a bit.
llvm-svn: 131956
2011-05-24 06:00:08 +00:00
Jakob Stoklund Olesen 0130027dec Work around code generation bug in Visual Studio 2010.
See http://llvm.org/pr9976 for details.

llvm-svn: 131954
2011-05-24 03:20:56 +00:00
Cameron Zwarich 843bc7d673 Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values when
promoting allocas to SSA variables. Fixes <rdar://problem/9479036>.

llvm-svn: 131953
2011-05-24 03:10:43 +00:00
Chris Lattner 4d37d99798 add a helper method to get the byval alignment of an argument.
llvm-svn: 131883
2011-05-22 23:57:23 +00:00
Charles Davis c7250faeb1 Add methods to parse the SEH directives to the COFFAsmParser. Implement some
of them, particularly the ones that don't take arguments. Also implement
.seh_proc and .seh_handler.

llvm-svn: 131866
2011-05-22 21:12:15 +00:00
Frits van Bommel ad964559ef Add a parameter to ConstantFoldTerminator() that callers can use to ask it to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior.
I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this.

llvm-svn: 131855
2011-05-22 16:24:18 +00:00
Chris Lattner 4932e3de1b another typo
llvm-svn: 131854
2011-05-22 15:44:02 +00:00
Chris Lattner 6783871672 fix comment typo
llvm-svn: 131853
2011-05-22 15:34:37 +00:00
Chris Lattner e8bf2d5ad3 Fix some minor typos and grammar.
llvm-svn: 131835
2011-05-22 04:44:48 +00:00
Charles Davis bc2daa0f93 Implement emission of all Win64 exception tables. Make the COFF streamer emit
these tables.

llvm-svn: 131833
2011-05-22 04:15:07 +00:00
Charles Davis 1c8bd5ad7e Make the COFF streamer emit unwind info when processing a .seh_handlerdata
directive.

Implement emission of Win64 EH unwind info.

Pull in <cassert> in MCWin64EH.h so it can use the assert() macro.

llvm-svn: 131832
2011-05-22 03:01:05 +00:00
Chris Lattner 6078926e26 random comment cleanups.
llvm-svn: 131829
2011-05-22 00:50:53 +00:00
Chris Lattner b5865ded27 remove StandardPasses, it has been replaced with PassManagerBuilder
llvm-svn: 131827
2011-05-22 00:30:45 +00:00
Chris Lattner fa9fe70a6a add support for LTO passes.
llvm-svn: 131820
2011-05-22 00:14:20 +00:00
Charles Davis a8805fd71a Include DataTypes.h from this header to get the uint*_t types.
llvm-svn: 131817
2011-05-22 00:05:26 +00:00
Charles Davis 4ccc861cbc Allow access to the .pdata and .xdata sections through the TargetAsmInfo
class.

llvm-svn: 131816
2011-05-22 00:03:24 +00:00
Chris Lattner 34cc63cd71 add an extension point mechanism that allow plugins to add stuff to
the pass manager.

llvm-svn: 131814
2011-05-21 23:50:37 +00:00
Nick Lewycky babca9aee9 Add CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
use these soon.

llvm-svn: 131812
2011-05-21 23:14:36 +00:00
Chris Lattner 790cb34f93 add a new PassManagerBuilder class to replace StandardPasses.h
llvm-svn: 131807
2011-05-21 20:39:42 +00:00
Chris Lattner 4c0d9e2249 add a copy ctor to TargetLibraryInfo.
llvm-svn: 131806
2011-05-21 20:09:13 +00:00
Eli Friedman 3de2ddc578 PR7952: Make isa<> use the same logic as cast<>, so that they both work
consistently.

llvm-svn: 131803
2011-05-21 19:13:10 +00:00
Charles Davis 8e8f59bdfb A handler for a function in the Win64 EH scheme can be both an unwind handler
and an exception handler. Handle that case.

Also, add an 'Emitted' member to the MCWin64EHUnwindInfo struct. It will be
needed later.

llvm-svn: 131791
2011-05-21 15:57:49 +00:00
Andrew Trick d5d0764b3b Have Program::Wait return -2 for crashed and timeouts instead of embedding
info in the error message. Per Dan's request.

llvm-svn: 131780
2011-05-21 00:56:46 +00:00
Charles Davis bc1feb1f25 Add .pdata and .xdata sections to the COFF TLOF implementation.
llvm-svn: 131763
2011-05-20 22:13:55 +00:00
Argyrios Kyrtzidis ac8bc12cd1 Add asserts in StringRef to make sure we avoid undefined behavior:
-strlen should not be called with NULL. Also guarantee that StringRef's Length is 0 if Data is NULL.
-memcmp should not be called with NULL (even if size is 0)

Patch by Matthieu Monrocq!

llvm-svn: 131747
2011-05-20 19:24:12 +00:00
Andrew Trick f44aadf0fd indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.
No functionality enabled by default. Use -disable-iv-rewrite.
Extended IVUsers to keep track of the phi that represents the users' IV.
Added the WidenIV transform to replace a narrow IV with a wide IV
by doing a one-for-one replacement of IV users instead of expanding the
SCEV expressions. [sz]exts are removed and truncs are inserted.

llvm-svn: 131744
2011-05-20 18:25:42 +00:00
Benjamin Kramer cc7a928885 Remove noisy semicolons.
llvm-svn: 131724
2011-05-20 09:20:25 +00:00
Rafael Espindola 8e129296fe Misc code refactorings:
* Remove unnecessary arguments now that ForceExpAbs is a method.
* Use ForceExpAbs in EmitAbsValue.

llvm-svn: 131683
2011-05-19 21:40:34 +00:00
Charles Davis de745ba396 Implement the EndProlog Win64 EH method on the base MCStreamer.
llvm-svn: 131679
2011-05-19 21:24:54 +00:00
Charles Davis 7e6e8951af Implement the Win64 EH prolog instruction methods on the base MCStreamer.
I had to change the API slightly to avoid overloading issues.

llvm-svn: 131666
2011-05-19 19:35:55 +00:00
Eli Friedman d2144a9fb8 Fix up the new StandardPasses to run the same scalarrepl passes as the old one.
llvm-svn: 131665
2011-05-19 19:14:54 +00:00
Joerg Sonnenberger 74ba2623ce Reapply 131644 including the missing header changes:
Introduce -fatal-assembler-warnings for the obvious purpose

llvm-svn: 131655
2011-05-19 18:00:13 +00:00
Charles Davis 4cd8856704 Turns out GAS does have Win64 EH directives. (It also supports WinCE EH.) Make
ours compatible with GAS.

In retrospect, I should have emailed binutils about this earlier. Thanks to
Kai Tietz for pointing out that GAS already had SEH directives.

llvm-svn: 131652
2011-05-19 17:46:39 +00:00
Charles Davis b4222589bf Implement the StartChained and EndChained Win64 EH methods on MCStreamer.
llvm-svn: 131629
2011-05-19 04:04:13 +00:00
Francois Pichet 68610c1673 Fix the MSVC build.
Use a set of overloaded functions instead of template function for CreatePassFn.

It seems that template deduction for functions type that differs only by return type doesn't work with MSVC. 

llvm-svn: 131624
2011-05-19 02:54:11 +00:00
Charles Davis d991ec4e68 Implement the StartProc and EndProc Win64 EH methods on the base MCStreamer.
Based largely on Rafael Espindola's work on CFI. Other methods soon to follow.

llvm-svn: 131623
2011-05-19 02:49:00 +00:00
Charles Davis 382c065822 Fix build issues with headers, which I discovered by actually using them.
Also, convert all the inline functions on UnwindInfo into methods.

llvm-svn: 131622
2011-05-19 02:47:23 +00:00
Charles Davis bd5a09d3b2 Add a header patterned after MCDwarf.h for supporting Win64 exception handling
under MC.

llvm-svn: 131593
2011-05-18 22:48:24 +00:00