summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement the JIT side of the GDB JIT debugging interface. To enable thisReid Kleckner2009-09-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature, either build the JIT in debug mode to enable it by default or pass -jit-emit-debug to lli. Right now, the only debug information that this communicates to GDB is call frame information, since it's already being generated to support exceptions in the JIT. Eventually, when DWARF generation isn't tied so tightly to AsmPrinter, it will be easy to push that information to GDB through this interface. Here's a step-by-step breakdown of how the feature works: - The JIT generates the machine code and DWARF call frame info (.eh_frame/.debug_frame) for a function into memory. - The JIT copies that info into an in-memory ELF file with a symbol for the function. - The JIT creates a code entry pointing to the ELF buffer and adds it to a linked list hanging off of a global descriptor at a special symbol that GDB knows about. - The JIT calls a function marked noinline that GDB knows about and has put an internal breakpoint in. - GDB catches the breakpoint and reads the global descriptor to look for new code. - When sees there is new code, it reads the ELF from the inferior's memory and adds it to itself as an object file. - The JIT continues, and the next time we stop the program, we are able to produce a proper backtrace. Consider running the following program through the JIT: #include <stdio.h> void baz(short z) { long w = z + 1; printf("%d, %x\n", w, *((int*)NULL)); // SEGFAULT here } void bar(short y) { int z = y + 1; baz(z); } void foo(char x) { short y = x + 1; bar(y); } int main(int argc, char** argv) { char x = 1; foo(x); } Here is a backtrace before this patch: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x2aaaabdfbd10 (LWP 25476)] 0x00002aaaabe7d1a8 in ?? () (gdb) bt #0 0x00002aaaabe7d1a8 in ?? () #1 0x0000000000000003 in ?? () #2 0x0000000000000004 in ?? () #3 0x00032aaaabe7cfd0 in ?? () #4 0x00002aaaabe7d12c in ?? () #5 0x00022aaa00000003 in ?? () #6 0x00002aaaabe7d0aa in ?? () #7 0x01000002abe7cff0 in ?? () #8 0x00002aaaabe7d02c in ?? () #9 0x0100000000000001 in ?? () #10 0x00000000014388e0 in ?? () #11 0x00007fff00000001 in ?? () #12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, F=0x14024e0, ArgValues=@0x7fffffffe050) at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 #13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain (this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 #14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398, envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 And a backtrace after this patch: Program received signal SIGSEGV, Segmentation fault. 0x00002aaaabe7d1a8 in baz () (gdb) bt #0 0x00002aaaabe7d1a8 in baz () #1 0x00002aaaabe7d12c in bar () #2 0x00002aaaabe7d0aa in foo () #3 0x00002aaaabe7d02c in main () #4 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, F=0x14024e0, ArgValues=...) at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 #5 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain (this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 #6 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8, envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 llvm-svn: 82418
* tidy upChris Lattner2009-09-201-3/+3
| | | | llvm-svn: 82397
* --- Reverse-merging r82282 into '.':Bill Wendling2009-09-202-53/+22
| | | | | | | | | | | | | U lib/CodeGen/AsmPrinter/DwarfException.cpp U lib/CodeGen/AsmPrinter/DwarfException.h --- Reverse-merging r82274 into '.': U lib/Target/TargetLoweringObjectFile.cpp G lib/CodeGen/AsmPrinter/DwarfException.cpp These revisions were breaking everything. llvm-svn: 82396
* Tabs -> spaces, and remove trailing whitespace.Daniel Dunbar2009-09-204-142/+142
| | | | llvm-svn: 82355
* Here's fun! It turns out that these filter functions can be internal. If they'reBill Wendling2009-09-201-1/+2
| | | | | | | | internal, they shouldn't use the indirect pointer stuff. In the case of throw_rethrow_test, it was marked as 'internal' and calculated its own offset to its contents. llvm-svn: 82354
* When computing live intervals for earlyclobber operands,Dale Johannesen2009-09-201-3/+16
| | | | | | | | | | we pushed the beginning of the interval back 1, so the interval would overlap with inputs that die. We were also pushing the end of the interval back 1, though, which means the earlyclobber didn't overlap with other output operands. Don't do this. PR 4964. llvm-svn: 82342
* Fix indentation.Daniel Dunbar2009-09-191-76/+76
| | | | llvm-svn: 82333
* Strip trailing whitespace.Daniel Dunbar2009-09-191-17/+17
| | | | llvm-svn: 82332
* Remove the default value for ConstantStruct::get's isPacked parameter andNick Lewycky2009-09-191-2/+3
| | | | | | update the code which was broken by this. llvm-svn: 82327
* Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic ↵Evan Cheng2009-09-191-6/+8
| | | | | | blocks and update CFG, it should also inform sdisel of the changes so the phi source operands will come from the right basic blocks. llvm-svn: 82311
* Fix a comment typo and some whitespace.Bob Wilson2009-09-181-2/+2
| | | | llvm-svn: 82285
* Factor out label difference creation.Bill Wendling2009-09-182-35/+30
| | | | llvm-svn: 82282
* It's inefficient to have place the exception tables (which contain the LSDA)Bill Wendling2009-09-181-5/+40
| | | | | | | | | into the __DATA section. At launch time, dyld has to update most of the section to fix up the type info pointers. It's better to place it into the __TEXT section and use pc-rel indirect pointer encodings. Similar to the personality routine. llvm-svn: 82274
* Enhance EmitInstrWithCustomInserter() so target can specify CFG changes that ↵Evan Cheng2009-09-188-19/+41
| | | | | | | | sdisel will use to properly complete phi nodes. Not functionality change yet. llvm-svn: 82273
* add a new hook to allow targets to splat stuff at the end of the file.Chris Lattner2009-09-181-0/+5
| | | | | | Overriding doFinalization is pretty lame. llvm-svn: 82268
* duncan points out the EH selector values are signed.Chris Lattner2009-09-181-1/+1
| | | | llvm-svn: 82245
* Allow symbols to start from the digit if target requests it. This allows, ↵Anton Korobeynikov2009-09-181-0/+3
| | | | | | | | | e.g. pinning variables to specified absolute address. Make use of this feature for MSP430. This unbreaks PR4776. llvm-svn: 82227
* Revert r82214. It broke 403.gcc on x86_64 / Darwin.Evan Cheng2009-09-181-12/+5
| | | | llvm-svn: 82215
* Fix a bug in sdisel switch lowering code. When it updates the phi nodes in ↵Evan Cheng2009-09-181-5/+12
| | | | | | | | switch successor blocks, it can introduce multiple phi operands of the same value from different blocks (and may not be on the predecessor list). This can be seen on CodeGen/Generic/2006-09-06-SwitchLowering.ll. But it's not known to cause any real regression (but I have added an assertion for it now). llvm-svn: 82214
* tolerate llvm.eh.selector.i64 on 32-bit systems and llvm.eh.selector.i32 onChris Lattner2009-09-171-21/+24
| | | | | | 64-bit systems. llvm-svn: 82180
* pass machinemoduleinfo down into getSymbolForDwarfGlobalReference, Chris Lattner2009-09-171-0/+1
| | | | | | currently unused. llvm-svn: 82157
* grammarJim Grosbach2009-09-171-1/+1
| | | | llvm-svn: 82150
* Remove simple regalloc. It has bit rotted.Evan Cheng2009-09-172-262/+0
| | | | llvm-svn: 82127
* Fix PR4910: Broken logic in coalescer means when a physical register ↵Evan Cheng2009-09-171-3/+4
| | | | | | liveness is being shortened, the sub-registers were not. The symptom is the register allocator could not find a free register for this particular test. llvm-svn: 82108
* Fix typo.Devang Patel2009-09-161-1/+1
| | | | llvm-svn: 82080
* At iSel time, update DebugLoc based on debug info attached with an instruction.Devang Patel2009-09-161-1/+30
| | | | llvm-svn: 82077
* Add a new pass for doing late hoisting of floating-point and vectorDan Gohman2009-09-161-1/+6
| | | | | | | | | | | constants out of loops. These aren't covered by the regular LICM pass, because in LLVM IR constants don't require separate instructions. They're not always covered by the MachineLICM pass either, because it doesn't know how to unfold folded constant-pool loads. This is somewhat experimental at this point, and off by default. llvm-svn: 82076
* Don't sort the vector when it is empty. This should fix some expensive checkingBenjamin Kramer2009-09-161-1/+2
| | | | | | failures. llvm-svn: 82040
* updated lib/CodeGen/CMakeLists.txt to unbreak cmake build after r82018Xerxes Ranby2009-09-161-0/+1
| | | | llvm-svn: 82038
* add a new MachineModuleInfoMachO class, which is the per-moduleChris Lattner2009-09-161-0/+44
| | | | | | stuff common across all macho targets. llvm-svn: 82018
* the pointer MMI keeps will start out with object-file format specific stuffChris Lattner2009-09-161-2/+2
| | | | llvm-svn: 82012
* remove the AsmPrinter::printMCInst hook hack now thatChris Lattner2009-09-161-4/+0
| | | | | | we have MCInstPrinter. llvm-svn: 82006
* Big change #1 for personality function references:Chris Lattner2009-09-161-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | Eliminate the PersonalityPrefix/Suffix & NeedsIndirectEncoding fields from MAI: they aren't part of the asm syntax, they are related to the structure of the object file. To replace their functionality, add a new TLOF::getSymbolForDwarfGlobalReference method which asks targets to decide how to reference a global from EH in a pc-relative way. The default implementation just returns the symbol. The default darwin implementation references the symbol through an indirect $non_lazy_ptr stub. The bizarro x86-64 darwin specialization handles the weird "foo@GOTPCREL+4" hack. DwarfException.cpp now uses this to emit the reference to the symbol in the right way, and this also eliminates another horrible hack from DwarfException.cpp: - if (strcmp(MAI->getPersonalitySuffix(), "+4@GOTPCREL")) - O << "-" << MAI->getPCSymbol(); llvm-svn: 81991
* inline AsmPrinter::getCurrentFunctionEHName into its only caller.Chris Lattner2009-09-162-11/+6
| | | | llvm-svn: 81970
* Eliminate AsmPrinter::EmitExternalGlobal, inlining its (now)Chris Lattner2009-09-162-8/+1
| | | | | | | | one implementation into its one caller. This eliminates a totally awesome and gratuitous hack where we casted a Function* to GlobalVariable*. llvm-svn: 81967
* eliminate the horrid AsmPrinter::getGlobalLinkName method, inliningChris Lattner2009-09-163-15/+4
| | | | | | it into all of its call sites and simplifying them. llvm-svn: 81962
* remove some horrible MAI hooks which fortunately turn out to be always empty.Chris Lattner2009-09-151-22/+3
| | | | llvm-svn: 81946
* strength reduce a call to PrintRelDirective(true).Chris Lattner2009-09-151-1/+3
| | | | llvm-svn: 81942
* add hooks to hang target-specific goop off MachineModuleInfo,Chris Lattner2009-09-152-7/+10
| | | | | | | move MachineFunctionInfo virtual method out of line to give it a home. llvm-svn: 81940
* Do not add the SVOffset to the Node CSE ID. The same pointer argument ↵Nate Begeman2009-09-151-5/+0
| | | | | | | | cannot have different SVOffsets. llvm-svn: 81937
* Expand on comment.Eric Christopher2009-09-151-1/+4
| | | | llvm-svn: 81928
* Fix -Asserts warning.Daniel Dunbar2009-09-151-1/+2
| | | | llvm-svn: 81909
* Better solution for tracking both the original alignment of the access, and ↵Nate Begeman2009-09-153-44/+33
| | | | | | | | the current alignment based on the source value offset. This avoids increasing the size of mem nodes. llvm-svn: 81897
* Another try at early partial coalescing. Identity phi source copies (their ↵Evan Cheng2009-09-151-58/+56
| | | | | | | | sources are defined by phi join def) are coalesced. And the phi join copy is backward copy propagated into the other copies. Still miscompiling some tests. :-( llvm-svn: 81849
* Remove incorrect CSE code from r81813.Nate Begeman2009-09-151-2/+0
| | | | llvm-svn: 81819
* Substantially speed up combiner-aa in the following ways:Nate Begeman2009-09-151-33/+69
| | | | | | | | | | | | | | 1. Switch from an std::set to a SmallPtrSet for visited chain nodes. 2. Do not force the recursive flattening of token factor nodes, regardless of use count. 3. Immediately process newly created TokenFactor nodes. Also, improve combiner-aa by teaching it that loads to non-overlapping offsets of relatively aligned objects cannot alias. These changes result in a >5x speedup for combiner-aa on most testcases. llvm-svn: 81816
* Teach the legalizer to propagate the original alignment of loads and store whenNate Begeman2009-09-151-6/+11
| | | | | | it splits them. llvm-svn: 81815
* Add an "original alignment" field to load and store nodes. This enables theNate Begeman2009-09-152-19/+28
| | | | | | | DAG Combiner to disambiguate chains for loads and stores of types which are broken up by the Legalizer into smaller pieces. llvm-svn: 81813
* Add early coalescing to liveintervals. This is work in progress and is known ↵Evan Cheng2009-09-141-24/+164
| | | | | | | | to miscompute some tests. Read it at your own rish, I have aged 10 year while writing this. The gist of this is if source of some of the copies that feed into a phi join is defined by the phi join, we'd like to eliminate them. However, if any of the non-identity source overlaps the live interval of the phi join then the coalescer won't be able to coalesce them. The early coalescer's job is to eliminate the identity copies by partially-coalescing the two live intervals. llvm-svn: 81796
* Pull the creation of the "RewindFunction" function out of the loop. It's onlyBill Wendling2009-09-141-14/+25
| | | | | | | created once, so shouldn't be stuck in the middle of the loop. Also early exit if there are no uses of UnwindInst in the function. llvm-svn: 81785
OpenPOWER on IntegriCloud