summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ms-inline asm] Split the parsing of IR asm strings into GCC and MS variants.Chad Rosier2012-09-111-67/+158
| | | | | | Add support in the EmitMSInlineAsmStr() function for handling integer consts. llvm-svn: 163645
* [ms-inline asm] Properly emit the asm directives when the AsmPrinterVariantChad Rosier2012-09-101-1/+17
| | | | | | and InlineAsmVariant don't match. llvm-svn: 163550
* [ms-inline asm] Pass the correct AsmVariant to the PrintAsmOperand() functionChad Rosier2012-09-101-3/+4
| | | | | | and update the printOperand() function accordingly. llvm-svn: 163544
* Fix indent.Chad Rosier2012-09-071-2/+2
| | | | llvm-svn: 163416
* Update function names to conform to guidelines. No functional change intended.Chad Rosier2012-09-071-4/+4
| | | | llvm-svn: 163401
* [ms-inline asm] Use the asm dialect from the MI to set the parser dialect.Chad Rosier2012-09-051-2/+4
| | | | llvm-svn: 163273
* The inline asm operand modifier 'n' is suppose Jack Carter2012-06-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | to be generic across architectures. It has the following description in the gnu sources: Negate the immediate constant Several Architectures such as x86 have local implementations of operand modifier 'n' which go beyond the above description slightly. This won't affect them. Affected files: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Added 'n' to the switch cases. test/CodeGen/Generic/asm-large-immediate.ll Generic compiled test (x86 for me) test/CodeGen/Mips/asm-large-immediate.ll Mips compiled version of the generic one Contributer: Jack Carter llvm-svn: 158939
* The inline asm operand modifier 'c' is suppose Jack Carter2012-06-211-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to be generic across architectures. It has the following description in the gnu sources: Substitute immediate value without immediate syntax Several Architectures such as x86 have local implementations of operand modifier 'c' which go beyond the above description slightly. To make use of the generic modifiers without overriding local implementation one can make a call to the base class method for AsmPrinter::PrintAsmOperand() in the locally derived method's "default" case in the switch statement. That way if it is already defined locally the generic version will never get called. This change is needed when test/CodeGen/generic/asm-large-immediate.ll failed on a native Mips board. The test was assuming a generic implementation was in place. Affected files: lib/Target/Mips/MipsAsmPrinter.cpp: Changed the default case to call the base method. lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Added 'c' to the switch cases. test/CodeGen/Mips/asm-large-immediate.ll Mips compiled version of the generic one Contributer: Jack Carter llvm-svn: 158925
* Formatting fixes.Akira Hatanaka2012-05-081-4/+4
| | | | | | Patch by Jack Carter. llvm-svn: 156409
* In erroneous inline assembly we could mistakenly try to access theEric Christopher2012-03-221-1/+5
| | | | | | | | | metadata operand as an actual operand, leading to an assert. Error out in this case. rdar://11007633 llvm-svn: 153234
* Tidy up. Whitepsace.Jim Grosbach2011-09-211-3/+3
| | | | llvm-svn: 140275
* Move TargetRegistry and TargetSelect from Target to Support where they belong.Evan Cheng2011-08-241-1/+1
| | | | | | These are strictly utilities for registering targets and components. llvm-svn: 138450
* Remove unused Target argument from AsmParser construction methods.Jim Grosbach2011-08-161-1/+1
| | | | | | The argument is unused, and is a layering violation in any case. llvm-svn: 137735
* Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to ↵Evan Cheng2011-07-261-2/+3
| | | | | | MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser. llvm-svn: 136027
* Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where ↵Evan Cheng2011-07-231-1/+1
| | | | | | they belong. llvm-svn: 135833
* Change createAsmParser to take a MCSubtargetInfo instead of triple,Evan Cheng2011-07-091-5/+10
| | | | | | | | | CPU, and feature string. Parsing some asm directives can change subtarget state (e.g. .code 16) and it must be reflected in other modules (e.g. MCCodeEmitter). That is, the MCSubtargetInfo instance must be shared. llvm-svn: 134795
* Eliminate asm parser's dependency on TargetMachine:Evan Cheng2011-07-081-1/+6
| | | | | | | | | | - Each target asm parser now creates its own MCSubtatgetInfo (if needed). - Changed AssemblerPredicate to take subtarget features which tablegen uses to generate asm matcher subtarget feature queries. e.g. "ModeThumb,FeatureThumb2" is translated to "(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0". llvm-svn: 134678
* Do not model all INLINEASM instructions as having unmodelled side effects.Evan Cheng2011-01-071-1/+1
| | | | | | | | | | Instead encode llvm IR level property "HasSideEffects" in an operand (shared with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check the operand when the instruction is an INLINEASM. This allows memory instructions to be moved around INLINEASM instructions. llvm-svn: 123044
* With the newly simplified SourceMgr interfaces and the generalizedChris Lattner2010-11-171-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SrcMgrDiagHandler, we can improve clang diagnostics for inline asm: instead of reporting them on a source line of the original line, we can report it on the correct line wherever the string literal came from. For something like this: void foo() { asm("push %rax\n" ".code32\n"); } we used to get this: (note that the line in t.c isn't helpful) t.c:4:7: error: warning: ignoring directive for now asm("push %rax\n" ^ <inline asm>:2:1: note: instantiated into assembly here .code32 ^ now we get: t.c:5:8: error: warning: ignoring directive for now ".code32\n" ^ <inline asm>:2:1: note: instantiated into assembly here .code32 ^ Note that we're pointing to line 5 properly now. llvm-svn: 119488
* now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate theChris Lattner2010-11-171-9/+5
| | | | | | | | cookie argument to the SourceMgr diagnostic stuff. This cleanly separates LLVMContext's inlineasm handler from the sourcemgr error handling definition, increasing type safety and cleaning things up. llvm-svn: 119486
* rearrange how the handler in SourceMgr is installed, eliminating the use of Chris Lattner2010-11-171-8/+35
| | | | | | the cookie argument to setDiagHandler llvm-svn: 119483
* refactor the interface to EmitInlineAsm a bit, no functionality change.Chris Lattner2010-11-171-10/+17
| | | | llvm-svn: 119482
* Nuke trailing whitespace.Jim Grosbach2010-10-011-28/+28
| | | | llvm-svn: 115377
* Target: Give the TargetAsmParser access to the TargetMachine.Daniel Dunbar2010-07-191-1/+1
| | | | | | - Unfortunate, but necessary for now to handle subtarget instruction matching. Eventually we should factor out the lower level target machine information so we don't need to do this. llvm-svn: 108664
* MC: Move several clients to using AsmParser constructor function.Daniel Dunbar2010-07-181-6/+7
| | | | llvm-svn: 108645
* a more graceful fix for test/Other/inline-asm-newline-terminator.ll,Chris Lattner2010-07-151-14/+0
| | | | | | follow on to r103765 llvm-svn: 108390
* Propagate the AlignStack bit in InlineAsm's to the Dale Johannesen2010-07-021-1/+1
| | | | | | | | | | | | | | | | | | | PrologEpilog code, and use it to determine whether the asm forces stack alignment or not. gcc consistently does not do this for GCC-style asms; Apple gcc inconsistently sometimes does it for asm blocks. There is no convenient place to put a bit in either the SDNode or the MachineInstr form, so I've added an extra operand to each; unlovely, but it does allow for expansion for more bits, should we need it. PR 5125. Some existing testcases are affected. The operand lists of the SDNode and MachineInstr forms are indexed with awesome mnemonics, like "2"; I may fix this someday, but not now. I'm not making it any worse. If anyone is inspired I think you can find all the right places from this patch. llvm-svn: 107506
* MC: Pass the target instance to the AsmParser constructor.Daniel Dunbar2010-07-011-1/+1
| | | | llvm-svn: 107426
* Inline Asm: Ensure buffer is newline terminated to match how the text is ↵Daniel Dunbar2010-05-141-0/+14
| | | | | | | | printed. - This is a hack, but I can't decide the best place to handle this. Chris? llvm-svn: 103765
* implicit defs get added to the end of machine instrs sometimes. Scan the ↵Chris Lattner2010-04-081-4/+9
| | | | | | whole instruction for the metadata operand instead of assuming it will be at the end of the instruction. llvm-svn: 100792
* Use twines to simplify calls to report_fatal_error. For code size and ↵Benjamin Kramer2010-04-081-12/+12
| | | | | | readability. llvm-svn: 100756
* introduce a new recoverable error handling API to LLVMContextChris Lattner2010-04-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | and use it in one place in inline asm handling stuff. Before we'd generate this for an invalid modifier letter: $ clang asm.c -c -o t.o fatal error: error in backend: Invalid operand found in inline asm: 'abc incl ${0:Z}' INLINEASM <es:abc incl ${0:Z}>, 10, %EAX<def>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,def,dead>, <!-1> Now we generate this: $ clang asm.c -c -o t.o error: invalid operand in inline asm: 'incl ${0:Z}' asm.c:3:12: note: generated from here __asm__ ("incl %Z0" : "+r" (X)); ^ 1 error generated. This is much better but still admittedly not great ("why" is the operand invalid??), codegen should try harder with its diagnostics :) llvm-svn: 100723
* rename llvm::llvm_report_error -> llvm::report_fatal_errorChris Lattner2010-04-071-10/+10
| | | | llvm-svn: 100709
* Have the inst emitter add the !srcloc mdnode to the machine instr.Chris Lattner2010-04-071-2/+12
| | | | | | | Have the asmprinter use the mdnode to scavenge a source location if present. Document this nonsense in langref. llvm-svn: 100607
* remove another magic number.Chris Lattner2010-04-071-3/+2
| | | | llvm-svn: 100606
* propagate cookie management out one layer of function calls.Chris Lattner2010-04-061-4/+3
| | | | llvm-svn: 100510
* report errors through LLVMContext's inline asm handler if available.Chris Lattner2010-04-061-1/+15
| | | | llvm-svn: 100509
* Give AsmParser an option to control whether it finalizesChris Lattner2010-04-051-1/+2
| | | | | | | | | | | | | | | | | | | | the stream. New demo: $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o $ otool -tv t.o t.o: (__TEXT,__text) section _foo: 0000000000000000 subq $0x08,%rsp 0000000000000004 movl %edi,(%rsp) 0000000000000007 movl %edi,%eax 0000000000000009 incl %eax 000000000000000b movl %eax,(%rsp) 000000000000000e movl %eax,0x04(%rsp) 0000000000000012 addq $0x08,%rsp 0000000000000016 ret llvm-svn: 100492
* add .o file writing for inline asm in llc. Here's a sillyChris Lattner2010-04-051-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | demo: $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o <inline asm>:1:2: error: unrecognized instruction abc incl %eax ^ LLVM ERROR: Error parsing inline asm Only problem seems to be that the parser finalizes OutStreamer at the end of the first inline asm, which isn't what we want. For example: $ cat asm.c int foo(int X) { __asm__ ("incl %0" : "+r" (X)); return X; } $ clang asm.c -S -o - -emit-llvm | llc ... subq $8, %rsp movl %edi, (%rsp) movl %edi, %eax ## InlineAsm Start incl %eax ## InlineAsm End movl %eax, (%rsp) movl %eax, 4(%rsp) addq $8, %rsp ret $ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o $ otool -tv t.o t.o: (__TEXT,__text) section _foo: 0000000000000000 subq $0x08,%rsp 0000000000000004 movl %edi,(%rsp) 0000000000000007 movl %edi,%eax 0000000000000009 incl %eax $ don't stop at inc! llvm-svn: 100491
* stringref-ize the MemoryBuffer::get apis. This requiresChris Lattner2010-04-051-9/+7
| | | | | | a co-committed clang patch. llvm-svn: 100485
* move uleb/sleb printing into AsmPrinter from DwarfPrinter.Chris Lattner2010-04-041-3/+3
| | | | llvm-svn: 100344
* use stringref instead of strtol to avoid errno gymnastics.Chris Lattner2010-04-041-7/+6
| | | | llvm-svn: 100341
* split inline asm support out to its own .cpp file.Chris Lattner2010-04-041-0/+315
llvm-svn: 100340
OpenPOWER on IntegriCloud