Commit Graph

488 Commits

Author SHA1 Message Date
Dan Gohman fe7532a308 Split the SDValue out of OutputArg so that SelectionDAG-independent
code can do calling-convention queries. This obviates OutputArgReg.

llvm-svn: 107786
2010-07-07 15:54:55 +00:00
Devang Patel a3ca21b228 Propagate debug loc.
llvm-svn: 107710
2010-07-06 22:08:15 +00:00
Dan Gohman 3439629239 Reapply r107655 with fixes; insert the pseudo instruction into
the block before calling the expansion hook. And don't
put EFLAGS in a mbb's live-in list twice.

llvm-svn: 107691
2010-07-06 20:24:04 +00:00
Dan Gohman f4f04107ef Revert r107655.
llvm-svn: 107668
2010-07-06 15:49:48 +00:00
Dan Gohman 12205645a6 Fix a bunch of custom-inserter functions to handle the case where
the pseudo instruction is not at the end of the block.

llvm-svn: 107655
2010-07-06 15:18:19 +00:00
Evan Cheng 0664a67fe1 Remove isSS argument from CreateFixedObject. Fixed objects cannot be spill slots so it's always false.
llvm-svn: 107550
2010-07-03 00:40:23 +00:00
Chris Lattner cfed96a410 fix breakage from r98938 by correctly marking msp430 calls as variadic.
Patch by Ben Ransford!

llvm-svn: 106722
2010-06-24 06:46:50 +00:00
Eric Christopher fa1b54d26e Remove isTwoAddress from MSP430.
llvm-svn: 106455
2010-06-21 20:07:30 +00:00
Eric Christopher 0ca648d758 Make 80-column.
llvm-svn: 106448
2010-06-21 18:56:55 +00:00
Stuart Hastings 0125b6410a Add a DebugLoc parameter to TargetInstrInfo::InsertBranch(). This
addresses a longstanding deficiency noted in many FIXMEs scattered
across all the targets.

This effectively moves the problem up one level, replacing eleven
FIXMEs in the targets with eight FIXMEs in CodeGen, plus one path
through FastISel where we actually supply a DebugLoc, fixing Radar
7421831.

llvm-svn: 106243
2010-06-17 22:43:56 +00:00
Rafael Espindola ef2b6ce00a cleanup
llvm-svn: 105322
2010-06-02 13:53:17 +00:00
Jakob Stoklund Olesen 7de379467e Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104704
2010-05-26 17:27:12 +00:00
Jakob Stoklund Olesen 50eec620f4 Revert "Replace the SubRegSet tablegen class with a less error-prone mechanism."
This reverts commit 104654.

llvm-svn: 104660
2010-05-26 01:21:14 +00:00
Jakob Stoklund Olesen 0b0274524c Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104654
2010-05-26 00:28:19 +00:00
Jakob Stoklund Olesen 673e7e0f37 Remove NumberHack entirely.
SubRegIndex instances are now numbered uniquely the same way Register instances
are - in lexicographical order by name.

llvm-svn: 104627
2010-05-25 19:49:33 +00:00
Jakob Stoklund Olesen fdb25de17e Switch SubRegSet to using symbolic SubRegIndices
llvm-svn: 104571
2010-05-24 23:03:18 +00:00
Jakob Stoklund Olesen edab242488 Replace the tablegen RegisterClass field SubRegClassList with an alist-like data
structure that represents a mapping without any dependencies on SubRegIndex
numbering.

This brings us closer to being able to remove the explicit SubRegIndex
numbering, and it is now possible to specify any mapping without inventing
*_INVALID register classes.

llvm-svn: 104563
2010-05-24 21:46:58 +00:00
Jakob Stoklund Olesen fd6f16fab9 SubRegIndex'ize MSP430
llvm-svn: 104513
2010-05-24 17:42:55 +00:00
Evan Cheng 168ced94d8 Implement @llvm.returnaddress. rdar://8015977.
llvm-svn: 104421
2010-05-22 01:47:14 +00:00
Evan Cheng 738e920edf Code refactoring: pull SchedPreference enum from TargetLowering.h to TargetMachine.h and put it in its own namespace.
llvm-svn: 104147
2010-05-19 20:19:50 +00:00
Duncan Sands 6c5e4355bb I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it
to LLVM_LIBRARY_VISIBILITY and introduce LLVM_GLOBAL_VISIBILITY, which is
the opposite, for future use by dragonegg.

llvm-svn: 103495
2010-05-11 20:16:09 +00:00
Dan Gohman bb919dfb6b Implement a bunch more TargetSelectionDAGInfo infrastructure.
Move EmitTargetCodeForMemcpy, EmitTargetCodeForMemset, and
EmitTargetCodeForMemmove out of TargetLowering and into
SelectionDAGInfo to exercise this.

llvm-svn: 103481
2010-05-11 17:31:57 +00:00
Dan Gohman 779c69bbc5 Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.

llvm-svn: 103194
2010-05-06 20:33:48 +00:00
Evan Cheng efb126a665 Add argument TargetRegisterInfo to loadRegFromStackSlot and storeRegToStackSlot.
llvm-svn: 103193
2010-05-06 19:06:44 +00:00
Anton Korobeynikov 319d71f44f Do folding for indirect branches, where possible
llvm-svn: 102836
2010-05-01 12:28:21 +00:00
Anton Korobeynikov ebbdfef2fc Implement indirect branches on MSP430
llvm-svn: 102835
2010-05-01 12:04:32 +00:00
Anton Korobeynikov 6fbff44893 Long branch target oparands are not pc-rel.
This should fix PR6603.

llvm-svn: 102834
2010-05-01 12:04:22 +00:00
Dan Gohman 25c1653700 Get rid of the EdgeMapping map. Instead, just check for BasicBlock
changes before doing phi lowering for switches.

llvm-svn: 102809
2010-05-01 00:01:06 +00:00
Evan Cheng 4158a0ff6b Implement -disable-non-leaf-fp-elim which disable frame pointer elimination
optimization for non-leaf functions. This will be hooked up to gcc's
-momit-leaf-frame-pointer option. rdar://7886181

llvm-svn: 101984
2010-04-21 03:18:23 +00:00
Dan Gohman 21cea8ac2e Use const qualifiers with TargetLowering. This eliminates several
const_casts, and it reinforces the design of the Target classes being
immutable.

SelectionDAGISel::IsLegalToFold is now a static member function, because
PIC16 uses it in an unconventional way. There is more room for API
cleanup here.

And PIC16's AsmPrinter no longer uses TargetLowering.

llvm-svn: 101635
2010-04-17 15:26:15 +00:00
Dan Gohman 9becdddc49 Add skeleton target-specific SelectionDAGInfo files.
llvm-svn: 101564
2010-04-16 23:04:22 +00:00
Dan Gohman bcaf681cde Add const qualifiers to CodeGen's use of LLVM IR constructs.
llvm-svn: 101334
2010-04-15 01:51:59 +00:00
Chris Lattner 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Dale Johannesen 60b289709e Educate GetInstrSizeInBytes implementations that
DBG_VALUE does not generate code.

llvm-svn: 100681
2010-04-07 19:51:44 +00:00
Chris Lattner a49ac8ace0 prune some #includes.
llvm-svn: 100399
2010-04-05 04:04:10 +00:00
Jakob Stoklund Olesen b93331f3be Replace TSFlagsFields and TSFlagsShifts with a simpler TSFlags field.
When a target instruction wants to set target-specific flags, it should simply
set bits in the TSFlags bit vector defined in the Instruction TableGen class.

This works well because TableGen resolves member references late:

class I : Instruction {
  AddrMode AM = AddrModeNone;
  let TSFlags{3-0} = AM.Value;
}

let AM = AddrMode4 in
def ADD : I;

TSFlags gets the expected bits from AddrMode4 in this example.

llvm-svn: 100384
2010-04-05 03:10:20 +00:00
Chris Lattner 8b30492da3 simplify various getAnalysisUsage implementations.
llvm-svn: 100376
2010-04-05 00:38:44 +00:00
Chris Lattner d20699bc87 Momentous day: remove the "O" member from AsmPrinter. Now all
"asm printering" happens through MCStreamer.  This also 
Streamerizes PIC16 debug info, which escaped my attention.

This removes a leak from LLVMTargetMachine of the 'legacy'
output stream.

llvm-svn: 100327
2010-04-04 08:18:47 +00:00
Chris Lattner 5e5961864f mcize a bunch more stuff, using EmitRawText for things we
don't have mcstreamer support for yet.

llvm-svn: 100319
2010-04-04 07:05:53 +00:00
Chris Lattner 3bb09768cb fix PrintAsmOperand and PrintAsmMemoryOperand to pass down
raw_ostream to print to.

llvm-svn: 100313
2010-04-04 05:29:35 +00:00
Chris Lattner 7012916275 fix an ugly wart in the MCInstPrinter api where the
raw_ostream to print an instruction to had to be specified
at MCInstPrinter construction time instead of being able
to pick at each call to printInstruction.

llvm-svn: 100307
2010-04-04 05:04:31 +00:00
Chris Lattner 76c564b1bb change a ton of code to not implicitly use the "O" raw_ostream
member of AsmPrinter.  Instead, pass it in explicitly.

llvm-svn: 100306
2010-04-04 04:47:45 +00:00
Chris Lattner 6f306d7d30 use DebugLoc default ctor instead of DebugLoc::getUnknownLoc()
llvm-svn: 100214
2010-04-02 20:16:16 +00:00
Dale Johannesen 4244d12769 Teach AnalyzeBranch, RemoveBranch and the branch
folder to be tolerant of debug info following the
branch(es) at the end of a block.

llvm-svn: 100168
2010-04-02 01:38:09 +00:00
Chris Lattner 9897043928 Rip out the 'is temporary' nonsense from the MCContext interface to
create symbols.  It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.

This fixes rdar://7807601.

llvm-svn: 99902
2010-03-30 18:10:53 +00:00
Chris Lattner 29bdac4928 eliminate the now-unneeded context argument of MBB::getSymbol()
llvm-svn: 98451
2010-03-13 21:04:28 +00:00
Chris Lattner e468f88b26 rearrange MCContext ownership. Before LLVMTargetMachine created it
and passing off ownership to AsmPrinter.  Now MachineModuleInfo
creates it and owns it by value.  This allows us to use MCSymbols
more consistently throughout the rest of the code generator, and
simplifies a bit of code.  This also allows MachineFunction to 
keep an MCContext reference handy, and cleans up the TargetRegistry
interfaces for AsmPrinters.

llvm-svn: 98450
2010-03-13 20:55:24 +00:00
Jeffrey Yasskin 9eeda13a52 Fix LLVM build when the user specifies CPPFLAGS on the make command line.
llvm-svn: 98394
2010-03-12 21:42:14 +00:00
Chris Lattner 0b822ab447 inline GetGlobalValueSymbol into the rest its callers and
remove it.

llvm-svn: 98390
2010-03-12 21:19:23 +00:00
Chris Lattner ac2361a9b0 set the temporary bit on MCSymbols correctly.
llvm-svn: 98124
2010-03-10 02:25:11 +00:00
Jim Grosbach fae913adf8 Change the Value argument to eliminateFrameIndex to a type-tagged value. This
is preparatory to having PEI's scavenged frame index value reuse logic
properly distinguish types of frame values (e.g., whether the value is
stack-pointer relative or frame-pointer relative).

No functionality change.

llvm-svn: 98086
2010-03-09 21:45:49 +00:00
Anton Korobeynikov 6f5523aa8b Do not use '&' prefix for globals when register base field is non-zero, otherwise msp430-as will silently miscompile the code (TI's assembler report an error though).
This fixes PR6349

llvm-svn: 97877
2010-03-06 11:41:12 +00:00
Chris Lattner 71ddd8e2aa remove 300 lines of code that is now dead in the MSP430 backend
now that isel handles chains more aggressively.  This also
allows us to make isLegalToFold non-virtual.

llvm-svn: 97597
2010-03-02 22:30:08 +00:00
Chris Lattner dd030701bd Fix some issues in WalkChainUsers dealing with
CopyToReg/CopyFromReg/INLINEASM.  These are annoying because
they have the same opcode before an after isel.  Fix this by
setting their NodeID to -1 to indicate that they are selected,
just like what automatically happens when selecting things that
end up being machine nodes.

With that done, give IsLegalToFold a new flag that causes it to
ignore chains.  This lets the HandleMergeInputChains routine be
the one place that validates chains after a match is successful,
enabling the new hotness in chain processing.  This smarter
chain processing eliminates the need for "PreprocessRMW" in the
X86 and MSP430 backends and enables MSP to start matching it's
multiple mem operand instructions more aggressively.

I currently #if out the dead code in the X86 backend and MSP 
backend, I'll remove it for real in a follow-on patch.

The testcase changes are:
  test/CodeGen/X86/sse3.ll: we generate better code
  test/CodeGen/X86/store_op_load_fold2.ll: PreprocessRMW was 
      miscompiling this before, we now generate correct code
      Convert it to filecheck while I'm at it.
  test/CodeGen/MSP430/Inst16mm.ll: Add a testcase for mem/mem
      folding to make anton happy. :)

llvm-svn: 97596
2010-03-02 22:20:06 +00:00
Chris Lattner f98f124a73 Sink InstructionSelect() out of each target into SDISel, and rename it
DoInstructionSelection.  Inline "SelectRoot" into it from DAGISelHeader.
Sink some other stuff out of DAGISelHeader into SDISel.

Eliminate the various 'Indent' stuff from various targets, which dates
to when isel was recursive.

 17 files changed, 114 insertions(+), 430 deletions(-)

llvm-svn: 97555
2010-03-02 06:34:30 +00:00
Dan Gohman 8c5d683aa9 The mayHaveSideEffects flag is no longer used.
llvm-svn: 97348
2010-02-27 23:47:46 +00:00
Anton Korobeynikov e96503faa1 IT turns out that during jumpless setcc lowering eq and ne were swapped.
This fixes PR6348

llvm-svn: 96734
2010-02-21 12:28:58 +00:00
Anton Korobeynikov ab663a0bfe Move TLOF implementations to libCodegen to resolve layering violation.
llvm-svn: 96288
2010-02-15 22:37:53 +00:00
Evan Cheng 5e73ff2e3a Split SelectionDAGISel::IsLegalAndProfitableToFold to
IsLegalToFold and IsProfitableToFold. The generic version of the later simply checks whether the folding candidate has a single use.

This allows the target isel routines more flexibility in deciding whether folding makes sense. The specific case we are interested in is folding constant pool loads with multiple uses.

llvm-svn: 96255
2010-02-15 19:41:07 +00:00
David Greene 27d044d65d Remove an assumption of default arguments. This is in anticipation of a
change to SelectionDAG build APIs.

llvm-svn: 96234
2010-02-15 16:56:22 +00:00
Duncan Sands 9dff9bec31 Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Chris Lattner b06015aa69 move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h.  #include the new TargetOpcodes.h
into MachineInstr.  Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the 
codebase.

llvm-svn: 95687
2010-02-09 19:54:29 +00:00
Chris Lattner 402a111318 emit instructions through the streamer.
llvm-svn: 95180
2010-02-03 01:15:03 +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
Evan Cheng 6f36a083ef Revert 95130.
llvm-svn: 95160
2010-02-02 23:55:14 +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
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
Chris Lattner fd97a3369e Switch MSP430, SPU, Sparc, and SystemZ to use EmitFunctionBody().
Diffstat:
 6 files changed, 30 insertions(+), 284 deletions(-)

llvm-svn: 94727
2010-01-28 01:48:52 +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
Chris Lattner 80108921be don't emit constant pools twice.
llvm-svn: 94706
2010-01-28 00:15:18 +00:00
Chris Lattner 9da5e1f650 Switch MSP430, CellSPU, SystemZ, Darwin/PPC, Alpha, and Sparc to
EmitFunctionHeader:

7 files changed, 16 insertions(+), 210 deletions(-)

llvm-svn: 94630
2010-01-27 00:17:20 +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
Chris Lattner 3ba6da49f5 call emitconstantpool and emitjumptable like other targets.
llvm-svn: 94601
2010-01-26 22:06:58 +00:00
Chris Lattner ff234e09b9 Eliminate SetDirective, and replace it with HasSetDirective.
Default HasSetDirective to true, since most targets have it.

The targets that claim to not have it probably do, or it is
spelled differently. These include Blackfin, Mips, Alpha, and
PIC16.  All of these except pic16 are normal ELF targets, so
they almost certainly have it.

llvm-svn: 94585
2010-01-26 20:40:54 +00:00
Chris Lattner d051af7551 add a new MachineBasicBlock::getSymbol method, replacing
the AsmPrinter::GetMBBSymbol.

llvm-svn: 94515
2010-01-26 04:55:51 +00:00
Chris Lattner 823aed16f9 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner 7ba0661f27 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner 2b4364fe03 revert 93934, removing the MCAsmInfo endianness bit. I can't
stomache MCAsmInfo having this, and I found a better solution to
this layering issue.

llvm-svn: 93985
2010-01-20 06:34:14 +00:00
Chris Lattner 003b5c8472 give MCAsmInfo a 'has little endian' bit. This is unfortunate, but
I really want clients of the streamer to be able to say "emit this
64-bit integer" and have it get broken down right by the streamer.

I may change this in the future, we'll see how it works out.

llvm-svn: 93934
2010-01-19 22:42:28 +00:00
Chris Lattner c7a062d187 Now that we have everything nicely factored (e.g. asmprinter is not
doing global variable classification anymore) and hookized, sink almost
all target targets global variable emission code into AsmPrinter and out
of each target.

Some notes:

1. PIC16 does completely custom and crazy stuff, so it is not changed.
2. XCore has some custom handling for extra directives.  I'll look at it next.
3. This switches linux/ppc to use .globl instead of .global.  If .globl is
   actually wrong, let me know and I'll fix it.
4. This makes linux/ppc get a lot of random cases right which were obviously
   wrong before, it is probably now a bit healthier.
5. Blackfin will probably start getting .comm and other things that it didn't
   before.  If this is undesirable, it should explicitly opt out of these
   things by clearing the relevant fields of MCAsmInfo.

This leads to a nice diffstat:
 14 files changed, 127 insertions(+), 830 deletions(-)

llvm-svn: 93858
2010-01-19 05:38:33 +00:00
Chris Lattner c8f7717808 remove the MAI argument to MCExpr::print and switch overthing to use << when printing them.
llvm-svn: 93699
2010-01-18 00:37:40 +00:00
Chris Lattner 8b5d55ed06 now that MCSymbol::print doesn't use it's MAI argument, we can
remove it and change all the code that prints MCSymbols to use 
<< instead, which is much simpler and cleaner.

llvm-svn: 93695
2010-01-17 21:43:43 +00:00
Chris Lattner 94d91a5b30 eliminate uses of mangler and simplify code.
llvm-svn: 93615
2010-01-16 01:40:07 +00:00
Chris Lattner 719e908e7c MCize a bunch more stuff, eliminating a lot of uses of the mangler
and CurrentFnName.

llvm-svn: 93594
2010-01-16 00:21:18 +00:00
Ted Kremenek bda8193caf Update CMake build.
llvm-svn: 93570
2010-01-15 22:59:11 +00:00
Anton Korobeynikov a6450df92a zext / truncate is free on msp430. Inform codegen about this.
llvm-svn: 93556
2010-01-15 21:19:43 +00:00
Anton Korobeynikov ce52fd5f93 Add branch relaxation pass (shamelessly stolen from PPC).
llvm-svn: 93554
2010-01-15 21:19:05 +00:00
Anton Korobeynikov 71471293a5 Provide instruction sizes & encoding. No opcodes yet (but not needed so far).
llvm-svn: 93553
2010-01-15 21:18:39 +00:00
Anton Korobeynikov 93a7d026a8 Enable bit tests and setcc stuff.
llvm-svn: 93552
2010-01-15 21:18:18 +00:00
Anton Korobeynikov 6826ce7e96 Add micro-optimization which allows us to fold imm into cmp. This allows us to save 1 word (sometimes) and reduce register pressure.
llvm-svn: 93551
2010-01-15 21:18:02 +00:00
Anton Korobeynikov e57b234b88 Add instruction formats & support stuff
llvm-svn: 93550
2010-01-15 21:17:13 +00:00
Anton Korobeynikov cefa7addc8 Fix cmp emission on msp430: we definitely should turn stuff like
"icmp lhs, rhs" into "cmp rhs, lhs". This should fix PR5979.

llvm-svn: 93496
2010-01-15 01:29:49 +00:00
Anton Korobeynikov abf4ef0ee1 Remove pseudo-MI in custom inserter.
llvm-svn: 93467
2010-01-14 22:09:11 +00:00
Dan Gohman ea6f91ff64 Change SelectCode's argument from SDValue to SDNode *, to make it more
clear what information these functions are actually using.

This is also a micro-optimization, as passing a SDNode * around is
simpler than passing a { SDNode *, int } by value or reference.

llvm-svn: 92564
2010-01-05 01:24:18 +00:00
Bill Wendling 5dda76ef11 Mark variable used by 'assert' as 'unused'.
llvm-svn: 92198
2009-12-28 02:07:00 +00:00
Bill Wendling 220f4dad9e Remove dead variable.
llvm-svn: 92197
2009-12-28 02:05:36 +00:00
Anton Korobeynikov 3e9e87a9cb Mark FPW as allocable when frame address is taken.
llvm-svn: 91841
2009-12-21 20:18:49 +00:00
John McCall eabfd8b155 Pass the error string directly to llvm_unreachable instead of the residual
(0 && "error").  Rough consensus seems to be that g++ *should* be diagnosing
this because the pointer makes it not an ICE in c++03.  Everyone agrees that
the current standard is silly and null-pointer-ness should not be based on
ICE-ness.  Excellent fight scene in Act II, denouement weak, two stars.

llvm-svn: 91644
2009-12-18 00:27:18 +00:00
Anton Korobeynikov 45800ce646 Do not allow uninitialize access during debug printing
llvm-svn: 91232
2009-12-13 01:00:32 +00:00
Anton Korobeynikov d8f320947f Implement variable-width shifts.
No testcase yet - it seems we're exposing generic codegen bugs.

llvm-svn: 91221
2009-12-12 18:55:37 +00:00
Anton Korobeynikov e27e028cdd Lower setcc branchless, if this is profitable.
Based on the patch by Brian Lucas!

llvm-svn: 91175
2009-12-11 23:01:29 +00:00
Anton Korobeynikov dd2b2f8cba Reduce (cmp 0, and_su (foo, bar)) into (bit foo, bar). This saves extra instruction. Patch inspired by Brian Lucas!
llvm-svn: 90819
2009-12-08 01:03:04 +00:00
Anton Korobeynikov 24a6316aaa Some pretty-printing
llvm-svn: 90742
2009-12-07 02:28:41 +00:00
Anton Korobeynikov ff4ab51400 Add lowering of returnaddr and frameaddr intrinsics. Shamelessly stolen from x86 :)
llvm-svn: 90740
2009-12-07 02:28:10 +00:00
Anton Korobeynikov b4be8ce537 Initial codegen support for MSP430 ISRs
llvm-svn: 90739
2009-12-07 02:27:53 +00:00
Anton Korobeynikov 28d3c733aa Add ability to select hw multiplier mode and select appropriate libcalls.
llvm-svn: 90737
2009-12-07 02:27:08 +00:00
Dan Gohman 047a767d74 Remove the target hook TargetInstrInfo::BlockHasNoFallThrough in favor of
MachineBasicBlock::canFallThrough(), which is target-independent and more
thorough.

llvm-svn: 90634
2009-12-05 00:44:40 +00:00
Chris Lattner a48f44d9ee improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Anton Korobeynikov abdf86d2be Minor optimization: when doing eq/ne comparions and RHS is a constant - swap operands, this will allow us to fold imm into comparison.
llvm-svn: 89574
2009-11-22 01:14:08 +00:00
Anton Korobeynikov 3a31644c7a Drop unsupported imm operands
llvm-svn: 89573
2009-11-22 01:13:54 +00:00
Anton Korobeynikov a9c7bb724a Use 2-byte alignment for functions. 4 bytes are clear overkill here.
llvm-svn: 89572
2009-11-22 01:13:39 +00:00
Anton Korobeynikov d099b578e4 Use semicolon as assembler comment string
llvm-svn: 89571
2009-11-22 01:12:49 +00:00
Dan Gohman e14b347176 Update for new getBlockAddress signature.
llvm-svn: 89507
2009-11-20 23:21:00 +00:00
David Greene 659c1a9d78 Move DebugInfo checks into EmitComments and remove them from
target-specific AsmPrinters.  Not all comments need DebugInfo.

Re-enable the line numbers comment test.

llvm-svn: 88697
2009-11-13 21:34:57 +00:00
David Greene be851acfb0 Make the MachineFunction argument of getFrameRegister const.
This also fixes a build error.

llvm-svn: 87027
2009-11-12 21:00:03 +00:00
David Greene 1fbe054450 Add a bool flag to StackObjects telling whether they reference spill
slots.  The AsmPrinter will use this information to determine whether to
print a spill/reload comment.

Remove default argument values.  It's too easy to pass a wrong argument
value when multiple arguments have default values.  Make everything
explicit to trap bugs early.

Update all targets to adhere to the new interfaces..

llvm-svn: 87022
2009-11-12 20:49:22 +00:00
Dan Gohman 9fd22f68f2 Set isBarrier = 1 on return instructions, as they are control barriers.
llvm-svn: 86851
2009-11-11 18:11:07 +00:00
Jeffrey Yasskin b40d3f76a0 Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Anton Korobeynikov 700c4ab3f9 Add and-not (bic) patterns. Based heavily on patch by Brian Lucas!
llvm-svn: 86471
2009-11-08 15:33:12 +00:00
Anton Korobeynikov e92c508764 Move OR patterns upper to all logical stuff. No functionality change.
llvm-svn: 86470
2009-11-08 15:32:44 +00:00
Anton Korobeynikov a404d61c8e Some nice peephole patterns. Based on patch by Brian Lucas!
llvm-svn: 86469
2009-11-08 15:32:28 +00:00
Anton Korobeynikov fd9a893cab Print tab before operand of jcc
llvm-svn: 86468
2009-11-08 15:32:11 +00:00
Anton Korobeynikov 4ca8d3a6a6 Fix invalid operand updates & implement post-inc memory operands
llvm-svn: 86466
2009-11-08 14:27:38 +00:00
Chris Lattner 8714348afd indicate what the native integer types for the target are.
Please verify.

llvm-svn: 86397
2009-11-07 19:07:32 +00:00
Anton Korobeynikov cf84ab5043 First try of the post-inc operands handling... Not fully worked, though :(
llvm-svn: 86386
2009-11-07 17:15:25 +00:00
Anton Korobeynikov d3c8319f48 Add some dummy support for post-incremented loads
llvm-svn: 86385
2009-11-07 17:15:06 +00:00
Anton Korobeynikov f93bb39b03 Add 8 bit libcalls and make use of them for msp430
llvm-svn: 86384
2009-11-07 17:14:39 +00:00
Anton Korobeynikov e61e0b9a74 Add few pseudo-source-values
llvm-svn: 86383
2009-11-07 17:13:57 +00:00
Anton Korobeynikov 2a88785685 Initial support for addrmode handling. Tests by Brian Lucas!
llvm-svn: 86382
2009-11-07 17:13:35 +00:00
Anton Korobeynikov 1bbc8d2a86 Some preliminary variable asmprinting
llvm-svn: 86381
2009-11-07 17:12:58 +00:00
Anton Korobeynikov 3b7c712e9e Use '.L' for global private prefix (as mspgcc)
llvm-svn: 86380
2009-11-07 17:12:38 +00:00
Anton Korobeynikov e04fa15cb3 Drop old asmprinter stuff
llvm-svn: 86379
2009-11-07 17:12:21 +00:00
Dan Gohman ee8afcc59d Factor out the printing of the leading tab into printInlineAsm.
llvm-svn: 86199
2009-11-06 00:04:54 +00:00
Dan Gohman b15f4a1cbd Remove uninteresting and confusing debug output.
llvm-svn: 86149
2009-11-05 18:47:09 +00:00
Jakob Stoklund Olesen c7cfc94bcc Print out an informative comment for KILL instructions.
The KILL pseudo-instruction may survive to the asm printer pass, just like the IMPLICIT_DEF. Print the KILL as a comment instead of just leaving a blank line in the output.

With -asm-verbose=0, a blank line is printed, like IMPLICIT?DEF.

llvm-svn: 86041
2009-11-04 19:24:37 +00:00
Dan Gohman 453d64c9f5 Rename usesCustomDAGSchedInserter to usesCustomInserter, and update a
bunch of associated comments, because it doesn't have anything to do
with DAGs or scheduling. This is another step in decoupling MachineInstr
emitting from scheduling.

llvm-svn: 85517
2009-10-29 18:10:34 +00:00
Ted Kremenek ce8f626f82 Update CMake files.
llvm-svn: 85161
2009-10-26 22:06:01 +00:00
Nick Lewycky 974e12b2d3 Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky 02d5f77d26 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Benjamin Kramer c77f8634e5 Shift art to the right to keep GCC from complaining about multi-line comments.
llvm-svn: 84849
2009-10-22 09:28:49 +00:00
Anton Korobeynikov f1ad2c618a Use special DAG-to-DAG preprocessing to allow mem-mem instructions to be selected.
Yay for ASCII graphics!

llvm-svn: 84808
2009-10-22 00:16:00 +00:00
Anton Korobeynikov 9e92857b38 Add DAG printing for RMW stuff debugging
llvm-svn: 84776
2009-10-21 19:18:28 +00:00
Anton Korobeynikov ccfa3e31f7 RMW preprocessing stuff was incorrect. Grab the stuff from x86 backend and disable some tests until it will be clever enough to handle them.
llvm-svn: 84775
2009-10-21 19:17:55 +00:00
Anton Korobeynikov 5399c2d05e Implement branch folding
llvm-svn: 84774
2009-10-21 19:17:18 +00:00
Anton Korobeynikov 2983dcb1f2 Cosmetic changes, no functionality changes
llvm-svn: 84773
2009-10-21 19:16:49 +00:00
Anton Korobeynikov 7099d0c19c Add note
llvm-svn: 84713
2009-10-21 00:14:15 +00:00
Anton Korobeynikov e43af4a085 Be crazy and assert in case of unsupported modifier passed.
llvm-svn: 84712
2009-10-21 00:13:58 +00:00
Anton Korobeynikov 11074fa73e Handle external symbols
llvm-svn: 84711
2009-10-21 00:13:42 +00:00
Anton Korobeynikov cc55b9086d Distinguish between pcrel imm operands and 'normal' ones. Fix fixes gross weirdness of asmprinting.
llvm-svn: 84710
2009-10-21 00:13:25 +00:00
Anton Korobeynikov 94ba9c27b0 Add basic block operands & jump kinds
llvm-svn: 84709
2009-10-21 00:13:05 +00:00
Anton Korobeynikov 8a06a4e5c8 Ignore all implicit reg operands
llvm-svn: 84708
2009-10-21 00:12:44 +00:00
Anton Korobeynikov 196b0e5431 Add a workaround for different memops prefixes
llvm-svn: 84707
2009-10-21 00:12:27 +00:00
Anton Korobeynikov 4e32bff382 Checkpoint MCInst printer. We (almostly) able to print global / JT / constpool entries
llvm-svn: 84706
2009-10-21 00:12:08 +00:00
Anton Korobeynikov 7fbc0a50d5 Add simple operand printing stuff
llvm-svn: 84704
2009-10-21 00:11:27 +00:00
Anton Korobeynikov 6e78029d82 Add experimental MSP430 MCInstLowering stuff
llvm-svn: 84703
2009-10-21 00:11:08 +00:00
Anton Korobeynikov daaa2f0c31 Wire up MSP430 printMCInst() method
llvm-svn: 84702
2009-10-21 00:10:47 +00:00
Anton Korobeynikov b6e2e4fd50 Add MSP430 InstPrinter stub
llvm-svn: 84701
2009-10-21 00:10:30 +00:00
Anton Korobeynikov 13de81ac40 Use proper target data
llvm-svn: 84700
2009-10-21 00:10:00 +00:00
Evan Cheng 8759585aba Revert 84315 for now. Re-thinking the patch.
llvm-svn: 84321
2009-10-17 07:53:04 +00:00
Evan Cheng 0818d87ed1 Rename getFixedStack to getStackObject. The stack objects represented are not
necessarily fixed. Only those will negative frame indices are "fixed."

llvm-svn: 84315
2009-10-17 06:22:26 +00:00
Anton Korobeynikov 4b38ce9f25 Add missed mem-mem move patterns
llvm-svn: 83812
2009-10-11 23:03:53 +00:00
Anton Korobeynikov 415c3dc501 Add MSP430 mem-mem insts support. Patch by Brian Lucas with some my refinements
llvm-svn: 83811
2009-10-11 23:03:28 +00:00
Anton Korobeynikov 6bce6bbf40 Implement 'm' memory operand properly
llvm-svn: 83785
2009-10-11 19:14:21 +00:00
Anton Korobeynikov a58a3f930a Implement proper asmprinting for the globals. This eliminates bogus "call" modifier and also adds support for offsets wrt globals.
llvm-svn: 83784
2009-10-11 19:14:02 +00:00
Anton Korobeynikov 3525a4a268 Implement asm printing for inline asm memory operands
llvm-svn: 83783
2009-10-11 19:13:34 +00:00
Anton Korobeynikov 5b8826b4da It seems that OR operation does not affect status reg at all.
Remove impdef of SRW. This fixes PR4779

llvm-svn: 83739
2009-10-10 22:17:47 +00:00
Jim Grosbach fa14dd430c Add register-reuse to frame-index register scavenging. When a target uses
a virtual register to eliminate a frame index, it can return that register
and the constant stored there to PEI to track. When scavenging to allocate
for those registers, PEI then tracks the last-used register and value, and
if it is still available and matches the value for the next index, reuses
the existing value rather and removes the re-materialization instructions.
Fancier tracking and adjustment of scavenger allocations to keep more
values live for longer is possible, but not yet implemented and would likely
be better done via a different, less special-purpose, approach to the
problem.

eliminateFrameIndex() is modified so the target implementations can return
the registers they wish to be tracked for reuse.

ARM Thumb1 implements and utilizes the new mechanism. All other targets are
simply modified to adjust for the changed eliminateFrameIndex() prototype.

llvm-svn: 83467
2009-10-07 17:12:56 +00:00
Dan Gohman 10d3dc569b Instead of printing unnecessary basic block labels as labels in
verbose-asm mode, print comments instead. This eliminates a non-comment
difference between verbose-asm mode and non-verbose-asm mode.

Also, factor out the relevant code out of all the targets and into
target-independent code.

llvm-svn: 83392
2009-10-06 17:38:38 +00:00
Devang Patel 051454a16f Update processDebugLoc() so that it can be used to process debug info before and after printing an instruction.
llvm-svn: 83363
2009-10-06 02:19:11 +00:00
Devang Patel e0709cfc92 Use MachineInstr as an processDebugLoc() argument.
This will allow processDebugLoc() to handle scopes for DWARF debug info. 

llvm-svn: 83183
2009-09-30 23:12:50 +00:00
Dan Gohman 32f71d714b Rename getTargetNode to getMachineNode, for consistency with the
naming scheme used in SelectionDAG, where there are multiple kinds
of "target" nodes, but "machine" nodes are nodes which represent
a MachineInstr.

llvm-svn: 82790
2009-09-25 18:54:59 +00:00
Evan Cheng 9827ad39a7 Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic 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
2009-09-19 09:51:03 +00:00
Evan Cheng 270d0f986f Enhance EmitInstrWithCustomInserter() so target can specify CFG changes that sdisel will use to properly complete phi nodes.
Not functionality change yet.

llvm-svn: 82273
2009-09-18 21:02:19 +00:00
Anton Korobeynikov 592638ae05 Allow symbols to start from the digit if target requests it. This allows, e.g. pinning
variables to specified absolute address. Make use of this feature for MSP430.
This unbreaks PR4776.

llvm-svn: 82227
2009-09-18 16:57:42 +00:00
Chris Lattner eb2cc68254 remove all but one reference to TargetRegisterDesc::AsmName.
llvm-svn: 81714
2009-09-13 20:31:40 +00:00
Chris Lattner ad10b3be3e the tblgen produced 'getRegisterName' method does not access
the object, make it static instead of const.

llvm-svn: 81711
2009-09-13 20:19:22 +00:00
Chris Lattner 06c5eed9e9 make tblgen produce a function that returns the name for a physreg.
Nothing is using this info yet.

llvm-svn: 81707
2009-09-13 20:08:00 +00:00
Chris Lattner 1d04aa78f3 replace printBasicBlockLabel with EmitBasicBlockStart,
now that printBasicBlockLabel is only used for starting
a MBB.  This allows elimination of a bunch of arguments.

llvm-svn: 81684
2009-09-13 18:25:37 +00:00
Chris Lattner 4cd449813a convert some uses of printBasicBlockLabel to use GetMBBSymbol
instead.

llvm-svn: 81677
2009-09-13 17:14:04 +00:00
Chris Lattner 321bc99a74 remove DebugLoc from MCInst and eliminate "Comment printing" from
the MCInst path of the asmprinter.  Instead, pull comment printing
out of the autogenerated asmprinter into each target that uses the
autogenerated asmprinter.  This causes code duplication into each
target, but in a way that will be easier to clean up later when more
asmprinter stuff is commonized into the base AsmPrinter class.

This also fixes an xcore strangeness where it inserted two tabs
before every instruction.

llvm-svn: 81396
2009-09-09 23:14:36 +00:00
Duncan Sands 2fbeaf084f Remove some unused variables and methods warned about by
icc (#177, partial).  Patch by Erick Tryzelaar.

llvm-svn: 81106
2009-09-06 08:33:48 +00:00
Sandeep Patel 68c5f477fa Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson.
llvm-svn: 80773
2009-09-02 08:44:58 +00:00
Benjamin Kramer 3c62f5095a Normalize makefile comments and sort cmake file lists.
llvm-svn: 80584
2009-08-31 13:05:24 +00:00
Anton Korobeynikov a0e01bec87 Add dummy inline asm handling for 'r' constraint. This fixes PR4778
llvm-svn: 80085
2009-08-26 13:44:29 +00:00
Anton Korobeynikov 271cdda8e1 Provide dynamic_stackalloc lowering for MSP430.
This fixes PR4769

llvm-svn: 80001
2009-08-25 17:00:23 +00:00
Daniel Dunbar 34ee203337 Fix some refactos for iostream changes (in -Asserts mode).
- The world needs better C++ refactoring tools, can I get an Amen!?

llvm-svn: 79843
2009-08-23 08:50:52 +00:00
Chris Lattner 317dbbcfb1 eliminate uses of cerr()
llvm-svn: 79834
2009-08-23 07:05:07 +00:00
Chris Lattner af29ea6d57 eliminate the last DOUTs from the targets.
llvm-svn: 79833
2009-08-23 06:49:22 +00:00
Benjamin Kramer f7b571726a Forgot to update some CMakeLists.
llvm-svn: 79780
2009-08-22 22:20:11 +00:00
Chris Lattner e9a75a6654 rename TAI -> MAI, being careful not to make MAILJMP instructions :)
llvm-svn: 79777
2009-08-22 21:43:10 +00:00
Chris Lattner 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Chris Lattner 4b7dadb76e eliminate AsmPrinter::SwitchToSection and just have clients
talk to the MCStreamer directly instead.

llvm-svn: 79405
2009-08-19 05:49:37 +00:00
Anton Korobeynikov c1524d442d Cleanup the mess in msp430 target registration and hopefully unbreak the build
llvm-svn: 79024
2009-08-14 19:06:50 +00:00
Anton Korobeynikov 384b336911 Hopefully unbreak cmake builds
llvm-svn: 79015
2009-08-14 18:46:49 +00:00
Anton Korobeynikov 52b7f0ad5f Give MSP430 a separate asmprinter lib
llvm-svn: 79012
2009-08-14 18:28:12 +00:00
Chris Lattner 9a6cf91261 Change TargetAsmInfo to be constructed via TargetRegistry from a Target+Triple
pair instead of from a virtual method on TargetMachine.  This cuts the final
ties of TargetAsmInfo to TargetMachine, meaning that MC can now use 
TargetAsmInfo.

llvm-svn: 78802
2009-08-12 07:22:17 +00:00
Owen Anderson 9f94459d24 Split EVT into MVT and EVT, the former representing _just_ a primitive type, while
the latter is capable of representing either a primitive or an extended type.

llvm-svn: 78713
2009-08-11 20:47:22 +00:00
Chris Lattner 2c30970b22 pass the TargetTriple down from each target ctor to the
LLVMTargetMachine ctor.  It is currently unused.

llvm-svn: 78711
2009-08-11 20:42:37 +00:00
Owen Anderson 53aa7a960c Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
llvm-svn: 78610
2009-08-10 22:56:29 +00:00