1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

15502 Commits

Author SHA1 Message Date
Andrew Trick
e696d2f01f Move pass configuration out of pass constructors: TailDuplicate::PreRegAlloc
llvm-svn: 150091
2012-02-08 21:22:30 +00:00
Jakob Stoklund Olesen
74f9e359dd Keep track of register masks in LiveIntervalAnalysis.
Build an ordered vector of register mask operands (i.e., calls) when
computing live intervals. Provide a checkRegMaskInterference() function
that computes a bit mask of usable registers for a live range.

This is a quick way of determining of a live range crosses any calls,
and restricting it to the callee saved registers if it does.
Previously, we had to discover call clobbers for each candidate register
independently.

llvm-svn: 150077
2012-02-08 17:33:45 +00:00
Benjamin Kramer
b42d2a7238 Value initialize MCRegisterClasses. Not sure how could miss this during the MCTargetDesc refactor.
llvm-svn: 150076
2012-02-08 14:43:53 +00:00
Craig Topper
6dbd5e534c Remove GCC builtins for vpermilp* intrinsics as clang no longer needs them. Custom lower the intrinsics to the vpermilp target specific node and remove intrinsic patterns.
llvm-svn: 150060
2012-02-08 06:36:57 +00:00
Andrew Trick
bbd036d602 Added MachineInstr::isBundled() to check if an instruction is part of a bundle.
llvm-svn: 150044
2012-02-08 02:17:25 +00:00
Andrew Trick
e77bb4ffea whitespace
llvm-svn: 150042
2012-02-08 02:17:18 +00:00
Kostya Serebryany
d0b4cd4c46 Don't use static CTORs for the Attributes constants, while still keeping the class type-safe
llvm-svn: 150031
2012-02-08 01:11:21 +00:00
Eric Christopher
4330499af4 Add support for a temporary forward decl type. We want this so we
can rauw forward declarations if we decide to emit the full type.

Part of rdar://10809898

llvm-svn: 150024
2012-02-08 00:22:26 +00:00
Devang Patel
5b37f2548b Remove tabs.
llvm-svn: 150022
2012-02-08 00:17:07 +00:00
David Blaikie
7503072263 Correct use of const in ParseCommandLineOptions
llvm-svn: 149999
2012-02-07 19:36:01 +00:00
NAKAMURA Takumi
dde136cf30 Bitcode/BitstreamReader.h: Tweak for big endian hosts.
llvm-svn: 149980
2012-02-07 10:53:19 +00:00
Nick Lewycky
4673078750 Fix comment-rulers.
llvm-svn: 149922
2012-02-06 22:41:47 +00:00
Jakob Stoklund Olesen
d0be5953be Remove some unused functions.
LiveIntervalAnalysis has a number of functions that simply forward to
SlotIndexes.  Since SlotIndexes is a stand-alone analysis now, clients
should really refer to it directly.

llvm-svn: 149921
2012-02-06 22:37:58 +00:00
Nick Lewycky
1065924494 System headers after llvm headers.
llvm-svn: 149919
2012-02-06 22:36:39 +00:00
Derek Schuff
f522835510 Enable streaming of bitcode
This CL delays reading of function bodies from initial parse until
materialization, allowing overlap of compilation with bitcode download.

llvm-svn: 149918
2012-02-06 22:30:29 +00:00
Chris Lattner
7a6bd0185e Remove some dead code and tidy things up now that vectors use ConstantDataVector
instead of always using ConstantVector.

llvm-svn: 149912
2012-02-06 21:56:39 +00:00
Bill Wendling
fa3b7c42a8 [unwind removal] Remove a the obsolete 'unwind' enum value.
llvm-svn: 149911
2012-02-06 21:55:35 +00:00
Bill Wendling
8c63e349bc [unwind removal] Remove all of the code for the dead 'unwind' instruction. There
were no 'unwind' instructions being generated before this, so this is in effect
a no-op.

llvm-svn: 149906
2012-02-06 21:44:22 +00:00
Chandler Carruth
a05c6dc02c Introduce helpers to compute the 32-bit varaints and 64-bit variants of
some architectures. These are useful for interacting with multiarch or
bi-arch GCC (or GCC-based) toolchains.

llvm-svn: 149895
2012-02-06 20:46:33 +00:00
Devang Patel
864da4b549 DebugInfo: Provide a new hook to encode relationship between a property and an ivar.
llvm-svn: 149874
2012-02-06 17:49:43 +00:00
Craig Topper
9de7cec5b8 Move some llvm_unreachable's from r149849 out of switch statements to satisfy -Wcovered-switch-default
llvm-svn: 149860
2012-02-06 08:17:43 +00:00
Benjamin Kramer
0d983ac1b6 SmallVector's construct_range is the same thing as std::uninitialized_fill, no need to reinvent it.
llvm-svn: 149851
2012-02-05 22:48:31 +00:00
Benjamin Kramer
5e6c218c54 Simplify code. No functionality change.
llvm-svn: 149850
2012-02-05 22:14:48 +00:00
Craig Topper
e18a06be4d Convert assert(0) to llvm_unreachable
llvm-svn: 149849
2012-02-05 22:14:15 +00:00
Talin
176069f81d Efficient Constant Uniquing.
llvm-svn: 149848
2012-02-05 20:54:10 +00:00
Chandler Carruth
9db1b1bb0a Begin fleshing out more convenience predicates in llvm::Triple and
convert at least one client over to use them. Subsequent patches both to
LLVM and Clang will try to convert more people over to a common set of
predicates.

This round of predicates is focused on OS-categorization predicates.

llvm-svn: 149815
2012-02-05 08:26:40 +00:00
Chris Lattner
9782adedd7 reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul.  Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.

llvm-svn: 149800
2012-02-05 02:29:43 +00:00
Craig Topper
c289726019 Remove most of the intrinsics for XOP VPCMOV instruction. They all aliased to the same instruction with different types. This would be better accomplished with casts in the not yet created xopintrin.h header file.
llvm-svn: 149795
2012-02-05 00:55:56 +00:00
Jakob Stoklund Olesen
af71c23a28 Drop the REDEF_BY_EC VNInfo flag.
A live range that has an early clobber tied redef now looks like a
normal tied redef, except the early clobber def uses the early clobber
slot.

This is enough to handle any strange interference problems.

llvm-svn: 149769
2012-02-04 05:51:25 +00:00
Jakob Stoklund Olesen
44c5cece20 Don't store COPY pointers in VNInfo.
If a value is defined by a COPY, that instuction can easily and cheaply
be found by getInstructionFromIndex(VNI->def).

This reduces the size of VNInfo from 24 to 16 bytes, and improves
llc compile time by 3%.

llvm-svn: 149763
2012-02-04 05:20:49 +00:00
Andrew Trick
fb574d1c19 TargetPassConfig: confine the MC configuration to TargetMachine.
Passes prior to instructon selection are now split into separate configurable stages.
Header dependencies are simplified.
The bulk of this diff is simply removal of the silly DisableVerify flags.

Sorry for the target header churn. Attempting to stabilize them.

llvm-svn: 149754
2012-02-04 02:56:59 +00:00
Andrew Trick
7bc6010af2 Make TargetPassConfig an ImmutablePass so CodeGenPasses can query options
llvm-svn: 149752
2012-02-04 02:56:45 +00:00
Devang Patel
9146918282 Update llvm debug version to support new structure and tag for Objective-C property's debug info.
llvm-svn: 149736
2012-02-04 01:30:01 +00:00
Devang Patel
7280b69925 Introduce DIObjCProperty. This will be used to encode objective-c property.
llvm-svn: 149732
2012-02-04 00:59:25 +00:00
Jakob Stoklund Olesen
108f217812 Drop ZeroIndex and InvalidIndex.
They are not used any more. Simply use SlotIndex() to get an invalid
index.

llvm-svn: 149727
2012-02-04 00:11:06 +00:00
Devang Patel
1de069d34a Add new tag and an attribute to support debug info for objective-c property.
llvm-svn: 149724
2012-02-03 23:57:08 +00:00
Jakob Stoklund Olesen
d29f6d792b Delete some dead code.
llvm-svn: 149717
2012-02-03 21:32:06 +00:00
Jakob Stoklund Olesen
d1947b6f07 Handle register mask operands in setPhysRegsDeadExcept().
Calls that use register mask operands don't have implicit defs for
returned values.  The register mask operand handles the call clobber,
but it always behaves like a set of dead defs.

Add live implicit defs for any implicitly defined physregs that are
actually used.

llvm-svn: 149715
2012-02-03 21:23:14 +00:00
Jakob Stoklund Olesen
42c83746fc ArrayRef'ize MI::setPhysRegsDeadExcept().
llvm-svn: 149709
2012-02-03 20:43:39 +00:00
Andrew Trick
251c9756e5 Initialize all common codegen passes before configuration so we can use their PassIDs.
llvm-svn: 149705
2012-02-03 20:14:47 +00:00
Andrew Trick
da0c52e742 Added TargetPassConfig. The first little step toward configuring codegen passes.
Allows command line overrides to be centralized in LLVMTargetMachine.cpp.
LLVMTargetMachine can intercept common passes and give precedence to command line overrides.
Allows adding "internal" target configuration options without touching TargetOptions.
Encapsulates the PassManager.
Provides a good point to initialize all CodeGen passes so that Pass ID's can be used in APIs.
Allows modifying the target configuration hooks without rebuilding the world.

llvm-svn: 149672
2012-02-03 05:12:41 +00:00
Andrew Trick
0838f6788a whitespace
llvm-svn: 149671
2012-02-03 05:12:30 +00:00
Akira Hatanaka
874523adc5 Add a new MachineJumpTableInfo entry type, EK_GPRel64BlockAddress, which is
needed to emit a 64-bit gp-relative relocation entry. Make changes necessary
for emitting jump tables which have entries with directive .gpdword. This patch
does not implement the parts needed for direct object emission or JIT.

llvm-svn: 149668
2012-02-03 04:33:00 +00:00
Dan Gohman
d18622bd02 Fix SSAUpdaterImpl's RecordMatchingPHI to record exactly the
PHI nodes which were matched, rather than climbing up the
original PHI node's operands to rediscover PHI nodes for
recording, since the PHI nodes found that are not
necessarily part of the matched set.
This fixes rdar://10589171.

llvm-svn: 149654
2012-02-03 01:07:01 +00:00
Rafael Espindola
3440cd1895 Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).

llvm-svn: 149651
2012-02-03 00:59:30 +00:00
Jakob Stoklund Olesen
b84880cf78 Require non-NULL register masks.
It doesn't seem worthwhile to give meaning to a NULL register mask
pointer. It complicates all the code using register mask operands.

llvm-svn: 149646
2012-02-02 23:52:57 +00:00
Jakob Stoklund Olesen
230a0a4b40 Specify SubRegIndex components on the index itself.
It is simpler to define a composite index directly:

  def ssub_2 : SubRegIndex<[dsub_1, ssub_0]>;
  def ssub_3 : SubRegIndex<[dsub_1, ssub_1]>;

Than specifying the composite indices on each register:

  CompositeIndices = [(ssub_2 dsub_1, ssub_0),
                      (ssub_3 dsub_1, ssub_1)] in ...

This also makes it clear that SubRegIndex composition is supposed to be
unique.

llvm-svn: 149556
2012-02-01 23:16:41 +00:00
Andrew Trick
b4963dd8da VLIW specific scheduler framework that utilizes deterministic finite automaton (DFA).
This new scheduler plugs into the existing selection DAG scheduling framework. It is a top-down critical path scheduler that tracks register pressure and uses a DFA for pipeline modeling.

Patch by Sergei Larin!

llvm-svn: 149547
2012-02-01 22:13:57 +00:00
Stepan Dyatkovskiy
856ca370cc SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
llvm-svn: 149481
2012-02-01 07:49:51 +00:00
Andrew Trick
3c9be3c4cc Add pass printer passes in the right place.
The pass pointer should never be referenced after sending it to
schedulePass(), which may delete the pass. To fix this bug I had to
clean up the design leading to more goodness.

You may notice now that any non-analysis pass is printed. So things like loop-simplify and lcssa show up, while target lib, target data, alias analysis do not show up. Normally, analysis don't mutate the IR, but you can now check this by using both -print-after and -print-before. The effects of analysis will now show up in between the two.

The llc path is still in bad shape. But I'll be improving it in my next checkin. Meanwhile, print-machineinstrs still works the same way. With print-before/after, many llc passes that were not printed before now are, some of these should be converted to analysis. A few very important passes, isel and scheduler, are not properly initialized, so not printed.

llvm-svn: 149480
2012-02-01 07:16:20 +00:00
Andrew Trick
fd4f90b0c5 whitespace
llvm-svn: 149479
2012-02-01 07:16:17 +00:00
Hal Finkel
15dafd979c A few of the changes suggested in code review (by Nick Lewycky)
llvm-svn: 149472
2012-02-01 05:51:45 +00:00
Argyrios Kyrtzidis
492f34016f Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are:

r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365

llvm-svn: 149470
2012-02-01 04:51:17 +00:00
Hal Finkel
8cf5de5774 Add a basic-block autovectorization pass.
This is the initial checkin of the basic-block autovectorization pass along with some supporting vectorization infrastructure.
Special thanks to everyone who helped review this code over the last several months (especially Tobias Grosser).

llvm-svn: 149468
2012-02-01 03:51:43 +00:00
Bob Wilson
caefeeb04d Add Triple::getMacOSXVersion to replace crufty code in the clang driver.
This new function provides a way to get the Mac OS X version number from
either generic "darwin" triples of macosx triples.

llvm-svn: 149438
2012-01-31 22:32:29 +00:00
Manuel Klimek
bd5c3cbb68 RefCountedBaseVPTR needs the IntrusiveRefCntPtrInfo as friend,
now that this handles the release / retain calls.

Adds a regression test for that bug (which is a compile-time
regression) and for the last two changes to the IntrusiveRefCntPtr,
especially tests for the memory leak due to copy construction of the
ref-counted object and ensuring that the traits are used for release /
retain calls.

llvm-svn: 149411
2012-01-31 19:58:34 +00:00
Jim Grosbach
655a744f5f Tidy up. Trailing whitespace.
llvm-svn: 149408
2012-01-31 19:47:32 +00:00
Devang Patel
b8688eac99 Add assembler dialect attribute in asm parser which lets target specific asm parser change dialect on the fly.
llvm-svn: 149396
2012-01-31 18:14:05 +00:00
Craig Topper
2b764de6ab Remove pcmpgt/pcmpeq intrinsics as clang is not using them.
llvm-svn: 149367
2012-01-31 06:52:44 +00:00
Chris Lattner
a9b3505e9a eliminate the "string" form of ConstantArray::get, using
ConstantDataArray::getString instead.

llvm-svn: 149365
2012-01-31 06:18:43 +00:00
Chris Lattner
c613633ed8 remove commented-out code.
llvm-svn: 149364
2012-01-31 06:17:26 +00:00
Chris Lattner
06407b2f81 with recent changes, ConstantArray is never a "string". Remove the associated
methods and constant fold the clients to false.

llvm-svn: 149362
2012-01-31 06:05:00 +00:00
Chris Lattner
7903530b71 remove the last vestiges of llvm::GetConstantStringInfo, in CodeGen.
llvm-svn: 149356
2012-01-31 05:09:17 +00:00
Chandler Carruth
a71c1f9470 Add various coarse bit-width architecture predicates to llvm::Triple.
These are very useful for frontends and other utilities reasoning about
or selecting between triples.

llvm-svn: 149353
2012-01-31 04:52:32 +00:00
Chris Lattner
b463bd21fc Change ConstantArray::get to form a ConstantDataArray when possible,
kicking in the big win of ConstantDataArray.  As part of this, change
the implementation of GetConstantStringInfo in ValueTracking to work
with ConstantDataArray (and not ConstantArray) making it dramatically,
amazingly, more efficient in the process and renaming it to 
getConstantStringInfo.

This keeps around a GetConstantStringInfo entrypoint that (grossly)
forwards to getConstantStringInfo and constructs the std::string 
required, but existing clients should move over to 
getConstantStringInfo instead.

llvm-svn: 149351
2012-01-31 04:42:22 +00:00
Bill Wendling
fadeb75339 Remove the now-dead llvm.eh.exception and llvm.eh.selector intrinsics.
llvm-svn: 149331
2012-01-31 01:58:48 +00:00
Bill Wendling
0b1a8d62d4 Remove the eh.exception and eh.selector intrinsics. Also remove a hack to copy
over the catch information. The catch information is now tacked to the invoke
instruction.

llvm-svn: 149326
2012-01-31 01:46:13 +00:00
Ted Kremenek
add0641097 Relax constructor for IntrusiveRefCntPtr to not be explicit.
llvm-svn: 149309
2012-01-31 00:57:08 +00:00
Ted Kremenek
0022d6619e Use traits for IntrusiveRefCntPtr to determine how to increment/decrement a reference count.
llvm-svn: 149308
2012-01-31 00:57:04 +00:00
Bill Wendling
011d7b0f34 Add a constified getLandingPad() method.
llvm-svn: 149303
2012-01-31 00:26:24 +00:00
Chris Lattner
b890ac010a Various improvements suggested by Duncan
llvm-svn: 149255
2012-01-30 18:19:30 +00:00
Craig Topper
c79d58b551 Add GCCBuiltin declarations for cmpsd/cmpss/cmppd/cmpps to allow custom code to be removed from clang.
llvm-svn: 149234
2012-01-30 08:33:36 +00:00
Talin
d6b8c10155 DenseMap::find_as() and unit tests.
llvm-svn: 149229
2012-01-30 06:55:43 +00:00
Chris Lattner
bd514b7976 initialize the Next field to null
llvm-svn: 149217
2012-01-30 01:17:43 +00:00
Chris Lattner
d52c923a50 Add bitcode reader and writer support for ConstantDataAggregate, which
should be feature complete now.  Lets see if it works.

llvm-svn: 149215
2012-01-30 00:51:16 +00:00
Chandler Carruth
0a86383339 Cleanup the organization of some methods in llvm::Triple and provide
a better doxyment group for convenience predicates.

llvm-svn: 149211
2012-01-29 23:09:12 +00:00
Douglas Gregor
1b572cae6f Move Clang's file-level locking facility over to LLVM's support
library, since it doesn't really have anything to do with Clang.

llvm-svn: 149203
2012-01-29 20:15:10 +00:00
Jakob Stoklund Olesen
6bf068351e Fix some scavenger performance issues.
- Don't call malloc+free in the very hot forward().
- Don't call isTiedToDefOperand().
- Don't create BitVector temporaries.
- Merge DeadRegs into KillRegs.
- Eliminate the early clobber checks, they were irrelevant to scavenging.
- Remove unnecessary code from -Asserts builds.

This speeds up ARM PEI by 3.4x and overall llc -O0 codegen time by 11%.

llvm-svn: 149189
2012-01-29 01:29:28 +00:00
Jakob Stoklund Olesen
033045b6da Add a BitVector::reset(BitVector&) method.
The alternative LHS &= ~RHS is way too slow because it creates a
temporary that calls malloc/free.

llvm-svn: 149187
2012-01-29 01:29:22 +00:00
Rafael Espindola
7bddde2b49 Add r149110 back with a fix for when the vector and the int have the same
width.

llvm-svn: 149151
2012-01-27 23:33:07 +00:00
Lang Hames
e0f0352889 Add a "moveInstr" method to LiveIntervals. This can be used to move instructions
around within a basic block while maintaining live-intervals.

Updated ScheduleTopDownLive in MachineScheduler.cpp to use the moveInstr API
when reordering MIs.

llvm-svn: 149147
2012-01-27 22:36:19 +00:00
Jim Grosbach
86e3cd33a1 Fix typo.
llvm-svn: 149137
2012-01-27 18:35:03 +00:00
Jim Grosbach
6280a1137f Better diagnostic for malformed .org assembly directive.
Provide source line number information.

llvm-svn: 149101
2012-01-27 00:37:08 +00:00
Jim Grosbach
a3c09652c6 Add simple support for keeping MCFixup source information.
Can be used to issue more user friendly diagnostics for faulty
relocation constructs and such.

llvm-svn: 149092
2012-01-26 23:20:11 +00:00
Jim Grosbach
fbf782200a Add SourceMgr to MCContext for backend diagnostics.
llvm-svn: 149090
2012-01-26 23:20:05 +00:00
Chris Lattner
ba1715c058 progress making the world safe to ConstantDataVector. While
we're at it, allow PatternMatch's "neg" pattern to match integer
vector negations, and enhance ComputeNumSigned bits to handle
shl of vectors.

llvm-svn: 149082
2012-01-26 21:37:55 +00:00
Chris Lattner
bed3b11d94 tidy up forward declarations.
llvm-svn: 149078
2012-01-26 20:44:57 +00:00
Jakob Stoklund Olesen
9e8bb24748 Clear kill flags before propagating a copy.
The live range of the source register may be extended when a redundant
copy is eliminated. Make sure any kill flags between the two copies are
cleared.

This fixes PR11765.

llvm-svn: 149069
2012-01-26 17:52:15 +00:00
James Molloy
402abeda73 Add support for the R_ARM_TARGET1 relocation, which should be given to relocations applied to all C++ constructors and destructors.
This enables the linker to match concrete relocation types (absolute or relative) with whatever library or C++ support code is being linked against.

llvm-svn: 149057
2012-01-26 09:25:43 +00:00
Chris Lattner
a4599933fa eliminate the Constant::getVectorElements method. There are better (and
more robust) ways to do what it was doing now.  Also, add static methods
for decoding a ShuffleVector mask.

llvm-svn: 149028
2012-01-26 02:51:13 +00:00
Chris Lattner
f2a0e16598 Add a ConstantDataVector::getSplatValue() method, for parity with
ConstantVector.  Fix some outright bugs in the implementation of
ConstantArray and Constant struct, which would cause us to not make
one big UndefValue when asking for an array/struct with all undef
elements.  Enhance Constant::isAllOnesValue to work with
ConstantDataVector.

llvm-svn: 149021
2012-01-26 02:31:22 +00:00
Chris Lattner
2b60bb9025 add StructType helpers too.
llvm-svn: 149000
2012-01-26 00:06:44 +00:00
Chris Lattner
1213962a11 Ok, break down and add some cast<>'ing helper methods to the Type class
to reduce the number of cast<>'s we have.  This allows someone to use
things like Ty->getVectorNumElements() instead of 
cast<VectorType>(Ty)->getNumElements() when you know that a type is a
vector.

It would be a great general cleanup to move the codebase to use these,
I will do so in the code I'm touching.

llvm-svn: 148999
2012-01-26 00:01:10 +00:00
Chris Lattner
84e46c89bd add some helper methods to ShuffleVectorInst and enhance its
"isValidOperands" and "getMaskValue" methods to allow 
ConstantDataSequential.

llvm-svn: 148998
2012-01-25 23:49:49 +00:00
Anton Korobeynikov
682b2821ce Properly emit ctors / dtors with priorities into desired sections
and let linker handle the rest.

This finally fixes PR5329

llvm-svn: 148990
2012-01-25 22:24:19 +00:00
Chandler Carruth
f49f791973 Revert a tiny bit of r148553 which extended LLVM's function attributes
to 64-bits, and added a new attribute in bit #32. Specifically, remove
this new attribute from the enum used in the C API. It's not yet clear
what the best approach is for exposing these new attributes in the
C API, and several different proposals are on the table. Until then, we
can simply not expose this bit in the API at all.

Also, I've reverted a somewhat unrelated change in the same revision
which switched from "1 << 31" to "1U << 31" for the top enum. While "1
<< 31" is technically undefined behavior, implementations DTRT here.
However, MS and -pedantic mode warn about non-'int' type enumerator
values. If folks feel strongly about this I can put the 'U' back in, but
it seemed best to wait for the proper solution.

llvm-svn: 148937
2012-01-25 07:40:15 +00:00
Evan Cheng
e441d21805 Update hasProperty comment.
llvm-svn: 148936
2012-01-25 07:38:48 +00:00
Chris Lattner
6791b23efa constify some methods and add a new Constant::getAggregateElement
helper method for the common operation of extracting an element
out of a constant aggregate.

llvm-svn: 148931
2012-01-25 06:16:32 +00:00
Chris Lattner
276264ed59 reapply r148901 with a crucial fix.
"Introduce a new ConstantVector::getSplat constructor function to 
simplify a really common case."

llvm-svn: 148924
2012-01-25 05:19:54 +00:00
Craig Topper
c968a4ccc9 Remove AVX 256-bit unaligned load intrinsics. 128-bit versions had been removed a while ago.
llvm-svn: 148922
2012-01-25 04:42:03 +00:00
Argyrios Kyrtzidis
c5d8deed3f Revert r148901 because it crashes llvm tests.
Original log:
    Introduce a new ConstantVector::getSplat constructor function to
    simplify a really common case.

llvm-svn: 148906
2012-01-25 02:42:41 +00:00
Chris Lattner
33f1fdff02 Introduce a new ConstantVector::getSplat constructor function to
simplify a really common case.

llvm-svn: 148901
2012-01-25 01:53:58 +00:00
Chris Lattner
884a2b01e2 Remove the Type::getNumElements() method, which is only called in 4 places,
did something extremely surprising, and shadowed actually useful 
implementations that had completely different behavior.

llvm-svn: 148898
2012-01-25 01:32:59 +00:00
Talin
12820f024e Additional methods for SmallString.
llvm-svn: 148881
2012-01-24 23:43:59 +00:00
Jakob Stoklund Olesen
3ff9738293 Add an (interleave A, B, ...) SetTheory operator.
This will interleave the elements from two or more lists.

llvm-svn: 148824
2012-01-24 18:06:05 +00:00
David Blaikie
1040475c84 Reword comment based on feedback by Duncan Sands.
llvm-svn: 148809
2012-01-24 16:18:30 +00:00
Chris Lattner
70c46f210a Rearrange argument order of ::get methods so that LLVMContext comes first,
add a ConstantDataArray::getString method that corresponds to the (to be
removed) StringRef version of ConstantArray::get, but is dramatically more 
efficient.

llvm-svn: 148804
2012-01-24 14:04:40 +00:00
Chris Lattner
9713727d0b add more support for ConstantDataSequential
llvm-svn: 148802
2012-01-24 13:41:11 +00:00
Chris Lattner
55e4ae9dcd Add AsmPrinter (aka MCLowering) support for ConstantDataSequential,
and clean up some other misc stuff.  Unlike ConstantArray, we will
prefer to emit .fill directives for "String" arrays that all have
the same value, since they are denser than emitting a .ascii

llvm-svn: 148793
2012-01-24 09:31:43 +00:00
Chris Lattner
c616f8a90f Add various "string" methods to ConstantDataSequential, which have the
same semantics as ConstantArray's but much more efficient because they
don't have to return std::string's.  The ConstantArray methods will
eventually be removed.

llvm-svn: 148792
2012-01-24 09:01:07 +00:00
Chris Lattner
1c091db526 add ::drop_back() and ::drop_front() methods, which are like pop_front/pop_back on a vector, but a) aren't destructive to "this", and b) can take a # elements to drop.
llvm-svn: 148791
2012-01-24 08:58:57 +00:00
Chris Lattner
e9cf212d3f teach valuetracking about ConstantDataSequential
llvm-svn: 148790
2012-01-24 07:54:10 +00:00
Chris Lattner
d5993b31dd Split the interesting bits of ConstantFoldLoadThroughGEPConstantExpr
out into a new ConstantFoldLoadThroughGEPIndices (more useful) function
and rewrite it to be simpler, more efficient, and to handle the new
ConstantDataSequential type.

Enhance ConstantFoldLoadFromConstPtr to handle ConstantDataSequential.

llvm-svn: 148786
2012-01-24 05:43:50 +00:00
Chris Lattner
e534fbc8f6 Add some accessor methods to CAZ and UndefValue that help simplify clients.
Make some CDS methods public.

llvm-svn: 148785
2012-01-24 05:42:11 +00:00
Chris Lattner
df67e07d2e implement the ConstantDataSequential accessor methods.
No need for 'getOperand' :)

llvm-svn: 148778
2012-01-24 04:43:41 +00:00
Chandler Carruth
55876621c9 Revert r148686 (and r148694, a fix to it) due to a serious layering
violation -- MC cannot depend on CodeGen.

Specifically, the MCTargetDesc component of each target is actually
a subcomponent of the MC library. As such, it cannot depend on the
target-independent code generator, because MC itself cannot depend on
the target-independent code generator. This change moved a flag from the
ARM MCTargetDesc file ARMMCAsmInfo.cpp to the CodeGen layer in
ARMException.cpp, leaving behind an 'extern' to refer back to it. That
layering order isn't viable givin the constraints outlined above.
Commandline flags are designed to be static specifically to avoid these
types of bugs.

Fixing this is likely going to require some non-trivial refactoring.

llvm-svn: 148759
2012-01-24 00:30:17 +00:00
David Blaikie
cafc52ba9a Changing bitfield enums to unsigned ints.
This was suggested by Chandler Carruth on the basis of past experience with
esoteric compilers/quirks relating to signed enums.

llvm-svn: 148746
2012-01-23 23:27:47 +00:00
Chris Lattner
860d90844c start the implementation of a new ConstantDataVector and ConstantDataArray
classes, per PR1324.  Not all of their helper functions are implemented,
nothing creates them, and the rest of the compiler doesn't handle them yet.

llvm-svn: 148741
2012-01-23 22:57:10 +00:00
Bill Wendling
22382365ff Remove extraneous ';'s.
llvm-svn: 148740
2012-01-23 22:55:02 +00:00
David Blaikie
0c22143732 Simplify llvm:🆑:Option by using a bit field instead of manual bit packing.
This still preserves the same total layout.

Previously it looked like:
*** Dumping AST Record Layout
   0 | class llvm:🆑:Option
   0 |   (Option vtable pointer)
   8 |   int NumOccurrences
  12 |   int Flags
  16 |   unsigned int Position
  20 |   unsigned int AdditionalVals
  24 |   class llvm:🆑:Option * NextRegistered
  32 |   const char * ArgStr
  40 |   const char * HelpStr
  48 |   const char * ValueStr
  sizeof=56, dsize=56, align=8
  nvsize=56, nvalign=8

Now it looks like:
*** Dumping AST Record Layout
   0 | class llvm:🆑:Option
   0 |   (Option vtable pointer)
   8 |   int NumOccurrences
  12 |   enum NumOccurrencesFlag Occurrences
  12 |   unsigned int Value
  12 |   enum OptionHidden HiddenFlag
  12 |   enum FormattingFlags Formatting
  13 |   unsigned int Misc
  16 |   unsigned int Position
  20 |   unsigned int AdditionalVals
  24 |   class llvm:🆑:Option * NextRegistered
  32 |   const char * ArgStr
  40 |   const char * HelpStr
  48 |   const char * ValueStr
  sizeof=56, dsize=56, align=8
  nvsize=56, nvalign=8

llvm-svn: 148736
2012-01-23 22:22:44 +00:00
Rafael Espindola
9f3a003d3c Add support for .cfi_signal_frame. Fixes pr11762.
llvm-svn: 148733
2012-01-23 21:51:52 +00:00
Chris Lattner
cfea666af2 Various public StringMap methods take or return "MapEntryTy", make it public.
llvm-svn: 148732
2012-01-23 21:42:52 +00:00
Chris Lattner
7f4e7ce468 revert r148688 too, this isn't safe for DenseMap use. When DenseMap resizes, it will need to copy around arbitrary pointers
llvm-svn: 148699
2012-01-23 15:10:41 +00:00
Chris Lattner
0a21f75290 allow OwningPtr to be copy constructed if null, which is required to
make them be a valuetype in a DenseMap.

llvm-svn: 148688
2012-01-23 08:19:57 +00:00
Evgeniy Stepanov
bffa428d01 An option to selectively enable parts of ARM EHABI support.
This change adds an new value to the --arm-enable-ehabi option that
disables emitting unwinding descriptors. This mode gives a working
backtrace() without the (currently broken) exception support.

llvm-svn: 148686
2012-01-23 07:57:39 +00:00
Rafael Espindola
c53beeb5f6 The iteration order over a std::set<Module*> depends on the addresses of the
modules. Avoid that to make the order the linker sees the modules deterministic.

llvm-svn: 148676
2012-01-23 03:41:53 +00:00
Eli Bendersky
07d655054e Remove trailing spaces
llvm-svn: 148655
2012-01-22 09:26:00 +00:00
Eli Bendersky
d2042f3698 Basic runtime dynamic loading capabilities added to ELFObjectFile, implemented
in a subclass named DyldELFObject. This class supports rebasing the object file
it represents by re-mapping section addresses to the actual memory addresses
the object was placed in. This is required for MC-JIT implementation on ELF with
debugging support.

Patch reviewed on llvm-commits.

Developed together with Ashok Thirumurthi and Andrew Kaylor.

llvm-svn: 148653
2012-01-22 09:01:03 +00:00
Jakob Stoklund Olesen
46feaf86cf Handle register masks in LiveVariables.
A register mask operand kills any live physreg that isn't preserved.
Unlike an implicit-def operand, the clobbered physregs are never live
afterwards.

This means LiveVariables has to track a much smaller number of live
physregs, and it should spend much less time in addRegisterDead().

llvm-svn: 148609
2012-01-21 00:58:53 +00:00
Jakob Stoklund Olesen
0eca627fb7 Delete an unused member variable.
llvm-svn: 148594
2012-01-20 22:48:59 +00:00
David Blaikie
06ecc99a56 More dead code removal (using -Wunreachable-code)
llvm-svn: 148578
2012-01-20 21:51:11 +00:00
Benjamin Kramer
a55074eb7f Don't use my favorite C++11 feature (comma at end of enum).
llvm-svn: 148555
2012-01-20 18:08:30 +00:00
Kostya Serebryany
b37a1263e1 Extend Attributes to 64 bits
Problem: LLVM needs more function attributes than currently available (32 bits).
One such proposed attribute is "address_safety", which shows that a function is being checked for address safety (by AddressSanitizer, SAFECode, etc).

Solution:
- extend the Attributes from 32 bits to 64-bits
- wrap the object into a class so that unsigned is never erroneously used instead
- change "unsigned" to "Attributes" throughout the code, including one place in clang.
- the class has no "operator uint64 ()", but it has "uint64_t Raw() " to support packing/unpacking.
- the class has "safe operator bool()" to support the common idiom:  if (Attributes attr = getAttrs()) useAttrs(attr);
- The CTOR from uint64_t is marked explicit, so I had to add a few explicit CTOR calls
- Add the new attribute "address_safety". Doing it in the same commit to check that attributes beyond first 32 bits actually work.
- Some of the functions from the Attribute namespace are worth moving inside the class, but I'd prefer to have it as a separate commit.

Tested:
"make check" on Linux (32-bit and 64-bit) and Mac (10.6)
built/run spec CPU 2006 on Linux with clang -O2.


This change will break clang build in lib/CodeGen/CGCall.cpp.
The following patch will fix it.

llvm-svn: 148553
2012-01-20 17:56:17 +00:00
Benjamin Kramer
14636e5e0a Protect SmallVectorImpl's constructor and a few other methods that aren't meant to be public.
llvm-svn: 148550
2012-01-20 16:39:46 +00:00
Andrew Trick
be3e9530e1 SCEVExpander fixes. Affects LSR and indvars.
LSR has gradually been improved to more aggressively reuse existing code, particularly existing phi cycles. This exposed problems with the SCEVExpander's sloppy treatment of its insertion point. I applied some rigor to the insertion point problem that will hopefully avoid an endless bug cycle in this area. Changes:

- Always used properlyDominates to check safe code hoisting.

- The insertion point provided to SCEV is now considered a lower bound. This is usually a block terminator or the use itself. Under no cirumstance may SCEVExpander insert below this point.

- LSR is reponsible for finding a "canonical" insertion point across expansion of different expressions.

- Robust logic to determine whether IV increments are in "expanded" form and/or can be safely hoisted above some insertion point.

Fixes PR11783: SCEVExpander assert.

llvm-svn: 148535
2012-01-20 07:41:13 +00:00
Owen Anderson
61bdf3c55c Add a new form of MCOperand, for representing sub-instructions. This is intended for supporting bundles through the MC layer, rather than lowering them pre-MC as we currently do for Thumb2 IT blocks. Since these sub-instruction operands hold pointers to the sub-instructions, it is the responsibility of the target's AsmPrinter to provide storage for them for the duration of the EmitInstruction() call.
llvm-svn: 148492
2012-01-19 19:24:37 +00:00
Evan Cheng
5a5dfca748 More bundle related API additions.
llvm-svn: 148465
2012-01-19 07:47:03 +00:00
Chris Lattner
b57d05e24b Introduce a new MutableArrayRef class, which refers to a series of mutable
T's that are consequtively in memory.

llvm-svn: 148463
2012-01-19 06:34:52 +00:00
Evan Cheng
fe9c0eef4b Enhance finalizeBundle to return end of bundle iterator because it makes sense.
llvm-svn: 148462
2012-01-19 06:13:10 +00:00
Lang Hames
059e79c753 Added methods to get the live range immediately before a given slot. Intended to parallel the getVNInfoBefore method.
llvm-svn: 148453
2012-01-19 01:36:06 +00:00
Evan Cheng
86ca08f633 - Slight change to finalizeBundle() interface. LastMI is not exclusive (pointing
to instruction right after the last instruction in the bundle.
- Add a finalizeBundle() variant that doesn't specify LastMI. Instead, the code
  will find the last instruction in the bundle by following the 'InsideBundle'
  marker. This is useful in case bundles are formed early (i.e. during MI
  scheduling) but finalized later (i.e. after register allocator has finished
  rewriting virtual registers with physical registers).

llvm-svn: 148444
2012-01-19 00:46:06 +00:00
Nick Lewycky
c1e7e2eaf6 Add a TargetOption for disabling tail calls.
llvm-svn: 148442
2012-01-19 00:34:10 +00:00
Evan Cheng
cfc7639cc7 Rename Finalizebundle to finalizeBundle to conform to coding guideline.
llvm-svn: 148440
2012-01-19 00:06:10 +00:00
Jakob Stoklund Olesen
acb9eccef3 Add a RegisterMaskSDNode class.
This SelectionDAG node will be attached to call nodes by LowerCall(),
and eventually becomes a MO_RegisterMask MachineOperand on the
MachineInstr representing the call instruction.

LowerCall() will attach a register mask that depends on the calling
convention.

llvm-svn: 148436
2012-01-18 23:52:12 +00:00
Rafael Espindola
700f91def8 Add support for the gnueabihf environment. Patch by Sylvestre Ledru.
llvm-svn: 148434
2012-01-18 23:35:29 +00:00
Nadav Rotem
d5e875c776 Document the fact that the selection dag changes the vselect condition type
llvm-svn: 148411
2012-01-18 20:50:30 +00:00
Jim Grosbach
f88f0b08c4 Tidy up. MCAsmBackend naming conventions.
llvm-svn: 148400
2012-01-18 18:52:16 +00:00
Jim Grosbach
700e5901a7 Move some ARM specific MCAssmebler bits into the ARMAsmBackend.
llvm-svn: 148364
2012-01-18 00:23:57 +00:00
Jakob Stoklund Olesen
e9c53bc69b Add a CoveredBySubRegs property to Register descriptions.
When set, this bit indicates that a register is completely defined by
the value of its sub-registers.

Use the CoveredBySubRegs property to infer which super-registers are
call-preserved given a list of callee-saved registers.  For example, the
ARM registers D8-D15 are callee-saved.  This now automatically implies
that Q4-Q7 are call-preserved.

Conversely, Win64 callees save XMM6-XMM15, but the corresponding
YMM6-YMM15 registers are not call-preserved because they are not fully
defined by their sub-registers.

llvm-svn: 148363
2012-01-18 00:16:39 +00:00
Jakub Staszak
50112641ee Remove unneeded include.
llvm-svn: 148360
2012-01-17 23:53:08 +00:00
Jakob Stoklund Olesen
c5fac0a05c Add TableGen support for callee saved registers.
Targets can now add CalleeSavedRegs defs to their *CallingConv.td file.
TableGen will use this to create a *_SaveList array suitable for
returning from getCalleeSavedRegs() as well as a *_RegMask bit mask
suitable for returning from getCallPreservedMask().

llvm-svn: 148346
2012-01-17 22:46:58 +00:00
Jakub Staszak
2f69ff9223 Move includes to the .cpp file.
llvm-svn: 148342
2012-01-17 22:16:31 +00:00
Jakub Staszak
c3dc479049 Trailing spaces.
llvm-svn: 148332
2012-01-17 20:58:08 +00:00
Dan Gohman
9b37a5592c Add a new ObjC ARC optimization pass to eliminate unneeded
autorelease push+pop pairs.

llvm-svn: 148330
2012-01-17 20:52:24 +00:00
Dan Gohman
45976c3482 Add a new PassManagerBuilder customization point,
EP_ModuleOptimizerEarly, to allow passes to be added before the
main ModulePass optimizers.

llvm-svn: 148329
2012-01-17 20:51:32 +00:00
Manuel Klimek
8fb099f26d Removes template magic to build up containers.
Instead, we now put the attributes of the container into members.

llvm-svn: 148302
2012-01-17 09:34:07 +00:00
Andrew Trick
cbb72886ec Renamed MachineScheduler to ScheduleTopDownLive.
Responding to code review.

llvm-svn: 148290
2012-01-17 06:55:03 +00:00
Andrew Trick
8cee8a6cb3 Moving options declarations around.
More short term hackery until we have a way to configure passes that work on LiveIntervals.

llvm-svn: 148289
2012-01-17 06:54:59 +00:00
Chris Lattner
c54b1a7001 add some missing const qualifiers.
llvm-svn: 148274
2012-01-17 01:31:32 +00:00
Jakob Stoklund Olesen
4004b18f94 Add portable bit mask operations to BitVector.
BitVector uses the native word size for its internal representation.
That doesn't work well for literal bit masks in source code.

This patch adds BitVector operations to efficiently apply literal bit
masks specified as arrays of uint32_t.  Since each array entry always
holds exactly 32 bits, these portable bit masks can be source code
literals, probably produced by TableGen.

llvm-svn: 148272
2012-01-17 01:24:32 +00:00
Jim Grosbach
9a204e284b ExecutionEngine interface to re-map addresses for engines that support it.
llvm-svn: 148264
2012-01-16 23:50:55 +00:00
Jakob Stoklund Olesen
335d417f27 Extract method for detecting constant unallocatable physregs.
It is safe to move uses of such registers.

llvm-svn: 148259
2012-01-16 22:34:08 +00:00
Jim Grosbach
acbad56e7f MCJIT support for non-function sections.
Move to a by-section allocation and relocation scheme. This allows
better support for sections which do not contain externally visible
symbols.

Flesh out the relocation address vs. local storage address separation a
bit more as well. Remote process JITs use this to tell the relocation
resolution code where the code will live when it executes.

The startFunctionBody/endFunctionBody interfaces to the JIT and the
memory manager are deprecated. They'll stick around for as long as the
old JIT does, but the MCJIT doesn't use them anymore.

llvm-svn: 148258
2012-01-16 22:26:39 +00:00
Jakob Stoklund Olesen
77ce60119b Add a new kind of MachineOperand: MO_RegisterMask.
Register masks will be used as a compact representation of large clobber
lists.  Currently, an x86 call instruction has some 40 operands
representing call-clobbered registers.  That's more than 1kB of useless
operands per call site.

A register mask operand references a bit mask of call-preserved
registers, everything else is clobbered.  The bit mask will typically
come from TargetRegisterInfo::getCallPreservedMask().

By abandoning ImplicitDefs for call-clobbered registers, it also becomes
possible to share call instruction descriptions between calling
conventions, and we can get rid of the WINCALL* instructions.

This patch introduces the new operand kind.  Future patches will add
RegMask support to target-independent passes before finally the fixed
clobber lists can be removed from call instruction descriptions.

llvm-svn: 148250
2012-01-16 19:22:00 +00:00
Benjamin Kramer
14443a8cf6 Return an ArrayRef from ShuffleVectorSDNode::getMask and push it through CodeGen.
llvm-svn: 148218
2012-01-15 13:16:05 +00:00
Chandler Carruth
d328cc2c87 Remove SetWorkingDirectory from the Process interface. Nothing in LLVM
or Clang is using this, and it would be hard to use it correctly given
the thread hostility of the function. Also, it never checked the return
which is rather dangerous with chdir. If someone was in fact using this,
please let me know, as well as what the usecase actually is so that
I can add it back and make it more correct and secure to use. (That
said, it's never going to be "safe" per-se, but we could at least
document the risks...)

llvm-svn: 148211
2012-01-15 08:41:35 +00:00
Jakob Stoklund Olesen
742b6d295b Add TRI::getCallPreservedMask() hook.
The hook returns a bit-mask of call-preserved registers that will
eventually replace the current list of implicit defs on call
instructions.  This will make it possible to support multiple calling
conventions without duplicating call instruction descriptors.

The call-preserved mask is slightly different from the list returned by
the getCalleeSavedRegs() hook, it includes all aliases that are
preserved by calls.

The hook takes a CallingConv::ID argument instead of a MachineFunction
pointer, so it can provide information about calls to extern functions,
and even indirect function calls.

TRI::getCalleeSavedRegs() returns information about the function
currently being compiled. TRI::getCallPreservedMask() returns
information about the functions it is calling.

llvm-svn: 148165
2012-01-14 01:45:25 +00:00
Pete Cooper
f70959894c Fixed comment. Thanks Duncan!
llvm-svn: 148123
2012-01-13 17:52:01 +00:00
Andrew Trick
85c44d1485 Added the MachineSchedulerPass skeleton.
llvm-svn: 148105
2012-01-13 06:30:30 +00:00
Andrew Trick
6e61e9f2b6 whitespace
llvm-svn: 148104
2012-01-13 06:30:25 +00:00
Jakob Stoklund Olesen
9ba097a208 Delete CodeInit and CodeRecTy from TableGen.
The code type was always identical to a string anyway. Now it is simply
a synonym. The code literal syntax [{...}] is still valid.

llvm-svn: 148092
2012-01-13 03:38:34 +00:00
Jakob Stoklund Olesen
3776477761 Use uniqued StringInit pointers for lookups.
This avoids a gazillion StringMap and dynamic_cast calls, making
TableGen run 3x faster.

llvm-svn: 148091
2012-01-13 03:16:35 +00:00
Pete Cooper
f3141fef55 Added MVT::v2f16
llvm-svn: 148067
2012-01-12 23:14:13 +00:00
Evan Cheng
fc3ec91768 Allow targets to select source order pre-RA scheduler.
llvm-svn: 148033
2012-01-12 18:27:52 +00:00
Evan Cheng
2fcee784d6 Move Sched::Preference out of TargetMachine.h where it is not referenced.
llvm-svn: 148014
2012-01-12 02:35:23 +00:00
Eli Friedman
487774ddbe Re-fix the issue Bill fixed in r147899 in a slightly different way, which doesn't abuse the semantics of linker_private. We don't really want to merge any string constant with a weak_odr global.
llvm-svn: 147971
2012-01-11 22:06:46 +00:00
Jan Sjödin
cb98434ebe Add XOP Intrinsics and tests
llvm-svn: 147949
2012-01-11 15:20:20 +00:00
Andrew Trick
1454836d05 Clarified the SCEV getSmallConstantTripCount interface with in-your-face comments.
This interface is misleading and dangerous, but it is actually what we need for unrolling.

llvm-svn: 147926
2012-01-11 06:52:55 +00:00
Jakob Stoklund Olesen
37e4396a06 Detect when a value is undefined on an edge to a landing pad.
Consider this code:

int h() {
  int x;
  try {
    x = f();
    g();
  } catch (...) {
    return x+1;
  }
  return x;
}

The variable x is undefined on the first edge to the landing pad, but it
has the f() return value on the second edge to the landing pad.

SplitAnalysis::getLastSplitPoint() would assume that the return value
from f() was live into the landing pad when f() throws, which is of
course impossible.

Detect these cases, and treat them as if the landing pad wasn't there.
This allows spill code to be inserted after the function call to f().

<rdar://problem/10664933>

llvm-svn: 147912
2012-01-11 02:07:05 +00:00
Jakob Stoklund Olesen
63258fcd99 Exclusively use SplitAnalysis::getLastSplitPoint().
Delete the alternative implementation in LiveIntervalAnalysis.

These functions computed the same thing, but SplitAnalysis caches the
result.

llvm-svn: 147911
2012-01-11 02:07:00 +00:00
Bill Wendling
2a03f15116 If the global variable is removed by the linker, then don't constant merge it
with other symbols.

An object in the __cfstring section is suppoed to be filled with CFString
objects, which have a pointer to ___CFConstantStringClassReference followed by a
pointer to a __cstring. If we allow the object in the __cstring section to be
merged with another global, then it could end up in any section. Because the
linker is going to remove these symbols in the final executable, we shouldn't
bother to merge them.
<rdar://problem/10564621>

llvm-svn: 147899
2012-01-11 00:13:08 +00:00
Devang Patel
90a5a47ef8 Let asm parser query asm syntax dialect.
llvm-svn: 147880
2012-01-10 21:49:42 +00:00
Kevin Enderby
21c229f1fb This is the matching change for the data structure name changes for the
functional change in r147860 to use DW_TAG_label's instead TAG_subprogram's.
This only changes names and updates comments.  No functional change.

llvm-svn: 147877
2012-01-10 21:12:34 +00:00
Chandler Carruth
ecd9169f3a Teach the triple library about the androideabi environment.
Patch by Evgeniy Stepanov.

llvm-svn: 147871
2012-01-10 19:46:00 +00:00
Chandler Carruth
2a6b59a693 Add 'llvm_unreachable' to passify GCC's understanding of the constraints
of several newly un-defaulted switches. This also helps optimizers
(including LLVM's) recognize that every case is covered, and we should
assume as much.

llvm-svn: 147861
2012-01-10 18:08:01 +00:00
David Blaikie
8d47bb30e3 Remove unnecessary default cases in switches that cover all enum values.
llvm-svn: 147855
2012-01-10 16:47:17 +00:00
Andrew Trick
db66631fb3 Enable LSR IV Chains with sufficient heuristics.
These heuristics are sufficient for enabling IV chains by
default. Performance analysis has been done for i386, x86_64, and
thumbv7. The optimization is rarely important, but can significantly
speed up certain cases by eliminating spill code within the
loop. Unrolled loops are prime candidates for IV chains. In many
cases, the final code could still be improved with more target
specific optimization following LSR. The goal of this feature is for
LSR to make the best choice of induction variables.

Instruction selection may not completely take advantage of this
feature yet. As a result, there could be cases of slight code size
increase.

Code size can be worse on x86 because it doesn't support postincrement
addressing. In fact, when chains are formed, you may see redundant
address plus stride addition in the addressing mode. GenerateIVChains
tries to compensate for the common cases.

On ARM, code size increase can be mitigated by using postincrement
addressing, but downstream codegen currently misses some opportunities.

llvm-svn: 147826
2012-01-10 01:45:08 +00:00
Rafael Espindola
6b018e0b1d Remove the logging streamer.
llvm-svn: 147820
2012-01-10 00:40:39 +00:00
Devang Patel
921a16318d Split AsmParser into two components - AsmParser and AsmParserVariant
AsmParser holds info specific to target parser.
AsmParserVariant holds info specific to asm variants supported by the target.

llvm-svn: 147787
2012-01-09 19:13:28 +00:00
Rafael Espindola
7618aa1c64 Don't print an unused label before .cfi_endproc.
llvm-svn: 147763
2012-01-09 00:17:29 +00:00
Rafael Espindola
19a13321f8 Don't print a label before .cfi_startproc when we don't need to. This makes
the produce assembly when using CFI just a bit more readable.

llvm-svn: 147743
2012-01-07 22:42:19 +00:00
Benjamin Kramer
4c48b2024d Make clever use of alignment and padding to shrink GlobalValue.
-8 bytes on x86_64, no change on x86.

llvm-svn: 147742
2012-01-07 21:17:16 +00:00
Benjamin Kramer
0ce9fd3032 Remove VectorExtras. This unused helper was written for a type of API that is discouraged now.
llvm-svn: 147738
2012-01-07 19:42:13 +00:00
Benjamin Kramer
b13cdd4879 Port the trick to skip the check for empty buckets from StringMap to DenseMap.
This should fix the odd behavior that find() is slower than lookup().

llvm-svn: 147731
2012-01-07 13:12:07 +00:00
Rafael Espindola
2d545fa143 Split Finish into Finish and FinishImpl to have a common place to do end of
file error checking. Use that to error on an unfinished cfi_startproc.

The error is not nice, but is already better than a segmentation fault.

llvm-svn: 147717
2012-01-07 03:13:18 +00:00
Evan Cheng
8af07ba749 Added a late machine instruction copy propagation pass. This catches
opportunities that only present themselves after late optimizations
such as tail duplication .e.g.
## BB#1:
        movl    %eax, %ecx
        movl    %ecx, %eax
        ret

The register allocator also leaves some of them around (due to false
dep between copies from phi-elimination, etc.)

This required some changes in codegen passes. Post-ra scheduler and the
pseudo-instruction expansion passes have been moved after branch folding
and tail merging. They were before branch folding before because it did
not always update block livein's. That's fixed now. The pass change makes
independently since we want to properly schedule instructions after
branch folding / tail duplication.

rdar://10428165
rdar://10640363

llvm-svn: 147716
2012-01-07 03:02:36 +00:00
Andrew Trick
8a5a1e603e Extended replaceCongruentPhis to handle mixed phi types.
llvm-svn: 147707
2012-01-07 01:12:09 +00:00
Andrew Trick
60f6beef61 Expose isNonConstantNegative to users of ScalarEvolution.
llvm-svn: 147700
2012-01-07 00:27:31 +00:00
Andrew Trick
d5553c6ad2 Put all IVUsers in the processed set. Allow querying IVUsers with isIVUserOrOperand.
llvm-svn: 147686
2012-01-06 21:41:55 +00:00
Benjamin Kramer
509b7e6c60 Kill ObjectCodeEmitter and BinaryObject, they were unused and superseded by MC.
llvm-svn: 147618
2012-01-05 22:31:37 +00:00
Danil Malyshev
234aa2c4ea A small re-factored JIT/MCJIT::getPointerToNamedFunction(), so it could be called with the base class.
llvm-svn: 147610
2012-01-05 21:16:14 +00:00
Sebastian Pop
53d6e3b9d3 revert r147542 after comments from Joerg Sonnenberger
llvm-svn: 147608
2012-01-05 18:28:46 +00:00
Chris Lattner
8a6a27b69a allow clients of SmallSet to specify their own comparison function for the set.
Patch by Stepan Dyatkovskiy!

llvm-svn: 147607
2012-01-05 17:35:07 +00:00
Andrew Trick
f4817ef455 comment cleanup
llvm-svn: 147585
2012-01-05 01:01:01 +00:00
Jakob Stoklund Olesen
a33612c1f2 Freeze reserved registers before starting register allocation.
The register allocators don't currently support adding reserved
registers while they are running.  Extend the MRI API to keep track of
the set of reserved registers when register allocation started.

Target hooks like hasFP() and needsStackRealignment() can look at this
set to avoid reserving more registers during register allocation.

llvm-svn: 147577
2012-01-05 00:26:49 +00:00
Dan Gohman
f9fb5b3951 Generalize isSafeToSpeculativelyExecute to work on arbitrary
Values, rather than just Instructions, since it's interesting
for ConstantExprs too.

llvm-svn: 147560
2012-01-04 23:01:09 +00:00
Benjamin Kramer
dfab20fd0c Simplify more DenseMap.find users.
llvm-svn: 147550
2012-01-04 21:41:24 +00:00
Benjamin Kramer
15f1af87d2 StringMap.find never points to an empty bucket or tombstone, skip the check.
llvm-svn: 147546
2012-01-04 20:45:14 +00:00
Benjamin Kramer
503550b85a Simplify code. No functionality change.
Using DenseMap iterators isn't free as they have to check for empty
buckets. Dominator queries are common so this gives a minor speedup.

llvm-svn: 147544
2012-01-04 20:20:08 +00:00
Sebastian Pop
4f82b3a13f use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT
Get back getHostTriple.

For JIT compilation, use the host triple instead of the default
target: this fixes some JIT testcases that used to fail when the
compiler has been configured as a cross compiler.

llvm-svn: 147542
2012-01-04 19:47:22 +00:00
Chris Lattner
4f5ba31205 generalize LLVMContext::emitError to take a twine instead of a StringRef.
llvm-svn: 147501
2012-01-03 23:47:05 +00:00
Stepan Dyatkovskiy
7d03628e1e Fix for PR11652: assertion failures when Type.cpp is compiled with -Os
llvm-svn: 147470
2012-01-03 20:04:35 +00:00
Stepan Dyatkovskiy
7d6561f886 Type: replaced usage of ID with getTypeID().
llvm-svn: 147446
2012-01-03 14:05:04 +00:00
Benjamin Kramer
fba4e88bc2 PatternMatch: Introduce a matcher for instructions with the "exact" bit. Use it to simplify a few matchers.
llvm-svn: 147403
2012-01-01 17:55:30 +00:00
Benjamin Kramer
450513861d PatternMatch: Simplify code by reusing the Operator class.
llvm-svn: 147402
2012-01-01 17:55:23 +00:00
Rafael Espindola
db7319d272 Implement cfi_restore. Patch by Brian Anderson!
llvm-svn: 147356
2011-12-29 21:43:03 +00:00
Rafael Espindola
bc8c3d0ca0 Rename Remember and Restore to RememberState and RestoreState for consistency.
llvm-svn: 147354
2011-12-29 21:09:08 +00:00
Rafael Espindola
27298c6f33 Implement .cfi_escape. Patch by Brian Anderson!
llvm-svn: 147352
2011-12-29 20:24:47 +00:00
Rafael Espindola
1935193ab7 Fix grammar error noticed by Duncan.
llvm-svn: 147333
2011-12-29 02:15:06 +00:00
Nick Lewycky
7425820374 Change CaptureTracking to pass a Use* instead of a Value* when a value is
captured. This allows the tracker to look at the specific use, which may be
especially interesting for function calls.

Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does
not iterate until a fixpoint and does not guarantee that it produces the same
result regardless of iteration order. The new implementation builds up a graph
of how arguments are passed from function to function, and uses a bottom-up walk
on the argument-SCCs to assign nocapture. This gets us nocapture more often, and
does so rather efficiently and independent of iteration order.

llvm-svn: 147327
2011-12-28 23:24:21 +00:00
Benjamin Kramer
77f9c9f719 Switch StringMap from an array of structures to a structure of arrays.
- -25% memory usage of the main table on x86_64 (was wasted in struct padding).
- no significant performance change.

llvm-svn: 147294
2011-12-27 20:35:07 +00:00
Rafael Espindola
504588a7a3 Section relative fixups are a coff concept, not a x86 one. Replace the
x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.

llvm-svn: 147252
2011-12-24 14:47:52 +00:00
Rafael Espindola
2fc741dfac Move x86 specific bits of the COFF writer to lib/Target/X86.
llvm-svn: 147231
2011-12-24 02:14:02 +00:00
Rafael Espindola
1c25d8bcd4 Define trivial destructor inline.
llvm-svn: 147230
2011-12-24 01:53:13 +00:00
Rafael Espindola
fc942cb186 Make GetRelocType pure virtual.
llvm-svn: 147229
2011-12-24 01:36:25 +00:00
Mon P Wang
e062e56cab When not destroying the source, the linker is not remapping the types. Added support
to CloneFunctionInto to allow remapping for this case.

llvm-svn: 147217
2011-12-23 02:18:32 +00:00
Chris Lattner
c1c640b408 fix typo
llvm-svn: 147159
2011-12-22 19:20:51 +00:00
Rafael Espindola
9c71db357e Move PPC bits to lib/Target/PowerPC.
llvm-svn: 147124
2011-12-22 01:57:09 +00:00
Akira Hatanaka
e7bcf63d98 Local dynamic TLS model for direct object output. Create the correct TLS MIPS
ELF relocations.

Patch by Jack Carter.

llvm-svn: 147118
2011-12-22 01:05:17 +00:00
Rafael Espindola
ee837037ee Move the ARM specific parts of the ELF writer to Target/ARM.
llvm-svn: 147115
2011-12-22 00:37:50 +00:00
Lang Hames
4258202987 Fixed typo.
llvm-svn: 147113
2011-12-22 00:12:51 +00:00
Jakob Stoklund Olesen
893037ce23 Move common code into an MRI function.
llvm-svn: 147071
2011-12-21 19:50:05 +00:00
Manuel Klimek
2147506d8b Changes the JSON parser to use the SourceMgr.
Diagnostics are now emitted via the SourceMgr and we use MemoryBuffer
for buffer management. Switched the code to make use of the trailing
'0' that MemoryBuffer guarantees where it makes sense.

llvm-svn: 147063
2011-12-21 18:16:39 +00:00
Rafael Espindola
8c9b0dea02 Move the X86 specific bits of the ELF writer to the Target/X86 directory.
Other targets will follow shortly.

llvm-svn: 147060
2011-12-21 17:30:17 +00:00
Rafael Espindola
f9c7f9e3f3 Reduce the exposure of Triple::OSType in the ELF object writer. This will
avoid including ADT/Triple.h in many places when the target specific bits are
moved.

llvm-svn: 147059
2011-12-21 17:00:36 +00:00
Rafael Espindola
2334fc676a Add const.
llvm-svn: 147054
2011-12-21 14:48:04 +00:00
Jakub Staszak
6f3beda2b4 Add some constantness to BranchProbabilityInfo and BlockFrequnencyInfo.
llvm-svn: 146986
2011-12-20 20:03:10 +00:00
Devang Patel
a57e0b8f49 Add support to add named metadata operand.
Patch by Andrew Wilkins!

llvm-svn: 146984
2011-12-20 19:29:36 +00:00
Manuel Klimek
94bfd4f3fc Fixes a potential compilation error.
Pulling the template implementation into the header to guarantee
that it's visible to all possible instantiations.

llvm-svn: 146973
2011-12-20 11:04:23 +00:00
Manuel Klimek
9661304f32 Pulls the implementation of skip() into JSONParser.
This is the first step towards migrating more of the parser
implementation into the parser class.

llvm-svn: 146971
2011-12-20 10:42:52 +00:00
Manuel Klimek
e08a021292 Addressing style issues in JSON parser.
llvm-svn: 146968
2011-12-20 09:26:26 +00:00
David Blaikie
576aba04f1 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146960
2011-12-20 02:50:00 +00:00
Chris Lattner
f60c5dadf8 fix typo
llvm-svn: 146940
2011-12-20 01:11:37 +00:00
Chris Lattner
151b0ec955 add a method to improve compatibility with SmallVector.
llvm-svn: 146928
2011-12-20 00:03:41 +00:00
Dan Gohman
7940e4e81d Add basic generic CodeGen support for half.
llvm-svn: 146927
2011-12-20 00:02:33 +00:00
Evan Cheng
4c77fb5375 Add a if-conversion optimization that allows 'true' side of a diamond to be
unpredicated. That is, turn
 subeq  r0, r1, #1
 addne  r0, r1, #1                                                                                                                                                                                                     
into
 sub    r0, r1, #1
 addne  r0, r1, #1

For targets where conditional instructions are always executed, this may be
beneficial. It may remove pseudo anti-dependency in out-of-order execution
CPUs. e.g.
 op    r1, ...
 str   r1, [r10]        ; end-of-life of r1 as div result
 cmp   r0, #65
 movne r1, #44  ; raw dependency on previous r1
 moveq r1, #12

If movne is unpredicated, then
 op    r1, ...
 str   r1, [r10]
 cmp   r0, #65
 mov   r1, #44  ; r1 written unconditionally
 moveq r1, #12

Both mov and moveq are no longer depdendent on the first instruction. This gives
the out-of-order execution engine more freedom to reorder them.

This has passed entire LLVM test suite. But it has not been enabled for any ARM
variant pending more performance evaluation.

rdar://8951196

llvm-svn: 146914
2011-12-19 22:01:30 +00:00
Eli Friedman
53dbd7d97f Add "using" to silence warnings.
llvm-svn: 146913
2011-12-19 21:53:12 +00:00
Eli Friedman
602ab7a677 Attempt to fix PR11607 by shuffling around which class defines which methods.
llvm-svn: 146897
2011-12-19 20:06:03 +00:00
Jakob Stoklund Olesen
0aa2f7755a Emit a getMatchingSuperRegClass() implementation for every target.
Use information computed while inferring new register classes to emit
accurate, table-driven implementations of getMatchingSuperRegClass().

Delete the old manual, error-prone implementations in the targets.

llvm-svn: 146873
2011-12-19 16:53:34 +00:00
Joerg Sonnenberger
8cf8d64d19 Allow inlining of functions with returns_twice calls, if they have the
attribute themselve.

llvm-svn: 146851
2011-12-18 20:35:43 +00:00