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

119 Commits

Author SHA1 Message Date
Jack Carter
78a165943b This patch just fixes up various llvm formatting
violations such as tabs, blanks at eol and long 
lines.


 

llvm-svn: 175007
2013-02-12 21:29:39 +00:00
Chandler Carruth
0c74d78ebf Give the MCStreamer class hierarchy LLVM RTTI facilities for use with
isa<> and dyn_cast<>. In several places, code is already hacking around
the absence of this, and there seem to be several interfaces that might
be lifted and/or devirtualized using this.

This change was based on a discussion with Jim Grosbach about how best
to handle testing for specific MCStreamer subclasses. He said that this
was the correct end state, and everything else was too hacky so
I decided to just make it so.

No functionality should be changed here, this is just threading the kind
through all the constructors and setting up the classof overloads.

llvm-svn: 174113
2013-01-31 23:29:57 +00:00
Eric Christopher
44e3142d09 Last in the series of removing unnecessary '0' arguments for
address space. Reordered the EmitULEB128IntValue arguments to
make this easier.

llvm-svn: 171949
2013-01-09 03:52:05 +00:00
Pedro Artigas
b5becdf476 small fixes to enable the reuse of the pass manager across multiple modules
llvm-svn: 171475
2013-01-04 18:04:42 +00:00
Reed Kotler
7ee48929d5 This patch is needed to make c++ exceptions work for mips16.
Mips16 is really a processor decoding mode (ala thumb 1) and in the same
program, mips16 and mips32 functions can exist and can call each other.

If a jal type instruction encounters an address with the lower bit set, then
the processor switches to mips16 mode (if it is not already in it). If the
lower bit is not set, then it switches to mips32 mode.

The linker knows which functions are mips16 and which are mips32.
When relocation is performed on code labels, this lower order bit is
set if the code label is a mips16 code label.

In general this works just fine, however when creating exception handling
tables and dwarf, there are cases where you don't want this lower order
bit added in.

This has been traditionally distinguished in gas assembly source by using a
different syntax for the label.

lab1:      ; this will cause the lower order bit to be added
lab2=.     ; this will not cause the lower order bit to be added

In some cases, it does not matter because in dwarf and debug tables
the difference of two labels is used and in that case the lower order
bits subtract each other out.

To fix this, I have added to mcstreamer the notion of a debuglabel.
The default is for label and debug label to be the same. So calling
EmitLabel and EmitDebugLabel produce the same result.

For various reasons, there is only one set of labels that needs to be
modified for the mips exceptions to work. These are the "$eh_func_beginXXX" 
labels.

Mips overrides the debug label suffix from ":" to "=." .

This initial patch fixes exceptions. More changes most likely
will be needed to DwarfCFException to make all of this work
for actual debugging. These changes will be to emit debug labels in some
places where a simple label is emitted now.

Some historical discussion on this from gcc can be found at:
http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00623.html
http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01273.html 

llvm-svn: 170279
2012-12-16 04:00:45 +00:00
Pedro Artigas
0e3841e00e Make the MCStreamer have a reset method and call that after finalization of the asm printer,
also changed MCContext to a single reset only method for simplicity as requested on the list

llvm-svn: 170041
2012-12-12 22:59:46 +00:00
Lang Hames
313bb2d202 Defer call to InitSections until after MCContext has been initialized. If
InitSections is called before the MCContext is initialized it could cause
duplicate temporary symbols to be emitted later (after context initialization
resets the temporary label counter).

llvm-svn: 169785
2012-12-10 22:49:11 +00:00
Chandler Carruth
a490793037 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Rafael Espindola
81ee486113 Add support for .cfi_register now that it is easy to extent the representation
to support it. Original patch with the parsing and plumbing by the PaX team and
Roman Divacky. I added the bits in MCDwarf.cpp and the test.

llvm-svn: 168565
2012-11-25 15:14:49 +00:00
Rafael Espindola
0291ef94b9 Give each MCCFIInstruction its own opcode.
This untangles the switch cases of the old Move and RelMove opcodes a bit
and makes it clear how to add new instructions.

llvm-svn: 168534
2012-11-24 03:10:54 +00:00
Rafael Espindola
f8d9d5032b Move a bit of duplicated code into a helper function.
llvm-svn: 168533
2012-11-24 02:18:49 +00:00
Rafael Espindola
edc8307796 Refactor how MCCFIInstructions are created.
Give MCCFIInstruction a single, private constructor and add helper static
methods that create each type of cfi instruction. This is is preparation
for changing its representation. The representation with a pair
MachineLocations older than MC and has been abused quiet a bit to support
more cfi instructions.

llvm-svn: 168532
2012-11-24 02:01:08 +00:00
Rafael Espindola
a6e1d5393f Implement .cfi_undefined. Based on a patch from PaX team, updated by
Roman Divacky. I just added the testcase.

llvm-svn: 168520
2012-11-23 16:59:41 +00:00
Adhemerval Zanella
ad392b0f93 PowerPC: add EmitTCEntry class for TOC creation
This patch replaces the EmitRawText by a EmitTCEntry class (specialized for
each Streamer) in PowerPC64 TOC entry creation.

llvm-svn: 165940
2012-10-15 15:43:14 +00:00
Jim Grosbach
dfe45ef6c5 Move [SU]LEB128 encoding to a utility header.
These functions are very generic. There's no reason for them to
be tied to MCObjectWriter.

llvm-svn: 161545
2012-08-08 23:56:06 +00:00
Jim Grosbach
343a996ca5 Refactor data-in-code annotations.
Use a dedicated MachO load command to annotate data-in-code regions.
This is the same format the linker produces for final executable images,
allowing consistency of representation and use of introspection tools
for both object and executable files.

Data-in-code regions are annotated via ".data_region"/".end_data_region"
directive pairs, with an optional region type.

data_region_directive := ".data_region" { region_type }
region_type := "jt8" | "jt16" | "jt32" | "jta32"
end_data_region_directive := ".end_data_region"

The previous handling of ARM-style "$d.*" labels was broken and has
been removed. Specifically, it didn't handle ARM vs. Thumb mode when
marking the end of the section.

rdar://11459456

llvm-svn: 157062
2012-05-18 19:12:01 +00:00
Benjamin Kramer
6fe4d97e20 Bump SmallString to the minimum required amount for raw_ostream to avoid allocation.
It's is a bit annoying, we should hide this implementation detail better.

llvm-svn: 151284
2012-02-23 21:15:21 +00:00
Craig Topper
639b152ca5 Convert assert(0) to llvm_unreachable
llvm-svn: 149967
2012-02-07 05:05:23 +00:00
Akira Hatanaka
874523adc5 Add a new MachineJumpTableInfo entry type, EK_GPRel64BlockAddress, which is
needed to emit a 64-bit gp-relative relocation entry. Make changes necessary
for emitting jump tables which have entries with directive .gpdword. This patch
does not implement the parts needed for direct object emission or JIT.

llvm-svn: 149668
2012-02-03 04:33:00 +00:00
Rafael Espindola
9f3a003d3c Add support for .cfi_signal_frame. Fixes pr11762.
llvm-svn: 148733
2012-01-23 21:51:52 +00:00
Rafael Espindola
7618aa1c64 Don't print an unused label before .cfi_endproc.
llvm-svn: 147763
2012-01-09 00:17:29 +00:00
Rafael Espindola
19a13321f8 Don't print a label before .cfi_startproc when we don't need to. This makes
the produce assembly when using CFI just a bit more readable.

llvm-svn: 147743
2012-01-07 22:42:19 +00:00
Rafael Espindola
2d545fa143 Split Finish into Finish and FinishImpl to have a common place to do end of
file error checking. Use that to error on an unfinished cfi_startproc.

The error is not nice, but is already better than a segmentation fault.

llvm-svn: 147717
2012-01-07 03:13:18 +00:00
Rafael Espindola
db7319d272 Implement cfi_restore. Patch by Brian Anderson!
llvm-svn: 147356
2011-12-29 21:43:03 +00:00
Rafael Espindola
bc8c3d0ca0 Rename Remember and Restore to RememberState and RestoreState for consistency.
llvm-svn: 147354
2011-12-29 21:09:08 +00:00
Rafael Espindola
27298c6f33 Implement .cfi_escape. Patch by Brian Anderson!
llvm-svn: 147352
2011-12-29 20:24:47 +00:00
Rafael Espindola
549d0683b1 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
f33f417d80 Twinify.
llvm-svn: 143811
2011-11-05 13:11:25 +00:00
Benjamin Kramer
4c8932e3b8 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
c551c1c5f9 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
e255773f3d 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
fc1e6fbc69 Initialize member variable.
llvm-svn: 138548
2011-08-25 04:04:18 +00:00
Evan Cheng
7bfc442b2d 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
cefc38659a 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
6211e2602f 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
1ae06d95e0 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
0a62f9906f Make EmitIntValue() work properly on big-endian targets.
llvm-svn: 132715
2011-06-07 17:31:02 +00:00
Charles Davis
5ebea6fc5f 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
823e8a90ce 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
32b363ded1 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
0021487a8e 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
d943eb05ed 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
a4187a96c9 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
d74119d139 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
a537e589c9 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
525855fe48 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
7f9c007dce 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
520128d52f 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
5e5cc95580 "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
97c81eee80 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