Commit Graph

5327 Commits

Author SHA1 Message Date
Evan Cheng aeba2250a5 Re-enable x86 tail call optimization.
llvm-svn: 95295
2010-02-04 06:47:24 +00:00
Evan Cheng 9976832a05 Indirect tail call has to go through a call preserved register since it's after callee register pops. X86 isel lowering is using EAX / R11 and it was somehow adding that to function live out. That prevented the real function return register from being added to the function live out list and bad things happen.
This fixes 483.xalancbmk (with tail call opt).

llvm-svn: 95280
2010-02-04 02:40:39 +00:00
Dale Johannesen c337d6538a Rewrite FP constant handling in DEBUG_VALUE yet
again, so it more or less handles long double.
Restore \n removed in latest MC frenzy.

llvm-svn: 95271
2010-02-04 01:33:43 +00:00
Chris Lattner 223084d3ac enhance new encoder to support prefixes + RawFrm
instructions with no operands.  It can now handle

define void @test2() nounwind { ret void }

llvm-svn: 95261
2010-02-03 21:57:59 +00:00
Chris Lattner 6794f9b9f6 set up some infrastructure, some minor cleanups.
llvm-svn: 95260
2010-02-03 21:43:43 +00:00
Evan Cheng f4139067ee Speculatively disable x86 automatic tail call optimization while we track down a self-hosting issue.
llvm-svn: 95259
2010-02-03 21:40:40 +00:00
Chris Lattner f914be06d2 stub out a new X86 encoder, which can be tried with
-enable-new-x86-encoder until its stable.

llvm-svn: 95256
2010-02-03 21:24:49 +00:00
Chris Lattner 2f750f3b5a rename createX86MCCodeEmitter to more accurately reflect what it creates.
llvm-svn: 95254
2010-02-03 21:14:33 +00:00
Kevin Enderby 00f1e6c030 Added support for X86 instruction prefixes so llvm-mc can assemble them. The
Lock prefix, Repeat string operation prefixes and the Segment override prefixes.
Also added versions of the move string and store string instructions without the
repeat prefixes to X86InstrInfo.td. And finally marked the rep versions of
move/store string records in X86InstrInfo.td as isCodeGenOnly = 1 so tblgen is
happy building the disassembler files.

llvm-svn: 95252
2010-02-03 21:04:42 +00:00
Chris Lattner 3bcbdb8a28 reapply r95206, this time actually delete the code I'm replacing in the third stub case.
llvm-svn: 95209
2010-02-03 06:42:38 +00:00
Chris Lattner 37fad99a05 revert r95206, it is apparently causing bootstrap failure on i386-darwin9
llvm-svn: 95208
2010-02-03 06:41:18 +00:00
Chris Lattner 3eef965b06 make the x86 backend emit darwin stubs through mcstreamer
instead of textually.

llvm-svn: 95206
2010-02-03 06:21:16 +00:00
Chris Lattner 082f484074 make MachineModuleInfoMachO hold non-const MCSymbol*'s instead
of const ones.  non-const ones aren't very useful, because you can't
even, say, emit them.

llvm-svn: 95205
2010-02-03 06:18:30 +00:00
Evan Cheng 40905b4302 Allow all types of callee's to be tail called. But avoid automatic tailcall if the callee is a result of bitcast to avoid losing necessary zext / sext etc.
llvm-svn: 95195
2010-02-03 03:28:02 +00:00
Chris Lattner 0b78cc2af5 don't emit \n's at the start of X86AsmPrinter::runOnMachineFunction,
.o files don't like that.

llvm-svn: 95187
2010-02-03 01:49:49 +00:00
Chris Lattner 183ef68ef7 Finally eliminate printMCInst and send instructions through
the streamer.  Demo:

$ cat t.ll 
define i32 @test() nounwind {
  ret i32 42
}
$ llc t.ll -o -
...
_test: 
	movl	$42, %eax
	ret
$ llc t.ll -o t.o -filetype=obj
$ otool -tv t.o 
t.o:
(__TEXT,__text) section
_test:
00000000	movl	$0x0000002a,%eax
00000005	ret

llvm-svn: 95179
2010-02-03 01:13:25 +00:00
Chris Lattner 996ec840d0 rejigger the world so that EmitInstruction prints the \n at
the end of the instruction instead of expecting the caller to
do it.  This currently causes the asm-verbose instruction 
comments to be on the next line.

llvm-svn: 95178
2010-02-03 01:09:55 +00:00
Chris Lattner 41ad1905c9 sink handling of target-independent machine instrs (other
than DEBUG_VALUE :(  ) into the target indep AsmPrinter.cpp
file.   This allows elimination of the 
NO_ASM_WRITER_BOILERPLATE hack among other things.

llvm-svn: 95177
2010-02-03 01:00:52 +00:00
Dale Johannesen 55e768c99a Print FPImm a less kludgy way; APFloat.toString seems
to have some problems anyway.

llvm-svn: 95171
2010-02-03 00:36:40 +00:00
Evan Cheng 5f238a9650 ByVal frame object size should be that of the byval argument, not the size of the type which is just a pointer. This is not known to break stuff but is wrong nevertheless.
llvm-svn: 95163
2010-02-02 23:58:13 +00:00
Evan Cheng 6f36a083ef Revert 95130.
llvm-svn: 95160
2010-02-02 23:55:14 +00:00
Dale Johannesen b3cfc2b77c Accept floating point immediates in DEBUG_VALUE.
llvm-svn: 95159
2010-02-02 23:54:23 +00:00
Daniel Dunbar bdbffbedf0 AsmParser/X86: Add temporary hack to allow parsing "sal". Eventually we need
some mechanism for specifying alternative syntaxes, but I'm not sure what form
that should take yet.

llvm-svn: 95158
2010-02-02 23:46:47 +00:00
Chris Lattner b0d44c3807 refactor code so that LLVMTargetMachine creates the asmstreamer and
mccontext instead of having AsmPrinter do it.  This allows other 
types of MCStreamer's to be passed in.

llvm-svn: 95155
2010-02-02 23:37:42 +00:00
Chris Lattner 6a6137832d remove dead code.
llvm-svn: 95144
2010-02-02 22:03:00 +00:00
Daniel Dunbar 3184f22447 MCAsmParser/X86: Represent absolute memory operands as CodeGen does, with scale
== 1.

llvm-svn: 95137
2010-02-02 21:44:16 +00:00
Daniel Dunbar d28d6db735 MCCodeEmitter/X86: Handle tied registers better when converting MCInst ->
MCMachineInstr. This also fixes handling of tied registers for MRMSrcMem
instructions.

llvm-svn: 95136
2010-02-02 21:44:10 +00:00
Chris Lattner 0cd6c2a047 eliminate all the dead addSimpleCodeEmitter implementations.
eliminate random "code emitter" stuff in Alpha, except for
the JIT path.  Next up, remove the template cruft.

llvm-svn: 95131
2010-02-02 21:31:47 +00:00
Evan Cheng c1b0116ff1 Pass callsite return type to TargetLowering::LowerCall and use that to check sibcall eligibility.
llvm-svn: 95130
2010-02-02 21:29:10 +00:00
Evan Cheng 55afd2564c Perform sibcall in some cases when arguments are passes memory. Look for cases
where callee's arguments are already in the caller's own caller's stack and
they line up perfectly. e.g.

extern int foo(int a, int b, int c);

int bar(int a, int b, int c) {
  return foo(a, b, c);
}

llvm-svn: 95053
2010-02-02 02:22:50 +00:00
Evan Cheng a49d8e6d38 Fix PR6196. GV callee may not be a function.
llvm-svn: 95017
2010-02-01 22:40:09 +00:00
Evan Cheng ed8ca56eeb Undo r94946 now all the tests are passing again.
llvm-svn: 94970
2010-02-01 02:13:39 +00:00
Evan Cheng b33dbc5019 Change TAILJMP's to be varargs and transfer implicit uses over from TCRETURN's. Otherwise the missing uses can make post-regalloc scheduling do bad things. This fixes 403.gcc.
llvm-svn: 94950
2010-01-31 07:28:44 +00:00
Evan Cheng 9adc6f46cf Fix a missing check from my last commit.
llvm-svn: 94949
2010-01-31 07:27:31 +00:00
Evan Cheng 7f62def0f9 Avoid recursive sibcall's.
llvm-svn: 94946
2010-01-31 06:44:49 +00:00
Sean Callanan 9aeccadce4 Moved InstallLexer() from the X86-specific AsmLexer
to the TargetAsmLexer class so that clients can
actually use the TargetAsmLexer they get from a
Target.

llvm-svn: 94940
2010-01-31 02:28:18 +00:00
Evan Cheng 70f714fdbe Allow more tailcall optimization: calls with inputs that are all passed in registers.
llvm-svn: 94873
2010-01-30 01:22:00 +00:00
Evan Cheng 2d5a75b42a Don't forget to transfer target flag when inserting a tailcall instruction.
llvm-svn: 94872
2010-01-30 01:16:15 +00:00
Daniel Dunbar 76e5d70c57 MC/X86 AsmParser: Handle absolute memory operands correctly. We were doing
something totally broken and parsing them as immediates, but the .td file also
had the wrong match class so things sortof worked. Except, that is, that we
would parse
  movl $0, %eax
as
  movl 0, %eax
Feel free to guess how well that worked.

llvm-svn: 94869
2010-01-30 01:02:48 +00:00
Daniel Dunbar f05d00787a X86.td: Refactor to bring operands that use print_pcrel_imm together.
llvm-svn: 94861
2010-01-30 00:24:12 +00:00
Daniel Dunbar a97adee959 AsmMatcher/X86: Separate out sublass for memory operands that have no segment
register, and use to cleanup a FIXME in X86AsmParser.cpp.

llvm-svn: 94859
2010-01-30 00:24:00 +00:00
Dale Johannesen ad00f03e86 Add assertion to humor the paranoid.
llvm-svn: 94843
2010-01-29 21:21:28 +00:00
Evan Cheng 297a494f55 Catch more trivial tail call opportunities: no inputs and output types match.
llvm-svn: 94804
2010-01-29 06:45:59 +00:00
Sean Callanan 82436d1666 Added a custom TableGen backend to support the
enhanced disassembler, and the necessary makefile
rules to build the table for X86.

llvm-svn: 94764
2010-01-29 00:21:04 +00:00
Evan Cheng 346af88396 Fix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is different from its inputs.
This fixes PR6146.

llvm-svn: 94731
2010-01-28 01:57:22 +00:00
Chris Lattner 94a946cac4 Remove the argument from EmitJumpTableInfo, because it doesn't need it.
Move the X86 implementation of function body emission up to 
AsmPrinter::EmitFunctionBody, which works by calling the virtual
EmitInstruction method.

llvm-svn: 94716
2010-01-28 01:02:27 +00:00
Dale Johannesen 77b108e17b Treat MO_REG 0 location as undefined in DEBUG_VALUE,
per document.

llvm-svn: 94693
2010-01-27 22:11:16 +00:00
Jeffrey Yasskin 091217be6f Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Evan Cheng 85476f304c Perform trivial tail call optimization for callees with "C" ABI. These are done
even when -tailcallopt is not specified and it does not require changing ABI.
First case is the most trivial one. Perform tail call optimization when both
the caller and callee do not return values and when the callee does not take
any input arguments.

llvm-svn: 94664
2010-01-27 06:25:16 +00:00
Evan Cheng 67a69dd2ed Eliminate target hook IsEligibleForTailCallOptimization.
Target independent isel should always pass along the "tail call" property. Change
target hook LowerCall's parameter "isTailCall" into a refernce. If the target
decides it's impossible to honor the tail call request, it should set isTailCall
to false to make target independent isel happy.

llvm-svn: 94626
2010-01-27 00:07:07 +00:00