summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectStreamer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a default implementation of createObjectStreamer.Rafael Espindola2015-03-181-0/+14
| | | | | | | This removes duplicated code from backends that don't need to do anything fancy. llvm-svn: 232658
* Fix uses of reserved identifiers starting with an underscore followed by an ↵David Blaikie2015-03-161-2/+2
| | | | | | | | | uppercase letter This covers essentially all of llvm's headers and libs. One or two weird cases I wasn't sure were worth/appropriate to fix. llvm-svn: 232394
* Clean up static analyzer warnings.Michael Ilseman2014-12-121-1/+3
| | | | | | | | | Clang's static analyzer found several potential cases of undefined behavior, use of un-initialized values, and potentially null pointer dereferences in tablegen, Support, MC, and ADT. This cleans them up with specific assertions on the assumptions of the code. llvm-svn: 224154
* Revert r221150, as it broke sanitizer testsOliver Stannard2014-11-031-7/+4
| | | | llvm-svn: 221151
* Emit .eh_frame with relocations to functions, rather than sectionsOliver Stannard2014-11-031-4/+7
| | | | | | | | | | | | | | | | | | | | | | | When LLVM emits DWARF call frame information, it currently creates a local, section-relative symbol in the code section, which is pointed to by a relocation on the .eh_frame section. However, for C++ we emit some functions in section groups, and the SysV ABI has some rules to make it easier to remove these sections (http://www.sco.com/developers/gabi/latest/ch4.sheader.html#section_group_rules): A symbol table entry with STB_LOCAL binding that is defined relative to one of a group's sections, and that is contained in a symbol table section that is not part of the group, must be discarded if the group members are discarded. References to this symbol table entry from outside the group are not allowed. This means that we need to use the function symbol for the relocation, not a temporary symbol. There was a comment in the code claiming that the local symbol was used to avoid creating a relocation, but a relocation must be created anyway as the code and CFI are in different sections. llvm-svn: 221150
* Attempt to fix the build after r220439David Majnemer2014-10-221-1/+1
| | | | llvm-svn: 220440
* [MC] Attach labels to existing fragments instead of using a separate fragmentDerek Schuff2014-10-221-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently when emitting a label, a new data fragment is created for it if the current fragment isn't a data fragment. This change instead enqueues the label and attaches it to the next fragment (e.g. created for the next instruction) if possible. When bundle alignment is not enabled, this has no functionality change (it just results in fewer extra fragments being created). For bundle alignment, previously labels would point to the beginning of the bundle padding instead of the beginning of the emitted instruction. This was not only less efficient (e.g. jumping to the nops instead of past them) but also led to miscalculation of the address of the GOT (since MC uses a label difference rather than emitting a "." symbol). Fixes https://code.google.com/p/nativeclient/issues/detail?id=3982 Test Plan: regression test attached Reviewers: jvoung, eliben Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D5915 llvm-svn: 220439
* Make EmitDwarfSetLineAddr an static helper. NFC.Rafael Espindola2014-08-151-1/+13
| | | | llvm-svn: 215718
* Make BuildSymbolDiff an static helper.Rafael Espindola2014-08-151-2/+13
| | | | llvm-svn: 215717
* Add a helper to MCExpr for when an expression is know to be absolute.Rafael Espindola2014-08-151-4/+0
| | | | llvm-svn: 215713
* Merge the used symbol scanning of MCObjectStreamer and RecordStreamer.Rafael Espindola2014-06-251-7/+4
| | | | | | This completes the refactoring of RecordStreamer. llvm-svn: 211727
* Move expression visitation logic up to MCStreamer.Rafael Espindola2014-06-251-26/+0
| | | | | | Remove the duplicate from MCRecordStreamer. No functionality change. llvm-svn: 211714
* Simplify the visitation of target expressions. No functionality change.Rafael Espindola2014-06-251-11/+15
| | | | llvm-svn: 211707
* Simplify AddValueSymbols. No functionality change.Rafael Espindola2014-06-251-4/+3
| | | | llvm-svn: 211701
* Simplify the handling of .cfi_endproc.Rafael Espindola2014-06-251-2/+5
| | | | | | No functionality change. llvm-svn: 211651
* Print a=b as an assignment.Rafael Espindola2014-06-241-4/+0
| | | | | | | | | | | In assembly the expression a=b is parsed as an assignment, so it should be printed as one. This remove a truly horrible hack for producing a label with "a=.". It would be used by codegen but would never be reached by the asm parser. Sorry I missed this when it was first committed. llvm-svn: 211639
* Move EH/Debug frame handling to the object streamer.Rafael Espindola2014-05-121-2/+22
| | | | | | | Now that the asm streamer doesn't use it, the MCStreamer doesn't need to know about it. llvm-svn: 208562
* Fix the assembler to print a better relocatable expression errorKevin Enderby2014-04-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic that includes location information. Currently if one has this assembly: .quad (0x1234 + (4 * SOME_VALUE)) where SOME_VALUE is undefined ones gets the less than useful error message with no location information: % clang -c x.s clang -cc1as: fatal error: error in backend: expected relocatable expression With this fix one now gets a more useful error message with location information: % clang -c x.s x.s:5:8: error: expected relocatable expression .quad (0x1234 + (4 * SOME_VALUE)) ^ To do this I plumbed the SMLoc through the MCObjectStreamer EmitValue() and EmitValueImpl() interfaces so it could be used when creating the MCFixup. rdar://12391022 llvm-svn: 206906
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-131-4/+4
| | | | | | check instead of comparing to nullptr. llvm-svn: 206129
* Revert debug info compression support.David Blaikie2014-04-101-6/+1
| | | | | | | | | | To support compression for debug_line and debug_frame a different approach is required. To simplify review, revert the old implementation and XFAIL the test case. New implementation to follow shortly. Reverts r205059 and r204958. llvm-svn: 205989
* DebugInfo: Emit relocation to debug_line section when emitting asm for asmDavid Blaikie2014-04-011-6/+4
| | | | | | | | | | | | | | I don't think this is reachable by any frontend (why would you transform asm to asm+debug info?) but it helps tidy up some of this code, avoid the weird special case of "emit the first CU, store the label, then emit the rest" in MCDwarfLineTable::Emit by instead having the DWARF-for-assembly case use the same codepath as DwarfDebug.cpp, by registering the label of the debug_line section, thus causing it to be emitted. (with a special case in asm output to just emit the label since asm output uses the .loc directives, etc, rather than the debug_loc directly) llvm-svn: 205286
* DebugInfo: Support for compressed debug info sectionsDavid Blaikie2014-03-271-1/+6
| | | | | | | | | | | | | | | | | | | 1) When creating a .debug_* section and instead create a .zdebug_ section. 2) When creating a fragment in a .zdebug_* section, make it a compressed fragment. 3) When computing the size of a compressed section, compress the data and use the size of the compressed data. 4) Emit the compressed bytes. Also, check that only if a section has a compressed fragment, then that is the only fragment in the section. Assert-fail if the fragment's data is modified after it is compressed. Initial review on llvm-commits by Eric Christopher and Rafael Espindola. llvm-svn: 204958
* Mark alias symbols as microMIPS if necessary. Differential Revision: ↵Zoran Jovanovic2014-03-201-1/+2
| | | | | | http://llvm-reviews.chandlerc.com/D3080 llvm-svn: 204323
* MCDwarf: Rename MCDwarfFileTable to MCDwarfLineTableDavid Blaikie2014-03-131-1/+1
| | | | | | | This type now represents all the data for the DWARF line table: directory names, file names, and the line table proper. llvm-svn: 203858
* MCDwarf: Refactor line table handling into a single data structureDavid Blaikie2014-03-131-2/+1
| | | | | | | | | | | | | | | | | This replaces several "compile unit ID -> thing" mappings in favor of one mapping from CUID to the whole line table structure (files, directories, and lines). This is another step along the way to refactoring out reusable components of line table handling for use when generating debug_line.dwo for fission type units. Also, might be a good basis to fold some of this handling down into MCStreamers to avoid the special case of "One line table when doing asm printing, line table per CU otherwise" by building it into the different MCStreamer implementations. llvm-svn: 203821
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-021-1/+1
| | | | | | Remove the old functions. llvm-svn: 202636
* DebugInfo: Don't include the name of the CU file in the line table file list ↵David Blaikie2014-02-141-1/+2
| | | | | | | | | | | | | | | | | | | | when it's unneeded Recommitting r201380 (reverted in r201389) Recommitting r201351 and r201355 (reverted in r201351 and r201355) We weren't emitting the an empty (header only) line table when the line table was empty - this made the DWARF invalid (the compile unit would point to the zero-size debug_lines section where there should've been an empty line table but there was nothing at all). Fix that, and as a consequence this works around/addresses PR18809. Also, we emit a non-empty line table to workaround a darwin linker bug, so XFAILing on darwin too. Also, mark the test as 'REQUIRES: object-emission' because it does. llvm-svn: 201429
* Revert "DebugInfo: Don't include the name of the CU file in the line table ↵Eric Christopher2014-02-141-2/+1
| | | | | | | | file list when it's unneeded" This reverts commit r201380 for now while we investigate. llvm-svn: 201389
* DebugInfo: Don't include the name of the CU file in the line table file list ↵David Blaikie2014-02-141-1/+2
| | | | | | | | | | | | | | when it's unneeded Recommitting r201351 and r201355 (reverted in r201351 and r201355) We weren't emitting the an empty (header only) line table when the line table was empty - this made the DWARF invalid (the compile unit would point to the zero-size debug_lines section where there should've been an empty line table but there was nothing at all). Fix that, and as a consequence this works around/addresses PR18809. llvm-svn: 201380
* Explictly pass MCSubtargetInfo to MCCodeEmitter::EncodeInstruction()David Woodhouse2014-01-281-1/+2
| | | | llvm-svn: 200348
* Keep the MCSubtargetInfo in the MCRelxableFragment class.David Woodhouse2014-01-281-1/+1
| | | | | | | | | | | Needed to fix PR18303 to correctly re-encode the instruction if it is relaxed. We keep a copy of the MCSubtargetInfo to make sure that we are not effected by future changes to the subtarget info coming from the assembler (e.g. when parsing .code 16 directived). llvm-svn: 200347
* Modify MCObjectStreamer EmitInstTo* interfaceDavid Woodhouse2014-01-281-4/+5
| | | | | | | | Add MCSubtargetInfo parameter virtual void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &); virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &); llvm-svn: 200346
* Change MCStreamer EmitInstruction interface to take subtarget infoDavid Woodhouse2014-01-281-1/+1
| | | | llvm-svn: 200345
* Construct the MCStreamer before constructing the MCTargetStreamer.Rafael Espindola2014-01-261-11/+6
| | | | | | | | | | This has a few advantages: * Only targets that use a MCTargetStreamer have to worry about it. * There is never a MCTargetStreamer without a MCStreamer, so we can use a reference. * A MCTargetStreamer can talk to the MCStreamer in its constructor. llvm-svn: 200129
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* Emit DWARF line entries for all data in the instruction stream.Peter Collingbourne2013-10-201-0/+1
| | | | | | | r182712 attempted to do this, but it failed to handle data emitted via EmitBytes. llvm-svn: 193041
* Add a MCTargetStreamer interface.Rafael Espindola2013-10-081-6/+11
| | | | | | | | | | | | | This patch fixes an old FIXME by creating a MCTargetStreamer interface and moving the target specific functions for ARM, Mips and PPC to it. The ARM streamer is still declared in a common place because it is used from lib/CodeGen/ARMException.cpp, but the Mips and PPC are completely hidden in the corresponding Target directories. I will send an email to llvmdev with instructions on how to use this. llvm-svn: 192181
* Remove some really nasty uses of hasRawTextSupport.Rafael Espindola2013-10-051-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When MC was first added, targets could use hasRawTextSupport to keep features working before they were added to the MC interface. The design goal of MC is to provide an uniform api for printing assembly and object files. Short of relaxations and other corner cases, a object file is just another representation of the assembly. It was never the intention that targets would keep doing things like if (hasRawTextSupport()) Set flags in one way. else Set flags in another way. When they do that they create two code paths and the object file is no longer just another representation of the assembly. This also then requires testing with llc -filetype=obj, which is extremelly brittle. This patch removes some of these hacks by replacing them with smaller ones. The ARM flag setting is trivial, so I just moved it to the constructor. For Mips, the patch adds two temporary hack directives that allow the assembly to represent the same things as the object file was already able to. The hope is that the mips developers will replace the hack directives with the same ones that gas uses and drop the -print-hack-directives flag. I will also try to implement a target streamer interface, so that we can move this out of the common code. In summary, for any new work, two rules of the thumb are * Don't use "llc -filetype=obj" in tests. * Don't add calls to hasRawTextSupport. llvm-svn: 192035
* Add 'const' qualifiers to static const char* variables.Craig Topper2013-07-161-1/+1
| | | | llvm-svn: 186371
* Remove address spaces from MC.Rafael Espindola2013-07-021-11/+5
| | | | | | | | This is dead code since PIC16 was removed in 2010. The result was an odd mix, where some parts would carefully pass it along and others would assert it was zero (most of the object streamer for example). llvm-svn: 185436
* Use MCFillFragment for zero-initialized data.Serge Pavlov2013-06-271-0/+7
| | | | | | | | It fixes PR16338 (ICE when compiling very large two-dimensional array). Differential Revision: http://llvm-reviews.chandlerc.com/D1043 llvm-svn: 185080
* [MC/DWARF] Generate multiple .debug_line entries for adjacent .loc directivesUlrich Weigand2013-06-191-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | The compiler occasionally generates multiple .loc directives in a row (at the same instruction address). These need to be transformed into multple actual .debug_line table entries, since they are used to signal certain information to the debugger (e.g. if the opening brace of a function body is on the same line as the declaration). The MCAsmStreamer version of EmitDwarfLocDirective handles this correctly by emitting a .loc directive every time it is called. However, the MCObjectStream version simply defaults to recording the information and emitting only a single table entry later, e.g. when EmitInstruction is called. This patch introduces a MCAsmStreamer::EmitDwarfLocDirective version that emits a line table entry for a .loc directive that may already be pending before recording the new directive. (This is similar to how this is handled in GNU as.) With this patch (and the code alignment factor patch) applied, I'm now getting identical DWARF .debug sections for all test-suite object files on PowerPC for the internal and the external assembler. llvm-svn: 184357
* Add support for DWARF line number table entries for values in the instructionCameron Zwarich2013-05-251-0/+2
| | | | | | stream. llvm-svn: 182712
* Add support for subsections to the ELF assembler. Fixes PR8717.Peter Collingbourne2013-04-171-15/+28
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D598 llvm-svn: 179725
* Suppress a GCC -Wunused-variable warning in -Asserts buildsMatt Beaumont-Gay2013-02-151-0/+2
| | | | llvm-svn: 175319
* If bundle alignment is enabled, do not add data to a fragment with instructionsDerek Schuff2013-02-151-1/+3
| | | | | | | | | | | | With bundle alignment, instructions all get their own MCFragments (unless they are in a bundle-locked group). For instructions with fixups, this is an MCDataFragment. Emitting actual data (e.g. for .long) attempts to re-use MCDataFragments, which we don't want int this case since it leads to fragments which exceed the bundle size. So, don't reuse them in this case. Also adds a test and fixes some formatting. llvm-svn: 175316
* Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C ↵Benjamin Kramer2013-02-151-1/+1
| | | | | | linkage. llvm-svn: 175264
* Give the MCStreamer class hierarchy LLVM RTTI facilities for use withChandler Carruth2013-01-311-15/+12
| | | | | | | | | | | | | | | | 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
* These functions have default arguments of 0 for the last arg. UseEric Christopher2013-01-091-1/+1
| | | | | | them and add one where it seemed obvious that we wanted one. llvm-svn: 171932
* Renamed MCInstFragment to MCRelaxableFragment and added some comments.Eli Bendersky2013-01-081-1/+2
| | | | | | No change in functionality. llvm-svn: 171822
OpenPOWER on IntegriCloud