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

4112 Commits

Author SHA1 Message Date
NAKAMURA Takumi
2be06d544c VMCore/AsmWriter.cpp: Tweak to check #INF and #NAN earlier.
With MSVCRT, prior checker missed emission of #INF and #NAN.

FIXME: Checking should be simpler.
llvm-svn: 150667
2012-02-16 08:12:24 +00:00
NAKAMURA Takumi
39331a549a VMCore/AsmWriter.cpp: Use APFloat instead of atof(3).
atof(3) might behave differently among platforms.

llvm-svn: 150661
2012-02-16 04:19:15 +00:00
Bill Wendling
2f3fb87abe Use the enum instead of 'unsigned'.
llvm-svn: 150632
2012-02-15 23:27:50 +00:00
Bill Wendling
e5d57bd4d0 Add a module flags accessor method which returns the flags in a vector.
llvm-svn: 150623
2012-02-15 22:34:20 +00:00
Eric Christopher
6be42e9898 Add a way to replace a field inside a metadata node. This can be
used to incrementally update a created node without needing a
temporary node and RAUW.

llvm-svn: 150571
2012-02-15 09:09:29 +00:00
Andrew Trick
3a4ed52447 Added TargetPassConfig::disablePass/substitutePass as a general mechanism to override specific passes.
llvm-svn: 150562
2012-02-15 03:21:47 +00:00
Bill Wendling
0dfc3d1e3e [WIP] Initial code for module flags.
Module flags are key-value pairs associated with the module. They include a
'behavior' value, indicating how module flags react when mergine two
files. Normally, it's just the union of the two module flags. But if two module
flags have the same key, then the resulting flags are dictated by the behaviors.

Allowable behaviors are:

     Error
       Emits an error if two values disagree.

     Warning
       Emits a warning if two values disagree.

     Require
       Emits an error when the specified value is not present
       or doesn't have the specified value. It is an error for
       two (or more) llvm.module.flags with the same ID to have
       the Require behavior but different values. There may be
       multiple Require flags per ID.

     Override
       Uses the specified value if the two values disagree. It
       is an error for two (or more) llvm.module.flags with the
       same ID to have the Override behavior but different
       values.

llvm-svn: 150300
2012-02-11 11:38:06 +00:00
Andrew Trick
135effe79b Added Pass::createPass(ID) to handle pass configuration by ID
llvm-svn: 150092
2012-02-08 21:22:34 +00:00
Bill Wendling
085bdb73fa Cache the sizes of vectors instead of calculating them all over the place.
llvm-svn: 149954
2012-02-07 01:48:12 +00:00
Bill Wendling
4183d7faf3 Reserve space in these vectors to prevent having to grow the array too
much. This gets us an addition 0.9% on 445.gobmk.

llvm-svn: 149952
2012-02-07 01:27:51 +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
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
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
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
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
Duncan Sands
9a1b76b649 Simplify some GEP checks in the verifier.
llvm-svn: 149698
2012-02-03 17:28:51 +00:00
Craig Topper
94fcde74f6 Add auto upgrade support for x86 pcmpgt/pcmpeq intrinics removed in r149367.
llvm-svn: 149678
2012-02-03 06:10:55 +00:00
Andrew Trick
0838f6788a whitespace
llvm-svn: 149671
2012-02-03 05:12:30 +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
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
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
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
63a482554f fix a small oversight that broke the fhourstones app.
llvm-svn: 149357
2012-01-31 05:18:56 +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
Chris Lattner
1d52d79d31 fix asmwriting of ConstantDataArray to use the right element count,
simplify ConstantArray handling, since they can never be empty.

llvm-svn: 149341
2012-01-31 03:15:40 +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
Chris Lattner
e087cbc056 First step of flipping on ConstantDataSequential: enable ConstantDataVector
to be formed whenever ConstantVector::get is used.

llvm-svn: 149226
2012-01-30 06:21:21 +00:00
Chris Lattner
aeafae8c79 Fix ConstantFoldShuffleVectorInstruction to properly handle the case
when the result type has a different # elements than the input vectors.

llvm-svn: 149221
2012-01-30 05:34:13 +00:00
Chris Lattner
466ff4b5f1 continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.

llvm-svn: 149116
2012-01-27 03:08:05 +00:00
Chris Lattner
70ba9d3a8c smallvectorize and ArrayRef'ize some stuff.
llvm-svn: 149077
2012-01-26 20:40:56 +00:00
Chris Lattner
80a5e94437 Reduce a lot of code duplication by implementing
ConstantExpr::getWithOperandReplaced and ConstantExpr::replaceUsesOfWithOnConstant
 in terms of ConstantExpr::getWithOperands.  While we're at it,
make sure that ConstantExpr::getWithOperands covers all instructions: it was
missing insert/extractvalue.  

llvm-svn: 149076
2012-01-26 20:37:11 +00:00
Chris Lattner
6e8ec90268 unbreak test/Bitcode/shuffle.ll.
llvm-svn: 149033
2012-01-26 03:10:45 +00:00
Chris Lattner
713c49ff5a simplify by using ShuffleVectorInst::getMaskValue.
llvm-svn: 149029
2012-01-26 02:54:54 +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
fd273f7516 Continue improving support for ConstantDataAggregate, and use the
new methods recently added to (sometimes greatly!) simplify code.

llvm-svn: 149024
2012-01-26 02:32:04 +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
1c318c6440 some general cleanup, using new methods and tidying up old code.
llvm-svn: 149006
2012-01-26 00:42:34 +00:00
Chris Lattner
c680a02df0 fix pasto in the new (and still unused) ShuffleVectorInst::getShuffleMask method.
llvm-svn: 149005
2012-01-26 00:41:50 +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
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
473bdbaabc use ConstantVector::getSplat in a few places.
llvm-svn: 148929
2012-01-25 06:02:56 +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
Nick Lewycky
8b7c7ba376 Fix assert("msg"). Fix unused-variable warnings complaining about VT used only
in asserts.

llvm-svn: 148910
2012-01-25 03:20:12 +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