Rafael Espindola
4ea99816ef
Implement cfi_restore. Patch by Brian Anderson!
...
llvm-svn: 147356
2011-12-29 21:43:03 +00:00
Rafael Espindola
03dbffd8ce
Rename Remember and Restore to RememberState and RestoreState for consistency.
...
llvm-svn: 147354
2011-12-29 21:09:08 +00:00
Rafael Espindola
ef4aa35164
Implement .cfi_escape. Patch by Brian Anderson!
...
llvm-svn: 147352
2011-12-29 20:24:47 +00:00
Rafael Espindola
d3df3d3527
Add back the MC bits of 126425. Original patch by Nathan Jeffords. I added the
...
asm parsing and testcase.
llvm-svn: 146801
2011-12-17 01:14:52 +00:00
Benjamin Kramer
adc5b46782
Twinify.
...
llvm-svn: 143811
2011-11-05 13:11:25 +00:00
Benjamin Kramer
c74798d5cf
Add an option to pad an uleb128 to MCObjectWriter and remove the uleb128 encoding from the DWARF asm printer.
...
As a side effect we now print dwarf ulebs with .ascii directives.
llvm-svn: 143809
2011-11-05 11:52:44 +00:00
Nick Lewycky
40f8f2ff24
Add support for a new extension to the .file directive:
...
.file filenumber "directory" "filename"
This removes one join+split of the directory+filename in MC internals. Because
bitcode files have independent fields for directory and filenames in debug info,
this patch may change the .o files written by existing .bc files.
llvm-svn: 142300
2011-10-17 23:05:28 +00:00
Owen Anderson
0ca562ec4c
Teach the MC to output code/data region marker labels in MachO and ELF modes. These are used by disassemblers to provide better disassembly, particularly on targets like ARM Thumb that like to intermingle data in the TEXT segment.
...
llvm-svn: 141135
2011-10-04 23:26:17 +00:00
Benjamin Kramer
88e6d5945f
Initialize member variable.
...
llvm-svn: 138548
2011-08-25 04:04:18 +00:00
Evan Cheng
eee864520c
Some autoconf tests use module level inline asm to test compiler's handling of
...
.cfi_startproc. e.g. libffi:
$ cat confopt.c
asm (".cfi_startproc\n\t.cfi_endproc");
int main () { return 0; }
Teach MC / dwarf emission to handle these cfi directives which essentially
create an empty frame.
rdar://10017184
llvm-svn: 138504
2011-08-24 22:31:37 +00:00
Rafael Espindola
c48e10cd54
Assume .cfi_startproc is the first thing in a function. If the function is
...
externally visable, create a local symbol to use in the CFE. If not, use the
function label itself.
Fixes PR10420.
llvm-svn: 136716
2011-08-02 20:24:22 +00:00
Bill Wendling
c438d78c38
Add a method to set compact unwind encoding information in a frame.
...
llvm-svn: 135449
2011-07-19 00:01:42 +00:00
Evan Cheng
a83b37a9db
Move some parts of TargetAsmInfo down to MCAsmInfo. This is not the greatest
...
solution but it is a small step towards removing the horror that is
TargetAsmInfo.
llvm-svn: 135237
2011-07-15 02:09:41 +00:00
Roman Divacky
384ffa9a0e
Make EmitIntValue() work properly on big-endian targets.
...
llvm-svn: 132715
2011-06-07 17:31:02 +00:00
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
Charles Davis
a60cd577fd
My attempt at fixing the leak reported by the valgrind buildbots. Valgrind will
...
still report leaks, but they're spurious now. Valgrind cannot peer into
std::vector objects--or any dynamic array, for that matter--because it doesn't
know how big the array is.
llvm-svn: 132174
2011-05-27 02:01:08 +00:00
Charles Davis
9dcee31aab
Fix inverted conditional in SaveReg and SaveXMM. Err when the frame pointer is
...
already defined, and err when the PushMachFrame operation isn't the first
operation (if specified at all).
llvm-svn: 132173
2011-05-27 01:42:17 +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
f4ce8fde18
Test basic SEH directive-parsing functionality. Fix a latent bug exposed by
...
this test.
llvm-svn: 132004
2011-05-24 21:22:53 +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
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
e636022b4d
Don't allow unaligned offsets and sizes in the Win64 EH directives.
...
Also, fix threshold for 'Big' register saves.
llvm-svn: 131830
2011-05-22 00:56:20 +00:00
Charles Davis
6879634efd
Don't allow .seh_handler and .seh_handlerdata directives inside chained
...
unwind areas.
llvm-svn: 131795
2011-05-21 17:36:25 +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
Charles Davis
54254008ba
Set the "LastFrameInst" field when streaming a .seh_setframe directive. This
...
is needed for an upcoming patch.
llvm-svn: 131772
2011-05-21 00:09:04 +00:00
Charles Davis
24b31b6b7d
"Implement" the HandlerData Win64 EH method in the base MCStreamer.
...
There's really nothing to implement. All this really does is swap to a
pseudo-section that later gets written to the unwind info struct. That
needs to be implemented in the object streamers.
llvm-svn: 131734
2011-05-20 16:06:22 +00:00
Rafael Espindola
1edfb17bc2
Looks like OS X assemblers (including MC) don't like
...
foo:
bar = foo
.quad bar
Avoid producing it. Fixes PR9951.
llvm-svn: 131687
2011-05-19 22:05:56 +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
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
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
77e0610d7c
Add some more Win64 EH directives:
...
- StartChained and EndChained delimit a chained unwind area, which can contain
additional operations to be undone if an exception occurs inside of it.
- UnwindOnly declares that this function doesn't handle any exceptions. If it
has a handler, it's an unwind handler instead of an exception handler.
- Lsda declares the location and size of the LSDA, which in the Win64 EH
scheme is kept inside the UNWIND_INFO struct. Windows itself ignores the
LSDA; it's used by the Language-Specific Handler (the "Personality Function"
from DWARF).
llvm-svn: 131572
2011-05-18 20:54:10 +00:00
Charles Davis
384041d0dc
While thinking about how to know where the functions' boundaries are for
...
the purposes of the Win64 EH tables, I realized we had no way to tell where
the function ends. (MASM bounds functions with PROC and ENDP keywords.)
Add a directive to delimit the end of the function, and rename the 'frame'
directive to more accurately reflect its duality with the new directive.
llvm-svn: 131522
2011-05-18 04:47:22 +00:00
Charles Davis
2701815ed8
Add a method I forgot in the last commit. Don't worry, this one passed
...
self-host :).
llvm-svn: 131421
2011-05-16 21:13:58 +00:00
Charles Davis
2f10078ae7
Fix copy-pasto.
...
llvm-svn: 131384
2011-05-15 17:28:27 +00:00
Charles Davis
af18d07ed6
Add stub methods to MCStreamer for emitting Win64 exception-handling
...
information.
llvm-svn: 131382
2011-05-15 17:20:01 +00:00
Rafael Espindola
ec53aa9485
Add CFIStartSections to the asm printer. Add an assert that at least
...
one of the sections is created.
llvm-svn: 131124
2011-05-10 13:39:48 +00:00
Rafael Espindola
1ecb12fc57
Add support for producing .deubg_frame sections.
...
llvm-svn: 131121
2011-05-10 03:54:12 +00:00
Rafael Espindola
b6089d6cac
Factor some code into a new EmitFrames method.
...
llvm-svn: 131119
2011-05-10 03:14:15 +00:00
Rafael Espindola
74b101f3e3
Parsing and plumbing for .cfi_sections.
...
llvm-svn: 131117
2011-05-10 01:10:18 +00:00
Rafael Espindola
fd05785324
Simplify the handling of pcrel relocations on ELF. Now we do the right thing
...
for all symbol differences and can drop the old EmitPCRelSymbolValue
method.
This also make getExprForFDESymbol on ELF equal to the one on MachO, and it
can be made non-virtual.
llvm-svn: 130634
2011-05-01 03:50:49 +00:00
Rafael Espindola
1d1eced025
Implement MCAsmStreamer::EmitDwarfAdvanceFrameAddr.
...
llvm-svn: 130585
2011-04-30 03:21:04 +00:00
Rafael Espindola
349c3298da
Mark the EH symbol global or weak if the corresponding function is.
...
llvm-svn: 130397
2011-04-28 12:50:37 +00:00
Rafael Espindola
27c0c9bb87
Factor a bit of code to MCStreamer::EmitLabel. Keep track of the last
...
non private symbol. This will be use for handling
foo:
.cfi_startproc
...
On OS X where we have to create a foo.eh symbol.
llvm-svn: 130305
2011-04-27 15:21:19 +00:00
Devang Patel
17740e70d5
Reduce clutter in asm output. Do not emit source location as comment for each instruction.
...
llvm-svn: 129715
2011-04-18 20:26:49 +00:00
Rafael Espindola
539d96f01d
Be consistent about being virtual and returning void in the cfi methods.
...
Implement the ones that were missing in the asm streamer.
llvm-svn: 129413
2011-04-12 23:59:07 +00:00
Rafael Espindola
fd794affe5
Remove LastOffset from the asm parser.
...
llvm-svn: 129378
2011-04-12 18:53:30 +00:00
Rafael Espindola
1ec0f46169
Fix the case of a .cfi_rel_offset before any .cfi_def_cfa_offset.
...
llvm-svn: 129362
2011-04-12 16:12:03 +00:00