1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

14905 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
76da38e8e8 Expand the x86 V_SET0* pseudos right after register allocation.
This also makes it possible to reduce the number of pseudo instructions
and get rid of the encoding information.

llvm-svn: 140776
2011-09-29 05:10:54 +00:00
Jakob Stoklund Olesen
49803374a4 Remove NumImplicitOps which is now unused.
llvm-svn: 140767
2011-09-29 01:47:36 +00:00
Michael J. Spencer
5948c3822e Object: Add isSection{Data,BSS}.
llvm-svn: 140721
2011-09-28 20:57:30 +00:00
Bill Wendling
b3656866e2 Create and use an llvm.eh.sjlj.functioncontext intrinsic.
This intrinsic is used to pass the index of the function context to the back-end
for further processing. The back-end is in charge of filling in the rest of the
entries.

llvm-svn: 140676
2011-09-28 03:36:43 +00:00
Jakob Stoklund Olesen
2bf243f464 Remove X86-dependent stuff from SSEDomainFix.
This also enables domain swizzling for AVX code which required a few
trivial test changes.

The pass will be moved to lib/CodeGen shortly.

llvm-svn: 140659
2011-09-27 23:50:46 +00:00
Jakob Stoklund Olesen
b843221bf0 Promote the X86 Get/SetSSEDomain functions to TargetInstrInfo.
I am going to unify the SSEDomainFix and NEONMoveFix passes into a
single target independent pass.  They are essentially doing the same
thing.

llvm-svn: 140652
2011-09-27 22:57:18 +00:00
Jim Grosbach
e883e939a3 Rename AddSelectionDAGCSEId() to addSelectionDAGCSEId().
Naming conventions consistency. No functional change.

llvm-svn: 140636
2011-09-27 20:59:33 +00:00
Michael J. Spencer
82f9fa9d9a Object: Add archive support.
llvm-svn: 140626
2011-09-27 19:36:55 +00:00
Nadav Rotem
5b6d21503b Cleanup PromoteIntOp_EXTRACT_VECTOR_ELT and PromoteIntRes_SETCC.
Add a new method: getAnyExtOrTrunc and use it to replace the manual check.

llvm-svn: 140603
2011-09-27 11:16:47 +00:00
Eli Friedman
9c1a430966 Enhance alias analysis for atomic instructions a bit. Upgrade a couple alias-analysis tests to the new atomic instructions.
llvm-svn: 140557
2011-09-26 20:15:28 +00:00
James Molloy
d63e75cd59 Fix emission of debug data for global variables. getContext() on DIGlobalVariables is not valid any more.
llvm-svn: 140539
2011-09-26 17:40:42 +00:00
Jakob Stoklund Olesen
cbd2c336ab Add target hook for pseudo instruction expansion.
Many targets use pseudo instructions to help register allocation.  Like
the COPY instruction, these pseudos can be expanded after register
allocation.  The early expansion can make life easier for PEI and the
post-ra scheduler.

This patch adds a hook that is called for all remaining pseudo
instructions from the ExpandPostRAPseudos pass.

llvm-svn: 140472
2011-09-25 19:21:35 +00:00
Jakob Stoklund Olesen
7e8448c147 Clean up code after renaming LowerSubregs -> ExpandPostRAPseudos.
No functional change intended.

llvm-svn: 140470
2011-09-25 16:46:08 +00:00
Daniel Dunbar
599366dcae sys::Process: Add a SetWorkingDirectory method.
llvm-svn: 140433
2011-09-23 23:23:36 +00:00
Anna Zaks
76528b198e Add getTreeFactory() to ImmutableSet to allow construction of ImmutableSetRef from an ImmutableSet object.
llvm-svn: 140402
2011-09-23 19:10:26 +00:00
Eric Christopher
f79f875df9 We're no longer going to bother supporting platforms that don't
support C89.

We probably didn't support them anyways.

llvm-svn: 140361
2011-09-23 00:53:10 +00:00
Owen Anderson
d3151e11e8 Start stubbing out MCModule and MCAtom, which provide an API for accessing the rich disassembly of a complete object or executable.
These are very much a work in progress, and not really useful yet.

llvm-svn: 140345
2011-09-22 22:32:22 +00:00
Jakob Stoklund Olesen
1d3105c3d3 Add a MinNumRegs argument to MRI::constrainRegClass().
The function will refuse to use a register class with fewer registers
than MinNumRegs.  This can be used by clients to avoid accidentally
increase register pressure too much.

The default value of MinNumRegs=0 doesn't affect how constrainRegClass()
works.

llvm-svn: 140339
2011-09-22 21:39:31 +00:00
Andrew Trick
c94573ded6 Lower ARM adds/subs to add/sub after adding optional CPSR operand.
This is still a hack until we can teach tblgen to generate the
optional CPSR operand rather than an implicit CPSR def. But the
strangeness is now limited to the selection DAG. ADD/SUB MI's no
longer have implicit CPSR defs, nor do we allow flag setting variants
of these opcodes in machine code. There are several corner cases to
consider, and getting one wrong would previously lead to nasty
miscompilation. It's not the first time I've debugged one, so this
time I added enough verification to ensure it won't happen again.

llvm-svn: 140228
2011-09-21 02:20:46 +00:00
Benjamin Kramer
1622dddba3 DebugInfo: Add equality operators and default constructor to DILineInfo.
llvm-svn: 140223
2011-09-21 01:13:16 +00:00
Bill Wendling
66d2eeb730 Use ArrayRef instead of an explicit 'const std::vector &'.
llvm-svn: 140172
2011-09-20 19:05:04 +00:00
Andrew Trick
bfac89c238 Restore hasPostISelHook tblgen flag.
No functionality change. The hook makes it explicit which patterns
require "special" handling. i.e. it self-documents tblgen
deficiencies. I plan to add verification in ExpandISelPseudos and
Thumb2SizeReduce to catch any missing hasPostISelHooks. Otherwise it's
too fragile.

llvm-svn: 140160
2011-09-20 18:22:31 +00:00
Akira Hatanaka
795050d1d1 Add mips64 & mips64el to Triple. Patch by Liu with modifications.
llvm-svn: 140157
2011-09-20 18:09:37 +00:00
NAKAMURA Takumi
4c7dbf17cc include/llvm/Config/llvm-config.h.in: Add the entry LLVM_PATH_XDOT_PY, for consistency against llvm-config.h.cmake.
llvm-svn: 140137
2011-09-20 03:54:11 +00:00
NAKAMURA Takumi
b4fb714301 include/llvm/Config: Reorder LLVM_HAS_ATOMICS along config.h.in for consistency.
llvm-svn: 140136
2011-09-20 03:54:05 +00:00
NAKAMURA Takumi
bfa21dba17 include/llvm/Config/config.h.cmake: Unbreak CMake build to tweak LLVM_HAS_ATOMICS.
llvm-svn: 140135
2011-09-20 03:53:57 +00:00
Andrew Trick
53aeb9f663 ARM isel bug fix for adds/subs operands.
Modified ARMISelLowering::AdjustInstrPostInstrSelection to handle the
full gamut of CPSR defs/uses including instructins whose "optional"
cc_out operand is not really optional. This allowed removal of the
hasPostISelHook to simplify the .td files and make the implementation
more robust.
Fixes rdar://10137436: sqlite3 miscompile

llvm-svn: 140134
2011-09-20 03:17:40 +00:00
Eric Christopher
6cf9c3efe8 Remove more of llvmc and dependencies.
llvm-svn: 140121
2011-09-20 00:34:27 +00:00
Eric Christopher
cd8b37ee52 Regenerate configure.
llvm-svn: 140065
2011-09-19 20:46:12 +00:00
Eric Christopher
9f7d25652d Rename LLVM_MULTITHREADED define and fix build without threads.
Patch by Arrowdodger.

llvm-svn: 140064
2011-09-19 20:43:23 +00:00
Ted Kremenek
484a96fab1 Add ImmutableMapRef and ImmutableSetRef, which consolidate Immutable[Map,Set] and its Factory. This may eventually replace Immtuable[Map,Set].
llvm-svn: 139967
2011-09-16 23:01:25 +00:00
Owen Anderson
e54c4beb5a Don't attach annotations to MCInst's. Instead, have the disassembler return, and the printer accept, an annotation string which can be passed through if the client cares about annotations.
llvm-svn: 139876
2011-09-15 23:38:46 +00:00
Ivan Krasin
de2d3cf093 use 64-bit types instead of off_t/size_t to avoid the issue when
gold plugin is built with Large File Support (sizeof(off_t) == 64 on i686)
and the rest of LLVM is built w/o Large File Support
(sizeof(off_t) == 32 on i686) which corrupts the stack.

llvm-svn: 139873
2011-09-15 23:13:00 +00:00
Benjamin Kramer
d8bbe6cceb Unbreak the build for compilers that don't include cstdint everywhere.
llvm-svn: 139868
2011-09-15 22:26:16 +00:00
Benjamin Kramer
8e526ee5b0 CommandLine: Add support for 64 bit unsigned integer options.
llvm-svn: 139848
2011-09-15 21:17:37 +00:00
Benjamin Kramer
a2833ff7e0 DWARF: Put all the pieces we have together and provide a single accessor to DIContext that provides line information when given an address.
llvm-svn: 139836
2011-09-15 20:43:22 +00:00
Owen Anderson
84d4e5d0e2 Add support for stored annotations to MCInst, and provide facilities for MC-based InstPrinters to print them out. Enhance the ARM and X86 InstPrinter's to do so in verbose mode.
llvm-svn: 139820
2011-09-15 18:36:29 +00:00
Jakob Stoklund Olesen
93195a175c Use getPrevSlot() instead of getPrevIndex().
The getPrevIndex() function moves to the same slot in the previous
instruction.  For getVNInfoBefore(), we just need the previous slot in
the same instruction.

llvm-svn: 139793
2011-09-15 15:31:49 +00:00
Nick Lewycky
e83d55a4d2 Despite what the GCC wiki says, a quick search shows that
DW_AT_GNU_template_name = 0x2110, not 0x2108. That would explain those 
attr #0x2110 under the DW_TAG_GNU_template_template_param I'm seeing. Migrate
from documented values to reality.

llvm-svn: 139785
2011-09-15 05:30:55 +00:00
Nick Lewycky
d984768671 Add some more DWARF extensions from:
1. http://gcc.gnu.org/wiki/TemplateParmsDwarf
2. ftp://ftp.software.ibm.com/software/os390/czos/dwarf/mips_extensions.pdf

llvm-svn: 139784
2011-09-15 05:21:03 +00:00
Jakob Stoklund Olesen
83f23f23cd Stop verifying hasPHIKill() flags.
There is only one legitimate use remaining, in addIntervalsForSpills().
All other calls to hasPHIKill() are only used to update PHIKill flags.

The addIntervalsForSpills() function is part of the old spilling
framework, only used by linearscan.

llvm-svn: 139783
2011-09-15 05:16:30 +00:00
Jakob Stoklund Olesen
a7631a56b4 Leave hasPHIKill flags alone in LiveInterval::RenumberValues.
It is conservatively correct to keep the hasPHIKill flags, even after
deleting PHI-defs.

The calculation can be very expensive after taildup has created a
quadratic number of indirectbr edges in the CFG, and the hasPHIKill flag
isn't used for anything after RenumberValues().

llvm-svn: 139780
2011-09-15 04:37:18 +00:00
Nick Lewycky
c76a2c21bc Update Dwarf enums list for DWARF 4.
Note that DW_TAG_rvalue_reference_type is officially 0x42, not 0x41.

llvm-svn: 139779
2011-09-15 04:23:44 +00:00
Andrew Trick
e5bb7267ff [regcoalescing] bug fix for RegistersDefinedFromSameValue.
An improper SlotIndex->VNInfo lookup was leading to unsafe copy removal.
Fixes PR10920 401.bzip2 miscompile with no IV rewrite.

llvm-svn: 139765
2011-09-15 01:09:33 +00:00
Douglas Gregor
66d5bb28aa Update the comment for system_temp_directory() to indicate when it
will ignore the erasedOnReboot option, and properly escape the
backslash in "C:\TEMP". Thanks to Aaron and Francois.

llvm-svn: 139755
2011-09-14 23:21:47 +00:00
Devang Patel
e5dc3a1f1e Add support to emit debug info for C++0x nullptr type.
llvm-svn: 139751
2011-09-14 23:13:28 +00:00
Douglas Gregor
96b7e66374 Add a simple routine to determine the typical system directory for
temporary data. 

llvm-svn: 139725
2011-09-14 20:27:01 +00:00
Jim Grosbach
36d319e831 Move state var to private class member.
llvm-svn: 139697
2011-09-14 16:37:04 +00:00
Douglas Gregor
8c0777c5f3 Add APInt support for converting to/from hexatridecimal strings
llvm-svn: 139695
2011-09-14 15:54:46 +00:00
Benjamin Kramer
52607b3842 Object: make the following changes into SymbolRef
- Add enum SymbolType and function getSymbolType()
- Add function isGlobal() - it's returns true for symbols that can be used in another objects, such as library functions.
- Rename function getAddress() to getOffset() and add new function getAddress(), because currently getAddress() returns section offset of symbol first byte. new getAddress() return symbol address.
- Change usage SymbolRef::getAddress() to getOffset() in tools/llvm-nm and tools/llvm-objdump.

Patch by Danil Malyshev!

llvm-svn: 139683
2011-09-14 01:22:52 +00:00
Benjamin Kramer
2c621d55f6 Remove unimplemented function prototypes from PathV2. They can be readded when someone cares enough.
Patch by Aaron Ballman!

llvm-svn: 139682
2011-09-14 01:14:36 +00:00
Benjamin Kramer
5b94d9657f ObjectFile: Add support for mach-o-style dSYM companion files.
llvm-svn: 139676
2011-09-14 00:39:22 +00:00
Eric Christopher
25b7bedcf9 Fix indenting.
llvm-svn: 139670
2011-09-13 23:45:39 +00:00
Kevin Enderby
4a91571f82 First step in supporting #line directives in assembler. This step parses the
#line directives with the needed support in the lexer.  Next will be to build
a simple file/line# table mapping source SMLoc's for later use by diagnostics.
And the last step will be to get the diagnostics to use the mapping for file
and line numbers.

llvm-svn: 139669
2011-09-13 23:45:18 +00:00
Benjamin Kramer
eb3c03dfb7 Remove include of header that doesn't exist (yet).
llvm-svn: 139629
2011-09-13 19:55:32 +00:00
Benjamin Kramer
c4e7a56915 Sketch out a DWARF parser.
This introduces a new library to LLVM: libDebugInfo. It will provide debug information
parsing to LLVM. Much of the design and some of the code is taken from the LLDB project.

It also contains an llvm-dwarfdump tool that can dump the abbrevs and DIEs from an
object file. It can be used to write tests for DWARF input and output easily.

llvm-svn: 139627
2011-09-13 19:42:23 +00:00
Benjamin Kramer
fcc23eeec7 Add the DataExtractor utility class.
It is an endian-aware helper that can read data from a StringRef. It will
come in handy for DWARF parsing. This class is inspired by LLDB's
DataExtractor, but is stripped down to the bare minimum needed for DWARF.

Comes with unit tests!

llvm-svn: 139626
2011-09-13 19:42:16 +00:00
Jakob Stoklund Olesen
8e739db8a2 Switch extendInBlock() to take a kill slot instead of the last use slot.
Three out of four clients prefer this interface which is consistent with
extendIntervalEndTo() and LiveRangeCalc::extend().

llvm-svn: 139604
2011-09-13 16:47:56 +00:00
Devang Patel
ac7dbe4022 Maintain hexadecimal order.
llvm-svn: 139601
2011-09-13 16:39:59 +00:00
Devang Patel
484cb2a602 Add DW_ATE_UTF, which clang started using in my previous commit!
llvm-svn: 139503
2011-09-12 17:18:20 +00:00
Nadav Rotem
abb5bb41d4 CR fixes per Bruno's request.
Undo the changes from r139285 which added custom lowering to vselect.
Add tablegen lowering for vselect.

llvm-svn: 139479
2011-09-11 15:02:23 +00:00
Duncan Sands
6fc4c521c9 Mark the eh.typeid.for intrinsic as being 'const', which it is inside
any given function.  As pointed out by John McCall, this is needed to
have redundant eh.typeid.for tests be eliminated in the presence of
cleanups.

llvm-svn: 139360
2011-09-09 07:50:37 +00:00
Devang Patel
ba2d56b1ef Directly point debug info to the stack slot of the arugment, instead of trying to keep track of vreg in which it the arugment is copied. The LiveDebugVariable can keep track of variable's ranges.
llvm-svn: 139330
2011-09-08 22:59:09 +00:00
Benjamin Kramer
3c40c2100b Add support for relocations to ObjectFile.
Patch by Danil Malyshev!

llvm-svn: 139314
2011-09-08 20:52:17 +00:00
James Molloy
f781d3d8e9 Refactor instprinter and mcdisassembler to take a SubtargetInfo. Add -mattr= handling to llvm-mc. Reviewed by Owen Anderson.
llvm-svn: 139237
2011-09-07 17:24:38 +00:00
Duncan Sands
b027f19035 When inlining exception handling code into another function, ensure that
duplicate tests are eliminated (for example if the two functions both have
a catch clause catching the same type, ensure the redundant one is removed).
Note that it would probably be safe to say that eh.typeid.for is 'const',
but since two calls to it with the same argument can give different results
(but only if the calls are in different functions), it seems more correct to
mark it only 'pure'; this doesn't get in the way of the optimization.

llvm-svn: 139236
2011-09-07 16:44:14 +00:00
Eli Friedman
6a45370c0f Relax the MemOperands on atomics a bit. Fixes -verify-machineinstrs failures for atomic laod/store on ARM.
(The fix for the related failures on x86 is going to be nastier because we actually need Acquire memoperands attached to the atomic load instrs, etc.)

llvm-svn: 139221
2011-09-07 02:23:42 +00:00
Duncan Sands
d1311488fe Add codegen support for vector select (in the IR this means a select
with a vector condition); such selects become VSELECT codegen nodes.
This patch also removes VSETCC codegen nodes, unifying them with SETCC
nodes (codegen was actually often using SETCC for vector SETCC already).
This ensures that various DAG combiner optimizations kick in for vector
comparisons.  Passes dragonegg bootstrap with no testsuite regressions
(nightly testsuite as well as "make check-all").  Patch mostly by
Nadav Rotem.

llvm-svn: 139159
2011-09-06 19:07:46 +00:00
Duncan Sands
6939ae53ac Split the init.trampoline intrinsic, which currently combines GCC's
init.trampoline and adjust.trampoline intrinsics, into two intrinsics
like in GCC.  While having one combined intrinsic is tempting, it is
not natural because typically the trampoline initialization needs to
be done in one function, and the result of adjust trampoline is needed
in a different (nested) function.  To get around this llvm-gcc hacks the
nested function lowering code to insert an additional parent variable
holding the adjust.trampoline result that can be accessed from the child
function.  Dragonegg doesn't have the luxury of tweaking GCC code, so it
stored the result of adjust.trampoline in the memory GCC set aside for
the trampoline itself (this is always available in the child function),
and set up some new memory (using an alloca) to hold the trampoline.
Unfortunately this breaks Go which allocates trampoline memory on the
heap and wants to use it even after the parent has exited (!).  Rather
than doing even more hacks to get Go working, it seemed best to just use
two intrinsics like in GCC.  Patch mostly by Sanjoy Das.

llvm-svn: 139140
2011-09-06 13:37:06 +00:00
Duncan Sands
a74d10bb60 Add some simple insertvalue simplifications, for the purpose of cleaning
up do-nothing exception handling code produced by dragonegg.

llvm-svn: 139113
2011-09-05 06:52:48 +00:00
Andrew Trick
43d88c3879 Comment and clarifying assert.
llvm-svn: 139036
2011-09-02 21:20:46 +00:00
Duncan Sands
33f33411e8 Darwin wants ctors/dtors to be ordered the other way round to linux.
llvm-svn: 139015
2011-09-02 18:07:19 +00:00
Benjamin Kramer
bd939ad83e Don't drop alignment info on local common symbols.
- On COFF the .lcomm directive has an alignment argument.
- On ELF we fall back to .local + .comm

Based on a patch by NAKAMURA Takumi.

Fixes PR9337, PR9483 and PR10128.

llvm-svn: 138976
2011-09-01 23:04:27 +00:00
Rafael Espindola
3bb0f9391c Remove the old tail duplication pass. It is not used and is unable to update
ssa, so it has to be run really early in the pipeline. Any replacement
should probably use the SSAUpdater.

llvm-svn: 138841
2011-08-30 23:03:45 +00:00
Benjamin Kramer
2ca7c2b2c7 Teach macho-dump to dump the uleb128s referred to by linkedit_data segments.
llvm-svn: 138836
2011-08-30 22:10:58 +00:00
Jeffrey Yasskin
8f36e758c2 Fix C++0x narrowing errors when char is unsigned.
In the case of EDInstInfo, this would actually cause a bug when -1 became 255
and was then compared >=0 in llvm-mc/Disassembler.cpp.

llvm-svn: 138825
2011-08-30 20:53:29 +00:00
Nicolas Geoffray
7927005c3a The code model of JIT should default to JITDefault.
llvm-svn: 138819
2011-08-30 19:50:33 +00:00
Rafael Espindola
321e47cd0b Emit segmented-stack specific code into function prologues for
X86. Modify the pass added in the previous patch to call this new
code.

This new prologues generated will call a libgcc routine (__morestack)
to allocate more stack space from the heap when required

Patch by Sanjoy Das.

llvm-svn: 138812
2011-08-30 19:39:58 +00:00
Rafael Espindola
84f69a1992 Command line option to enable support for segmented stacks:
-segmented-stacks.
Patch by Sanjoy Das!

llvm-svn: 138811
2011-08-30 19:29:02 +00:00
Evan Cheng
91aa81acaa Follow up to r138791.
Add a instruction flag: hasPostISelHook which tells the pre-RA scheduler to
call a target hook to adjust the instruction. For ARM, this is used to
adjust instructions which may be setting the 's' flag. ADC, SBC, RSB, and RSC
instructions have implicit def of CPSR (required since it now uses CPSR physical
register dependency rather than "glue"). If the carry flag is used, then the
target hook will *fill in* the optional operand with CPSR. Otherwise, the hook
will remove the CPSR implicit def from the MachineInstr.

llvm-svn: 138810
2011-08-30 19:09:48 +00:00
Benjamin Kramer
de3a6db63c Teach macho-dump how to dump linkedit_data load commands.
llvm-svn: 138807
2011-08-30 18:33:37 +00:00
Benjamin Kramer
67a03c6a96 Add load commands from Lion to Macho.h.
llvm-svn: 138806
2011-08-30 18:33:34 +00:00
Jim Grosbach
a1aa6a2e8b Thumb2 parsing and encoding for IT blocks.
llvm-svn: 138773
2011-08-29 22:24:09 +00:00
Jim Grosbach
447ede4d6e Tidy up. Whitespace.
llvm-svn: 138767
2011-08-29 21:15:20 +00:00
Jim Grosbach
a5a8e59643 Tidy up. 80 columns.
llvm-svn: 138750
2011-08-29 18:22:04 +00:00
Andrew Trick
026fa4da72 Reapply r138695. Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138737
2011-08-29 17:07:00 +00:00
Tobias Grosser
c6abc36833 Add AMDIL as valid target triple to LLVM.
Submitted by: Villmow, Micah <Micah.Villmow@amd.com>

llvm-svn: 138734
2011-08-29 15:44:55 +00:00
Andrew Trick
65754eb3f7 Reverting r138695 to see if it fixes clang self host.
llvm-svn: 138701
2011-08-27 06:10:16 +00:00
Andrew Trick
e38568bc07 Fix PassManager stack depths.
Patch by Xiaoyi Guo!

llvm-svn: 138695
2011-08-27 02:11:03 +00:00
Andrew Trick
504187a152 LoopInfo::updateUnloop fix, and verify Block->Loop maps.
Fixes an oversight, and adds verification to catch it in the unloop.ll tests.

llvm-svn: 138622
2011-08-26 03:06:34 +00:00
Bill Wendling
546c7a05de Initial check in that will auto-upgrade the old EH scheme to the new EH scheme.
This upgrade suffers from the problems of the old EH scheme - i.e., that the
calls to llvm.eh.exception() and llvm.eh.selector() can wander off and get
lost. It makes a valiant effort to reclaim these little lost lambs.

This is a first draft, so it hasn't yet been hooked up to the parser.

llvm-svn: 138602
2011-08-25 23:22:40 +00:00
David Greene
4cca5f784a Constify Comparison
Make ConstantInt::uge() const so it may be used in const contexts.

llvm-svn: 138579
2011-08-25 20:18:22 +00:00
Eli Friedman
6f95a6ae1b Basic x86 code generation for atomic load and store instructions.
llvm-svn: 138478
2011-08-24 20:50:09 +00:00
Nadav Rotem
43673d6d0b Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.
llvm-svn: 138469
2011-08-24 20:18:38 +00:00
Evan Cheng
420bf5446c Move TargetRegistry and TargetSelect from Target to Support where they belong.
These are strictly utilities for registering targets and components.

llvm-svn: 138450
2011-08-24 18:08:43 +00:00
Nate Begeman
87ffb9491b Add some useful accessors to c++ api that appear to be missing from the c api
llvm-svn: 138371
2011-08-23 20:27:46 +00:00
Evan Cheng
ed13551c1d Some refactoring so TargetRegistry.h no longer has to include any files
from MC.

llvm-svn: 138367
2011-08-23 20:15:21 +00:00
Eric Christopher
aa4993b9aa Revert "Address Duncan's CR request:"
This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340)

Conflicts:

	test/Transforms/InstCombine/bitcast.ll

llvm-svn: 138366
2011-08-23 20:11:10 +00:00
Nadav Rotem
d449bc9bff Address Duncan's CR request:
1. Cleanup the tests in ConstantFolding.cpp
2. Implement isAllOnes for Constant, ConstantFP, ConstantVector

llvm-svn: 138340
2011-08-23 17:48:43 +00:00
Ivan Krasin
aa3c2057c5 This patch adds support of le32 pseudo-cpu that stands for generic
32-bit little-endian CPU. Used by PNaCl and Emscripten.

llvm-svn: 138335
2011-08-23 16:59:00 +00:00
Benjamin Kramer
48f01f6a77 Add an MCInstrAnalysis version of isCall.
llvm-svn: 138305
2011-08-22 23:41:41 +00:00
Jay Foad
e6083b67c2 Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding its
functionality into DEFINE_TRANSPARENT_OPERAND_ACCESSORS. A side-effect
of this is that the operand accessors for Constants will tolerate NULL
operands, fixing PR10663.

llvm-svn: 138230
2011-08-22 09:37:03 +00:00
Devang Patel
e4127d626e Do not use named md nodes to track variables that are completely optimized. This does not scale while doing LTO with debug info. New approach is to include list of variables in the subprogram info directly.
llvm-svn: 138145
2011-08-19 23:28:12 +00:00
Jakob Stoklund Olesen
391019be7a Add IntervalMap::const_iterator::atBegin().
It returns true when operator--() can be called.

llvm-svn: 138107
2011-08-19 22:04:19 +00:00
Benjamin Kramer
c5a90f3683 C API functions must be able to see their extern "C" definitions, or it will be impossible to call them from C.
llvm-svn: 138022
2011-08-19 01:36:54 +00:00
Bill Wendling
3079e1ccda Add SplitLandingPadPredecessors().
SplitLandingPadPredecessors is similar to SplitBlockPredecessors in that it
splits the current block and attaches a set of predecessors to the new basic
block. However, it differs from SplitBlockPredecessors in that it's specifically
designed to handle landing pad blocks.

Two new basic blocks are created: one that is has the vector of predecessors as
its predecessors and one that has the remaining predecessors as its
predecessors. Those two new blocks then receive a cloned copy of the landingpad
instruction from the original block. The landingpad instructions are joined in a
PHI, etc. Like SplitBlockPredecessors, it updates the LLVM IR, AliasAnalysis,
DominatorTree, DominanceFrontier, LoopInfo, and LCCSA analyses.

llvm-svn: 138014
2011-08-19 00:05:40 +00:00
Ivan Krasin
311fcc9b92 Add NativeClient operating system support.
This patch adds support of NativeClient (*-*-nacl) OS support to LLVM.
It's already supported in autoconf/config.sub.

The motivation for this change is to start upstreaming PNaCl work. The
whole set of patches include llvm backends (i686, x86_64, ARM),
llvm-gcc (probably, would not be upstreamed because it's deprecated)
and clang (the work has been just started, the amount of changes is
going to be low and the most of the work is expected to be done close
to the mainline).

llvm-svn: 138005
2011-08-18 22:54:21 +00:00
Ivan Krasin
338df71d60 FastISel: avoid function calls between the materialization of the constant and its use.
llvm-svn: 137993
2011-08-18 22:06:10 +00:00
Chris Lattner
8213fad390 Rip out the old StructType APIs as warned about on llvmdev last week.
llvm-svn: 137953
2011-08-18 17:39:28 +00:00
Richard Osborne
415c5ff412 Add intrinsics for SETEV, GETED, GETET.
llvm-svn: 137938
2011-08-18 13:00:48 +00:00
Bill Wendling
71ce55ffd7 Add the support in code-gen for the landingpad instruction lowering.
The landingpad instruction is lowered into the EXCEPTIONADDR and EHSELECTION
SDNodes. The information from the landingpad instruction is harvested by the
'AddLandingPadInfo' function. The new EH uses the current EH scheme in the
back-end. This will change once we switch over to the new scheme. (Reviewed by
Jakob!)

llvm-svn: 137880
2011-08-17 21:56:44 +00:00
Bill Wendling
466ed8d316 Remove unneeded sentence.
llvm-svn: 137854
2011-08-17 19:33:27 +00:00
Jordy Rose
8f407b9649 ...and make sure DynamicLibrary builds by removing "const" from the Invalid placeholder.
llvm-svn: 137843
2011-08-17 18:28:14 +00:00
Jordy Rose
06883230c0 Don't use NULL to represent an invalid library; Cygwin uses this for RTLD_DEFAULT. Caught by Takumi.
llvm-svn: 137841
2011-08-17 18:23:17 +00:00
Owen Anderson
3146968039 Allow the MCDisassembler to return a "soft fail" status code, indicating an instruction that is disassemblable, but invalid. Only used for ARM UNPREDICTABLE instructions at the moment.
Patch by James Molloy.

llvm-svn: 137830
2011-08-17 17:44:15 +00:00
Jordy Rose
c689530acc Use DynamicLibrary instances as a way to get symbols from a specific library. Preparation for upcoming (preliminary) support for plugins for the static analyzer.
llvm-svn: 137791
2011-08-17 00:29:32 +00:00
Devang Patel
630d8ce36b Until now all debug info MDNodes referred to a root MDNode, a compile unit. This simplified handling of these needs in dwarf writer. However, one side effect of this is that during link time optimization all these MDNodes are _not_ uniqued. In other words there will be N number of MDNodes describing "int", "char" and all other types, which would suddenly grow when each object file starts using libraries like STL.
MDNodes graph structure such that compiler unit keeps track of important MDNodes and update dwarf writer to process mdnodes top-down instead of bottom up.

llvm-svn: 137778
2011-08-16 22:09:43 +00:00
Devang Patel
c6fd34458c Increment debug info version to accommodate upcoming change in debug info node structure.
llvm-svn: 137751
2011-08-16 21:00:05 +00:00
Bill Wendling
4ad70bfedd Add getFirstInsertionPt() method.
getFirstInsertionPt() returns an iterator to the first insertion point in a
basic block. This is after all PHIs and any other instruction which is required
to be at the top of the basic block (like LandingPadInst).

llvm-svn: 137744
2011-08-16 20:42:52 +00:00
Jim Grosbach
a9a0c62719 Remove unused Target argument from AsmParser construction methods.
The argument is unused, and is a layering violation in any case.

llvm-svn: 137735
2011-08-16 18:33:49 +00:00
Jim Grosbach
095a0ae3f3 Remove unused forward declaration.
llvm-svn: 137734
2011-08-16 18:31:36 +00:00
Jim Grosbach
445c83b31e Tidy up. Trailing whitespace.
llvm-svn: 137721
2011-08-16 16:38:17 +00:00
David Chisnall
cfbcd5cf21 Add a mechanism for optimisation plugins to register passes that all front ends can use without needing to be aware of the plugin (or the plugin be aware of the front end).
Before 3.0, I'd like to add a mechanism for automatically loading a set of plugins from a config file.  API suggestions welcome...

llvm-svn: 137717
2011-08-16 13:58:41 +00:00
Rafael Espindola
697b91ccef Remove unimplemented method. Fixes PR10658.
Thanks to Jonas Gafele for noticing.

llvm-svn: 137716
2011-08-16 13:53:50 +00:00
Jim Grosbach
31c0c9a1f6 MCTargetAsmParser target match predicate support.
Allow a target assembly parser to do context sensitive constraint checking
on a potential instruction match. This will be used, for example, to handle
Thumb2 IT block parsing.

llvm-svn: 137675
2011-08-15 23:03:29 +00:00
Devang Patel
f1b61abc8c Add a finalize() hook, that'll let DIBuilder construct compile unit lazily.
llvm-svn: 137673
2011-08-15 23:00:00 +00:00
Jim Grosbach
bc7725aa09 Move MatchResultTy enum into base class definition.
No need for it to be redefined as part of every derived target asm parser
class.

llvm-svn: 137649
2011-08-15 20:53:08 +00:00
Devang Patel
1b73744344 Refactor. Global variables are part of compile unit so let CompileUnit create new global variable.
llvm-svn: 137621
2011-08-15 17:57:41 +00:00
Jim Grosbach
1ae038c9c5 Tidy up trailing whitespace.
llvm-svn: 137619
2011-08-15 17:30:25 +00:00
Nick Lewycky
5b5b31917d Remove the last improper use of getGlobalContext() from LLVM.
This caused a race condition where a thread calls ~LLVMContextImpl which calls
Module::dropAllReferences which calls begin() on an empty ilist that would
create the sentinel, which racily accesses the global context.

This can not be fixed by locking inside createSentinel because the lock would
need to be shared with all users of the global context, including those that
reside outside LLVM's own code.

llvm-svn: 137546
2011-08-13 01:04:44 +00:00
Bill Wendling
4cbbcd4f82 Initial commit of the 'landingpad' instruction.
This implements the 'landingpad' instruction. It's used to indicate that a basic
block is a landing pad. There are several restrictions on its use (see
LangRef.html for more detail). These restrictions allow the exception handling
code to gather the information it needs in a much more sane way.

This patch has the definition, implementation, C interface, parsing, and bitcode
support in it.

llvm-svn: 137501
2011-08-12 20:24:12 +00:00
Devang Patel
b79ed42390 Constify.
llvm-svn: 137489
2011-08-12 18:18:02 +00:00
Devang Patel
5901733259 Use ArrayRef.
llvm-svn: 137485
2011-08-12 18:10:19 +00:00
Chris Lattner
d297c1dd99 add ifdef's to let people easily remove these dead api for testing.
llvm-svn: 137483
2011-08-12 18:08:19 +00:00
Chris Lattner
7f69a7da6e add two missing function impls
llvm-svn: 137470
2011-08-12 17:43:05 +00:00
Chris Lattner
d666fbc755 add new accessors to reflect new terminology in struct types.
llvm-svn: 137468
2011-08-12 17:31:02 +00:00
Duncan Sands
10a9e984bc Silence a bunch (but not all) "variable written but not read" warnings
when building with assertions disabled.

llvm-svn: 137460
2011-08-12 14:54:45 +00:00
Chris Lattner
ec2b25406c Fix an obscure bug in PointerUnion that would bite PointerUnion3/4. Basically,
when checking isNull(), we'd pick off the sentinel bit for the outer 
PointerUnion, but would not recursively convert the inner pointerunion to bool,
so if *its* sentinel bit is set, isNull() would incorrectly return false.

No testcase, because someone hit this when they were trying to refactor code
to use PointerUnion3, but they since found a better solution.

llvm-svn: 137428
2011-08-12 04:31:38 +00:00
NAKAMURA Takumi
20a1b348b6 include/llvm/Config/config.h.cmake: Reorder to follow config.h.in, and import stuff from llvm-config.h.cmake and clang/config.h.
llvm-svn: 137424
2011-08-12 03:27:54 +00:00
NAKAMURA Takumi
4836113d85 CMake: Eliminate unused checks and #undef(s) as below;
STACK_DIRECTION
YYTEXT_POINTER
HAVE_NAMESPACES
HAVE_STD_ITERATOR
HAVE_FWD_ITERATOR
HAVE_BI_ITERATOR
HAVE_GLOBAL_HASH_MAP
HAVE_GLOBAL_HASH_SET
HAVE_GNU_EXT_HASH_MAP
HAVE_GNU_EXT_HASH_SET
HAVE_STD_EXT_HASH_MAP
HAVE_STD_EXT_HASH_SET

llvm-svn: 137423
2011-08-12 03:27:48 +00:00
NAKAMURA Takumi
57d496a7d6 include/llvm/Config/llvm-config.h: Reorder and reword to follow (generated) config.h.in.
llvm-svn: 137413
2011-08-12 01:50:50 +00:00
NAKAMURA Takumi
212fb11994 configure: Update since r136721.
llvm-svn: 137412
2011-08-12 01:50:43 +00:00
Nick Lewycky
a4f1ff9b56 A virtual destructor for the class with virtual methods!
llvm-svn: 137400
2011-08-12 00:32:15 +00:00
Andrew Trick
5a5a5ebe68 Allow loop unrolling to get known trip counts from ScalarEvolution.
SCEV unrolling can unroll loops with arbitrary induction variables. It
is a prerequisite for -disable-iv-rewrite performance. It is also
easily handles loops of arbitrary structure including multiple exits
and is generally more robust.

This is under a temporary option to avoid affecting default
behavior for the next couple of weeks. It is needed so that I can
checkin unit tests for updateUnloop.

llvm-svn: 137384
2011-08-11 23:36:16 +00:00
NAKAMURA Takumi
df74220667 DataTypes.h.cmake: Tweak INT32_MIN for MSVC. MSC treats -2147483648 as -(2147483648U).
It caused an unexpected behavior since r137254.

llvm-svn: 137365
2011-08-11 21:59:55 +00:00
Chad Rosier
1ff3ae1c91 Typo.
llvm-svn: 137286
2011-08-11 00:22:48 +00:00
Devang Patel
504551c7bf Stay within 80 columns.
llvm-svn: 137283
2011-08-10 23:58:09 +00:00
Andrew Trick
306e3d0508 Reapplying r136844.
An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.

llvm-svn: 137276
2011-08-10 23:22:57 +00:00
Andrew Trick
0a61db0237 Cleanup. Remove an extraneous GraphTraits specialization.
llvm-svn: 137264
2011-08-10 22:55:39 +00:00
Devang Patel
1541972a13 Distinguish between two copies of one inlined variable. Take 2.
llvm-svn: 137253
2011-08-10 21:50:54 +00:00
Devang Patel
4459f63998 Provide utility to extract and use lexical scoping information from machine instructions.
llvm-svn: 137237
2011-08-10 19:04:06 +00:00
Andrew Trick
f598747450 Cleanup. Make ScalarEvolution an explicit argument of the
SimplifyIndVar utility since it is required.

llvm-svn: 137202
2011-08-10 04:22:26 +00:00
Andrew Trick
b85da1c369 Added a SimplifyIndVar utility to simplify induction variable users
based on ScalarEvolution without changing the induction variable phis.

This utility is the main tool of IndVarSimplifyPass, but the pass also
restructures induction variables in strange ways that are sensitive to
pass ordering. This provides a way for other loop passes to simplify
new uses of induction variables created during transformation. The
utility may be used by any pass that preserves ScalarEvolution. Soon
LoopUnroll will use it.

The net effect in this checkin is to cleanup the IndVarSimplify pass
by factoring out the SimplifyIndVar algorithm into a standalone utility.

llvm-svn: 137197
2011-08-10 03:46:27 +00:00
Andrew Trick
d10d5f0609 Cleanup. Added LoopBlocksDFS::perform for simple clients.
llvm-svn: 137195
2011-08-10 01:59:05 +00:00
Peter Collingbourne
1d25d83435 Preserve the name for this variant of IRBuilder::CreateCall
llvm-svn: 137192
2011-08-10 01:10:08 +00:00
Andrew Trick
c7ba3c5cd2 Cleanup. Avoid relying on specialization of std::distance.
llvm-svn: 137191
2011-08-10 00:49:12 +00:00
Andrew Trick
3ed0cd3cb6 Fix the LoopUnroller to handle nontrivial loops and partial unrolling.
These are not individual bug fixes. I had to rewrite a good chunk of
the unroller to make it sane. I think it was getting lucky on trivial
completely unrolled loops with no early exits. I included some fairly
simple unit tests for partial unrolling. I didn't do much stress
testing, so it may not be perfect, but should be usable now.

llvm-svn: 137190
2011-08-10 00:28:10 +00:00
Jakob Stoklund Olesen
f7f4398587 Trim an unneeded header.
llvm-svn: 137184
2011-08-09 23:49:21 +00:00
Eli Friedman
5a2d27800e Representation of 'atomic load' and 'atomic store' in IR.
llvm-svn: 137170
2011-08-09 23:02:53 +00:00
Rafael Espindola
0e580ecc63 Add missing file.
llvm-svn: 137162
2011-08-09 22:19:52 +00:00
Jakob Stoklund Olesen
cbd8bcf3b8 Move CalculateRegClass to MRI::recomputeRegClass.
This function doesn't have anything to do with spill weights, and MRI
already has functions for manipulating the register class of a virtual
register.

llvm-svn: 137123
2011-08-09 16:46:27 +00:00
Devang Patel
1d038e6e01 Provide method to print variable's extended name which includes inline location.
llvm-svn: 137095
2011-08-09 01:03:14 +00:00
Jakob Stoklund Olesen
2f58336f2f Refer to the RegisterCoalescer pass by ID.
A public interface is no longer needed since RegisterCoalescer is not an
analysis any more.

llvm-svn: 137082
2011-08-09 00:29:53 +00:00
Jakob Stoklund Olesen
9451389166 Hoist hasLoadFromStackSlot and hasStoreToStackSlot.
These the methods are target-independent since they simply scan the
memory operands.  They can live in TargetInstrInfoImpl.

llvm-svn: 137063
2011-08-08 20:53:24 +00:00
Benjamin Kramer
3490c59cda Pacify virtual dtor warnings and cmake buildbots.
llvm-svn: 137060
2011-08-08 19:09:02 +00:00
Benjamin Kramer
8c3f23ec80 Add MCInstrAnalysis class. This allows the targets to specify own versions of MCInstrDescs functions.
- Add overrides for ARM.
- Teach llvm-objdump to use this instead of plain MCInstrDesc.

llvm-svn: 137059
2011-08-08 18:56:44 +00:00
Chandler Carruth
e833bbd11e Temporarily revert r135528 which distinguishes between two copies of one
inlined variable, based on the discussion in PR10542.

This explodes the runtime of several passes down the pipeline due to
a large number of "copies" remaining live across a large function. This
only shows up with both debug and opt, but when it does it creates
a many-minute compile when self-hosting LLVM+Clang. There are several
other cases that show these types of regressions.

All of this is tracked in PR10542, and progress is being made on fixing
the issue. Once its addressed, the re-instated, but until then this
restores the performance for self-hosting and other opt+debug builds.

Devang, let me know if this causes any trouble, or impedes fixing it in
any way, and thanks for working on this!

llvm-svn: 136953
2011-08-05 00:51:31 +00:00
Duncan Sands
b034709948 Fix a place that was clearly forgotten when the type legalization
logic moved over to its own enum.  Noticed by Andrey Karpov with
the PVS-studio tool.

llvm-svn: 136881
2011-08-04 16:01:54 +00:00
Andrew Trick
aebed187b7 Reverting r136884 updateUnloop, which crashed a linux builder.
llvm-svn: 136857
2011-08-04 01:04:37 +00:00
Andrew Trick
cfb48e5133 An algorithm for incrementally updating LoopInfo within a
LoopPassManager. The incremental update should be extremely cheap in
most cases and can be used in places where it's not feasible to
regenerate the entire loop forest.

- "Unloop" is a node in the loop tree whose last backedge has been removed.
- Perform reverse dataflow on the block inside Unloop to propagate the
  nearest loop from the block's successors.
- For reducible CFG, each block in unloop is visited exactly
  once. This is because unloop no longer has a backedge and blocks
  within subloops don't change parents.
- Immediate subloops are summarized by the nearest loop reachable from
  their exits or exits within nested subloops.
- At completion the unloop blocks each have a new parent loop, and
  each immediate subloop has a new parent.

llvm-svn: 136844
2011-08-03 23:50:25 +00:00
Andrew Trick
4b22856b91 whitespace
llvm-svn: 136840
2011-08-03 23:43:49 +00:00
Andrew Trick
b20e31e81f An interface for iterating over a loop's blocks in DFS order.
llvm-svn: 136838
2011-08-03 23:27:28 +00:00
Bill Wendling
fdea9930ac Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.
This is some of my original LLVM code. *wipes tear*

llvm-svn: 136821
2011-08-03 22:18:20 +00:00
Owen Anderson
2331040816 Add accessors for manipulating an MCInst's operands.
llvm-svn: 136818
2011-08-03 21:52:15 +00:00
Jakub Staszak
7b30ba0db8 Add more constantness in BlockFrequencyInfo.
llvm-svn: 136816
2011-08-03 21:30:57 +00:00
Eli Friedman
afd08dcc2c New approach to r136737: insert the necessary fences for atomic ops in platform-independent code, since a bunch of platforms (ARM, Mips, PPC, Alpha are the relevant targets here) need to do essentially the same thing.
I think this completes the basic CodeGen for atomicrmw and cmpxchg.

llvm-svn: 136813
2011-08-03 21:06:02 +00:00
Bill Wendling
9db96fc81f Remove CreateUnwind from the IRBuillder.
llvm-svn: 136811
2011-08-03 20:53:38 +00:00
Andrew Trick
bbb5c7b0aa SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget
to notify SCEV of a change. Add forgetLoop in a couple of those places.

llvm-svn: 136797
2011-08-03 18:32:11 +00:00
Jay Foad
095dcdbd48 Use cast<> instead of a C-style cast to get some free assertions.
llvm-svn: 136771
2011-08-03 10:05:04 +00:00
Rafael Espindola
2b0d064f3b Move methods in PassManagerBuilder offline.
llvm-svn: 136727
2011-08-02 21:50:27 +00:00
Rafael Espindola
73efcf56f6 move PassManagerBuilder.h to IPO. This is a non intuitive place to put it,
but it solves a layering violation since things in Support are not supposed to
use things in Transforms.

llvm-svn: 136726
2011-08-02 21:50:24 +00:00
Rafael Espindola
cefc38659a Assume .cfi_startproc is the first thing in a function. If the function is
externally visable, create a local symbol to use in the CFE. If not, use the
function label itself.

Fixes PR10420.

llvm-svn: 136716
2011-08-02 20:24:22 +00:00
Roman Divacky
7453a0dcd6 Sketch out PowerPC ELF writer. This is enough to get clang -integrated-as
to compile a working hello world on FreeBSD/PPC32.

llvm-svn: 136689
2011-08-02 15:51:38 +00:00
Bill Wendling
b37af02067 Remove the LLVMBuildUnwind C API function.
The 'unwind' function is going away with the new EH rewrite. This is step 0 in
keeping front-ends from using it.

llvm-svn: 136683
2011-08-02 06:20:17 +00:00
Andrew Trick
86f6a3c645 Use consistent terminology for loop exit/exiting blocks. Name change only.
llvm-svn: 136677
2011-08-02 04:23:35 +00:00
Eli Friedman
564f52b2bf Fix a couple silly typos in IRBuilder in the new atomic instructions.
llvm-svn: 136665
2011-08-02 00:45:35 +00:00
Owen Anderson
4ee266955a Add a clear() operation to MCInst, to drop all of its operands. Useful for the disassembler, where we may realize fairly late into decoding that something is wrong and need to reset.
llvm-svn: 136634
2011-08-01 18:43:18 +00:00
Jakub Staszak
db23d8b195 Add BlockFrequency::getEntryFrequency()
llvm-svn: 136618
2011-08-01 15:22:10 +00:00
Jay Foad
f5b5b93126 The operands of a GlobalAlias are always Constants. Simplify things
accordingly.

llvm-svn: 136608
2011-08-01 12:20:36 +00:00
Bill Wendling
8a625cebd2 Add the 'resume' instruction for the new EH rewrite.
This adds the 'resume' instruction class, IR parsing, and bitcode reading and
writing. The 'resume' instruction resumes propagation of an existing (in-flight)
exception whose unwinding was interrupted with a 'landingpad' instruction (to be
added later).

llvm-svn: 136589
2011-07-31 06:30:59 +00:00
Bill Wendling
57ddbb84ac Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444,
r136445, r136446, r136253 pending review.

llvm-svn: 136556
2011-07-30 05:42:50 +00:00
Jakob Stoklund Olesen
7b77f35a1b Add an isSSA() flag to MachineRegisterInfo.
This flag is true from isel to register allocation when the machine
function is required to be in SSA form.  The TwoAddressInstructionPass
and PHIElimination passes clear the flag.

The SSA flag wil be used by the machine code verifier to check for SSA
form, and eventually an assertion can enforce it in +Asserts builds.
This will catch the common target error of creating machine code with
multiple defs of a virtual register.

llvm-svn: 136532
2011-07-29 22:51:22 +00:00
Jakub Staszak
02fa079dc3 Add more constantness in BranchProbabilityInfo.
llvm-svn: 136502
2011-07-29 19:30:00 +00:00
David Greene
5927323d9c Add a std::string Wrapper for TableGen
Create a std::string wrapper for use as a DenseMap key.  DenseMap is
not safe in generate with strings, so this wrapper indicates that only
strings guaranteed not to have certain values should be used in the
DenseMap.

llvm-svn: 136481
2011-07-29 19:06:58 +00:00
Eli Friedman
6f2419f1a2 Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to be
working on x86 (at least for trivial testcases); other architectures will
need more work so that they actually emit the appropriate instructions for
orderings stricter than 'monotonic'. (As far as I can tell, the ARM, PPC,
Mips, and Alpha backends need such changes.)

llvm-svn: 136457
2011-07-29 03:05:32 +00:00
Bill Wendling
e4090cc864 Add the AddLandingPadInfo function.
AddLandingPadInfo takes a landingpad instruction and grabs all of the
information from it that it needs for EH table generation.

llvm-svn: 136429
2011-07-28 23:42:57 +00:00
Eli Friedman
f6797ffc9a LangRef and basic memory-representation/reading/writing for 'cmpxchg' and
'atomicrmw' instructions, which allow representing all the current atomic
rmw intrinsics.

The allowed operands for these instructions are heavily restricted at the
moment; we can probably loosen it a bit, but supporting general
first-class types (where it makes sense) might get a bit complicated,
given how SelectionDAG works.

As an initial cut, these operations do not support specifying an alignment,
but it would be possible to add if we think it's useful. Specifying an
alignment lower than the natural alignment would be essentially
impossible to support on anything other than x86, but specifying a greater
alignment would be possible.  I can't think of any useful optimizations which
would use that information, but maybe someone else has ideas.

Optimizer/codegen support coming soon.

llvm-svn: 136404
2011-07-28 21:48:00 +00:00
Jakub Staszak
6076fe7cff If run with -debug give more information about Cyclic Probability.
llvm-svn: 136403
2011-07-28 21:46:58 +00:00
Bill Wendling
dba29efd6f Use ArrayRef instead of requiring an std::vector.
llvm-svn: 136396
2011-07-28 21:25:33 +00:00
Bill Wendling
22f729dcfb The personality function should be a Function* and not just a Value*.
llvm-svn: 136392
2011-07-28 21:14:13 +00:00
Jakub Staszak
22fcf6c40b Fix stupid mistake from commit 136381.
llvm-svn: 136384
2011-07-28 20:17:18 +00:00
Jakub Staszak
534e099ba0 Speed up BlockFrequencyInfo a little bit.
llvm-svn: 136381
2011-07-28 20:09:31 +00:00
Duncan Sands
beab1f4882 This file was moved from Support to ADT. Correct a comment.
llvm-svn: 136344
2011-07-28 08:36:22 +00:00
Nick Lewycky
31d1c92d69 In DenseMapInfo<pair<T, U>> tombstone key, use the tombstone for T and U instead
of the empty key for U. This shouldn't really matter because the tombstone key
for the pair was still distinct from every other key, but it is odd. Patch by
Michael Ilseman!

llvm-svn: 136336
2011-07-28 06:48:33 +00:00
Bill Wendling
b75e5fc784 Make sure that the landingpad instruction takes a Constant* as the clause's value.
llvm-svn: 136326
2011-07-28 02:27:12 +00:00
Bill Wendling
03445c79b9 Add a couple of convenience functions:
* InvokeInst: Get the landingpad instruction associated with this invoke.
* LandingPadInst: A method to reserve extra space for clauses.

llvm-svn: 136325
2011-07-28 02:15:52 +00:00
Argyrios Kyrtzidis
a95f22ea2b Add an optional 'bool makeAbsolute' in llvm::sys::fs::unique_file function.
If true and 'model' parameter is not an absolute path, a temp directory will be prepended.
Make it true by default to match current behaviour.

llvm-svn: 136310
2011-07-28 00:29:20 +00:00
Eli Friedman
842ea169de Code generation for 'fence' instruction.
llvm-svn: 136283
2011-07-27 22:21:52 +00:00
Jakub Staszak
f5076015fc Use BlockFrequency instead of uint32_t in BlockFrequencyInfo.
llvm-svn: 136278
2011-07-27 22:05:51 +00:00
Bill Wendling
b96d318578 Keep enums stable. Append EH stuff to the end.
llvm-svn: 136263
2011-07-27 21:00:28 +00:00
Bill Wendling
b20cfdfe95 Merge the contents from exception-handling-rewrite to the mainline.
This adds the new instructions 'landingpad' and 'resume'.

llvm-svn: 136253
2011-07-27 20:18:04 +00:00
Eli Friedman
a36a11b45b The numbering of LLVMOpcode is supposed to be stable; revert my earlier change, and append Fence onto the end.
llvm-svn: 136245
2011-07-27 18:59:19 +00:00
Ted Kremenek
ee0970dabc Add a generic 'capacity_in_bytes' function to allow inspection of memory usage of various data structures.
llvm-svn: 136233
2011-07-27 18:40:45 +00:00
Jakub Staszak
29ef880b52 Move static methods to the anonymous namespace.
llvm-svn: 136221
2011-07-27 15:51:51 +00:00
Jakub Staszak
d5378ec61f Edge to itself is backedge as well.
llvm-svn: 136219
2011-07-27 15:42:09 +00:00
Eli Friedman
f226974353 Misc mid-level changes for new 'fence' instruction.
llvm-svn: 136205
2011-07-27 01:08:30 +00:00
Eli Friedman
2da127e60a Fix AliasSetTracker so that it doesn't make any assumptions about instructions it doesn't know about (like the atomic instructions I'm adding).
llvm-svn: 136198
2011-07-27 00:46:46 +00:00
Evan Cheng
bff9934d9a Support .code32 and .code64 in X86 assembler.
llvm-svn: 136197
2011-07-27 00:38:12 +00:00
Eli Friedman
22e4c4d12d Fix a couple minor mistakes pointed out by Bill in adding 'fence' instruction.
llvm-svn: 136124
2011-07-26 20:24:06 +00:00
Andrew Trick
ae93f1bf46 SCEV: Added a data structure for storing not-taken info per loop
exit. Added an interfaces for querying either the loop's exact/max
backedge taken count or a specific loop exit's not-taken count.

llvm-svn: 136100
2011-07-26 17:19:55 +00:00
Duncan Sands
8b264d3264 Strip trailing whitespace.
llvm-svn: 136099
2011-07-26 17:19:30 +00:00
Duncan Sands
0a14a12b51 Teach the Triple class about kfreebsd (FreeBSD kernel with
a GNU userspace).

llvm-svn: 136085
2011-07-26 15:30:04 +00:00
Rafael Espindola
a4148a5a84 Add LLVMAddAlwaysInlinerPass to the C API.
llvm-svn: 136083
2011-07-26 15:23:23 +00:00
Rafael Espindola
d7295c15ab LLVM 3.0 is here, remove old do nothing method.
llvm-svn: 136082
2011-07-26 15:17:32 +00:00
Jay Foad
fe750c827a Fix typo in comment.
llvm-svn: 136068
2011-07-26 09:36:52 +00:00
Evan Cheng
8e380354c4 Rename createCodeEmitter to createMCCodeEmitter; createObjectStreamer to createMCObjectStreamer.
llvm-svn: 136031
2011-07-26 00:42:34 +00:00
Evan Cheng
2e96785311 Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser.
llvm-svn: 136027
2011-07-26 00:24:13 +00:00
Evan Cheng
2a0a4e1a73 Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.
llvm-svn: 136010
2011-07-25 23:24:55 +00:00
Eli Friedman
50291d09da Initial implementation of 'fence' instruction, the new C++0x-style replacement for llvm.memory.barrier.
This is just a LangRef entry and reading/writing/memory representation; optimizer+codegen support coming soon.

llvm-svn: 136009
2011-07-25 23:16:38 +00:00
Evan Cheng
58e5fd1f16 Fix include guards.
llvm-svn: 135998
2011-07-25 22:52:04 +00:00
Jakub Staszak
ddeb8772c8 BranchProbability::print returns void now.
llvm-svn: 135994
2011-07-25 22:27:42 +00:00
Jakub Staszak
b4bffb255a Add BlockFrequency class.
llvm-svn: 135992
2011-07-25 22:24:51 +00:00
Rafael Espindola
7c7d45a67c Add LLVMAddTargetLibraryInfo to the C API.
llvm-svn: 135975
2011-07-25 21:20:54 +00:00
Rafael Espindola
e982fa5f80 Add LLVMAddLowerExpectIntrinsicPass to the C API.
llvm-svn: 135966
2011-07-25 20:57:59 +00:00
Evan Cheng
1d04cd9b26 Fix last bits of MC layer issues. llvm-mc doesn't need to initialize TargetMachine's anymore.
llvm-svn: 135963
2011-07-25 20:53:02 +00:00
Jakub Staszak
171cc8d07d Fix class description.
llvm-svn: 135948
2011-07-25 20:08:58 +00:00
Jakub Staszak
2873980483 Fix #include guard directive.
llvm-svn: 135947
2011-07-25 20:08:00 +00:00
Jakub Staszak
5c309cbead Rename BlockFrequency to BlockFrequencyInfo and MachineBlockFrequency to
MachineBlockFrequencyInfo.

llvm-svn: 135937
2011-07-25 19:25:40 +00:00
Jay Foad
278089b983 Remove uses of std::vector from TypeBuilder.
llvm-svn: 135906
2011-07-25 10:32:27 +00:00
Jay Foad
4f279f9a6f Use ArrayRef in the (protected) constructors of ConstantArray, ConstantStruct and ConstantVector.
llvm-svn: 135905
2011-07-25 10:14:44 +00:00
Jay Foad
6513dac6e2 Convert GetElementPtrInst to use ArrayRef.
llvm-svn: 135904
2011-07-25 09:48:08 +00:00
Chris Lattner
489601c923 switch Triple to take twines instead of stringrefs.
llvm-svn: 135889
2011-07-24 20:45:08 +00:00
Chris Lattner
0e3472660b Add Twine support for characters, and switch twine to use a union internally
to eliminate some casting.

llvm-svn: 135888
2011-07-24 20:44:30 +00:00
Frits van Bommel
e238f52543 Omit explicit length here, now that I've had a chance to test this with gcc.
llvm-svn: 135867
2011-07-24 09:53:46 +00:00
Benjamin Kramer
40ed4c3e06 Fix a silly off by one.
llvm-svn: 135842
2011-07-23 03:04:46 +00:00
Benjamin Kramer
35d7f76497 Add more constness.
llvm-svn: 135838
2011-07-23 01:40:15 +00:00
Benjamin Kramer
a1e84a1998 Turn the DenseSet in MCRegisterClass into a tblgenerated bit field. This should be faster and smaller.
Goodbye static ctors and dtors!

llvm-svn: 135836
2011-07-23 00:47:49 +00:00
Benjamin Kramer
0fc2a68e8f Give TargetRegisterClass a pointer to the MCRegisterClass and use it to access its data.
This makes TargetRegisterClass slightly slower. Next step will be making contains faster.
Eventually TargetRegisterClass will be killed entirely.

llvm-svn: 135835
2011-07-23 00:47:46 +00:00
Evan Cheng
13d54fc7c9 Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
llvm-svn: 135833
2011-07-23 00:45:41 +00:00
NAKAMURA Takumi
0912faa08f CMake: Fix LLVM_NATIVE_TARGETMC in config.h.cmake.
llvm-svn: 135832
2011-07-23 00:45:23 +00:00