summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* Nuke MCAnalysis.Sean Silva2014-09-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is buggy and barely tested. It is also mostly boilerplate. (This includes MCObjectDisassembler, which is the interface to that functionality) Following an IRC discussion with Jim Grosbach, it seems sensible to just nuke the whole lot of functionality, and dig it up from VCS if necessary (I hope not!). All of this stuff appears to have been added in a huge patch dump (look at the timeframe surrounding e.g. r182628) where almost every patch seemed to be untested and not reviewed before being committed. Post-review responses to the patches were never addressed. I don't think any of it would have passed pre-commit review. I doubt anyone is depending on this, since this code appears to be extremely buggy. In limited testing that Michael Spencer and I did, we couldn't find a single real-world object file that wouldn't crash the CFG reconstruction stuff. The symbolizer stuff has O(n^2) behavior and so is not much use to anyone anyway. It seemed simpler to remove them as a whole. Most of this code is boilerplate, which is the only way it was able to scrape by 60% coverage. HEADSUP: Modules folks, some files I nuked were referenced from include/llvm/module.modulemap; I just deleted the references. Hopefully that is the right fix (one was a FIXME though!). llvm-svn: 216983
* MC: split Win64EHUnwindEmitter into a shared streamerSaleem Abdulrasool2014-08-071-0/+1
| | | | | | | | | | This changes Win64EHEmitter into a utility WinEH UnwindEmitter that can be shared across multiple architectures and a target specific bit which is overridden (Win64::UnwindEmitter). This enables sharing the section selection code across X86 and the intended use in ARM for emitting unwind information for Windows on ARM. llvm-svn: 215050
* Finish inverting the MC -> Object dependency.Rafael Espindola2014-07-231-3/+0
| | | | | | | There were still some disassembler bits in lib/MC, but their use of Object was only visible in the includes they used, not in the symbols. llvm-svn: 213808
* Invert the MC -> Object dependency.Rafael Espindola2014-07-031-0/+2
| | | | | | | | | Now that we have a lib/MC/MCAnalysis, the dependency was there just because of two helper classes. Move the two over to MC. This will allow IRObjectFile to parse inline assembly. llvm-svn: 212248
* Move CFG building code to a new lib/MC/MCAnalysis library.Rafael Espindola2014-07-021-6/+1
| | | | | | | The new library is 150KB on a Release+Asserts build, so it is quiet a bit of code that regular users of MC don't need to link with now. llvm-svn: 212209
* [ARM] [MC] Refactor the constant pool classesWeiming Zhao2014-06-181-0/+1
| | | | | | | | | | | ARMTargetStreamer implements ConstantPool and AssmeblerConstantPools to keep track of assembler-generated constant pools that are used for ldr-pseudo. When implementing ldr-pseudo for AArch64, these two classes can be reused. So this patch factors them out from ARM target to the general MC lib. llvm-svn: 211198
* Fix pr19645.Rafael Espindola2014-05-031-1/+0
| | | | | | | | | | | | | | | | The fix itself is fairly simple: move getAccessVariant to MCValue so that we replace the old weak expression evaluation with the far more general EvaluateAsRelocatable. This then requires that EvaluateAsRelocatable stop when it finds a non trivial reference kind. And that in turn requires the ELF writer to look harder for weak references. Last but not least, this found a case where we were being bug by bug compatible with gas and accepting an invalid input. I reported pr19647 to track it. llvm-svn: 207920
* Create MCTargetOptions.Evgeniy Stepanov2014-04-231-0/+1
| | | | | | | | | For now it contains a single flag, SanitizeAddress, which enables AddressSanitizer instrumentation of inline assembly. Patch by Yuri Gorshenin. llvm-svn: 206971
* MachO: Add linker-optimisation hint framework to MC.Tim Northover2014-03-291-0/+1
| | | | | | | | Another part of the ARM64 backend (so tests will be following soon). This is currently used by the linker to relax adrp/ldr pairs into nops where possible, though could well be more broadly applicable. llvm-svn: 205084
* Look through variables when computing relocations.Rafael Espindola2014-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given bar = foo + 4 .long bar MC would eat the 4. GNU as includes it in the relocation. The rule seems to be that a variable that defines a symbol is used in the relocation and one that does not define a symbol is evaluated and the result included in the relocation. Fixing this unfortunately required some other changes: * Since the variable is now evaluated, it would prevent the ELF writer from noticing the weakref marker the elf streamer uses. This patch then replaces that with a VariantKind in MCSymbolRefExpr. * Using VariantKind then requires us to look past other VariantKind to see .weakref bar,foo call bar@PLT doing this also fixes zed = foo +2 call zed@PLT so that is a good thing. * Looking past VariantKind means that the relocation selection has to use the fixup instead of the target. This is a reboot of the previous fixes for MC. I will watch the sanitizer buildbot and wait for a build before adding back the previous fixes. llvm-svn: 204294
* Remove MCPureStreamer.Rafael Espindola2014-02-271-1/+0
| | | | | | | We moved MCJIT to use native object formats a long time ago and R600 now uses ELF, so it was dead. llvm-svn: 202408
* Add a MCAsmInfoELF class and factor some code into it.Rafael Espindola2013-10-161-0/+1
| | | | | | We had a MCAsmInfoCOFF, but no common class for all the ELF MCAsmInfos before. llvm-svn: 192760
* MC CFG: Add YAML MCModule representation to enable MC CFG testing.Ahmed Bougacha2013-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like yaml ObjectFiles, this will be very useful for testing the MC CFG implementation (mostly MCObjectDisassembler), by matching the output with YAML, and for potential users of the MC CFG, by using it as an input. There isn't much to the actual format, it is just a serialization of the MCModule class. Of note: - Basic block references (pred/succ, ..) are represented by the BB's start address. - Just as in the MC CFG, instructions are MCInsts with a size. - Operands have a prefix representing the type (only register and immediate supported here). - Instruction opcodes are represented by their names; enum values aren't stable, enum names mostly are: usually, a change to a name would need lots of changes in the backend anyway. Same with registers. All in all, an example is better than 1000 words, here goes: A simple binary: Disassembly of section __TEXT,__text: _main: 100000f9c: 48 8b 46 08 movq 8(%rsi), %rax 100000fa0: 0f be 00 movsbl (%rax), %eax 100000fa3: 3b 04 25 48 00 00 00 cmpl 72, %eax 100000faa: 0f 8c 07 00 00 00 jl 7 <.Lend> 100000fb0: 2b 04 25 48 00 00 00 subl 72, %eax .Lend: 100000fb7: c3 ret And the (pretty verbose) generated YAML: --- Atoms: - StartAddress: 0x0000000100000F9C Size: 20 Type: Text Content: - Inst: MOV64rm Size: 4 Ops: [ RRAX, RRSI, I1, R, I8, R ] - Inst: MOVSX32rm8 Size: 3 Ops: [ REAX, RRAX, I1, R, I0, R ] - Inst: CMP32rm Size: 7 Ops: [ REAX, R, I1, R, I72, R ] - Inst: JL_4 Size: 6 Ops: [ I7 ] - StartAddress: 0x0000000100000FB0 Size: 7 Type: Text Content: - Inst: SUB32rm Size: 7 Ops: [ REAX, REAX, R, I1, R, I72, R ] - StartAddress: 0x0000000100000FB7 Size: 1 Type: Text Content: - Inst: RET Size: 1 Ops: [ ] Functions: - Name: __text BasicBlocks: - Address: 0x0000000100000F9C Preds: [ ] Succs: [ 0x0000000100000FB7, 0x0000000100000FB0 ] <snip> ... llvm-svn: 188890
* MC: Disassembled CFG reconstruction.Ahmed Bougacha2013-05-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch builds on some existing code to do CFG reconstruction from a disassembled binary: - MCModule represents the binary, and has a list of MCAtoms. - MCAtom represents either disassembled instructions (MCTextAtom), or contiguous data (MCDataAtom), and covers a specific range of addresses. - MCBasicBlock and MCFunction form the reconstructed CFG. An MCBB is backed by an MCTextAtom, and has the usual successors/predecessors. - MCObjectDisassembler creates a module from an ObjectFile using a disassembler. It first builds an atom for each section. It can also construct the CFG, and this splits the text atoms into basic blocks. MCModule and MCAtom were only sketched out; MCFunction and MCBB were implemented under the experimental "-cfg" llvm-objdump -macho option. This cleans them up for further use; llvm-objdump -d -cfg now generates graphviz files for each function found in the binary. In the future, MCObjectDisassembler may be the right place to do "intelligent" disassembly: for example, handling constant islands is just a matter of splitting the atom, using information that may be available in the ObjectFile. Also, better initial atom formation than just using sections is possible using symbols (and things like Mach-O's function_starts load command). This brings two minor regressions in llvm-objdump -macho -cfg: - The printing of a relocation's referenced symbol. - An annotation on loop BBs, i.e., which are their own successor. Relocation printing is replaced by the MCSymbolizer; the basic CFG annotation will be superseded by more related functionality. llvm-svn: 182628
* Add MCSymbolizer for symbolic/annotated disassembly.Ahmed Bougacha2013-05-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a basic first step towards symbolization of disassembled instructions. This used to be done using externally provided (C API) callbacks. This patch introduces: - the MCSymbolizer class, that mimics the same functions that were used in the X86 and ARM disassemblers to symbolize immediate operands and to annotate loads based off PC (for things like c string literals). - the MCExternalSymbolizer class, which implements the old C API. - the MCRelocationInfo class, which provides a way for targets to translate relocations (either object::RelocationRef, or disassembler C API VariantKinds) to MCExprs. - the MCObjectSymbolizer class, which does symbolization using what it finds in an object::ObjectFile. This makes simple symbolization (with no fancy relocation stuff) work for all object formats! - x86-64 Mach-O and ELF MCRelocationInfos. - A basic ARM Mach-O MCRelocationInfo, that provides just enough to support the C API VariantKinds. Most of what works in otool (the only user of the old symbolization API that I know of) for x86-64 symbolic disassembly (-tvV) works, namely: - symbol references: call _foo; jmp 15 <_foo+50> - relocations: call _foo-_bar; call _foo-4 - __cf?string: leaq 193(%rip), %rax ## literal pool for "hello" Stub support is the main missing part (because libObject doesn't know, among other things, about mach-o indirect symbols). As for the MCSymbolizer API, instead of relying on the disassemblers to call the tryAdding* methods, maybe this could be done automagically using InstrInfo? For instance, even though PC-relative LEAs are used to get the address of string literals in a typical Mach-O file, a MOV would be used in an ELF file. And right now, the explicit symbolization only recognizes PC-relative LEAs. InstrInfo should have already have most of what is needed to know what to symbolize, so this can definitely be improved. I'd also like to remove object::RelocationRef::getValueString (it seems only used by relocation printing in objdump), as simply printing the created MCExpr is definitely enough (and cleaner than string concats). llvm-svn: 182625
* Remove MCTargetAsmLexer and its derived classes now that edis,Roman Divacky2012-12-201-1/+0
| | | | | | its only user, is gone. llvm-svn: 170699
* Give MCRegisterInfo an implementation file.Jakob Stoklund Olesen2012-07-271-0/+1
| | | | | | | | Move some functions from MCRegisterInfo.h that don't need to be inline. This shrinks llc by 8K. llvm-svn: 160865
* Remove the logging streamer.Rafael Espindola2012-01-101-1/+0
| | | | llvm-svn: 147820
* build/CMake: Finish removal of add_llvm_library_dependencies.Daniel Dunbar2011-11-291-5/+0
| | | | llvm-svn: 145420
* Sort CMakeLists.txt.Benjamin Kramer2011-09-241-7/+5
| | | | llvm-svn: 140465
* Add new files to CMake.Owen Anderson2011-09-221-0/+2
| | | | llvm-svn: 140352
* Update CMake build.Benjamin Kramer2011-09-221-0/+2
| | | | llvm-svn: 140347
* Pacify virtual dtor warnings and cmake buildbots.Benjamin Kramer2011-08-081-0/+1
| | | | llvm-svn: 137060
* Rewrite the CMake build to use explicit dependencies between libraries,Chandler Carruth2011-07-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specified in the same file that the library itself is created. This is more idiomatic for CMake builds, and also allows us to correctly specify dependencies that are missed due to bugs in the GenLibDeps perl script, or change from compiler to compiler. On Linux, this returns CMake to a place where it can relably rebuild several targets of LLVM. I have tried not to change the dependencies from the ones in the current auto-generated file. The only places I've really diverged are in places where I was seeing link failures, and added a dependency. The goal of this patch is not to start changing the dependencies, merely to move them into the correct location, and an explicit form that we can control and change when necessary. This also removes a serialization point in the build because we don't have to scan all the libraries before we begin building various tools. We no longer have a step of the build that regenerates a file inside the source tree. A few other associated cleanups fall out of this. This isn't really finished yet though. After talking to dgregor he urged switching to a single CMake macro to construct libraries with both sources and dependencies in the arguments. Migrating from the two macros to that style will be a follow-up patch. Also, llvm-config is still generated with GenLibDeps.pl, which means it still has slightly buggy dependencies. The internal CMake 'llvm-config-like' macro uses the correct explicitly specified dependencies however. A future patch will switch llvm-config generation (when using CMake) to be based on these deps as well. This may well break Windows. I'm getting a machine set up now to dig into any failures there. If anyone can chime in with problems they see or ideas of how to solve them for Windows, much appreciated. llvm-svn: 136433
* Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to ↵Evan Cheng2011-07-261-1/+1
| | | | | | MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser. llvm-svn: 136027
* TargetAsmBackend has been renamed to MCAsmBackend.Evan Cheng2011-07-251-1/+1
| | | | llvm-svn: 136012
* Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where ↵Evan Cheng2011-07-231-0/+1
| | | | | | they belong. llvm-svn: 135833
* Fix the CMake build.Francois Pichet2011-07-201-0/+1
| | | | llvm-svn: 135573
* Introduce MCCodeGenInfo, which keeps information that can affect codegenEvan Cheng2011-07-191-0/+1
| | | | | | | (including compilation, assembly). Move relocation model Reloc::Model from TargetMachine to MCCodeGenInfo so it's accessible even without TargetMachine. llvm-svn: 135468
* - Added MCSubtargetInfo to capture subtarget features and schedulingEvan Cheng2011-07-011-0/+1
| | | | | | | | | itineraries. - Refactor TargetSubtarget to be based on MCSubtargetInfo. - Change tablegen generated subtarget info to initialize MCSubtargetInfo and hide more details from targets. llvm-svn: 134257
* Fix CMake build.NAKAMURA Takumi2011-06-291-0/+1
| | | | llvm-svn: 134055
* Make the COFF streamer emit unwind info when processing a .seh_handlerdataCharles Davis2011-05-221-0/+1
| | | | | | | | | | directive. Implement emission of Win64 EH unwind info. Pull in <cassert> in MCWin64EH.h so it can use the assert() macro. llvm-svn: 131832
* Make all static functions become static class methods. Move shared ↵Jan Sjödin2011-02-281-0/+1
| | | | | | (duplicated) functions to new MCELF class. llvm-svn: 126686
* Move library stuff out of the toplevel CMakeLists.txt file.Oscar Fuentes2011-02-181-0/+3
| | | | llvm-svn: 125968
* Remove the MCObjectFormat class.Rafael Espindola2010-12-181-1/+0
| | | | llvm-svn: 122147
* Stub out explicit MCELFObjectTargetWriter interface.Rafael Espindola2010-12-171-0/+1
| | | | llvm-svn: 122067
* MC/Mach-O: Stub out explicit MCMachObjectTargetWriter interface.Daniel Dunbar2010-12-161-0/+1
| | | | llvm-svn: 121973
* MC-JIT: Stub out "pure" streamer.Daniel Dunbar2010-11-171-0/+1
| | | | | | - No immediate use, but maybe someone feels like hacking on it. llvm-svn: 119510
* Add a MCObjectFormat class so that code common to all targets that use aRafael Espindola2010-10-161-0/+1
| | | | | | | | | | | | single object format can be shared. This also adds support for mov zed+(bar-foo), %eax on ELF and COFF targets. llvm-svn: 116675
* Add ELF ObjectWriter and Streamer support.Matt Fleming2010-08-161-0/+2
| | | | llvm-svn: 111172
* Added first bit of support for the dwarf .file directive. This patch collectsKevin Enderby2010-07-281-0/+1
| | | | | | | the info from the .file directive and makes file and directory tables that will eventually be put out as part of the dwarf info in the output file. llvm-svn: 109651
* introduce WinCOFFObjectWriter, patch by Michael Spencer!Chris Lattner2010-07-111-0/+1
| | | | llvm-svn: 108103
* introduce WinCOFFStreamer.cpp, patch by Michael Spencer!Chris Lattner2010-07-111-0/+1
| | | | llvm-svn: 108102
* MC: Factor out an MCObjectStreamer class, which will be shared by the concreteDaniel Dunbar2010-06-161-0/+1
| | | | | | object file format writers. llvm-svn: 106140
* MC: Add an MCLoggingStreamer, for use in debugging integrated-as mismatches.Daniel Dunbar2010-05-231-0/+1
| | | | llvm-svn: 104463
* Added support in MC for Directional Local Labels.Kevin Enderby2010-05-171-0/+1
| | | | llvm-svn: 103989
* Update CMake build.Ted Kremenek2010-05-071-0/+1
| | | | llvm-svn: 103269
* MC/Mach-O: Move to MachObjectWriter.{h,cpp}.Daniel Dunbar2010-03-191-0/+1
| | | | llvm-svn: 98952
* MC: Split MCObjectWriter out of MCAssembler.cpp.Daniel Dunbar2010-03-191-0/+1
| | | | llvm-svn: 98949
* MC/X86: Add stub AsmBackend.Daniel Dunbar2010-02-211-0/+1
| | | | llvm-svn: 96763
OpenPOWER on IntegriCloud