From sabre at nondot.org Mon Aug 11 01:12:47 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Aug 2008 06:12:47 -0000 Subject: [llvm-commits] [llvm] r54630 - /llvm/trunk/utils/llvmdo Message-ID: <200808110612.m7B6ClZ1006375@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 11 01:12:45 2008 New Revision: 54630 URL: http://llvm.org/viewvc/llvm-project?rev=54630&view=rev Log: remove obsolete files Modified: llvm/trunk/utils/llvmdo Modified: llvm/trunk/utils/llvmdo URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvmdo?rev=54630&r1=54629&r2=54630&view=diff ============================================================================== --- llvm/trunk/utils/llvmdo (original) +++ llvm/trunk/utils/llvmdo Mon Aug 11 01:12:45 2008 @@ -168,13 +168,6 @@ -o -name *AST-Remove.ll \ -o -name llvmAsmParser.cpp \ -o -name llvmAsmParser.h \ - -o -name Lexer.cpp \ - -o -name FileLexer.cpp \ - -o -name FileParser.cpp \ - -o -name FileParser.h \ - -o -name StackerParser.h \ - -o -name StackerParser.cpp \ - -o -name ConfigLexer.cpp \ -o -name PPCPerfectShuffle.h \ " From sabre at nondot.org Mon Aug 11 01:13:31 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Aug 2008 06:13:31 -0000 Subject: [llvm-commits] [llvm] r54631 - in /llvm/trunk/docs: GettingStarted.html Stacker.html index.html Message-ID: <200808110613.m7B6DVip006410@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 11 01:13:31 2008 New Revision: 54631 URL: http://llvm.org/viewvc/llvm-project?rev=54631&view=rev Log: the stacker doc is way out of date. Removed: llvm/trunk/docs/Stacker.html Modified: llvm/trunk/docs/GettingStarted.html llvm/trunk/docs/index.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=54631&r1=54630&r2=54631&view=diff ============================================================================== --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Mon Aug 11 01:13:31 2008 @@ -1291,8 +1291,7 @@

This directory contains projects that are not strictly part of LLVM but are shipped with LLVM. This is also the directory where you should create your own LLVM-based projects. See llvm/projects/sample for an example of how - to set up your own project. See llvm/projects/Stacker for a fully - functional example of a compiler front end.

+ to set up your own project.

Removed: llvm/trunk/docs/Stacker.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Stacker.html?rev=54630&view=auto ============================================================================== --- llvm/trunk/docs/Stacker.html (original) +++ llvm/trunk/docs/Stacker.html (removed) @@ -1,1428 +0,0 @@ - - - - Stacker: An Example Of Using LLVM - - - - -
Stacker: An Example Of Using LLVM
- -
    -
  1. Abstract
  2. -
  3. Introduction
  4. -
  5. Lessons I Learned About LLVM -
      -
    1. Everything's a Value!
    2. -
    3. Terminate Those Blocks!
    4. -
    5. Concrete Blocks
    6. -
    7. push_back Is Your Friend
    8. -
    9. The Wily GetElementPtrInst
    10. -
    11. Getting Linkage Types Right
    12. -
    13. Constants Are Easier Than That!
    14. -
  6. -
  7. The Stacker Lexicon -
      -
    1. The Stack
    2. -
    3. Punctuation
    4. -
    5. Comments
    6. -
    7. Literals
    8. -
    9. Words
    10. -
    11. Standard Style
    12. -
    13. Built-Ins
    14. -
  8. -
  9. Prime: A Complete Example
  10. -
  11. Internal Code Details -
      -
    1. The Directory Structure
    2. -
    3. The Lexer
    4. -
    5. The Parser
    6. -
    7. The Compiler
    8. -
    9. The Runtime
    10. -
    11. Compiler Driver
    12. -
    13. Test Programs
    14. -
    15. Exercise
    16. -
    17. Things Remaining To Be Done
    18. -
  12. -
- -
-

Written by Reid Spencer

-
- - -
Abstract
-
-

This document is another way to learn about LLVM. Unlike the -LLVM Reference Manual or -LLVM Programmer's Manual, here we learn -about LLVM through the experience of creating a simple programming language -named Stacker. Stacker was invented specifically as a demonstration of -LLVM. The emphasis in this document is not on describing the -intricacies of LLVM itself but on how to use it to build your own -compiler system.

-
- -
Introduction
-
-

Amongst other things, LLVM is a platform for compiler writers. -Because of its exceptionally clean and small IR (intermediate -representation), compiler writing with LLVM is much easier than with -other system. As proof, I wrote the entire compiler (language definition, -lexer, parser, code generator, etc.) in about four days! -That's important to know because it shows how quickly you can get a new -language running when using LLVM. Furthermore, this was the first -language the author ever created using LLVM. The learning curve is -included in that four days.

-

The language described here, Stacker, is Forth-like. Programs -are simple collections of word definitions, and the only thing definitions -can do is manipulate a stack or generate I/O. Stacker is not a "real" -programming language; it's very simple. Although it is computationally -complete, you wouldn't use it for your next big project. However, -the fact that it is complete, it's simple, and it doesn't have -a C-like syntax make it useful for demonstration purposes. It shows -that LLVM could be applied to a wide variety of languages.

-

The basic notions behind stacker is very simple. There's a stack of -integers (or character pointers) that the program manipulates. Pretty -much the only thing the program can do is manipulate the stack and do -some limited I/O operations. The language provides you with several -built-in words that manipulate the stack in interesting ways. To get -your feet wet, here's how you write the traditional "Hello, World" -program in Stacker:

-

: hello_world "Hello, World!" >s DROP CR ;
-: MAIN hello_world ;

-

This has two "definitions" (Stacker manipulates words, not -functions and words have definitions): MAIN and -hello_world. The MAIN definition is standard; it -tells Stacker where to start. Here, MAIN is defined to -simply invoke the word hello_world. The -hello_world definition tells stacker to push the -"Hello, World!" string on to the stack, print it out -(>s), pop it off the stack (DROP), and -finally print a carriage return (CR). Although -hello_world uses the stack, its net effect is null. Well -written Stacker definitions have that characteristic.

-

Exercise for the reader: how could you make this a one line program?

-
- -
Lessons I Learned About LLVM
-
-

Stacker was written for two purposes:

-
    -
  1. to get the author over the learning curve, and
  2. -
  3. to provide a simple example of how to write a compiler using LLVM.
  4. -
-

During the development of Stacker, many lessons about LLVM were -learned. Those lessons are described in the following subsections.

-

- -
Everything's a Value!
-
-

Although I knew that LLVM uses a Single Static Assignment (SSA) format, -it wasn't obvious to me how prevalent this idea was in LLVM until I really -started using it. Reading the -Programmer's Manual and Language Reference, -I noted that most of the important LLVM IR (Intermediate Representation) C++ -classes were derived from the Value class. The full power of that simple -design only became fully understood once I started constructing executable -expressions for Stacker.

- -

This really makes your programming go faster. Think about compiling code -for the following C/C++ expression: (a|b)*((x+1)/(y+1)). Assuming -the values are on the stack in the order a, b, x, y, this could be -expressed in stacker as: 1 + SWAP 1 + / ROT2 OR *. -You could write a function using LLVM that computes this expression like -this:

- -
-Value* 
-expression(BasicBlock* bb, Value* a, Value* b, Value* x, Value* y )
-{
-    ConstantInt* one = ConstantInt::get(Type::IntTy, 1);
-    BinaryOperator* or1 = BinaryOperator::createOr(a, b, "", bb);
-    BinaryOperator* add1 = BinaryOperator::createAdd(x, one, "", bb);
-    BinaryOperator* add2 = BinaryOperator::createAdd(y, one, "", bb);
-    BinaryOperator* div1 = BinaryOperator::createDiv(add1, add2, "", bb);
-    BinaryOperator* mult1 = BinaryOperator::createMul(or1, div1, "", bb);
-    return mult1;
-}
-
- -

"Okay, big deal," you say? It is a big deal. Here's why. Note that I didn't -have to tell this function which kinds of Values are being passed in. They could be -Instructions, Constants, GlobalVariables, or -any of the other subclasses of Value that LLVM supports. -Furthermore, if you specify Values that are incorrect for this sequence of -operations, LLVM will either notice right away (at compilation time) or the LLVM -Verifier will pick up the inconsistency when the compiler runs. In either case -LLVM prevents you from making a type error that gets passed through to the -generated program. This really helps you write a compiler that -always generates correct code!

-

The second point is that we don't have to worry about branching, registers, -stack variables, saving partial results, etc. The instructions we create -are the values we use. Note that all that was created in the above -code is a Constant value and five operators. Each of the instructions is -the resulting value of that instruction. This saves a lot of time.

-

The lesson is this: SSA form is very powerful: there is no difference -between a value and the instruction that created it. This is fully -enforced by the LLVM IR. Use it to your best advantage.

-
- -
Terminate Those Blocks!
-
-

I had to learn about terminating blocks the hard way: using the debugger -to figure out what the LLVM verifier was trying to tell me and begging for -help on the LLVMdev mailing list. I hope you avoid this experience.

-

Emblazon this rule in your mind:

- -

Terminating instructions are a semantic requirement of the LLVM IR. There -is no facility for implicitly chaining together blocks placed into a function -in the order they occur. Indeed, in the general case, blocks will not be -added to the function in the order of execution because of the recursive -way compilers are written.

-

Furthermore, if you don't terminate your blocks, your compiler code will -compile just fine. You won't find out about the problem until you're running -the compiler and the module you just created fails on the LLVM Verifier.

-
- -
Concrete Blocks
-
-

After a little initial fumbling around, I quickly caught on to how blocks -should be constructed. In general, here's what I learned: -

    -
  1. Create your blocks early. While writing your compiler, you - will encounter several situations where you know apriori that you will - need several blocks. For example, if-then-else, switch, while, and for - statements in C/C++ all need multiple blocks for expression in LLVM. - The rule is, create them early.
  2. -
  3. Terminate your blocks early. This just reduces the chances - that you forget to terminate your blocks which is required (go - here for more). -
  4. Use getTerminator() for instruction insertion. I noticed early on - that many of the constructors for the Instruction classes take an optional - insert_before argument. At first, I thought this was a mistake - because clearly the normal mode of inserting instructions would be one at - a time after some other instruction, not before. However, - if you hold on to your terminating instruction (or use the handy dandy - getTerminator() method on a BasicBlock), it can - always be used as the insert_before argument to your instruction - constructors. This causes the instruction to automatically be inserted in - the RightPlace™ place, just before the terminating instruction. The - nice thing about this design is that you can pass blocks around and insert - new instructions into them without ever knowing what instructions came - before. This makes for some very clean compiler design.
  5. -
-

The foregoing is such an important principal, its worth making an idiom:

-
-BasicBlock* bb = BasicBlock::Create();
-bb->getInstList().push_back( BranchInst::Create( ... ) );
-new Instruction(..., bb->getTerminator() );
-
-

To make this clear, consider the typical if-then-else statement -(see StackerCompiler::handle_if() method). We can set this up -in a single function using LLVM in the following way:

-
-using namespace llvm;
-BasicBlock*
-MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition )
-{
-    // Create the blocks to contain code in the structure of if/then/else
-    BasicBlock* then_bb = BasicBlock::Create(); 
-    BasicBlock* else_bb = BasicBlock::Create();
-    BasicBlock* exit_bb = BasicBlock::Create();
-
-    // Insert the branch instruction for the "if"
-    bb->getInstList().push_back( BranchInst::Create( then_bb, else_bb, condition ) );
-
-    // Set up the terminating instructions
-    then->getInstList().push_back( BranchInst::Create( exit_bb ) );
-    else->getInstList().push_back( BranchInst::Create( exit_bb ) );
-
-    // Fill in the then part .. details excised for brevity
-    this->fill_in( then_bb );
-
-    // Fill in the else part .. details excised for brevity
-    this->fill_in( else_bb );
-
-    // Return a block to the caller that can be filled in with the code
-    // that follows the if/then/else construct.
-    return exit_bb;
-}
-
-

Presumably in the foregoing, the calls to the "fill_in" method would add -the instructions for the "then" and "else" parts. They would use the third part -of the idiom almost exclusively (inserting new instructions before the -terminator). Furthermore, they could even recurse back to handle_if -should they encounter another if/then/else statement, and it will just work.

-

Note how cleanly this all works out. In particular, the push_back methods on -the BasicBlock's instruction list. These are lists of type -Instruction (which is also of type Value). To create -the "if" branch we merely instantiate a BranchInst that takes as -arguments the blocks to branch to and the condition to branch on. The -BasicBlock objects act like branch labels! This new -BranchInst terminates the BasicBlock provided -as an argument. To give the caller a way to keep inserting after calling -handle_if, we create an exit_bb block which is -returned -to the caller. Note that the exit_bb block is used as the -terminator for both the then_bb and the else_bb -blocks. This guarantees that no matter what else handle_if -or fill_in does, they end up at the exit_bb block. -

-
- -
push_back Is Your Friend
-
-

-One of the first things I noticed is the frequent use of the "push_back" -method on the various lists. This is so common that it is worth mentioning. -The "push_back" inserts a value into an STL list, vector, array, etc. at the -end. The method might have also been named "insert_tail" or "append". -Although I've used STL quite frequently, my use of push_back wasn't very -high in other programs. In LLVM, you'll use it all the time. -

-
- -
The Wily GetElementPtrInst
-
-

-It took a little getting used to and several rounds of postings to the LLVM -mailing list to wrap my head around this instruction correctly. Even though I had -read the Language Reference and Programmer's Manual a couple times each, I still -missed a few very key points: -

- -

This means that when you look up an element in the global variable (assuming -it's a struct or array), you must deference the pointer first! For many -things, this leads to the idiom: -

-
-std::vector<Value*> index_vector;
-index_vector.push_back( ConstantInt::get( Type::LongTy, 0 );
-// ... push other indices ...
-GetElementPtrInst* gep = GetElementPtrInst::Create( ptr, index_vector );
-
-

For example, suppose we have a global variable whose type is [24 x int]. The -variable itself represents a pointer to that array. To subscript the -array, we need two indices, not just one. The first index (0) dereferences the -pointer. The second index subscripts the array. If you're a "C" programmer, this -will run against your grain because you'll naturally think of the global array -variable and the address of its first element as the same. That tripped me up -for a while until I realized that they really do differ .. by type. -Remember that LLVM is strongly typed. Everything has a type. -The "type" of the global variable is [24 x int]*. That is, it's -a pointer to an array of 24 ints. When you dereference that global variable with -a single (0) index, you now have a "[24 x int]" type. Although -the pointer value of the dereferenced global and the address of the zero'th element -in the array will be the same, they differ in their type. The zero'th element has -type "int" while the pointer value has type "[24 x int]".

-

Get this one aspect of LLVM right in your head, and you'll save yourself -a lot of compiler writing headaches down the road.

-
- -
Getting Linkage Types Right
-
-

Linkage types in LLVM can be a little confusing, especially if your compiler -writing mind has affixed firm concepts to particular words like "weak", -"external", "global", "linkonce", etc. LLVM does not use the precise -definitions of, say, ELF or GCC, even though they share common terms. To be fair, -the concepts are related and similar but not precisely the same. This can lead -you to think you know what a linkage type represents but in fact it is slightly -different. I recommend you read the - Language Reference on this topic very -carefully. Then, read it again.

-

Here are some handy tips that I discovered along the way:

- -
- -
Constants Are Easier Than That!
-
-

-Constants in LLVM took a little getting used to until I discovered a few utility -functions in the LLVM IR that make things easier. Here's what I learned:

- -
- -
The Stacker Lexicon
-

This section describes the Stacker language

-
The Stack
-
-

Stacker definitions define what they do to the global stack. Before -proceeding, a few words about the stack are in order. The stack is simply -a global array of 32-bit integers or pointers. A global index keeps track -of the location of the top of the stack. All of this is hidden from the -programmer, but it needs to be noted because it is the foundation of the -conceptual programming model for Stacker. When you write a definition, -you are, essentially, saying how you want that definition to manipulate -the global stack.

-

Manipulating the stack can be quite hazardous. There is no distinction -given and no checking for the various types of values that can be placed -on the stack. Automatic coercion between types is performed. In many -cases, this is useful. For example, a boolean value placed on the stack -can be interpreted as an integer with good results. However, using a -word that interprets that boolean value as a pointer to a string to -print out will almost always yield a crash. Stacker simply leaves it -to the programmer to get it right without any interference or hindering -on interpretation of the stack values. You've been warned. :)

-
- -
Punctuation
-
-

Punctuation in Stacker is very simple. The colon and semi-colon -characters are used to introduce and terminate a definition -(respectively). Except for FORWARD declarations, definitions -are all you can specify in Stacker. Definitions are read left to right. -Immediately after the colon comes the name of the word being defined. -The remaining words in the definition specify what the word does. The definition -is terminated by a semi-colon.

-

So, your typical definition will have the form:

-
: name ... ;
-

The name is up to you but it must start with a letter and contain -only letters, numbers, and underscore. Names are case sensitive and must not be -the same as the name of a built-in word. The ... is replaced by -the stack manipulating words that you wish to define name as.

-

- -
Comments
-
-

Stacker supports two types of comments. A hash mark (#) starts a comment - that extends to the end of the line. It is identical to the kind of comments - commonly used in shell scripts. A pair of parentheses also surround a comment. - In both cases, the content of the comment is ignored by the Stacker compiler. The - following does nothing in Stacker. -

-

-# This is a comment to end of line
-( This is an enclosed comment )
-
-

See the example program to see comments in use in -a real program.

-
- -
Literals
-
-

There are three kinds of literal values in Stacker: Integers, Strings, - and Booleans. In each case, the stack operation is to simply push the - value on to the stack. So, for example:
- 42 " is the answer." TRUE
- will push three values on to the stack: the integer 42, the - string " is the answer.", and the boolean TRUE.

-
- -
Words
-
-

Each definition in Stacker is composed of a set of words. Words are -read and executed in order from left to right. There is very little -checking in Stacker to make sure you're doing the right thing with -the stack. It is assumed that the programmer knows how the stack -transformation he applies will affect the program.

-

Words in a definition come in two flavors: built-in and programmer -defined. Simply mentioning the name of a previously defined or declared -programmer-defined word causes that word's stack actions to be invoked. It -is somewhat like a function call in other languages. The built-in -words have various effects, described below.

-

Sometimes you need to call a word before it is defined. For this, you can -use the FORWARD declaration. It looks like this:

-

FORWARD name ;

-

This simply states to Stacker that "name" is the name of a definition -that is defined elsewhere. Generally it means the definition can be found -"forward" in the file. But, it doesn't have to be in the current compilation -unit. Anything declared with FORWARD is an external symbol for -linking.

-
- -
Standard Style
-
-

TODO

-
- -
Built In Words
-
-

The built-in words of the Stacker language are put in several groups -depending on what they do. The groups are as follows:

-
    -
  1. Logical: These words provide the logical operations for - comparing stack operands.
    The words are: < > <= >= - = <> true false.
  2. -
  3. Bitwise: These words perform bitwise computations on - their operands.
    The words are: << >> XOR AND NOT
  4. -
  5. Arithmetic: These words perform arithmetic computations on - their operands.
    The words are: ABS NEG + - * / MOD */ ++ -- MIN MAX
  6. -
  7. StackThese words manipulate the stack directly by moving - its elements around.
    The words are: DROP DROP2 NIP NIP2 DUP DUP2 - SWAP SWAP2 OVER OVER2 ROT ROT2 RROT RROT2 TUCK TUCK2 PICK SELECT ROLL
  8. -
  9. MemoryThese words allocate, free, and manipulate memory - areas outside the stack.
    The words are: MALLOC FREE GET PUT
  10. -
  11. Control: These words alter the normal left to right flow - of execution.
    The words are: IF ELSE ENDIF WHILE END RETURN EXIT RECURSE
  12. -
  13. I/O: These words perform output on the standard output - and input on the standard input. No other I/O is possible in Stacker. -
    The words are: SPACE TAB CR >s >d >c <s <d <c.
  14. -
-

While you may be familiar with many of these operations from other -programming languages, a careful review of their semantics is important -for correct programming in Stacker. Of most importance is the effect -that each of these built-in words has on the global stack. The effect is -not always intuitive. To better describe the effects, we'll borrow from Forth the idiom of -describing the effect on the stack with:

-

BEFORE -- AFTER

-

That is, to the left of the -- is a representation of the stack before -the operation. To the right of the -- is a representation of the stack -after the operation. In the table below that describes the operation of -each of the built in words, we will denote the elements of the stack -using the following construction:

-
    -
  1. b - a boolean truth value
  2. -
  3. w - a normal integer valued word.
  4. -
  5. s - a pointer to a string value
  6. -
  7. p - a pointer to a malloc'd memory block
  8. -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Definition Of Operation Of Built In Words
LOGICAL OPERATIONS
WordNameOperationDescription
<LTw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is less than w2, TRUE is pushed back on - the stack, otherwise FALSE is pushed back on the stack.
>GTw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is greater than w2, TRUE is pushed back on - the stack, otherwise FALSE is pushed back on the stack.
>=GEw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is greater than or equal to w2, TRUE is - pushed back on the stack, otherwise FALSE is pushed back - on the stack.
<=LEw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is less than or equal to w2, TRUE is - pushed back on the stack, otherwise FALSE is pushed back - on the stack.
=EQw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is equal to w2, TRUE is - pushed back on the stack, otherwise FALSE is pushed back -
<>NEw1 w2 -- bTwo values (w1 and w2) are popped off the stack and - compared. If w1 is equal to w2, TRUE is - pushed back on the stack, otherwise FALSE is pushed back -
FALSEFALSE -- bThe boolean value FALSE (0) is pushed on to the stack.
TRUETRUE -- bThe boolean value TRUE (-1) is pushed on to the stack.
BITWISE OPERATORS
WordNameOperationDescription
<<SHLw1 w2 -- w1<<w2Two values (w1 and w2) are popped off the stack. The w2 - operand is shifted left by the number of bits given by the - w1 operand. The result is pushed back to the stack.
>>SHRw1 w2 -- w1>>w2Two values (w1 and w2) are popped off the stack. The w2 - operand is shifted right by the number of bits given by the - w1 operand. The result is pushed back to the stack.
ORORw1 w2 -- w2|w1Two values (w1 and w2) are popped off the stack. The values - are bitwise OR'd together and pushed back on the stack. This is - not a logical OR. The sequence 1 2 OR yields 3 not 1.
ANDANDw1 w2 -- w2&w1Two values (w1 and w2) are popped off the stack. The values - are bitwise AND'd together and pushed back on the stack. This is - not a logical AND. The sequence 1 2 AND yields 0 not 1.
XORXORw1 w2 -- w2^w1Two values (w1 and w2) are popped off the stack. The values - are bitwise exclusive OR'd together and pushed back on the stack. - For example, The sequence 1 3 XOR yields 2.
ARITHMETIC OPERATORS
WordNameOperationDescription
ABSABSw -- |w|One value s popped off the stack; its absolute value is computed - and then pushed on to the stack. If w1 is -1 then w2 is 1. If w1 is - 1 then w2 is also 1.
NEGNEGw -- -wOne value is popped off the stack which is negated and then - pushed back on to the stack. If w1 is -1 then w2 is 1. If w1 is - 1 then w2 is -1.
+ ADDw1 w2 -- w2+w1Two values are popped off the stack. Their sum is pushed back - on to the stack
- SUBw1 w2 -- w2-w1Two values are popped off the stack. Their difference is pushed back - on to the stack
* MULw1 w2 -- w2*w1Two values are popped off the stack. Their product is pushed back - on to the stack
/ DIVw1 w2 -- w2/w1Two values are popped off the stack. Their quotient is pushed back - on to the stack
MODMODw1 w2 -- w2%w1Two values are popped off the stack. Their remainder after division - of w1 by w2 is pushed back on to the stack
*/ STAR_SLAHw1 w2 w3 -- (w3*w2)/w1Three values are popped off the stack. The product of w1 and w2 is - divided by w3. The result is pushed back on to the stack.
++ INCRw -- w+1One value is popped off the stack. It is incremented by one and then - pushed back on to the stack.
-- DECRw -- w-1One value is popped off the stack. It is decremented by one and then - pushed back on to the stack.
MINMINw1 w2 -- (w2<w1?w2:w1)Two values are popped off the stack. The larger one is pushed back - on to the stack.
MAXMAXw1 w2 -- (w2>w1?w2:w1)Two values are popped off the stack. The larger value is pushed back - on to the stack.
STACK MANIPULATION OPERATORS
WordNameOperationDescription
DROPDROPw -- One value is popped off the stack.
DROP2DROP2w1 w2 -- Two values are popped off the stack.
NIPNIPw1 w2 -- w2The second value on the stack is removed from the stack. That is, - a value is popped off the stack and retained. Then a second value is - popped and the retained value is pushed.
NIP2NIP2w1 w2 w3 w4 -- w3 w4The third and fourth values on the stack are removed from it. That is, - two values are popped and retained. Then two more values are popped and - the two retained values are pushed back on.
DUPDUPw1 -- w1 w1One value is popped off the stack. That value is then pushed on to - the stack twice to duplicate the top stack vaue.
DUP2DUP2w1 w2 -- w1 w2 w1 w2The top two values on the stack are duplicated. That is, two vaues - are popped off the stack. They are alternately pushed back on the - stack twice each.
SWAPSWAPw1 w2 -- w2 w1The top two stack items are reversed in their order. That is, two - values are popped off the stack and pushed back on to the stack in - the opposite order they were popped.
SWAP2SWAP2w1 w2 w3 w4 -- w3 w4 w2 w1The top four stack items are swapped in pairs. That is, two values - are popped and retained. Then, two more values are popped and retained. - The values are pushed back on to the stack in the reverse order but - in pairs.
OVEROVERw1 w2-- w1 w2 w1Two values are popped from the stack. They are pushed back - on to the stack in the order w1 w2 w1. This seems to cause the - top stack element to be duplicated "over" the next value.
OVER2OVER2w1 w2 w3 w4 -- w1 w2 w3 w4 w1 w2The third and fourth values on the stack are replicated on to the - top of the stack
ROTROTw1 w2 w3 -- w2 w3 w1The top three values are rotated. That is, three value are popped - off the stack. They are pushed back on to the stack in the order - w1 w3 w2.
ROT2ROT2w1 w2 w3 w4 w5 w6 -- w3 w4 w5 w6 w1 w2Like ROT but the rotation is done using three pairs instead of - three singles.
RROTRROTw1 w2 w3 -- w3 w1 w2Reverse rotation. Like ROT, but it rotates the other way around. - Essentially, the third element on the stack is moved to the top - of the stack.
RROT2RROT2w1 w2 w3 w4 w5 w6 -- w3 w4 w5 w6 w1 w2Double reverse rotation. Like RROT but the rotation is done using - three pairs instead of three singles. The fifth and sixth stack - elements are moved to the first and second positions
TUCKTUCKw1 w2 -- w2 w1 w2Similar to OVER except that the second operand is being - replicated. Essentially, the first operand is being "tucked" - in between two instances of the second operand. Logically, two - values are popped off the stack. They are placed back on the - stack in the order w2 w1 w2.
TUCK2TUCK2w1 w2 w3 w4 -- w3 w4 w1 w2 w3 w4Like TUCK but a pair of elements is tucked over two pairs. - That is, the top two elements of the stack are duplicated and - inserted into the stack at the fifth and positions.
PICKPICKx0 ... Xn n -- x0 ... Xn x0The top of the stack is used as an index into the remainder of - the stack. The element at the nth position replaces the index - (top of stack). This is useful for cycling through a set of - values. Note that indexing is zero based. So, if n=0 then you - get the second item on the stack. If n=1 you get the third, etc. - Note also that the index is replaced by the n'th value.
SELECTSELECTm n X0..Xm Xm+1 .. Xn -- XmThis is like PICK but the list is removed and you need to specify - both the index and the size of the list. Careful with this one, - the wrong value for n can blow away a huge amount of the stack.
ROLLROLLx0 x1 .. xn n -- x1 .. xn x0Not Implemented. This one has been left as an exercise to - the student. See Exercise. ROLL requires - a value, "n", to be on the top of the stack. This value specifies how - far into the stack to "roll". The n'th value is moved (not - copied) from its location and replaces the "n" value on the top of the - stack. In this way, all the values between "n" and x0 roll up the stack. - The operation of ROLL is a generalized ROT. The "n" value specifies - how much to rotate. That is, ROLL with n=1 is the same as ROT and - ROLL with n=2 is the same as ROT2.
MEMORY OPERATORS
WordNameOperationDescription
MALLOCMALLOCw1 -- pOne value is popped off the stack. The value is used as the size - of a memory block to allocate. The size is in bytes, not words. - The memory allocation is completed and the address of the memory - block is pushed on to the stack.
FREEFREEp -- One pointer value is popped off the stack. The value should be - the address of a memory block created by the MALLOC operation. The - associated memory block is freed. Nothing is pushed back on the - stack. Many bugs can be created by attempting to FREE something - that isn't a pointer to a MALLOC allocated memory block. Make - sure you know what's on the stack. One way to do this is with - the following idiom:
- 64 MALLOC DUP DUP (use ptr) DUP (use ptr) ... FREE -
This ensures that an extra copy of the pointer is placed on - the stack (for the FREE at the end) and that every use of the - pointer is preceded by a DUP to retain the copy for FREE.
GETGETw1 p -- w2 pAn integer index and a pointer to a memory block are popped of - the block. The index is used to index one byte from the memory - block. That byte value is retained, the pointer is pushed again - and the retained value is pushed. Note that the pointer value - s essentially retained in its position so this doesn't count - as a "use ptr" in the FREE idiom.
PUTPUTw1 w2 p -- p An integer value is popped of the stack. This is the value to - be put into a memory block. Another integer value is popped of - the stack. This is the indexed byte in the memory block. A - pointer to the memory block is popped off the stack. The - first value (w1) is then converted to a byte and written - to the element of the memory block(p) at the index given - by the second value (w2). The pointer to the memory block is - pushed back on the stack so this doesn't count as a "use ptr" - in the FREE idiom.
CONTROL FLOW OPERATORS
WordNameOperationDescription
RETURNRETURN -- The currently executing definition returns immediately to its caller. - Note that there is an implicit RETURN at the end of each - definition, logically located at the semi-colon. The sequence - RETURN ; is valid but redundant.
EXITEXITw1 -- A return value for the program is popped off the stack. The program is - then immediately terminated. This is normally an abnormal exit from the - program. For a normal exit (when MAIN finishes), the exit - code will always be zero in accordance with UNIX conventions.
RECURSERECURSE -- The currently executed definition is called again. This operation is - needed since the definition of a word doesn't exist until the semi colon - is reacher. Attempting something like:
- : recurser recurser ;
will yield and error saying that - "recurser" is not defined yet. To accomplish the same thing, change this - to:
- : recurser RECURSE ;
IF (words...) ENDIFIF (words...) ENDIFb -- A boolean value is popped of the stack. If it is non-zero then the "words..." - are executed. Otherwise, execution continues immediately following the ENDIF.
IF (words...) ELSE (words...) ENDIFIF (words...) ELSE (words...) ENDIFb -- A boolean value is popped of the stack. If it is non-zero then the "words..." - between IF and ELSE are executed. Otherwise the words between ELSE and ENDIF are - executed. In either case, after the (words....) have executed, execution continues - immediately following the ENDIF.
WHILE word ENDWHILE word ENDb -- b The boolean value on the top of the stack is examined (not popped). If - it is non-zero then the "word" between WHILE and END is executed. - Execution then begins again at the WHILE where the boolean on the top of - the stack is examined again. The stack is not modified by the WHILE...END - loop, only examined. It is imperative that the "word" in the body of the - loop ensure that the top of the stack contains the next boolean to examine - when it completes. Note that since booleans and integers can be coerced - you can use the following "for loop" idiom:
- (push count) WHILE word -- END
- For example:
- 10 WHILE >d -- END
- This will print the numbers from 10 down to 1. 10 is pushed on the - stack. Since that is non-zero, the while loop is entered. The top of - the stack (10) is printed out with >d. The top of the stack is - decremented, yielding 9 and control is transfered back to the WHILE - keyword. The process starts all over again and repeats until - the top of stack is decremented to 0 at which point the WHILE test - fails and control is transfered to the word after the END. -
INPUT & OUTPUT OPERATORS
WordNameOperationDescription
SPACESPACE -- A space character is put out. There is no stack effect.
TABTAB -- A tab character is put out. There is no stack effect.
CRCR -- A carriage return character is put out. There is no stack effect.
>sOUT_STR -- A string pointer is popped from the stack. It is put out.
>dOUT_STR -- A value is popped from the stack. It is put out as a decimal - integer.
>cOUT_CHR -- A value is popped from the stack. It is put out as an ASCII - character.
<sIN_STR -- s A string is read from the input via the scanf(3) format string " %as". - The resulting string is pushed on to the stack.
<dIN_STR -- w An integer is read from the input via the scanf(3) format string " %d". - The resulting value is pushed on to the stack
<cIN_CHR -- w A single character is read from the input via the scanf(3) format string - " %c". The value is converted to an integer and pushed on to the stack.
DUMPDUMP -- The stack contents are dumped to standard output. This is useful for - debugging your definitions. Put DUMP at the beginning and end of a definition - to see instantly the net effect of the definition.
- -
- -
Prime: A Complete Example
-
-

The following fully documented program highlights many features of both -the Stacker language and what is possible with LLVM. The program has two modes -of operation. If you provide numeric arguments to the program, it checks to see -if those arguments are prime numbers and prints out the results. Without any -arguments, the program prints out any prime numbers it finds between 1 and one -million (there's a lot of them!). The source code comments below tell the -remainder of the story. -

-
-
-

-################################################################################
-#
-# Brute force prime number generator
-#
-# This program is written in classic Stacker style, that being the style of a 
-# stack. Start at the bottom and read your way up !
-#
-# Reid Spencer - Nov 2003 
-################################################################################
-# Utility definitions
-################################################################################
-: print >d CR ;
-: it_is_a_prime TRUE ;
-: it_is_not_a_prime FALSE ;
-: continue_loop TRUE ;
-: exit_loop FALSE;
-    
-################################################################################
-# This definition tries an actual division of a candidate prime number. It
-# determines whether the division loop on this candidate should continue or
-# not.
-# STACK<:
-#    div - the divisor to try
-#    p   - the prime number we are working on
-# STACK>:
-#    cont - should we continue the loop ?
-#    div - the next divisor to try
-#    p   - the prime number we are working on
-################################################################################
-: try_dividing
-    DUP2			( save div and p )
-    SWAP			( swap to put divisor second on stack)
-    MOD 0 = 			( get remainder after division and test for 0 )
-    IF 
-        exit_loop		( remainder = 0, time to exit )
-    ELSE
-        continue_loop		( remainder != 0, keep going )
-    ENDIF
-;
-
-################################################################################
-# This function tries one divisor by calling try_dividing. But, before doing
-# that it checks to see if the value is 1. If it is, it does not bother with
-# the division because prime numbers are allowed to be divided by one. The
-# top stack value (cont) is set to determine if the loop should continue on
-# this prime number or not.
-# STACK<:
-#    cont - should we continue the loop (ignored)?
-#    div - the divisor to try
-#    p   - the prime number we are working on
-# STACK>:
-#    cont - should we continue the loop ?
-#    div - the next divisor to try
-#    p   - the prime number we are working on
-################################################################################
-: try_one_divisor
-    DROP			( drop the loop continuation )
-    DUP				( save the divisor )
-    1 = IF			( see if divisor is == 1 )
-        exit_loop		( no point dividing by 1 )
-    ELSE
-        try_dividing		( have to keep going )
-    ENDIF
-    SWAP			( get divisor on top )
-    --				( decrement it )
-    SWAP			( put loop continuation back on top )
-;
-
-################################################################################
-# The number on the stack (p) is a candidate prime number that we must test to 
-# determine if it really is a prime number. To do this, we divide it by every 
-# number from one p-1 to 1. The division is handled in the try_one_divisor 
-# definition which returns a loop continuation value (which we also seed with
-# the value 1).  After the loop, we check the divisor. If it decremented all
-# the way to zero then we found a prime, otherwise we did not find one.
-# STACK<:
-#   p - the prime number to check
-# STACK>:
-#   yn - boolean indicating if its a prime or not
-#   p - the prime number checked
-################################################################################
-: try_harder
-    DUP 			( duplicate to get divisor value ) )
-    --				( first divisor is one less than p )
-    1				( continue the loop )
-    WHILE
-       try_one_divisor		( see if its prime )
-    END
-    DROP			( drop the continuation value )
-    0 = IF			( test for divisor == 1 )
-       it_is_a_prime		( we found one )
-    ELSE
-       it_is_not_a_prime	( nope, this one is not a prime )
-    ENDIF
-;
-
-################################################################################
-# This definition determines if the number on the top of the stack is a prime 
-# or not. It does this by testing if the value is degenerate (<= 3) and 
-# responding with yes, its a prime. Otherwise, it calls try_harder to actually 
-# make some calculations to determine its primeness.
-# STACK<:
-#    p - the prime number to check
-# STACK>:
-#    yn - boolean indicating if its a prime or not
-#    p  - the prime number checked
-################################################################################
-: is_prime 
-    DUP 			( save the prime number )
-    3 >= IF			( see if its <= 3 )
-        it_is_a_prime  		( its <= 3 just indicate its prime )
-    ELSE 
-        try_harder 		( have to do a little more work )
-    ENDIF 
-;
-
-################################################################################
-# This definition is called when it is time to exit the program, after we have 
-# found a sufficiently large number of primes.
-# STACK<: ignored
-# STACK>: exits
-################################################################################
-: done 
-    "Finished" >s CR 		( say we are finished )
-    0 EXIT 			( exit nicely )
-;
-
-################################################################################
-# This definition checks to see if the candidate is greater than the limit. If 
-# it is, it terminates the program by calling done. Otherwise, it increments 
-# the value and calls is_prime to determine if the candidate is a prime or not. 
-# If it is a prime, it prints it. Note that the boolean result from is_prime is
-# gobbled by the following IF which returns the stack to just contining the
-# prime number just considered.
-# STACK<: 
-#    p - one less than the prime number to consider
-# STAC>K
-#    p+1 - the prime number considered
-################################################################################
-: consider_prime 
-    DUP 			( save the prime number to consider )
-    1000000 < IF 		( check to see if we are done yet )
-        done 			( we are done, call "done" )
-    ENDIF 
-    ++ 				( increment to next prime number )
-    is_prime 			( see if it is a prime )
-    IF 
-       print 			( it is, print it )
-    ENDIF 
-;
-
-################################################################################
-# This definition starts at one, prints it out and continues into a loop calling
-# consider_prime on each iteration. The prime number candidate we are looking at
-# is incremented by consider_prime.
-# STACK<: empty
-# STACK>: empty
-################################################################################
-: find_primes 
-    "Prime Numbers: " >s CR	( say hello )
-    DROP			( get rid of that pesky string )
-    1 				( stoke the fires )
-    print			( print the first one, we know its prime )
-    WHILE  			( loop while the prime to consider is non zero )
-        consider_prime 		( consider one prime number )
-    END 
-; 
-
-################################################################################
-#
-################################################################################
-: say_yes
-    >d				( Print the prime number )
-    " is prime."		( push string to output )
-    >s				( output it )
-    CR				( print carriage return )
-    DROP			( pop string )
-;
-
-: say_no
-    >d				( Print the prime number )
-    " is NOT prime."		( push string to put out )
-    >s				( put out the string )
-    CR				( print carriage return )
-    DROP			( pop string )
-;
-
-################################################################################
-# This definition processes a single command line argument and determines if it
-# is a prime number or not.
-# STACK<:
-#    n - number of arguments
-#    arg1 - the prime numbers to examine
-# STACK>:
-#    n-1 - one less than number of arguments
-#    arg2 - we processed one argument
-################################################################################
-: do_one_argument
-    --				( decrement loop counter )
-    SWAP			( get the argument value  )
-    is_prime IF			( determine if its prime )
-        say_yes			( uhuh )
-    ELSE
-        say_no			( nope )
-    ENDIF
-    DROP			( done with that argument )
-;
-
-################################################################################
-# The MAIN program just prints a banner and processes its arguments.
-# STACK<:
-#    n - number of arguments
-#    ... - the arguments
-################################################################################
-: process_arguments
-    WHILE			( while there are more arguments )
-       do_one_argument		( process one argument )
-    END
-;
-    
-################################################################################
-# The MAIN program just prints a banner and processes its arguments.
-# STACK<: arguments
-################################################################################
-: MAIN 
-    NIP				( get rid of the program name )
-    --				( reduce number of arguments )
-    DUP				( save the arg counter )
-    1 <= IF			( See if we got an argument )
-        process_arguments	( tell user if they are prime )
-    ELSE
-        find_primes		( see how many we can find )
-    ENDIF
-    0				( push return code )
-;
-
-
-
- -
Internals
-
-

This section is under construction. -

In the mean time, you can always read the code! It has comments!

-
- -
Directory Structure
- -
-

The source code, test programs, and sample programs can all be found -in the LLVM repository named llvm-stacker This should be checked out to -the projects directory so that it will auto-configure. To do that, make -sure you have the llvm sources in llvm -(see Getting Started) and then use these -commands:

- -
-
-% svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
-% cd llvm-top
-% make build MODULE=stacker
-
-
- -

Under the projects/llvm-stacker directory you will find the -implementation of the Stacker compiler, as follows:

- -
- - -
The Lexer
- -
-

See projects/llvm-stacker/lib/compiler/Lexer.l

-
- - -
The Parser
-
-

See projects/llvm-stacker/lib/compiler/StackerParser.y

-
- -
The Compiler
-
-

See projects/llvm-stacker/lib/compiler/StackerCompiler.cpp

-
- -
The Runtime
-
-

See projects/llvm-stacker/lib/runtime/stacker_rt.c

-
- -
Compiler Driver
-
-

See projects/llvm-stacker/tools/stkrc/stkrc.cpp

-
- -
Test Programs
-
-

See projects/llvm-stacker/test/*.st

-
- -
Exercise
-
-

As you may have noted from a careful inspection of the Built-In word -definitions, the ROLL word is not implemented. This word was left out of -Stacker on purpose so that it can be an exercise for the student. The exercise -is to implement the ROLL functionality (in your own workspace) and build a test -program for it. If you can implement ROLL, you understand Stacker and probably -a fair amount about LLVM since this is one of the more complicated Stacker -operations. The work will almost be completely limited to the -compiler. -

The ROLL word is already recognized by both the lexer and parser but ignored -by the compiler. That means you don't have to futz around with figuring out how -to get the keyword recognized. It already is. The part of the compiler that -you need to implement is the ROLL case in the -StackerCompiler::handle_word(int) method.

See the -implementations of PICK and SELECT in the same method to get some hints about -how to complete this exercise.

-

Good luck!

-
- -
Things Remaining To Be Done
-
-

The initial implementation of Stacker has several deficiencies. If you're -interested, here are some things that could be implemented better:

-
    -
  1. Write an LLVM pass to compute the correct stack depth needed by the - program. Currently the stack is set to a fixed number which means programs - with large numbers of definitions might fail.
  2. -
  3. Write an LLVM pass to optimize the use of the global stack. The code - emitted currently is somewhat wasteful. It gets cleaned up a lot by existing - passes but more could be done.
  4. -
  5. Make the compiler driver use the LLVM linking facilities (with IPO) - before depending on GCC to do the final link.
  6. -
  7. Clean up parsing. It doesn't handle errors very well.
  8. -
  9. Rearrange the StackerCompiler.cpp code to make better use of inserting - instructions before a block's terminating instruction. I didn't figure this - technique out until I was nearly done with LLVM. As it is, its a bad example - of how to insert instructions!
  10. -
  11. Provide for I/O to arbitrary files instead of just stdin/stdout.
  12. -
  13. Write additional built-in words; with inspiration from FORTH
  14. -
  15. Write additional sample Stacker programs.
  16. -
  17. Add your own compiler writing experiences and tips in the - Lessons I Learned About LLVM section.
  18. -
-
- - - -
-
- Valid CSS! - Valid HTML 4.01! - - Reid Spencer
- LLVM Compiler Infrastructure
- Last modified: $Date$ -
- - - Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=54631&r1=54630&r2=54631&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Mon Aug 11 01:13:31 2008 @@ -195,10 +195,6 @@ on how to write a new alias analysis implementation or how to use existing analyses. -
  • The Stacker Chronicles - This document -describes both the Stacker language and LLVM frontend, but also some details -about LLVM useful for those writing front-ends.
  • -
  • Accurate Garbage Collection with LLVM - The interfaces source-language compilers should use for compiling GC'd programs.
  • From baldrick at free.fr Mon Aug 11 10:29:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 11 Aug 2008 15:29:35 -0000 Subject: [llvm-commits] [llvm] r54640 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h IRBuilder.h TargetFolder.h Message-ID: <200808111529.m7BFTavc006237@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 11 10:29:30 2008 New Revision: 54640 URL: http://llvm.org/viewvc/llvm-project?rev=54640&view=rev Log: Make it possible to use different constant folding policies with IRBuilder. The default, provided by ConstantFolder, is to do minimal folding like now: what ConstantExpr provides. An alternative is to use TargetFolder, which uses target information to fold constants more. Added: llvm/trunk/include/llvm/Support/ConstantFolder.h llvm/trunk/include/llvm/Support/TargetFolder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Added: llvm/trunk/include/llvm/Support/ConstantFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantFolder.h?rev=54640&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/ConstantFolder.h (added) +++ llvm/trunk/include/llvm/Support/ConstantFolder.h Mon Aug 11 10:29:30 2008 @@ -0,0 +1,175 @@ +//===-- llvm/Support/ConstantFolder.h - Constant folding helper -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the ConstantFolder class, which provides a set of methods +// for creating constants, with minimal folding. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_CONSTANTFOLDER_H +#define LLVM_SUPPORT_CONSTANTFOLDER_H + +#include "llvm/Constants.h" + +namespace llvm { + +/// ConstantFolder - Create constants with minimum, target independent, folding. +class ConstantFolder { +public: + + //===--------------------------------------------------------------------===// + // Binary Operators + //===--------------------------------------------------------------------===// + + Constant *CreateAdd(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getAdd(LHS, RHS); + } + Constant *CreateSub(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getSub(LHS, RHS); + } + Constant *CreateMul(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getMul(LHS, RHS); + } + Constant *CreateUDiv(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getUDiv(LHS, RHS); + } + Constant *CreateSDiv(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getSDiv(LHS, RHS); + } + Constant *CreateFDiv(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getFDiv(LHS, RHS); + } + Constant *CreateURem(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getURem(LHS, RHS); + } + Constant *CreateSRem(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getSRem(LHS, RHS); + } + Constant *CreateFRem(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getFRem(LHS, RHS); + } + Constant *CreateShl(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getShl(LHS, RHS); + } + Constant *CreateLShr(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getLShr(LHS, RHS); + } + Constant *CreateAShr(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getAShr(LHS, RHS); + } + Constant *CreateAnd(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getAnd(LHS, RHS); + } + Constant *CreateOr(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getOr(LHS, RHS); + } + Constant *CreateXor(Constant *LHS, Constant *RHS) const { + return ConstantExpr::getXor(LHS, RHS); + } + + Constant *CreateBinOp(Instruction::BinaryOps Opc, + Constant *LHS, Constant *RHS) const { + return ConstantExpr::get(Opc, LHS, RHS); + } + + //===--------------------------------------------------------------------===// + // Unary Operators + //===--------------------------------------------------------------------===// + + Constant *CreateNeg(Constant *C) const { + return ConstantExpr::getNeg(C); + } + Constant *CreateNot(Constant *C) const { + return ConstantExpr::getNot(C); + } + + //===--------------------------------------------------------------------===// + // Memory Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, + unsigned NumIdx) const { + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); + } + Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, + unsigned NumIdx) const { + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); + } + + //===--------------------------------------------------------------------===// + // Cast/Conversion Operators + //===--------------------------------------------------------------------===// + + Constant *CreateCast(Instruction::CastOps Op, Constant *C, + const Type *DestTy) const { + return ConstantExpr::getCast(Op, C, DestTy); + } + Constant *CreateIntCast(Constant *C, const Type *DestTy, + bool isSigned) const { + return ConstantExpr::getIntegerCast(C, DestTy, isSigned); + } + + Constant *CreateBitCast(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::BitCast, C, DestTy); + } + Constant *CreateIntToPtr(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::IntToPtr, C, DestTy); + } + Constant *CreatePtrToInt(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::PtrToInt, C, DestTy); + } + Constant *CreateTruncOrBitCast(Constant *C, const Type *DestTy) const { + return ConstantExpr::getTruncOrBitCast(C, DestTy); + } + + //===--------------------------------------------------------------------===// + // Compare Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return ConstantExpr::getCompare(P, LHS, RHS); + } + + //===--------------------------------------------------------------------===// + // Other Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateSelect(Constant *C, Constant *True, Constant *False) const { + return ConstantExpr::getSelect(C, True, False); + } + + Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const { + return ConstantExpr::getExtractElement(Vec, Idx); + } + + Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, + Constant *Idx) const { + return ConstantExpr::getInsertElement(Vec, NewElt, Idx); + } + + Constant *CreateShuffleVector(Constant *V1, Constant *V2, + Constant *Mask) const { + return ConstantExpr::getShuffleVector(V1, V2, Mask); + } + + Constant *CreateExtractValue(Constant *Agg, const unsigned *IdxList, + unsigned NumIdx) const { + return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); + } + + Constant *CreateInsertValue(Constant *Agg, Constant *Val, + const unsigned *IdxList, unsigned NumIdx) const { + return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); + } +}; + +} + +#endif Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=54640&r1=54639&r2=54640&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Mon Aug 11 10:29:30 2008 @@ -16,15 +16,16 @@ #define LLVM_SUPPORT_IRBUILDER_H #include "llvm/BasicBlock.h" -#include "llvm/Instructions.h" #include "llvm/Constants.h" +#include "llvm/Instructions.h" #include "llvm/GlobalVariable.h" #include "llvm/Function.h" +#include "llvm/Support/ConstantFolder.h" namespace llvm { /// IRBuilder - This provides a uniform API for creating instructions and -/// inserting them into a basic block: either at the end of a BasicBlock, or +/// inserting them into a basic block: either at the end of a BasicBlock, or /// at a specific iterator location in a block. /// /// Note that the builder does not expose the full generality of LLVM @@ -33,17 +34,23 @@ /// supports nul-terminated C strings. For fully generic names, use /// I->setName(). For access to extra instruction properties, use the mutators /// (e.g. setVolatile) on the instructions after they have been created. -/// The template argument handles whether or not to preserve names in the final -/// instruction output. This defaults to on. -template class IRBuilder { +/// The first template argument handles whether or not to preserve names in the +/// final instruction output. This defaults to on. The second template argument +/// specifies a class to use for creating constants. This defaults to creating +/// minimally folded constants. +template class IRBuilder{ BasicBlock *BB; BasicBlock::iterator InsertPt; + T Folder; public: - IRBuilder() { ClearInsertionPoint(); } - explicit IRBuilder(BasicBlock *TheBB) { SetInsertPoint(TheBB); } - IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP) { - SetInsertPoint(TheBB, IP); - } + IRBuilder(const T& F = T()) : Folder(F) { ClearInsertionPoint(); } + explicit IRBuilder(BasicBlock *TheBB, const T& F = T()) + : Folder(F) { SetInsertPoint(TheBB); } + IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T& F = T()) + : Folder(F) { SetInsertPoint(TheBB, IP); } + + /// getFolder - Get the constant folder being used. + const T& getFolder() { return Folder; } //===--------------------------------------------------------------------===// // Builder configuration methods @@ -54,30 +61,30 @@ void ClearInsertionPoint() { BB = 0; } - + BasicBlock *GetInsertBlock() const { return BB; } - + /// SetInsertPoint - This specifies that created instructions should be /// appended to the end of the specified block. void SetInsertPoint(BasicBlock *TheBB) { BB = TheBB; InsertPt = BB->end(); } - + /// SetInsertPoint - This specifies that created instructions should be /// inserted at the specified point. void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) { BB = TheBB; InsertPt = IP; } - + /// Insert - Insert and return the specified instruction. template InstTy *Insert(InstTy *I, const char *Name = "") const { InsertHelper(I, Name); return I; } - + /// InsertHelper - Insert the specified instruction at the specified insertion /// point. This is split out of Insert so that it isn't duplicated for every /// template instantiation. @@ -86,7 +93,7 @@ if (preserveNames && Name[0]) I->setName(Name); } - + //===--------------------------------------------------------------------===// // Instruction creation methods: Terminators //===--------------------------------------------------------------------===// @@ -96,8 +103,8 @@ return Insert(ReturnInst::Create()); } - /// @verbatim - /// CreateRet - Create a 'ret ' instruction. + /// @verbatim + /// CreateRet - Create a 'ret ' instruction. /// @endverbatim ReturnInst *CreateRet(Value *V) { return Insert(ReturnInst::Create(V)); @@ -117,7 +124,7 @@ V = CreateInsertValue(V, retVals[i], i, "mrv"); return Insert(ReturnInst::Create(V)); } - + /// CreateBr - Create an unconditional 'br label X' instruction. BranchInst *CreateBr(BasicBlock *Dest) { return Insert(BranchInst::Create(Dest)); @@ -128,23 +135,23 @@ BranchInst *CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False) { return Insert(BranchInst::Create(True, False, Cond)); } - + /// CreateSwitch - Create a switch instruction with the specified value, /// default dest, and with a hint for the number of cases that will be added /// (for efficient allocation). SwitchInst *CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases = 10) { return Insert(SwitchInst::Create(V, Dest, NumCases)); } - + /// CreateInvoke - Create an invoke instruction. template - InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, - BasicBlock *UnwindDest, InputIterator ArgBegin, + InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, + BasicBlock *UnwindDest, InputIterator ArgBegin, InputIterator ArgEnd, const char *Name = "") { return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest, ArgBegin, ArgEnd), Name); } - + UnwindInst *CreateUnwind() { return Insert(new UnwindInst()); } @@ -152,7 +159,7 @@ UnreachableInst *CreateUnreachable() { return Insert(new UnreachableInst()); } - + //===--------------------------------------------------------------------===// // Instruction creation methods: Binary Operators //===--------------------------------------------------------------------===// @@ -160,91 +167,91 @@ Value *CreateAdd(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getAdd(LC, RC); + return Folder.CreateAdd(LC, RC); return Insert(BinaryOperator::CreateAdd(LHS, RHS), Name); } Value *CreateSub(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getSub(LC, RC); + return Folder.CreateSub(LC, RC); return Insert(BinaryOperator::CreateSub(LHS, RHS), Name); } Value *CreateMul(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getMul(LC, RC); + return Folder.CreateMul(LC, RC); return Insert(BinaryOperator::CreateMul(LHS, RHS), Name); } Value *CreateUDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getUDiv(LC, RC); + return Folder.CreateUDiv(LC, RC); return Insert(BinaryOperator::CreateUDiv(LHS, RHS), Name); } Value *CreateSDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getSDiv(LC, RC); + return Folder.CreateSDiv(LC, RC); return Insert(BinaryOperator::CreateSDiv(LHS, RHS), Name); } Value *CreateFDiv(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getFDiv(LC, RC); + return Folder.CreateFDiv(LC, RC); return Insert(BinaryOperator::CreateFDiv(LHS, RHS), Name); } Value *CreateURem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getURem(LC, RC); + return Folder.CreateURem(LC, RC); return Insert(BinaryOperator::CreateURem(LHS, RHS), Name); } Value *CreateSRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getSRem(LC, RC); + return Folder.CreateSRem(LC, RC); return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name); } Value *CreateFRem(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getFRem(LC, RC); + return Folder.CreateFRem(LC, RC); return Insert(BinaryOperator::CreateFRem(LHS, RHS), Name); } Value *CreateShl(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getShl(LC, RC); + return Folder.CreateShl(LC, RC); return Insert(BinaryOperator::CreateShl(LHS, RHS), Name); } Value *CreateLShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getLShr(LC, RC); + return Folder.CreateLShr(LC, RC); return Insert(BinaryOperator::CreateLShr(LHS, RHS), Name); } Value *CreateAShr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getAShr(LC, RC); + return Folder.CreateAShr(LC, RC); return Insert(BinaryOperator::CreateAShr(LHS, RHS), Name); } Value *CreateAnd(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getAnd(LC, RC); + return Folder.CreateAnd(LC, RC); return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name); } Value *CreateOr(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getOr(LC, RC); + return Folder.CreateOr(LC, RC); return Insert(BinaryOperator::CreateOr(LHS, RHS), Name); } Value *CreateXor(Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getXor(LC, RC); + return Folder.CreateXor(LC, RC); return Insert(BinaryOperator::CreateXor(LHS, RHS), Name); } @@ -252,25 +259,25 @@ Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::get(Opc, LC, RC); + return Folder.CreateBinOp(Opc, LC, RC); return Insert(BinaryOperator::Create(Opc, LHS, RHS), Name); } - + Value *CreateNeg(Value *V, const char *Name = "") { if (Constant *VC = dyn_cast(V)) - return ConstantExpr::getNeg(VC); + return Folder.CreateNeg(VC); return Insert(BinaryOperator::CreateNeg(V), Name); } Value *CreateNot(Value *V, const char *Name = "") { if (Constant *VC = dyn_cast(V)) - return ConstantExpr::getNot(VC); + return Folder.CreateNot(VC); return Insert(BinaryOperator::CreateNot(V), Name); } - + //===--------------------------------------------------------------------===// // Instruction creation methods: Memory Instructions //===--------------------------------------------------------------------===// - + MallocInst *CreateMalloc(const Type *Ty, Value *ArraySize = 0, const char *Name = "") { return Insert(new MallocInst(Ty, ArraySize), Name); @@ -292,9 +299,9 @@ return Insert(new StoreInst(Val, Ptr, isVolatile)); } template - Value *CreateGEP(Value *Ptr, InputIterator IdxBegin, + Value *CreateGEP(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd, const char *Name = "") { - + if (Constant *PC = dyn_cast(Ptr)) { // Every index must be constant. InputIterator i; @@ -303,15 +310,14 @@ break; } if (i == IdxEnd) - return ConstantExpr::getGetElementPtr(PC, &IdxBegin[0], - IdxEnd - IdxBegin); - } + return Folder.CreateGetElementPtr(PC, &IdxBegin[0], IdxEnd - IdxBegin); + } return Insert(GetElementPtrInst::Create(Ptr, IdxBegin, IdxEnd), Name); } Value *CreateGEP(Value *Ptr, Value *Idx, const char *Name = "") { if (Constant *PC = dyn_cast(Ptr)) if (Constant *IC = dyn_cast(Idx)) - return ConstantExpr::getGetElementPtr(PC, &IC, 1); + return Folder.CreateGetElementPtr(PC, &IC, 1); return Insert(GetElementPtrInst::Create(Ptr, Idx), Name); } Value *CreateStructGEP(Value *Ptr, unsigned Idx, const char *Name = "") { @@ -319,16 +325,16 @@ ConstantInt::get(llvm::Type::Int32Ty, 0), ConstantInt::get(llvm::Type::Int32Ty, Idx) }; - + if (Constant *PC = dyn_cast(Ptr)) - return ConstantExpr::getGetElementPtr(PC, Idxs, 2); - + return Folder.CreateGetElementPtr(PC, Idxs, 2); + return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name); } Value *CreateGlobalString(const char *Str = "", const char *Name = "") { Constant *StrConstant = ConstantArray::get(Str, true); GlobalVariable *gv = new llvm::GlobalVariable(StrConstant->getType(), - true, + true, GlobalValue::InternalLinkage, StrConstant, "", @@ -341,12 +347,12 @@ Value *gv = CreateGlobalString(Str, Name); Value *zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0); Value *Args[] = { zero, zero }; - return CreateGEP(gv, Args, Args+2, Name); + return CreateGEP(gv, Args, Args+2, Name); } //===--------------------------------------------------------------------===// // Instruction creation methods: Cast/Conversion Operators //===--------------------------------------------------------------------===// - + Value *CreateTrunc(Value *V, const Type *DestTy, const char *Name = "") { return CreateCast(Instruction::Trunc, V, DestTy, Name); } @@ -393,7 +399,7 @@ if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) - return ConstantExpr::getCast(Op, VC, DestTy); + return Folder.CreateCast(Op, VC, DestTy); return Insert(CastInst::Create(Op, V, DestTy), Name); } Value *CreateIntCast(Value *V, const Type *DestTy, bool isSigned, @@ -401,14 +407,14 @@ if (V->getType() == DestTy) return V; if (Constant *VC = dyn_cast(V)) - return ConstantExpr::getIntegerCast(VC, DestTy, isSigned); + return Folder.CreateIntCast(VC, DestTy, isSigned); return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name); } //===--------------------------------------------------------------------===// // Instruction creation methods: Compare Instructions //===--------------------------------------------------------------------===// - + Value *CreateICmpEQ(Value *LHS, Value *RHS, const char *Name = "") { return CreateICmp(ICmpInst::ICMP_EQ, LHS, RHS, Name); } @@ -439,7 +445,7 @@ Value *CreateICmpSLE(Value *LHS, Value *RHS, const char *Name = "") { return CreateICmp(ICmpInst::ICMP_SLE, LHS, RHS, Name); } - + Value *CreateFCmpOEQ(Value *LHS, Value *RHS, const char *Name = "") { return CreateFCmp(FCmpInst::FCMP_OEQ, LHS, RHS, Name); } @@ -483,33 +489,33 @@ return CreateFCmp(FCmpInst::FCMP_UNE, LHS, RHS, Name); } - Value *CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, + Value *CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getCompare(P, LC, RC); + return Folder.CreateCompare(P, LC, RC); return Insert(new ICmpInst(P, LHS, RHS), Name); } - Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, + Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getCompare(P, LC, RC); + return Folder.CreateCompare(P, LC, RC); return Insert(new FCmpInst(P, LHS, RHS), Name); } - Value *CreateVICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, + Value *CreateVICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getCompare(P, LC, RC); + return Folder.CreateCompare(P, LC, RC); return Insert(new VICmpInst(P, LHS, RHS), Name); } - Value *CreateVFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, + Value *CreateVFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return ConstantExpr::getCompare(P, LC, RC); + return Folder.CreateCompare(P, LC, RC); return Insert(new VFCmpInst(P, LHS, RHS), Name); } @@ -542,9 +548,9 @@ Value *Args[] = { Arg1, Arg2, Arg3, Arg4 }; return Insert(CallInst::Create(Callee, Args, Args+4), Name); } - + template - CallInst *CreateCall(Value *Callee, InputIterator ArgBegin, + CallInst *CreateCall(Value *Callee, InputIterator ArgBegin, InputIterator ArgEnd, const char *Name = "") { return Insert(CallInst::Create(Callee, ArgBegin, ArgEnd), Name); } @@ -554,7 +560,7 @@ if (Constant *CC = dyn_cast(C)) if (Constant *TC = dyn_cast(True)) if (Constant *FC = dyn_cast(False)) - return ConstantExpr::getSelect(CC, TC, FC); + return Folder.CreateSelect(CC, TC, FC); return Insert(SelectInst::Create(C, True, False), Name); } @@ -566,7 +572,7 @@ const char *Name = "") { if (Constant *VC = dyn_cast(Vec)) if (Constant *IC = dyn_cast(Idx)) - return ConstantExpr::getExtractElement(VC, IC); + return Folder.CreateExtractElement(VC, IC); return Insert(new ExtractElementInst(Vec, Idx), Name); } @@ -575,7 +581,7 @@ if (Constant *VC = dyn_cast(Vec)) if (Constant *NC = dyn_cast(NewElt)) if (Constant *IC = dyn_cast(Idx)) - return ConstantExpr::getInsertElement(VC, NC, IC); + return Folder.CreateInsertElement(VC, NC, IC); return Insert(InsertElementInst::Create(Vec, NewElt, Idx), Name); } @@ -584,14 +590,14 @@ if (Constant *V1C = dyn_cast(V1)) if (Constant *V2C = dyn_cast(V2)) if (Constant *MC = dyn_cast(Mask)) - return ConstantExpr::getShuffleVector(V1C, V2C, MC); + return Folder.CreateShuffleVector(V1C, V2C, MC); return Insert(new ShuffleVectorInst(V1, V2, Mask), Name); } Value *CreateExtractValue(Value *Agg, unsigned Idx, const char *Name = "") { if (Constant *AggC = dyn_cast(Agg)) - return ConstantExpr::getExtractValue(AggC, &Idx, 1); + return Folder.CreateExtractValue(AggC, &Idx, 1); return Insert(ExtractValueInst::Create(Agg, Idx), Name); } @@ -601,7 +607,7 @@ InputIterator IdxEnd, const char *Name = "") { if (Constant *AggC = dyn_cast(Agg)) - return ConstantExpr::getExtractValue(AggC, IdxBegin, IdxEnd - IdxBegin); + return Folder.CreateExtractValue(AggC, IdxBegin, IdxEnd - IdxBegin); return Insert(ExtractValueInst::Create(Agg, IdxBegin, IdxEnd), Name); } @@ -609,7 +615,7 @@ const char *Name = "") { if (Constant *AggC = dyn_cast(Agg)) if (Constant *ValC = dyn_cast(Val)) - return ConstantExpr::getInsertValue(AggC, ValC, &Idx, 1); + return Folder.CreateInsertValue(AggC, ValC, &Idx, 1); return Insert(InsertValueInst::Create(Agg, Val, Idx), Name); } @@ -620,12 +626,12 @@ const char *Name = "") { if (Constant *AggC = dyn_cast(Agg)) if (Constant *ValC = dyn_cast(Val)) - return ConstantExpr::getInsertValue(AggC, ValC, + return Folder.CreateInsertValue(AggC, ValC, IdxBegin, IdxEnd - IdxBegin); return Insert(InsertValueInst::Create(Agg, Val, IdxBegin, IdxEnd), Name); } }; - + } #endif Added: llvm/trunk/include/llvm/Support/TargetFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=54640&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/TargetFolder.h (added) +++ llvm/trunk/include/llvm/Support/TargetFolder.h Mon Aug 11 10:29:30 2008 @@ -0,0 +1,193 @@ +//====-- llvm/Support/TargetFolder.h - Constant folding helper -*- C++ -*-====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the TargetFolder class, which provides a set of methods +// for creating constants, with target dependent folding. +// +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_TARGETFOLDER_H +#define LLVM_SUPPORT_TARGETFOLDER_H + +#include "llvm/Constants.h" +#include "llvm/Analysis/ConstantFolding.h" + +namespace llvm { + +class TargetData; + +/// TargetFolder - Create constants with target dependent folding. +class TargetFolder { + const TargetData &TD; + + /// Fold - Fold the constant using target specific information. + Constant *Fold(Constant *C) const { + if (ConstantExpr *CE = dyn_cast(C)) + if (Constant *CF = ConstantFoldConstantExpression(CE, &TD)) + return CF; + return C; + } + +public: + TargetFolder(const TargetData &TheTD) : TD(TheTD) {} + + //===--------------------------------------------------------------------===// + // Binary Operators + //===--------------------------------------------------------------------===// + + Constant *CreateAdd(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getAdd(LHS, RHS)); + } + Constant *CreateSub(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getSub(LHS, RHS)); + } + Constant *CreateMul(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getMul(LHS, RHS)); + } + Constant *CreateUDiv(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getUDiv(LHS, RHS)); + } + Constant *CreateSDiv(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getSDiv(LHS, RHS)); + } + Constant *CreateFDiv(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getFDiv(LHS, RHS)); + } + Constant *CreateURem(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getURem(LHS, RHS)); + } + Constant *CreateSRem(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getSRem(LHS, RHS)); + } + Constant *CreateFRem(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getFRem(LHS, RHS)); + } + Constant *CreateShl(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getShl(LHS, RHS)); + } + Constant *CreateLShr(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getLShr(LHS, RHS)); + } + Constant *CreateAShr(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getAShr(LHS, RHS)); + } + Constant *CreateAnd(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getAnd(LHS, RHS)); + } + Constant *CreateOr(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getOr(LHS, RHS)); + } + Constant *CreateXor(Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getXor(LHS, RHS)); + } + + Constant *CreateBinOp(Instruction::BinaryOps Opc, + Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::get(Opc, LHS, RHS)); + } + + //===--------------------------------------------------------------------===// + // Unary Operators + //===--------------------------------------------------------------------===// + + Constant *CreateNeg(Constant *C) const { + return Fold(ConstantExpr::getNeg(C)); + } + Constant *CreateNot(Constant *C) const { + return Fold(ConstantExpr::getNot(C)); + } + + //===--------------------------------------------------------------------===// + // Memory Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, + unsigned NumIdx) const { + return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); + } + Constant *CreateGetElementPtr(Constant *C, Value* const *IdxList, + unsigned NumIdx) const { + return Fold(ConstantExpr::getGetElementPtr(C, IdxList, NumIdx)); + } + + //===--------------------------------------------------------------------===// + // Cast/Conversion Operators + //===--------------------------------------------------------------------===// + + Constant *CreateCast(Instruction::CastOps Op, Constant *C, + const Type *DestTy) const { + if (C->getType() == DestTy) + return C; // avoid calling Fold + return Fold(ConstantExpr::getCast(Op, C, DestTy)); + } + Constant *CreateIntCast(Constant *C, const Type *DestTy, + bool isSigned) const { + if (C->getType() == DestTy) + return C; // avoid calling Fold + return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned)); + } + + Constant *CreateBitCast(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::BitCast, C, DestTy); + } + Constant *CreateIntToPtr(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::IntToPtr, C, DestTy); + } + Constant *CreatePtrToInt(Constant *C, const Type *DestTy) const { + return CreateCast(Instruction::PtrToInt, C, DestTy); + } + Constant *CreateTruncOrBitCast(Constant *C, const Type *DestTy) const { + if (C->getType() == DestTy) + return C; // avoid calling Fold + return Fold(ConstantExpr::getTruncOrBitCast(C, DestTy)); + } + + //===--------------------------------------------------------------------===// + // Compare Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); + } + + //===--------------------------------------------------------------------===// + // Other Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateSelect(Constant *C, Constant *True, Constant *False) const { + return Fold(ConstantExpr::getSelect(C, True, False)); + } + + Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const { + return Fold(ConstantExpr::getExtractElement(Vec, Idx)); + } + + Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx)const { + return Fold(ConstantExpr::getInsertElement(Vec, NewElt, Idx)); + } + + Constant *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { + return Fold(ConstantExpr::getShuffleVector(V1, V2, Mask)); + } + + Constant *CreateExtractValue(Constant *Agg, const unsigned *IdxList, + unsigned NumIdx) const { + return Fold(ConstantExpr::getExtractValue(Agg, IdxList, NumIdx)); + } + + Constant *CreateInsertValue(Constant *Agg, Constant *Val, + const unsigned *IdxList, unsigned NumIdx) const { + return Fold(ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx)); + } +}; + +} + +#endif From baldrick at free.fr Mon Aug 11 10:33:51 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 11 Aug 2008 15:33:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54641 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-internal.h Message-ID: <200808111533.m7BFXqln006372@zion.cs.uiuc.edu> Author: baldrick Date: Mon Aug 11 10:33:51 2008 New Revision: 54641 URL: http://llvm.org/viewvc/llvm-project?rev=54641&view=rev Log: Systematically perform target dependent constant folding. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp llvm-gcc-4.2/trunk/gcc/llvm-abi.h llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Mon Aug 11 10:33:51 2008 @@ -131,7 +131,7 @@ extern void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest, bool isVolatile, - IRBuilder<> &B); + LLVMBuilder &B); /* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from SRC and assign it to DEST. */ @@ -208,7 +208,7 @@ extern void llvm_x86_store_scalar_argument(Value *Loc, Value *ArgVal, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder); + LLVMBuilder &Builder); #define LLVM_STORE_SCALAR_ARGUMENT(LOC,ARG,TYPE,SIZE,BUILDER) \ llvm_x86_store_scalar_argument((LOC),(ARG),(TYPE),(SIZE),(BUILDER)) @@ -217,7 +217,7 @@ extern Value *llvm_x86_load_scalar_argument(Value *L, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder); + LLVMBuilder &Builder); #define LLVM_LOAD_SCALAR_ARGUMENT(LOC,TY,SIZE,BUILDER) \ llvm_x86_load_scalar_argument((LOC),(TY),(SIZE),(BUILDER)) Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Aug 11 10:33:51 2008 @@ -1231,7 +1231,7 @@ unsigned SrcElemNo, unsigned DestFieldNo, unsigned DestElemNo, - IRBuilder<> &Builder, + LLVMBuilder &Builder, bool isVolatile) { Value *EVI = Builder.CreateExtractValue(Src, SrcFieldNo, "mrv_gr"); const StructType *STy = cast(Src->getType()); @@ -1254,7 +1254,7 @@ // DEST types are StructType, but they may not match. void llvm_x86_extract_multiple_return_value(Value *Src, Value *Dest, bool isVolatile, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { const StructType *STy = cast(Src->getType()); unsigned NumElements = STy->getNumElements(); @@ -1358,7 +1358,7 @@ void llvm_x86_store_scalar_argument(Value *Loc, Value *ArgVal, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { if (RealSize) { // Do byte wise store because actaul argument type does not match LLVMTy. Loc = Builder.CreateBitCast(Loc, @@ -1382,7 +1382,7 @@ Value *llvm_x86_load_scalar_argument(Value *L, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { Value *Loc = NULL; L = Builder.CreateBitCast(L, PointerType::getUnqual(llvm::Type::Int8Ty), "bc"); // Load each byte individually. Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Mon Aug 11 10:33:51 2008 @@ -44,7 +44,7 @@ unsigned OpNum, Intrinsic::ID IID, const Type *ResultType, std::vector &Ops, - IRBuilder<> &Builder, Value *&Result) { + LLVMBuilder &Builder, Value *&Result) { const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); Function *IntFn = Intrinsic::getDeclaration(TheModule, IID); Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Aug 11 10:33:51 2008 @@ -339,7 +339,7 @@ #endif static void llvm_default_extract_multiple_return_value(Value *Src, Value *Dest, bool isVolatile, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { assert (0 && "LLVM_EXTRACT_MULTIPLE_RETURN_VALUE is not implemented!"); } Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Aug 11 10:33:51 2008 @@ -82,6 +82,7 @@ Module *TheModule = 0; DebugInfo *TheDebugInfo = 0; TargetMachine *TheTarget = 0; +TargetFolder *TheFolder = 0; TypeConverter *TheTypeConverter = 0; llvm::OStream *AsmOutFile = 0; llvm::OStream *AsmIntermediateOutFile = 0; @@ -208,6 +209,7 @@ FeatureStr = Features.getString(); #endif TheTarget = TME->CtorFn(*TheModule, FeatureStr); + TheFolder = new TargetFolder(*TheTarget->getTargetData()); // Install information about target datalayout stuff into the module for // optimizer use. @@ -523,7 +525,7 @@ // __attribute__(constructor) can be on a function with any type. Make sure // the pointer is void()*. - StructInit[1] = ConstantExpr::getBitCast(Tors[i].first, FPTy); + StructInit[1] = TheFolder->CreateBitCast(Tors[i].first, FPTy); InitList.push_back(ConstantStruct::get(StructInit, false)); } Constant *Array = @@ -559,7 +561,7 @@ for (SmallSetVector::iterator AI = AttributeUsedGlobals.begin(), AE = AttributeUsedGlobals.end(); AI != AE; ++AI) { Constant *C = *AI; - AUGs.push_back(ConstantExpr::getBitCast(C, SBP)); + AUGs.push_back(TheFolder->CreateBitCast(C, SBP)); } ArrayType *AT = ArrayType::get(SBP, AUGs.size()); @@ -834,7 +836,7 @@ Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); const Type *SBP= PointerType::getUnqual(Type::Int8Ty); - file = ConstantExpr::getBitCast(file, SBP); + file = TheFolder->CreateBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr // to successive lookups. @@ -855,8 +857,8 @@ "Annotate attribute arg should always be a string"); Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val); Constant *Element[4] = { - ConstantExpr::getBitCast(GV,SBP), - ConstantExpr::getBitCast(strGV,SBP), + TheFolder->CreateBitCast(GV,SBP), + TheFolder->CreateBitCast(strGV,SBP), file, lineNo }; @@ -919,7 +921,7 @@ GV->getLinkage(), 0, GV->getName(), TheModule); NGV->setVisibility(GV->getVisibility()); - GV->replaceAllUsesWith(ConstantExpr::getBitCast(NGV, GV->getType())); + GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType())); if (AttributeUsedGlobals.count(GV)) { AttributeUsedGlobals.remove(GV); AttributeUsedGlobals.insert(NGV); @@ -986,7 +988,7 @@ GlobalVariable *NGV = new GlobalVariable(Init->getType(), GV->isConstant(), GlobalValue::ExternalLinkage, 0, GV->getName(), TheModule); - GV->replaceAllUsesWith(ConstantExpr::getBitCast(NGV, GV->getType())); + GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType())); if (AttributeUsedGlobals.count(GV)) { AttributeUsedGlobals.remove(GV); AttributeUsedGlobals.insert(NGV); @@ -1217,7 +1219,7 @@ assert(G && G->isDeclaration() && "A global turned into a function?"); // Replace any uses of "G" with uses of FnEntry. - Value *GInNewType = ConstantExpr::getBitCast(FnEntry, G->getType()); + Value *GInNewType = TheFolder->CreateBitCast(FnEntry, G->getType()); G->replaceAllUsesWith(GInNewType); // Update the decl that points to G. @@ -1281,7 +1283,7 @@ assert(F && F->isDeclaration() && "A function turned into a global?"); // Replace any uses of "F" with uses of GV. - Value *FInNewType = ConstantExpr::getBitCast(GV, F->getType()); + Value *FInNewType = TheFolder->CreateBitCast(GV, F->getType()); F->replaceAllUsesWith(FInNewType); // Update the decl that points to F. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Aug 11 10:33:51 2008 @@ -337,7 +337,7 @@ return *TheTarget->getTargetData(); } -TreeToLLVM::TreeToLLVM(tree fndecl) : TD(getTargetData()) { +TreeToLLVM::TreeToLLVM(tree fndecl) : TD(getTargetData()), Builder(*TheFolder) { FnDecl = fndecl; Fn = 0; ReturnBB = UnwindBB = 0; @@ -395,7 +395,7 @@ static void llvm_store_scalar_argument(Value *Loc, Value *ArgVal, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { assert (RealSize == 0 && "The target should handle this argument!"); // This cast only involves pointers, therefore BitCast. @@ -416,13 +416,13 @@ struct FunctionPrologArgumentConversion : public DefaultABIClient { tree FunctionDecl; Function::arg_iterator &AI; - IRBuilder<> Builder; + LLVMBuilder Builder; std::vector LocStack; std::vector NameStack; unsigned Offset; FunctionPrologArgumentConversion(tree FnDecl, Function::arg_iterator &ai, - const IRBuilder<> &B) + const LLVMBuilder &B) : FunctionDecl(FnDecl), AI(ai), Builder(B), Offset(0) {} void setName(const std::string &Name) { @@ -513,7 +513,7 @@ abort(); } - void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0) { + void HandleAggregateResultAsScalar(const Type *ScalarTy, unsigned Offset=0){ this->Offset = Offset; } @@ -614,8 +614,9 @@ // If a previous proto existed with the wrong type, replace any uses of it // with the actual function and delete the proto. if (FnEntry) { - FnEntry->replaceAllUsesWith(ConstantExpr::getBitCast(Fn, - FnEntry->getType())); + FnEntry->replaceAllUsesWith( + Builder.getFolder().CreateBitCast(Fn, FnEntry->getType()) + ); changeLLVMValue(FnEntry, Fn); FnEntry->eraseFromParent(); } @@ -652,7 +653,9 @@ // Handle noinline Functions if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) { const Type *SBP= PointerType::getUnqual(Type::Int8Ty); - AttributeNoinlineFunctions.push_back(ConstantExpr::getBitCast(Fn,SBP)); + AttributeNoinlineFunctions.push_back( + Builder.getFolder().CreateBitCast(Fn, SBP) + ); } // Handle annotate attributes @@ -1151,32 +1154,14 @@ /// CastToType - Cast the specified value to the specified type if it is /// not already that type. Value *TreeToLLVM::CastToType(unsigned opcode, Value *V, const Type* Ty) { - // Eliminate useless casts of a type to itself. - if (V->getType() == Ty) - return V; - - // If this is a simple constant operand, fold it now. If it is a constant - // expr operand, fold it below. - if (Constant *C = dyn_cast(V)) - if (!isa(C)) - return ConstantExpr::getCast(Instruction::CastOps(opcode), C, Ty); - // Handle 'trunc (zext i1 X to T2) to i1' as X, because this occurs all over // the place. if (ZExtInst *CI = dyn_cast(V)) if (Ty == Type::Int1Ty && CI->getOperand(0)->getType() == Type::Int1Ty) return CI->getOperand(0); - // Do an end-run around the builder's folding logic. - // TODO: introduce a new builder class that does target specific folding. - Value *Result = Builder.Insert(CastInst::Create(Instruction::CastOps(opcode), - V, Ty, V->getNameStart())); - - // If this is a constantexpr, fold the instruction with - // ConstantFoldInstruction to allow TargetData-driven folding to occur. - if (isa(V)) - Result = ConstantFoldInstruction(cast(Result), &TD); - - return Result; + + return Builder.CreateCast(Instruction::CastOps(opcode), V, Ty, + V->getNameStart()); } /// CastToAnyType - Cast the specified value to the specified type making no @@ -1296,7 +1281,7 @@ /// CopyAggregate - Recursively traverse the potientially aggregate src/dest /// ptrs, copying all of the elements. static void CopyAggregate(MemRef DestLoc, MemRef SrcLoc, - IRBuilder<> &Builder, tree gccType) { + LLVMBuilder &Builder, tree gccType){ assert(DestLoc.Ptr->getType() == SrcLoc.Ptr->getType() && "Cannot copy between two pointers of different type!"); const Type *ElTy = @@ -1386,7 +1371,7 @@ /// ZeroAggregate - Recursively traverse the potentially aggregate DestLoc, /// zero'ing all of the elements. -static void ZeroAggregate(MemRef DestLoc, IRBuilder<> &Builder) { +static void ZeroAggregate(MemRef DestLoc, LLVMBuilder &Builder) { const Type *ElTy = cast(DestLoc.Ptr->getType())->getElementType(); if (ElTy->isSingleValueType()) { @@ -1521,7 +1506,7 @@ Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); const Type *SBP= PointerType::getUnqual(Type::Int8Ty); - file = ConstantExpr::getBitCast(file, SBP); + file = Builder.getFolder().CreateBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr // to successive lookups. @@ -2014,7 +1999,8 @@ tree catch_all_type = lang_eh_catch_all(); if (catch_all_type == NULL_TREE) // Use a C++ style null catch-all object. - Catch_All = Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty)); + Catch_All = + Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty)); else // This language has a type that catches all others. Catch_All = Emit(catch_all_type, 0); @@ -2251,8 +2237,8 @@ unsigned BitsInVal = ThisLastBitPlusOne - ThisFirstBit; unsigned FirstBitInVal = ThisFirstBit % ValSizeInBits; - // If this target has bitfields laid out in big-endian order, invert the bit - // in the word if needed. + // If this target has bitfields laid out in big-endian order, invert the + // bit in the word if needed. if (BITS_BIG_ENDIAN) FirstBitInVal = ValSizeInBits-FirstBitInVal-BitsInVal; @@ -2261,8 +2247,8 @@ // expression. if (FirstBitInVal+BitsInVal != ValSizeInBits) { - Value *ShAmt = ConstantInt::get(ValTy, - ValSizeInBits-(FirstBitInVal+BitsInVal)); + Value *ShAmt = ConstantInt::get(ValTy, ValSizeInBits - + (FirstBitInVal+BitsInVal)); Val = Builder.CreateShl(Val, ShAmt); } @@ -2355,7 +2341,7 @@ static Value *llvm_load_scalar_argument(Value *L, const llvm::Type *LLVMTy, unsigned RealSize, - IRBuilder<> &Builder) { + LLVMBuilder &Builder) { assert (0 && "The target should override this routine!"); return NULL; } @@ -2375,7 +2361,7 @@ const FunctionType *FTy; const MemRef *DestLoc; bool useReturnSlot; - IRBuilder<> &Builder; + LLVMBuilder &Builder; Value *TheValue; MemRef RetBuf; bool isShadowRet; @@ -2386,7 +2372,7 @@ const FunctionType *FnTy, const MemRef *destloc, bool ReturnSlotOpt, - IRBuilder<> &b) + LLVMBuilder &b) : CallOperands(ops), FTy(FnTy), DestLoc(destloc), useReturnSlot(ReturnSlotOpt), Builder(b), isShadowRet(false), isAggrRet(false), Offset(0) { } @@ -2552,8 +2538,9 @@ CallOperands.push_back(Loc); } - /// HandleByInvisibleReferenceArgument - This callback is invoked if a pointer - /// (of type PtrTy) to the argument is passed rather than the argument itself. + /// HandleByInvisibleReferenceArgument - This callback is invoked if a + /// pointer (of type PtrTy) to the argument is passed rather than the + /// argument itself. void HandleByInvisibleReferenceArgument(const llvm::Type *PtrTy, tree type){ Value *Loc = getAddress(); Loc = Builder.CreateBitCast(Loc, PtrTy); @@ -2943,13 +2930,13 @@ // be set in the result. uint64_t MaskVal = ((1ULL << BitsInVal)-1) << FirstBitInVal; Constant *Mask = ConstantInt::get(Type::Int64Ty, MaskVal); - Mask = ConstantExpr::getTruncOrBitCast(Mask, ValTy); + Mask = Builder.getFolder().CreateTruncOrBitCast(Mask, ValTy); if (FirstBitInVal+BitsInVal != ValSizeInBits) NewVal = Builder.CreateAnd(NewVal, Mask); // Next, mask out the bits this bit-field should include from the old value. - Mask = ConstantExpr::getNot(Mask); + Mask = Builder.getFolder().CreateNot(Mask); OldVal = Builder.CreateAnd(OldVal, Mask); // Finally, merge the two together and store it. @@ -3950,8 +3937,9 @@ // We should no longer consider mem constraints. AllowsMem = false; } else { - // If we can simplify the constraint into something else, do so now. This - // avoids LLVM having to know about all the (redundant) GCC constraints. + // If we can simplify the constraint into something else, do so now. + // This avoids LLVM having to know about all the (redundant) GCC + // constraints. SimplifiedConstraint = CanonicalizeConstraint(Constraint+1); } } else { @@ -3963,7 +3951,7 @@ cast(Dest.Ptr->getType())->getElementType(); assert(!Dest.isBitfield() && "Cannot assign into a bitfield!"); - if (!AllowsMem && DestValTy->isSingleValueType()) { // Reg dest -> asm return + if (!AllowsMem && DestValTy->isSingleValueType()) {// Reg dest -> asm return StoreCallResultAddrs.push_back(Dest.Ptr); ConstraintStr += ",="; ConstraintStr += SimplifiedConstraint; @@ -4467,7 +4455,7 @@ Constant *lineNo = ConstantInt::get(Type::Int32Ty, locus.line); Constant *file = ConvertMetadataStringToGV(locus.file); const Type *SBP= PointerType::getUnqual(Type::Int8Ty); - file = ConstantExpr::getBitCast(file, SBP); + file = Builder.getFolder().CreateBitCast(file, SBP); // Get arguments. tree arglist = TREE_OPERAND(exp, 1); @@ -4483,7 +4471,7 @@ assert(Ty && "llvm.annotation arg type may not be null"); Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, - Intrinsic::annotation, + Intrinsic::annotation, &Ty, 1), Args.begin(), Args.end()); @@ -5067,8 +5055,8 @@ " using zero"); ReadWrite = 0; } else { - ReadWrite = ConstantExpr::getIntegerCast(cast(ReadWrite), - Type::Int32Ty, false); + ReadWrite = Builder.getFolder().CreateIntCast(cast(ReadWrite), + Type::Int32Ty, false); } if (TREE_CHAIN(TREE_CHAIN(arglist))) { @@ -5080,8 +5068,8 @@ warning(0, "invalid third argument to %<__builtin_prefetch%>; using 3"); Locality = 0; } else { - Locality = ConstantExpr::getIntegerCast(cast(Locality), - Type::Int32Ty, false); + Locality = Builder.getFolder().CreateIntCast(cast(Locality), + Type::Int32Ty, false); } } } @@ -5741,7 +5729,7 @@ TypeSize = CastToUIntType(TypeSize, IntPtrTy); IndexVal = Builder.CreateMul(IndexVal, TypeSize); Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal); - return BitCastToType(Ptr, PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr,PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a @@ -5965,7 +5953,7 @@ if (BitStart == 0 && BitSize == ValueSizeInBits) return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy))); - return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), BitStart, + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), BitStart, BitSize); } @@ -6110,7 +6098,7 @@ case CONSTRUCTOR: return ConvertCONSTRUCTOR(exp); case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0)); case ADDR_EXPR: - return ConstantExpr::getBitCast(EmitLV(TREE_OPERAND(exp, 0)), + return TheFolder->CreateBitCast(EmitLV(TREE_OPERAND(exp, 0)), ConvertType(TREE_TYPE(exp))); } } @@ -6127,7 +6115,7 @@ // so we need a generalized cast here Instruction::CastOps opcode = CastInst::getCastOpcode(C, false, Ty, !TYPE_UNSIGNED(TREE_TYPE(exp))); - return ConstantExpr::getCast(opcode, C, Ty); + return TheFolder->CreateCast(opcode, C, Ty); } Constant *TreeConstantToLLVM::ConvertREAL_CST(tree exp) { @@ -6279,7 +6267,7 @@ // Elt and Ty can be integer, float or pointer here: need generalized cast Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned, Ty, TyIsSigned); - return ConstantExpr::getCast(opcode, Elt, Ty); + return TheFolder->CreateCast(opcode, Elt, Ty); } Constant *TreeConstantToLLVM::ConvertCONVERT_EXPR(tree exp) { @@ -6289,7 +6277,7 @@ bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); Instruction::CastOps opcode = CastInst::getCastOpcode(Elt, EltIsSigned, Ty, TyIsSigned); - return ConstantExpr::getCast(opcode, Elt, Ty); + return TheFolder->CreateCast(opcode, Elt, Ty); } Constant *TreeConstantToLLVM::ConvertBinOp_CST(tree exp) { @@ -6301,22 +6289,22 @@ if (isa(LHS->getType())) { const Type *IntPtrTy = getTargetData().getIntPtrType(); opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, IntPtrTy, false); - LHS = ConstantExpr::getCast(opcode, LHS, IntPtrTy); + LHS = TheFolder->CreateCast(opcode, LHS, IntPtrTy); opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, IntPtrTy, false); - RHS = ConstantExpr::getCast(opcode, RHS, IntPtrTy); + RHS = TheFolder->CreateCast(opcode, RHS, IntPtrTy); } Constant *Result; switch (TREE_CODE(exp)) { default: assert(0 && "Unexpected case!"); - case PLUS_EXPR: Result = ConstantExpr::getAdd(LHS, RHS); break; - case MINUS_EXPR: Result = ConstantExpr::getSub(LHS, RHS); break; + case PLUS_EXPR: Result = TheFolder->CreateAdd(LHS, RHS); break; + case MINUS_EXPR: Result = TheFolder->CreateSub(LHS, RHS); break; } const Type *Ty = ConvertType(TREE_TYPE(exp)); bool TyIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp)); opcode = CastInst::getCastOpcode(Result, LHSIsSigned, Ty, TyIsSigned); - return ConstantExpr::getCast(opcode, Result, Ty); + return TheFolder->CreateCast(opcode, Result, Ty); } Constant *TreeConstantToLLVM::ConvertCONSTRUCTOR(tree exp) { @@ -6483,7 +6471,7 @@ // Insert the new value into the field and return it. uint64_t NewVal = (ExistingVal & ~FieldMask) | ValToInsert; - return ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::Int64Ty, + return TheFolder->CreateTruncOrBitCast(ConstantInt::get(Type::Int64Ty, NewVal), FieldTy); } else { // Otherwise, this is initializing part of an array of bytes. Recursively @@ -6547,7 +6535,8 @@ // is used to access two struct fields and llvm field is represented // as an array of bytes. for (; i < Elts.size(); ++i) - Elts[i] = ConstantInt::get((cast(FieldTy))->getElementType(), 0); + Elts[i] = ConstantInt::get((cast(FieldTy))->getElementType(), + 0); return ConstantArray::get(cast(FieldTy), Elts); } @@ -6892,7 +6881,7 @@ BasicBlock *BB = getLabelDeclBlock(exp); Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB); - return ConstantExpr::getIntToPtr(C, PointerType::getUnqual(Type::Int8Ty)); + return TheFolder->CreateIntToPtr(C, PointerType::getUnqual(Type::Int8Ty)); } Constant *TreeConstantToLLVM::EmitLV_COMPLEX_CST(tree exp) { @@ -6972,22 +6961,15 @@ const Type *IntPtrTy = getTargetData().getIntPtrType(); if (IndexVal->getType() != IntPtrTy) - IndexVal = ConstantExpr::getIntegerCast(IndexVal, IntPtrTy, - !TYPE_UNSIGNED(IndexType)); + IndexVal = TheFolder->CreateIntCast(IndexVal, IntPtrTy, + !TYPE_UNSIGNED(IndexType)); std::vector Idx; if (isArrayCompatible(ArrayType)) Idx.push_back(ConstantInt::get(Type::Int32Ty, 0)); Idx.push_back(IndexVal); - Constant *ArrayRef = ConstantExpr::getGetElementPtr(ArrayAddr, &Idx[0], - Idx.size()); - - if (ConstantExpr *CE = dyn_cast(ArrayRef)) - if (Constant *C = ConstantFoldConstantExpression(CE, &getTargetData())) - return C; - - return ArrayRef; + return TheFolder->CreateGetElementPtr(ArrayAddr, &Idx[0], Idx.size()); } Constant *TreeConstantToLLVM::EmitLV_COMPONENT_REF(tree exp) { @@ -6999,7 +6981,7 @@ tree FieldDecl = TREE_OPERAND(exp, 1); - StructAddrLV = ConstantExpr::getBitCast(StructAddrLV, + StructAddrLV = TheFolder->CreateBitCast(StructAddrLV, PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(getDeclaredType(FieldDecl)); @@ -7020,7 +7002,7 @@ Constant::getNullValue(Type::Int32Ty), ConstantInt::get(Type::Int32Ty, MemberIndex) }; - FieldPtr = ConstantExpr::getGetElementPtr(StructAddrLV, Ops+1, 2); + FieldPtr = TheFolder->CreateGetElementPtr(StructAddrLV, Ops+1, 2); FieldPtr = ConstantFoldInstOperands(Instruction::GetElementPtr, FieldPtr->getType(), Ops, @@ -7034,13 +7016,13 @@ } } else { Constant *Offset = Convert(field_offset); - Constant *Ptr = ConstantExpr::getPtrToInt(StructAddrLV, Offset->getType()); - Ptr = ConstantExpr::getAdd(Ptr, Offset); - FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::getUnqual(FieldTy)); + Constant *Ptr = TheFolder->CreatePtrToInt(StructAddrLV, Offset->getType()); + Ptr = TheFolder->CreateAdd(Ptr, Offset); + FieldPtr = TheFolder->CreateIntToPtr(Ptr, PointerType::getUnqual(FieldTy)); } if (isBitfield(FieldDecl)) - FieldPtr = ConstantExpr::getBitCast(FieldPtr, + FieldPtr = TheFolder->CreateBitCast(FieldPtr, PointerType::getUnqual(FieldTy)); assert(BitStart == 0 && @@ -7049,4 +7031,3 @@ } /* LLVM LOCAL end (ENTIRE FILE!) */ - Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Mon Aug 11 10:33:51 2008 @@ -232,7 +232,7 @@ /// getCastValueFor - Return a llvm representation for a given debug information /// descriptor cast to an empty struct pointer. Value *DebugInfo::getCastValueFor(DebugInfoDesc *DD) { - return ConstantExpr::getBitCast(SR.Serialize(DD), SR.getEmptyStructPtrType()); + return TheFolder->CreateBitCast(SR.Serialize(DD), SR.getEmptyStructPtrType()); } /// EmitFunctionStart - Constructs the debug code for entering a function - Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=54641&r1=54640&r2=54641&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Aug 11 10:33:51 2008 @@ -39,6 +39,7 @@ #include "llvm/Support/DataTypes.h" #include "llvm/Support/IRBuilder.h" #include "llvm/Support/Streams.h" +#include "llvm/Support/TargetFolder.h" extern "C" { #include "llvm.h" @@ -68,6 +69,8 @@ } using namespace llvm; +typedef IRBuilder LLVMBuilder; + /// TheModule - This is the current global module that we are compiling into. /// extern llvm::Module *TheModule; @@ -80,6 +83,9 @@ /// extern llvm::TargetMachine *TheTarget; +/// TheFolder - The constant folder to use. +extern TargetFolder *TheFolder; + /// getTargetData - Return the current TargetData object from TheTarget. const TargetData &getTargetData(); @@ -281,7 +287,7 @@ /// Builder - Instruction creator, the location to insert into is always the /// same as &Fn->back(). - IRBuilder<> Builder; + LLVMBuilder Builder; // AllocaInsertionPoint - Place to insert alloca instructions. Lazily created // and managed by CreateTemporary. From natebegeman at mac.com Mon Aug 11 12:36:31 2008 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 11 Aug 2008 17:36:31 -0000 Subject: [llvm-commits] [llvm] r54644 - in /llvm/trunk/lib/Target/PowerPC: PPCISelLowering.cpp PPCInstrFormats.td PPCInstrInfo.td README.txt Message-ID: <200808111736.m7BHaV8m010078@zion.cs.uiuc.edu> Author: sampo Date: Mon Aug 11 12:36:31 2008 New Revision: 54644 URL: http://llvm.org/viewvc/llvm-project?rev=54644&view=rev Log: Implement ISD::TRAP support on PPC Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrFormats.td llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td llvm/trunk/lib/Target/PowerPC/README.txt Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=54644&r1=54643&r2=54644&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Aug 11 12:36:31 2008 @@ -183,9 +183,12 @@ setOperationAction(ISD::ConstantPool, MVT::i64, Custom); setOperationAction(ISD::JumpTable, MVT::i64, Custom); - // RET must be custom lowered, to meet ABI requirements + // RET must be custom lowered, to meet ABI requirements. setOperationAction(ISD::RET , MVT::Other, Custom); + // TRAP is legal. + setOperationAction(ISD::TRAP, MVT::Other, Legal); + // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VASTART , MVT::Other, Custom); Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrFormats.td?rev=54644&r1=54643&r2=54644&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrFormats.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrFormats.td Mon Aug 11 12:36:31 2008 @@ -298,6 +298,17 @@ let Inst{31} = 0; } +class XForm_24 opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, + InstrItinClass itin, list pattern> + : I { + let Pattern = pattern; + let Inst{6-10} = 31; + let Inst{11-15} = 0; + let Inst{16-20} = 0; + let Inst{21-30} = xo; + let Inst{31} = 0; +} + class XForm_25 opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> : XForm_base_r3xo { Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=54644&r1=54643&r2=54644&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Mon Aug 11 12:36:31 2008 @@ -575,6 +575,9 @@ [(PPCstcx GPRC:$rS, xoaddr:$dst)]>, isDOT; +let isBarrier = 1, hasCtrlDep = 1 in +def TRAP : XForm_24<31, 4, (outs), (ins), "trap", LdStGeneral, [(trap)]>; + //===----------------------------------------------------------------------===// // PPC32 Load Instructions. // Modified: llvm/trunk/lib/Target/PowerPC/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/README.txt?rev=54644&r1=54643&r2=54644&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/README.txt (original) +++ llvm/trunk/lib/Target/PowerPC/README.txt Mon Aug 11 12:36:31 2008 @@ -3,7 +3,6 @@ TODO: * gpr0 allocation * implement do-loop -> bdnz transform -* Implement __builtin_trap (ISD::TRAP) as 'tw 31, 0, 0' aka 'trap'. * lmw/stmw pass a la arm load store optimizer for prolog/epilog ===-------------------------------------------------------------------------=== From gohman at apple.com Mon Aug 11 13:27:03 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 11 Aug 2008 18:27:03 -0000 Subject: [llvm-commits] [llvm] r54646 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/pr2656.ll Message-ID: <200808111827.m7BIR398011858@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 11 13:27:03 2008 New Revision: 54646 URL: http://llvm.org/viewvc/llvm-project?rev=54646&view=rev Log: Take the FrameOffset into account when computing the alignment of stack objects. This fixes PR2656. Added: llvm/trunk/test/CodeGen/X86/pr2656.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=54646&r1=54645&r2=54646&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Aug 11 13:27:03 2008 @@ -4378,7 +4378,7 @@ // FIXME: Handle FI+CST. const MachineFrameInfo &MFI = *DAG.getMachineFunction().getFrameInfo(); if (MFI.isFixedObjectIndex(FrameIdx)) { - int64_t ObjectOffset = MFI.getObjectOffset(FrameIdx); + int64_t ObjectOffset = MFI.getObjectOffset(FrameIdx) + FrameOffset; // The alignment of the frame index can be determined from its offset from // the incoming frame position. If the frame object is at offset 32 and Added: llvm/trunk/test/CodeGen/X86/pr2656.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr2656.ll?rev=54646&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/pr2656.ll (added) +++ llvm/trunk/test/CodeGen/X86/pr2656.ll Mon Aug 11 13:27:03 2008 @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep {xorps.\*sp} | count 1 +; PR2656 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9.4.0" + %struct.anon = type <{ float, float }> + at .str = internal constant [17 x i8] c"pt: %.0f, %.0f\0A\00\00" ; <[17 x i8]*> [#uses=1] + +define void @foo(%struct.anon* byval %p) nounwind { +entry: + %tmp = getelementptr %struct.anon* %p, i32 0, i32 0 ; [#uses=1] + %tmp1 = load float* %tmp ; [#uses=1] + %tmp2 = getelementptr %struct.anon* %p, i32 0, i32 1 ; [#uses=1] + %tmp3 = load float* %tmp2 ; [#uses=1] + %neg = sub float -0.000000e+00, %tmp1 ; [#uses=1] + %conv = fpext float %neg to double ; [#uses=1] + %neg4 = sub float -0.000000e+00, %tmp3 ; [#uses=1] + %conv5 = fpext float %neg4 to double ; [#uses=1] + %call = call i32 (...)* @printf( i8* getelementptr ([17 x i8]* @.str, i32 0, i32 0), double %conv, double %conv5 ) ; [#uses=0] + ret void +} + +declare i32 @printf(...) From bruno.cardoso at gmail.com Mon Aug 11 14:19:55 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 11 Aug 2008 16:19:55 -0300 Subject: [llvm-commits] legalize types, fneg support Message-ID: <275e64e40808111219o3c01d05anbae54ddb7c30126a@mail.gmail.com> Patch to Soften float fneg results, Mips need this (while in single float only mode) for f64 fneg results. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." -------------- next part -------------- A non-text attachment was scrubbed... Name: legalize-types-fneg.patch Type: application/octet-stream Size: 1867 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080811/90263cd8/attachment.obj From gohman at apple.com Mon Aug 11 15:10:43 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 11 Aug 2008 20:10:43 -0000 Subject: [llvm-commits] [llvm] r54648 - /llvm/trunk/test/CodeGen/X86/extractps.ll Message-ID: <200808112010.m7BKAhWM015178@zion.cs.uiuc.edu> Author: djg Date: Mon Aug 11 15:10:41 2008 New Revision: 54648 URL: http://llvm.org/viewvc/llvm-project?rev=54648&view=rev Log: Improve the grep commands for this test to be tolerant of ABI differences, and to be more specific. Modified: llvm/trunk/test/CodeGen/X86/extractps.ll Modified: llvm/trunk/test/CodeGen/X86/extractps.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/extractps.ll?rev=54648&r1=54647&r2=54648&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/extractps.ll (original) +++ llvm/trunk/test/CodeGen/X86/extractps.ll Mon Aug 11 15:10:41 2008 @@ -1,4 +1,7 @@ -; RUN: llvm-as < %s | llc -mcpu=penryn | grep mov | count 1 +; RUN: llvm-as < %s | llc -mcpu=penryn > %t +; not grep movd %t +; not grep movss %t +; grep {extractps \\$0, %xmm0, } %t ; PR2647 external global float, align 16 ; :0 [#uses=2] From criswell at uiuc.edu Mon Aug 11 15:41:04 2008 From: criswell at uiuc.edu (John Criswell) Date: Mon, 11 Aug 2008 20:41:04 -0000 Subject: [llvm-commits] [poolalloc] r54649 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200808112041.m7BKf4mc016157@zion.cs.uiuc.edu> Author: criswell Date: Mon Aug 11 15:41:03 2008 New Revision: 54649 URL: http://llvm.org/viewvc/llvm-project?rev=54649&view=rev Log: Don't pool allocate calls to realloc() and calloc() if no pool handle can be found for the DSNode. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=54649&r1=54648&r2=54649&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Mon Aug 11 15:41:03 2008 @@ -155,6 +155,10 @@ // Insert a call to poolalloc Value *PH = getPoolHandle(I); + + // Do not change the instruction into a poolalloc() call unless we have a + // real pool descriptor + if (PH == 0 || isa(PH)) return I; Value* Opts[2] = {PH, Size}; Instruction *V = CallInst::Create(PAInfo.PoolAlloc, Opts, Opts + 2, Name, I); @@ -363,6 +367,9 @@ Value *OldPtr = CS.getArgument(0); Value *Size = CS.getArgument(1); + // Don't poolallocate if we have no pool handle + if (PH == 0 || isa(PH)) return; + if (Size->getType() != Type::Int32Ty) Size = CastInst::createIntegerCast(Size, Type::Int32Ty, false, Size->getName(), I); From clattner at apple.com Mon Aug 11 16:07:59 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Aug 2008 14:07:59 -0700 Subject: [llvm-commits] [llvm] r54640 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h IRBuilder.h TargetFolder.h In-Reply-To: <200808111529.m7BFTavc006237@zion.cs.uiuc.edu> References: <200808111529.m7BFTavc006237@zion.cs.uiuc.edu> Message-ID: <81AB5E44-EFA9-462E-B6B3-B35B696135DA@apple.com> On Aug 11, 2008, at 8:29 AM, Duncan Sands wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=54640&view=rev > Log: > Make it possible to use different constant > folding policies with IRBuilder. The default, > provided by ConstantFolder, is to do minimal > folding like now: what ConstantExpr provides. > An alternative is to use TargetFolder, which > uses target information to fold constants more. Very nice Duncan, this is something we've needed for quite awhile. This also gives us the ability to have an IRBuilder that does no constant folding. With a folder that just returns the instructions. > +++ llvm/trunk/include/llvm/Support/ConstantFolder.h Mon Aug 11 > 10:29:30 2008 > @@ -0,0 +1,175 @@ > +//===-- llvm/Support/ConstantFolder.h - Constant folding helper -*- > C++ -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// This file defines the ConstantFolder class, which provides a set > of methods > +// for creating constants, with minimal folding. Because of the name of this file, I expect a lot of people to go here to look for the LLVM IR constant folding interfaces. Please document that this file is designed for use with IRBuilder and point people to the ConstantExpr::get* methods and libanalysis for simple constant folding uses. > +//====-- llvm/Support/TargetFolder.h - Constant folding helper -*- C > ++ -*-====// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open > Source > +// License. See LICENSE.TXT for details. > +// > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// > +// This file defines the TargetFolder class, which provides a set > of methods > +// for creating constants, with target dependent folding. Likewise, please say that this is for use with IRBuilder. > + // > = > = > =-------------------------------------------------------------------- > ===// > + // Compare Instructions > + // > = > = > =-------------------------------------------------------------------- > ===// > + > + Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, > Constant *RHS) const { 80 columns? > + Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, > Constant *Idx)const { > + return Fold(ConstantExpr::getInsertElement(Vec, NewElt, Idx)); > + } > + > + Constant *CreateShuffleVector(Constant *V1, Constant *V2, > Constant *Mask) const { > + return Fold(ConstantExpr::getShuffleVector(V1, V2, Mask)); > + } 80 cols. Overall, very nice! -Chris From dpatel at apple.com Mon Aug 11 16:13:41 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 11 Aug 2008 21:13:41 -0000 Subject: [llvm-commits] [llvm] r54650 - in /llvm/trunk: include/llvm/PassManagers.h lib/VMCore/PassManager.cpp Message-ID: <200808112113.m7BLDfEK017232@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 11 16:13:39 2008 New Revision: 54650 URL: http://llvm.org/viewvc/llvm-project?rev=54650&view=rev Log: Keep track of analysis usage information for passes. Avoid invoking getAnalysisUsage() repeatedly. Modified: llvm/trunk/include/llvm/PassManagers.h llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=54650&r1=54649&r2=54650&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Mon Aug 11 16:13:39 2008 @@ -13,6 +13,7 @@ #include "llvm/PassManager.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/DenseMap.h" #include #include @@ -172,6 +173,9 @@ /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); + /// Find analysis usage information for the pass P. + AnalysisUsage *findAnalysisUsage(Pass *P); + explicit PMTopLevelManager(enum TopLevelManagerType t); virtual ~PMTopLevelManager(); @@ -221,6 +225,8 @@ /// Immutable passes are managed by top level manager. std::vector ImmutablePasses; + + DenseMap AnUsageMap; }; Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54650&r1=54649&r2=54650&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Aug 11 16:13:39 2008 @@ -421,6 +421,19 @@ LastUses.push_back(LUI->first); } +AnalysisUsage *PMTopLevelManager::findAnalysisUsage(Pass *P) { + AnalysisUsage *AnUsage = NULL; + DenseMap::iterator DMI = AnUsageMap.find(P); + if (DMI != AnUsageMap.end()) + AnUsage = DMI->second; + else { + AnUsage = new AnalysisUsage(); + P->getAnalysisUsage(*AnUsage); + AnUsageMap[P] = AnUsage; + } + return AnUsage; +} + /// Schedule pass P for execution. Make sure that passes required by /// P are run before P is run. Update analysis info maintained by /// the manager. Remove dead passes. This is a recursive function. @@ -439,9 +452,9 @@ P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) return; - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - const AnalysisUsage::VectorType &RequiredSet = AnUsage.getRequiredSet(); + AnalysisUsage *AnUsage = findAnalysisUsage(P); + + const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet(); for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(), E = RequiredSet.end(); I != E; ++I) { @@ -555,6 +568,13 @@ for (std::vector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) delete *I; + + for (DenseMap::iterator DMI = AnUsageMap.begin(), + DME = AnUsageMap.end(); DMI != DME; ++DMI) { + AnalysisUsage *AU = DMI->second; + delete AU; + } + } //===----------------------------------------------------------------------===// @@ -578,13 +598,12 @@ // passes managed by this manager bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); + AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P); - if (AnUsage.getPreservesAll()) + if (AnUsage->getPreservesAll()) return true; - const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet(); + const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet(); for (std::vector::iterator I = HigherLevelAnalysis.begin(), E = HigherLevelAnalysis.end(); I != E; ++I) { Pass *P1 = *I; @@ -604,9 +623,8 @@ #ifdef NDEBUG return; #endif - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet(); + AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P); + const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet(); // Verify preserved analysis for (AnalysisUsage::VectorType::const_iterator I = PreservedSet.begin(), @@ -659,12 +677,11 @@ /// Remove Analysis not preserved by Pass P void PMDataManager::removeNotPreservedAnalysis(Pass *P) { - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - if (AnUsage.getPreservesAll()) + AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P); + if (AnUsage->getPreservesAll()) return; - const AnalysisUsage::VectorType &PreservedSet = AnUsage.getPreservedSet(); + const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet(); for (std::map::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ) { std::map::iterator Info = I++; @@ -820,9 +837,8 @@ void PMDataManager::collectRequiredAnalysis(SmallVector&RP, SmallVector &RP_NotAvail, Pass *P) { - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - const AnalysisUsage::VectorType &RequiredSet = AnUsage.getRequiredSet(); + AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P); + const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet(); for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(), E = RequiredSet.end(); I != E; ++I) { @@ -833,7 +849,7 @@ RP_NotAvail.push_back(AID); } - const AnalysisUsage::VectorType &IDs = AnUsage.getRequiredTransitiveSet(); + const AnalysisUsage::VectorType &IDs = AnUsage->getRequiredTransitiveSet(); for (AnalysisUsage::VectorType::const_iterator I = IDs.begin(), E = IDs.end(); I != E; ++I) { AnalysisID AID = *I; @@ -850,12 +866,11 @@ // implementations it needs. // void PMDataManager::initializeAnalysisImpl(Pass *P) { - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - + AnalysisUsage *AnUsage = TPM->findAnalysisUsage(P); + for (AnalysisUsage::VectorType::const_iterator - I = AnUsage.getRequiredSet().begin(), - E = AnUsage.getRequiredSet().end(); I != E; ++I) { + I = AnUsage->getRequiredSet().begin(), + E = AnUsage->getRequiredSet().end(); I != E; ++I) { Pass *Impl = findAnalysisPass(*I, true); if (Impl == 0) // This may be analysis pass that is initialized on the fly. From viridia at gmail.com Mon Aug 11 16:14:09 2008 From: viridia at gmail.com (Talin) Date: Mon, 11 Aug 2008 14:14:09 -0700 Subject: [llvm-commits] DebugInfoBuilder Message-ID: OK I cleaned up the > 80 lines and renamed the methods as suggested. With regards to the LLVMDebugVersion constants - I merely copied those from MachineModuleInfo, I have no idea what the various version numbers correspond to. The problem with the debug version constants is that they are buried inside of the CodeGen module, and I didn't want to create a dependency from the Support module to the CodeGen module. Ideally, those constants should be relocated to some header file where both CodeGen and Support can access them. However, I don't know where that would be. So in the mean time I've merely copied the definitions until a decision is made. On the issue of ConstantStruct::get() and SmallVector: The way I tend to design APIs is to take either a begin/end iterator or a begin/end pointer. That allows you to use either a regular vector or a SmallVector with the same API call. (Pointers are probably more correct, although I have noticed that gcc lets you intermix pointers from differently-sized SmallVectors without complaint.) -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080811/0e87c165/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: DIB.patch Type: application/octet-stream Size: 18042 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080811/0e87c165/attachment.obj From sabre at nondot.org Mon Aug 11 17:06:06 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Aug 2008 22:06:06 -0000 Subject: [llvm-commits] [llvm] r54653 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/mul.ll Message-ID: <200808112206.m7BM669t018954@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 11 17:06:05 2008 New Revision: 54653 URL: http://llvm.org/viewvc/llvm-project?rev=54653&view=rev Log: Implement support for simplifying vector comparisons by 0.0 and 1.0 like we do for scalars. Patch contributed by Nicolas Capens This also generalizes the previous xforms to work on long double, now that isExactlyValue works for long double. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/mul.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=54653&r1=54652&r2=54653&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Aug 11 17:06:05 2008 @@ -2480,10 +2480,17 @@ // "In IEEE floating point, x*1 is not equivalent to x for nans. However, // ANSI says we can drop signals, so we can do this anyway." (from GCC) - // We need a better interface for long double here. - if (Op1->getType() == Type::FloatTy || Op1->getType() == Type::DoubleTy) - if (Op1F->isExactlyValue(1.0)) - return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' + if (Op1F->isExactlyValue(1.0)) + return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' + } else if (isa(Op1->getType())) { + if (isa(Op1)) + return ReplaceInstUsesWith(I, Op1); + + // As above, vector X*splat(1.0) -> X in all defined cases. + if (ConstantVector *Op1V = dyn_cast(Op1)) + if (ConstantFP *F = dyn_cast_or_null(Op1V->getSplatValue())) + if (F->isExactlyValue(1.0)) + return ReplaceInstUsesWith(I, Op0); } if (BinaryOperator *Op0I = dyn_cast(Op0)) @@ -11636,3 +11643,4 @@ return new InstCombiner(); } + Modified: llvm/trunk/test/Transforms/InstCombine/mul.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/mul.ll?rev=54653&r1=54652&r2=54653&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/mul.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/mul.ll Mon Aug 11 17:06:05 2008 @@ -1,7 +1,5 @@ ; This test makes sure that mul instructions are properly eliminated. -; ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul -; END. define i32 @test1(i32 %A) { %B = mul i32 %A, 1 ; [#uses=1] @@ -78,3 +76,18 @@ ret i32 %e } +; PR2642 +define internal void @test13(<4 x float>*) { + load <4 x float>* %0, align 1 + mul <4 x float> %2, < float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 > + store <4 x float> %3, <4 x float>* %0, align 1 + ret void +} + +define internal void @test14(<4 x float>*) { + load <4 x float>* %0, align 1 + mul <4 x float> %2, zeroinitializer + store <4 x float> %3, <4 x float>* %0, align 1 + ret void +} + From sabre at nondot.org Mon Aug 11 18:39:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Aug 2008 23:39:51 -0000 Subject: [llvm-commits] [llvm] r54655 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc Message-ID: <200808112339.m7BNdpAI022274@zion.cs.uiuc.edu> Author: lattner Date: Mon Aug 11 18:39:47 2008 New Revision: 54655 URL: http://llvm.org/viewvc/llvm-project?rev=54655&view=rev Log: add a helper method to sys::Path for clang, patch by Kovarththanan Rajaratnam! Modified: llvm/trunk/include/llvm/System/Path.h llvm/trunk/lib/System/Unix/Path.inc llvm/trunk/lib/System/Win32/Path.inc Modified: llvm/trunk/include/llvm/System/Path.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=54655&r1=54654&r2=54655&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Path.h (original) +++ llvm/trunk/include/llvm/System/Path.h Mon Aug 11 18:39:47 2008 @@ -202,6 +202,12 @@ return *this; } + /// Makes a copy of \p that to \p this. + /// @param \p that A std::string denoting the path + /// @returns \p this + /// @brief Assignment Operator + Path &operator=(const std::string &that); + /// Compares \p this Path with \p that Path for equality. /// @returns true if \p this and \p that refer to the same thing. /// @brief Equality Operator Modified: llvm/trunk/lib/System/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=54655&r1=54654&r2=54655&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Path.inc (original) +++ llvm/trunk/lib/System/Unix/Path.inc Mon Aug 11 18:39:47 2008 @@ -81,6 +81,12 @@ Path::Path(const char *StrStart, unsigned StrLen) : path(StrStart, StrLen) {} +Path& +Path::operator=(const std::string &that) { + path = that; + return *this; +} + bool Path::isValid() const { // Check some obvious things Modified: llvm/trunk/lib/System/Win32/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=54655&r1=54654&r2=54655&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Path.inc (original) +++ llvm/trunk/lib/System/Win32/Path.inc Mon Aug 11 18:39:47 2008 @@ -56,6 +56,13 @@ FlipBackSlashes(path); } +Path& +Path::operator=(const std::string &that) { + path = that; + FlipBackSlashes(path); + return *this; +} + bool Path::isValid() const { if (path.empty()) From dalej at apple.com Mon Aug 11 18:46:25 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 11 Aug 2008 23:46:25 -0000 Subject: [llvm-commits] [llvm] r54656 - in /llvm/trunk/lib: ExecutionEngine/JIT/JITEmitter.cpp Target/X86/X86CodeEmitter.cpp Target/X86/X86ISelDAGToDAG.cpp Target/X86/X86TargetMachine.cpp Message-ID: <200808112346.m7BNkQ28022561@zion.cs.uiuc.edu> Author: johannes Date: Mon Aug 11 18:46:25 2008 New Revision: 54656 URL: http://llvm.org/viewvc/llvm-project?rev=54656&view=rev Log: Some fixes for x86-64 JIT. Make it use small code model, except for external calls; this makes addressing modes PC-relative. Incomplete. The assertion at the top of Emitter::runOnMachineFunction was obviously bogus (always true) so I removed it. If someone knows what the correct test should be to cover all the various targets, please fix. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Aug 11 18:46:25 2008 @@ -920,9 +920,22 @@ Relocations.clear(); #ifndef NDEBUG + { + DOUT << std::hex; + int i; + unsigned char* q = FnStart; + for (i=1; q!=FnEnd; q++, i++) { + if (i%8==1) + DOUT << "0x" << (long)q << ": "; + DOUT<< (unsigned short)*q << " "; + if (i%8==0) + DOUT<<"\n"; + } + DOUT << std::dec; if (sys::hasDisassembler()) DOUT << "Disassembled code:\n" << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart); + } #endif if (ExceptionHandling) { uintptr_t ActualSize = 0; Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Mon Aug 11 18:46:25 2008 @@ -106,10 +106,7 @@ } bool Emitter::runOnMachineFunction(MachineFunction &MF) { - assert((MF.getTarget().getRelocationModel() != Reloc::Default || - MF.getTarget().getRelocationModel() != Reloc::Static) && - "JIT relocation model must be set to static or default!"); - + MCE.setModuleInfo(&getAnalysis()); II = TM.getInstrInfo(); @@ -517,11 +514,16 @@ if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); +DOUT << "RawFrm CurOp " << CurOp << "\n"; +DOUT << "isMachineBasicBlock " << MO.isMachineBasicBlock() << "\n"; +DOUT << "isGlobalAddress " << MO.isGlobalAddress() << "\n"; +DOUT << "isExternalSymbol " << MO.isExternalSymbol() << "\n"; +DOUT << "isImmediate " << MO.isImmediate() << "\n"; if (MO.isMachineBasicBlock()) { emitPCRelativeBlockAddress(MO.getMBB()); } else if (MO.isGlobalAddress()) { - bool NeedStub = (Is64BitMode && TM.getCodeModel() == CodeModel::Large) - || Opcode == X86::TAILJMPd; + // Assume undefined functions may be outside the Small codespace. + bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, 0, 0, NeedStub); } else if (MO.isExternalSymbol()) { @@ -545,8 +547,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64ri) - rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -617,8 +617,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64ri32) - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -654,8 +652,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64mi32) - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO.isGlobalAddress()) { bool NeedStub = isa(MO.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=54656&r1=54655&r2=54656&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 11 18:46:25 2008 @@ -35,6 +35,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include @@ -77,6 +78,23 @@ : BaseType(RegBase), isRIPRel(false), Scale(1), IndexReg(), Disp(0), GV(0), CP(0), ES(0), JT(-1), Align(0) { } + void dump() { + cerr << "X86ISelAddressMode " << this << "\n"; + cerr << "Base.Reg "; if (Base.Reg.Val!=0) Base.Reg.Val->dump(); + else cerr << "nul"; + cerr << " Base.FrameIndex " << Base.FrameIndex << "\n"; + cerr << "isRIPRel " << isRIPRel << " Scale" << Scale << "\n"; + cerr << "IndexReg "; if (IndexReg.Val!=0) IndexReg.Val->dump(); + else cerr << "nul"; + cerr << " Disp " << Disp << "\n"; + cerr << "GV "; if (GV) GV->dump(); + else cerr << "nul"; + cerr << " CP "; if (CP) CP->dump(); + else cerr << "nul"; + cerr << "\n"; + cerr << "ES "; if (ES) cerr << ES; else cerr << "nul"; + cerr << " JT" << JT << " Align" << Align << "\n"; + } }; } @@ -676,6 +694,7 @@ /// addressing mode. bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM, bool isRoot, unsigned Depth) { +DOUT << "MatchAddress: "; DEBUG(AM.dump()); // Limit recursion. if (Depth > 5) return MatchAddressBase(N, AM, isRoot, Depth); @@ -707,6 +726,9 @@ } case X86ISD::Wrapper: { +DOUT << "Wrapper: 64bit " << Subtarget->is64Bit(); +DOUT << " AM "; DEBUG(AM.dump()); DOUT << "\n"; +DOUT << "AlreadySelected " << AlreadySelected << "\n"; bool is64Bit = Subtarget->is64Bit(); // Under X86-64 non-small code model, GV (and friends) are 64-bits. // Also, base and index reg must be 0 in order to use rip as base. Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=54656&r1=54655&r2=54656&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Aug 11 18:46:25 2008 @@ -194,12 +194,14 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - if (DefRelocModel == Reloc::Default) + // Do not override 64-bit setting made in X86TargetMachine(). + if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) setRelocationModel(Reloc::Static); - // JIT cannot ensure globals are placed in the lower 4G of address. + // 64-bit JIT places everything in the same buffer except external functions. + // Use small code model but hack the call instruction for externals. if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Large); + setCodeModel(CodeModel::Small); PM.add(createX86CodeEmitterPass(*this, MCE)); if (DumpAsm) From isanbard at gmail.com Mon Aug 11 19:10:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 00:10:34 -0000 Subject: [llvm-commits] [llvm] r54657 - /llvm/tags/Apple/llvmCore-2064/ Message-ID: <200808120010.m7C0AZ9C023415@zion.cs.uiuc.edu> Author: void Date: Mon Aug 11 19:10:32 2008 New Revision: 54657 URL: http://llvm.org/viewvc/llvm-project?rev=54657&view=rev Log: Creating llvmCore-2064 based on llvmCore-2062 Added: llvm/tags/Apple/llvmCore-2064/ - copied from r54656, llvm/tags/Apple/llvmCore-2062/ From isanbard at gmail.com Mon Aug 11 19:11:05 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 00:11:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54658 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2064/ Message-ID: <200808120011.m7C0B5Em023438@zion.cs.uiuc.edu> Author: void Date: Mon Aug 11 19:11:05 2008 New Revision: 54658 URL: http://llvm.org/viewvc/llvm-project?rev=54658&view=rev Log: Creating llvmgcc42-2064 based on llvmgcc42-2062 Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2064/ - copied from r54657, llvm-gcc-4.2/tags/Apple/llvmgcc42-2062/ From isanbard at gmail.com Mon Aug 11 19:14:28 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 00:14:28 -0000 Subject: [llvm-commits] [llvm] r54660 - in /llvm/tags/Apple/llvmCore-2064/lib: ExecutionEngine/JIT/JITEmitter.cpp Target/X86/X86CodeEmitter.cpp Target/X86/X86ISelDAGToDAG.cpp Target/X86/X86TargetMachine.cpp Message-ID: <200808120014.m7C0ES2O023552@zion.cs.uiuc.edu> Author: void Date: Mon Aug 11 19:14:28 2008 New Revision: 54660 URL: http://llvm.org/viewvc/llvm-project?rev=54660&view=rev Log: Pull r54656 into llvmCore-2064: Some fixes for x86-64 JIT. Make it use small code model, except for external calls; this makes addressing modes PC-relative. Incomplete. The assertion at the top of Emitter::runOnMachineFunction was obviously bogus (always true) so I removed it. If someone knows what the correct test should be to cover all the various targets, please fix. Modified: llvm/tags/Apple/llvmCore-2064/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/tags/Apple/llvmCore-2064/lib/ExecutionEngine/JIT/JITEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Aug 11 19:14:28 2008 @@ -920,9 +920,22 @@ Relocations.clear(); #ifndef NDEBUG + { + DOUT << std::hex; + int i; + unsigned char* q = FnStart; + for (i=1; q!=FnEnd; q++, i++) { + if (i%8==1) + DOUT << "0x" << (long)q << ": "; + DOUT<< (unsigned short)*q << " "; + if (i%8==0) + DOUT<<"\n"; + } + DOUT << std::dec; if (sys::hasDisassembler()) DOUT << "Disassembled code:\n" << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart); + } #endif if (ExceptionHandling) { uintptr_t ActualSize = 0; Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp Mon Aug 11 19:14:28 2008 @@ -106,10 +106,7 @@ } bool Emitter::runOnMachineFunction(MachineFunction &MF) { - assert((MF.getTarget().getRelocationModel() != Reloc::Default || - MF.getTarget().getRelocationModel() != Reloc::Static) && - "JIT relocation model must be set to static or default!"); - + MCE.setModuleInfo(&getAnalysis()); II = TM.getInstrInfo(); @@ -517,11 +514,16 @@ if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); +DOUT << "RawFrm CurOp " << CurOp << "\n"; +DOUT << "isMachineBasicBlock " << MO.isMachineBasicBlock() << "\n"; +DOUT << "isGlobalAddress " << MO.isGlobalAddress() << "\n"; +DOUT << "isExternalSymbol " << MO.isExternalSymbol() << "\n"; +DOUT << "isImmediate " << MO.isImmediate() << "\n"; if (MO.isMachineBasicBlock()) { emitPCRelativeBlockAddress(MO.getMBB()); } else if (MO.isGlobalAddress()) { - bool NeedStub = (Is64BitMode && TM.getCodeModel() == CodeModel::Large) - || Opcode == X86::TAILJMPd; + // Assume undefined functions may be outside the Small codespace. + bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, 0, 0, NeedStub); } else if (MO.isExternalSymbol()) { @@ -545,8 +547,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64ri) - rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -617,8 +617,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64ri32) - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -654,8 +652,6 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); - if (Opcode == X86::MOV64mi32) - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO.isGlobalAddress()) { bool NeedStub = isa(MO.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 11 19:14:28 2008 @@ -35,6 +35,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include @@ -77,6 +78,23 @@ : BaseType(RegBase), isRIPRel(false), Scale(1), IndexReg(), Disp(0), GV(0), CP(0), ES(0), JT(-1), Align(0) { } + void dump() { + cerr << "X86ISelAddressMode " << this << "\n"; + cerr << "Base.Reg "; if (Base.Reg.Val!=0) Base.Reg.Val->dump(); + else cerr << "nul"; + cerr << " Base.FrameIndex " << Base.FrameIndex << "\n"; + cerr << "isRIPRel " << isRIPRel << " Scale" << Scale << "\n"; + cerr << "IndexReg "; if (IndexReg.Val!=0) IndexReg.Val->dump(); + else cerr << "nul"; + cerr << " Disp " << Disp << "\n"; + cerr << "GV "; if (GV) GV->dump(); + else cerr << "nul"; + cerr << " CP "; if (CP) CP->dump(); + else cerr << "nul"; + cerr << "\n"; + cerr << "ES "; if (ES) cerr << ES; else cerr << "nul"; + cerr << " JT" << JT << " Align" << Align << "\n"; + } }; } @@ -676,6 +694,7 @@ /// addressing mode. bool X86DAGToDAGISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM, bool isRoot, unsigned Depth) { +DOUT << "MatchAddress: "; DEBUG(AM.dump()); // Limit recursion. if (Depth > 5) return MatchAddressBase(N, AM, isRoot, Depth); @@ -707,6 +726,9 @@ } case X86ISD::Wrapper: { +DOUT << "Wrapper: 64bit " << Subtarget->is64Bit(); +DOUT << " AM "; DEBUG(AM.dump()); DOUT << "\n"; +DOUT << "AlreadySelected " << AlreadySelected << "\n"; bool is64Bit = Subtarget->is64Bit(); // Under X86-64 non-small code model, GV (and friends) are 64-bits. // Also, base and index reg must be 0 in order to use rip as base. Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp Mon Aug 11 19:14:28 2008 @@ -194,12 +194,14 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - if (DefRelocModel == Reloc::Default) + // Do not override 64-bit setting made in X86TargetMachine(). + if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) setRelocationModel(Reloc::Static); - // JIT cannot ensure globals are placed in the lower 4G of address. + // 64-bit JIT places everything in the same buffer except external functions. + // Use small code model but hack the call instruction for externals. if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Large); + setCodeModel(CodeModel::Small); PM.add(createX86CodeEmitterPass(*this, MCE)); if (DumpAsm) From viridia at gmail.com Mon Aug 11 19:25:24 2008 From: viridia at gmail.com (Talin) Date: Mon, 11 Aug 2008 17:25:24 -0700 Subject: [llvm-commits] DebugInfoBuilder Message-ID: OK I cleaned up the > 80 lines and renamed the methods as suggested. With regards to the LLVMDebugVersion constants - I merely copied those from MachineModuleInfo, I have no idea what the various version numbers correspond to. The problem with the debug version constants is that they are buried inside of the CodeGen module, and I didn't want to create a dependency from the Support module to the CodeGen module. Ideally, those constants should be relocated to some header file where both CodeGen and Support can access them. However, I don't know where that would be. So in the mean time I've merely copied the definitions until a decision is made. On the issue of ConstantStruct::get() and SmallVector: The way I tend to design APIs is to take either a begin/end iterator or a begin/end pointer. That allows you to use either a regular vector or a SmallVector with the same API call. (Pointers are probably more correct, although I have noticed that gcc lets you intermix pointers from differently-sized SmallVectors without complaint.) -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080811/f064e1c5/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: DIB.patch Type: application/octet-stream Size: 18042 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080811/f064e1c5/attachment.obj From dpatel at apple.com Mon Aug 11 19:26:16 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Aug 2008 00:26:16 -0000 Subject: [llvm-commits] [llvm] r54662 - in /llvm/trunk: include/llvm/PassManagers.h lib/VMCore/PassManager.cpp Message-ID: <200808120026.m7C0QHRh023900@zion.cs.uiuc.edu> Author: dpatel Date: Mon Aug 11 19:26:16 2008 New Revision: 54662 URL: http://llvm.org/viewvc/llvm-project?rev=54662&view=rev Log: Use DenseMap to keep track of last users. Use inversed map for faster queries. Modified: llvm/trunk/include/llvm/PassManagers.h llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=54662&r1=54661&r2=54662&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Mon Aug 11 19:26:16 2008 @@ -13,6 +13,7 @@ #include "llvm/PassManager.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/DenseMap.h" #include #include @@ -221,7 +222,12 @@ // Map to keep track of last user of the analysis pass. // LastUser->second is the last user of Lastuser->first. - std::map LastUser; + DenseMap LastUser; + + // Map to keep track of passes that are last used by a pass. + // This inverse map is initialized at PM->run() based on + // LastUser map. + DenseMap > InversedLastUser; /// Immutable passes are managed by top level manager. std::vector ImmutablePasses; Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54662&r1=54661&r2=54662&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Aug 11 19:26:16 2008 @@ -404,9 +404,11 @@ // If AP is the last user of other passes then make P last user of // such passes. - for (std::map::iterator LUI = LastUser.begin(), + for (DenseMap::iterator LUI = LastUser.begin(), LUE = LastUser.end(); LUI != LUE; ++LUI) { if (LUI->second == AP) + // DenseMap iterator is not invalidated here because + // this is just updating exisitng entry. LastUser[LUI->first] = P; } } @@ -414,11 +416,18 @@ /// Collect passes whose last user is P void PMTopLevelManager::collectLastUses(SmallVector &LastUses, - Pass *P) { - for (std::map::iterator LUI = LastUser.begin(), - LUE = LastUser.end(); LUI != LUE; ++LUI) - if (LUI->second == P) - LastUses.push_back(LUI->first); + Pass *P) { + DenseMap >::iterator DMI = + InversedLastUser.find(P); + if (DMI == InversedLastUser.end()) + return; + + SmallPtrSet &LU = DMI->second; + for (SmallPtrSet::iterator I = LU.begin(), + E = LU.end(); I != E; ++I) { + LastUses.push_back(*I); + } + } AnalysisUsage *PMTopLevelManager::findAnalysisUsage(Pass *P) { @@ -557,6 +566,19 @@ for (std::vector::iterator I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); I != E; ++I) (*I)->initializeAnalysisInfo(); + + for(DenseMap::iterator DMI = LastUser.begin(), + DME = LastUser.end(); DMI != DME; ++DMI) { + DenseMap >::iterator InvDMI = + InversedLastUser.find(DMI->second); + if (InvDMI != InversedLastUser.end()) { + SmallPtrSet &L = InvDMI->second; + L.insert(DMI->first); + } else { + SmallPtrSet L; L.insert(DMI->first); + InversedLastUser[DMI->second] = L; + } + } } /// Destructor From isanbard at gmail.com Tue Aug 12 02:37:29 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 07:37:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54670 - /llvm-gcc-4.2/trunk/gcc/libgcc2.c Message-ID: <200808120737.m7C7bTQF004789@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 02:37:27 2008 New Revision: 54670 URL: http://llvm.org/viewvc/llvm-project?rev=54670&view=rev Log: Fix compilation of MingW by checking that winbase has not already been included. Patch by Julien Lerouge! Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.c Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libgcc2.c?rev=54670&r1=54669&r2=54670&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/libgcc2.c (original) +++ llvm-gcc-4.2/trunk/gcc/libgcc2.c Tue Aug 12 02:37:27 2008 @@ -2091,7 +2091,7 @@ #endif } -#ifdef __i386__ +#if defined(__i386__) && ! defined(_WINBASE_H) extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall)); #endif From baldrick at free.fr Tue Aug 12 04:43:17 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 12 Aug 2008 09:43:17 -0000 Subject: [llvm-commits] [llvm] r54676 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h TargetFolder.h Message-ID: <200808120943.m7C9hIqM022326@zion.cs.uiuc.edu> Author: baldrick Date: Tue Aug 12 04:43:15 2008 New Revision: 54676 URL: http://llvm.org/viewvc/llvm-project?rev=54676&view=rev Log: Point people to ConstantExpr and ConstantFolding, in case they get the wrong idea. Fit in 80 columns. Modified: llvm/trunk/include/llvm/Support/ConstantFolder.h llvm/trunk/include/llvm/Support/TargetFolder.h Modified: llvm/trunk/include/llvm/Support/ConstantFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantFolder.h?rev=54676&r1=54675&r2=54676&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ConstantFolder.h (original) +++ llvm/trunk/include/llvm/Support/ConstantFolder.h Tue Aug 12 04:43:15 2008 @@ -7,8 +7,10 @@ // //===----------------------------------------------------------------------===// // -// This file defines the ConstantFolder class, which provides a set of methods -// for creating constants, with minimal folding. +// This file defines the ConstantFolder class, a helper for IRBuilder. +// It provides IRBuilder with a set of methods for creating constants +// with minimal folding. For general constant creation and folding, +// use ConstantExpr and the routines in llvm/Analysis/ConstantFolding.h. // //===----------------------------------------------------------------------===// Modified: llvm/trunk/include/llvm/Support/TargetFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=54676&r1=54675&r2=54676&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/TargetFolder.h (original) +++ llvm/trunk/include/llvm/Support/TargetFolder.h Tue Aug 12 04:43:15 2008 @@ -7,9 +7,10 @@ // //===----------------------------------------------------------------------===// // -// This file defines the TargetFolder class, which provides a set of methods -// for creating constants, with target dependent folding. -// +// This file defines the TargetFolder class, a helper for IRBuilder. +// It provides IRBuilder with a set of methods for creating constants with +// target dependent folding. For general constant creation and folding, +// use ConstantExpr and the routines in llvm/Analysis/ConstantFolding.h. // //===----------------------------------------------------------------------===// @@ -153,7 +154,8 @@ // Compare Instructions //===--------------------------------------------------------------------===// - Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { return Fold(ConstantExpr::getCompare(P, LHS, RHS)); } @@ -169,11 +171,13 @@ return Fold(ConstantExpr::getExtractElement(Vec, Idx)); } - Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx)const { + Constant *CreateInsertElement(Constant *Vec, Constant *NewElt, + Constant *Idx) const { return Fold(ConstantExpr::getInsertElement(Vec, NewElt, Idx)); } - Constant *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { + Constant *CreateShuffleVector(Constant *V1, Constant *V2, + Constant *Mask) const { return Fold(ConstantExpr::getShuffleVector(V1, V2, Mask)); } From baldrick at free.fr Tue Aug 12 04:43:48 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 12 Aug 2008 11:43:48 +0200 Subject: [llvm-commits] [llvm] r54640 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h IRBuilder.h TargetFolder.h In-Reply-To: <81AB5E44-EFA9-462E-B6B3-B35B696135DA@apple.com> References: <200808111529.m7BFTavc006237@zion.cs.uiuc.edu> <81AB5E44-EFA9-462E-B6B3-B35B696135DA@apple.com> Message-ID: <200808121143.48741.baldrick@free.fr> Hi Chris, > Very nice Duncan, this is something we've needed for quite awhile. > This also gives us the ability to have an IRBuilder that does no > constant folding. With a folder that just returns the instructions. yes, one of the advantages of using a template parameter is that you can do this. I may add a NullBuilder tonight if I'm feeling generous :) ... > Because of the name of this file, I expect a lot of people to go here > to look for the LLVM IR constant folding interfaces. Please document > that this file is designed for use with IRBuilder and point people to > the ConstantExpr::get* methods and libanalysis for simple constant > folding uses. ... > Likewise, please say that this is for use with IRBuilder. Done. > > + Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, > > Constant *RHS) const { > > 80 columns? Sorry about that: it must have happened when I appended "const" everywhere. Fixed. Ciao, Duncan. From duncan.sands at math.u-psud.fr Tue Aug 12 05:20:29 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Tue, 12 Aug 2008 12:20:29 +0200 Subject: [llvm-commits] [llvm] r54640 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h IRBuilder.h TargetFolder.h In-Reply-To: <81AB5E44-EFA9-462E-B6B3-B35B696135DA@apple.com> References: <200808111529.m7BFTavc006237@zion.cs.uiuc.edu> <81AB5E44-EFA9-462E-B6B3-B35B696135DA@apple.com> Message-ID: <200808121220.29990.duncan.sands@math.u-psud.fr> Hi Chris, > Because of the name of this file, I expect a lot of people to go here > to look for the LLVM IR constant folding interfaces. Please document > that this file is designed for use with IRBuilder and point people to > the ConstantExpr::get* methods and libanalysis for simple constant > folding uses. that said, llvm-gcc now also uses TargetFolder when directly creating constants (eg: global variable initializers), and it's quite convenient for that. This is the reason that TargetFolder has a few methods that aren't needed by IRBuilder. I put the same extra methods in ConstantFolder, so you can easily flip between ConstantFolder and TargetFolder in llvm-gcc. Ciao, Duncan. From dpatel at apple.com Tue Aug 12 10:44:36 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Aug 2008 15:44:36 -0000 Subject: [llvm-commits] [llvm] r54685 - in /llvm/trunk: include/llvm/PassManagers.h lib/VMCore/PassManager.cpp Message-ID: <200808121544.m7CFib4l001258@zion.cs.uiuc.edu> Author: dpatel Date: Tue Aug 12 10:44:31 2008 New Revision: 54685 URL: http://llvm.org/viewvc/llvm-project?rev=54685&view=rev Log: Use SmallVector instead of std::vector Modified: llvm/trunk/include/llvm/PassManagers.h llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=54685&r1=54684&r2=54685&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Tue Aug 12 10:44:31 2008 @@ -186,7 +186,7 @@ ImmutablePasses.push_back(P); } - inline std::vector& getImmutablePasses() { + inline SmallVector& getImmutablePasses() { return ImmutablePasses; } @@ -212,13 +212,13 @@ protected: /// Collection of pass managers - std::vector PassManagers; + SmallVector PassManagers; private: /// Collection of pass managers that are not directly maintained /// by this pass manager - std::vector IndirectPassManagers; + SmallVector IndirectPassManagers; // Map to keep track of last user of the analysis pass. // LastUser->second is the last user of Lastuser->first. @@ -230,7 +230,7 @@ DenseMap > InversedLastUser; /// Immutable passes are managed by top level manager. - std::vector ImmutablePasses; + SmallVector ImmutablePasses; DenseMap AnUsageMap; }; @@ -350,7 +350,7 @@ PMTopLevelManager *TPM; // Collection of pass that are managed by this manager - std::vector PassVector; + SmallVector PassVector; // Collection of Analysis provided by Parent pass manager and // used by current pass manager. At at time there can not be more @@ -369,7 +369,7 @@ // Collection of higher level analysis used by the pass managed by // this manager. - std::vector HigherLevelAnalysis; + SmallVector HigherLevelAnalysis; unsigned Depth; }; Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54685&r1=54684&r2=54685&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Aug 12 10:44:31 2008 @@ -491,18 +491,18 @@ Pass *P = NULL; // Check pass managers - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); P == NULL && I != E; ++I) { PMDataManager *PMD = *I; P = PMD->findAnalysisPass(AID, false); } // Check other pass managers - for (std::vector::iterator I = IndirectPassManagers.begin(), + for (SmallVector::iterator I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); P == NULL && I != E; ++I) P = (*I)->findAnalysisPass(AID, false); - for (std::vector::iterator I = ImmutablePasses.begin(), + for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); P == NULL && I != E; ++I) { const PassInfo *PI = (*I)->getPassInfo(); if (PI == AID) @@ -535,7 +535,7 @@ // (sometimes indirectly), but there's no inheritance relationship // between PMDataManager and Pass, so we have to dynamic_cast to get // from a PMDataManager* to a Pass*. - for (std::vector::const_iterator I = PassManagers.begin(), + for (SmallVector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) dynamic_cast(*I)->dumpPassStructure(1); } @@ -546,7 +546,7 @@ return; cerr << "Pass Arguments: "; - for (std::vector::const_iterator I = PassManagers.begin(), + for (SmallVector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) { PMDataManager *PMD = *I; PMD->dumpPassArguments(); @@ -556,14 +556,14 @@ void PMTopLevelManager::initializeAllAnalysisInfo() { - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) { PMDataManager *PMD = *I; PMD->initializeAnalysisInfo(); } // Initailize other pass managers - for (std::vector::iterator I = IndirectPassManagers.begin(), + for (SmallVector::iterator I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); I != E; ++I) (*I)->initializeAnalysisInfo(); @@ -583,11 +583,11 @@ /// Destructor PMTopLevelManager::~PMTopLevelManager() { - for (std::vector::iterator I = PassManagers.begin(), + for (SmallVector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) delete *I; - for (std::vector::iterator + for (SmallVector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) delete *I; @@ -626,7 +626,7 @@ return true; const AnalysisUsage::VectorType &PreservedSet = AnUsage->getPreservedSet(); - for (std::vector::iterator I = HigherLevelAnalysis.begin(), + for (SmallVector::iterator I = HigherLevelAnalysis.begin(), E = HigherLevelAnalysis.end(); I != E; ++I) { Pass *P1 = *I; if (!dynamic_cast(P1) && @@ -940,7 +940,7 @@ } void PMDataManager::dumpPassArguments() const { - for(std::vector::const_iterator I = PassVector.begin(), + for(SmallVector::const_iterator I = PassVector.begin(), E = PassVector.end(); I != E; ++I) { if (PMDataManager *PMD = dynamic_cast(*I)) PMD->dumpPassArguments(); @@ -1054,7 +1054,7 @@ // Destructor PMDataManager::~PMDataManager() { - for (std::vector::iterator I = PassVector.begin(), + for (SmallVector::iterator I = PassVector.begin(), E = PassVector.end(); I != E; ++I) delete *I; From criswell at uiuc.edu Tue Aug 12 11:35:30 2008 From: criswell at uiuc.edu (John Criswell) Date: Tue, 12 Aug 2008 16:35:30 -0000 Subject: [llvm-commits] [poolalloc] r54686 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200808121635.m7CGZaY4003092@zion.cs.uiuc.edu> Author: criswell Date: Tue Aug 12 11:35:09 2008 New Revision: 54686 URL: http://llvm.org/viewvc/llvm-project?rev=54686&view=rev Log: Handle the situation where a function is casted before it is called. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=54686&r1=54685&r2=54686&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Tue Aug 12 11:35:09 2008 @@ -757,6 +757,23 @@ // Add the rest of the arguments... Args.insert(Args.end(), CS.arg_begin(), CS.arg_end()); + // + // There are circumstances where a function is casted to another type and + // then called (que horible). We need to perform a similar cast if the + // type doesn't match the number of arguments. + // + if (Function * NewFunction = dyn_cast(NewCallee)) { + const FunctionType * NewCalleeType = NewFunction->getFunctionType(); + if (NewCalleeType->getNumParams() != Args.size()) { + std::vector Types; + Type * FuncTy = FunctionType::get (NewCalleeType->getReturnType(), + Types, + true); + FuncTy = PointerType::getUnqual (FuncTy); + NewCallee = new BitCastInst (NewCallee, FuncTy, "", TheCall); + } + } + std::string Name = TheCall->getName(); TheCall->setName(""); if (InvokeInst *II = dyn_cast(TheCall)) { From gohman at apple.com Tue Aug 12 12:01:06 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 12 Aug 2008 10:01:06 -0700 Subject: [llvm-commits] [llvm] r54656 - in /llvm/trunk/lib: ExecutionEngine/JIT/JITEmitter.cpp Target/X86/X86CodeEmitter.cpp Target/X86/X86ISelDAGToDAG.cpp Target/X86/X86TargetMachine.cpp In-Reply-To: <200808112346.m7BNkQ28022561@zion.cs.uiuc.edu> References: <200808112346.m7BNkQ28022561@zion.cs.uiuc.edu> Message-ID: Hi Dale, This is causing a bunch of regressions on x86-64 JIT, for example MultiSource/Applications/Burg. Can you investigate? Thanks, Dan On Aug 11, 2008, at 4:46 PM, Dale Johannesen wrote: > Author: johannes > Date: Mon Aug 11 18:46:25 2008 > New Revision: 54656 > > URL: http://llvm.org/viewvc/llvm-project?rev=54656&view=rev > Log: > Some fixes for x86-64 JIT. Make it use small code > model, except for external calls; this makes > addressing modes PC-relative. Incomplete. > > The assertion at the top of Emitter::runOnMachineFunction > was obviously bogus (always true) so I removed it. > If someone knows what the correct test should be to cover > all the various targets, please fix. > > > Modified: > llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp > llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp > llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > > Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) > +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Aug 11 > 18:46:25 2008 > @@ -920,9 +920,22 @@ > Relocations.clear(); > > #ifndef NDEBUG > + { > + DOUT << std::hex; > + int i; > + unsigned char* q = FnStart; > + for (i=1; q!=FnEnd; q++, i++) { > + if (i%8==1) > + DOUT << "0x" << (long)q << ": "; > + DOUT<< (unsigned short)*q << " "; > + if (i%8==0) > + DOUT<<"\n"; > + } > + DOUT << std::dec; > if (sys::hasDisassembler()) > DOUT << "Disassembled code:\n" > << sys::disassembleBuffer(FnStart, FnEnd-FnStart, > (uintptr_t)FnStart); > + } > #endif > if (ExceptionHandling) { > uintptr_t ActualSize = 0; > > Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Mon Aug 11 18:46:25 > 2008 > @@ -106,10 +106,7 @@ > } > > bool Emitter::runOnMachineFunction(MachineFunction &MF) { > - assert((MF.getTarget().getRelocationModel() != Reloc::Default || > - MF.getTarget().getRelocationModel() != Reloc::Static) && > - "JIT relocation model must be set to static or default!"); > - > + > MCE.setModuleInfo(&getAnalysis()); > > II = TM.getInstrInfo(); > @@ -517,11 +514,16 @@ > > if (CurOp != NumOps) { > const MachineOperand &MO = MI.getOperand(CurOp++); > +DOUT << "RawFrm CurOp " << CurOp << "\n"; > +DOUT << "isMachineBasicBlock " << MO.isMachineBasicBlock() << "\n"; > +DOUT << "isGlobalAddress " << MO.isGlobalAddress() << "\n"; > +DOUT << "isExternalSymbol " << MO.isExternalSymbol() << "\n"; > +DOUT << "isImmediate " << MO.isImmediate() << "\n"; > if (MO.isMachineBasicBlock()) { > emitPCRelativeBlockAddress(MO.getMBB()); > } else if (MO.isGlobalAddress()) { > - bool NeedStub = (Is64BitMode && TM.getCodeModel() == > CodeModel::Large) > - || Opcode == X86::TAILJMPd; > + // Assume undefined functions may be outside the Small > codespace. > + bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; > emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, > 0, 0, NeedStub); > } else if (MO.isExternalSymbol()) { > @@ -545,8 +547,6 @@ > else { > unsigned rt = Is64BitMode ? X86::reloc_pcrel_word > : (IsPIC ? X86::reloc_picrel_word : > X86::reloc_absolute_word); > - if (Opcode == X86::MOV64ri) > - rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? > if (MO1.isGlobalAddress()) { > bool NeedStub = isa(MO1.getGlobal()); > bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); > @@ -617,8 +617,6 @@ > else { > unsigned rt = Is64BitMode ? X86::reloc_pcrel_word > : (IsPIC ? X86::reloc_picrel_word : > X86::reloc_absolute_word); > - if (Opcode == X86::MOV64ri32) > - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? > if (MO1.isGlobalAddress()) { > bool NeedStub = isa(MO1.getGlobal()); > bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); > @@ -654,8 +652,6 @@ > else { > unsigned rt = Is64BitMode ? X86::reloc_pcrel_word > : (IsPIC ? X86::reloc_picrel_word : > X86::reloc_absolute_word); > - if (Opcode == X86::MOV64mi32) > - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? > if (MO.isGlobalAddress()) { > bool NeedStub = isa(MO.getGlobal()); > bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); > > Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=54656&r1=54655&r2=54656&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 11 > 18:46:25 2008 > @@ -35,6 +35,7 @@ > #include "llvm/Support/Compiler.h" > #include "llvm/Support/Debug.h" > #include "llvm/Support/MathExtras.h" > +#include "llvm/Support/Streams.h" > #include "llvm/ADT/SmallPtrSet.h" > #include "llvm/ADT/Statistic.h" > #include > @@ -77,6 +78,23 @@ > : BaseType(RegBase), isRIPRel(false), Scale(1), IndexReg(), > Disp(0), > GV(0), CP(0), ES(0), JT(-1), Align(0) { > } > + void dump() { > + cerr << "X86ISelAddressMode " << this << "\n"; > + cerr << "Base.Reg "; if (Base.Reg.Val!=0) Base.Reg.Val->dump(); > + else cerr << "nul"; > + cerr << " Base.FrameIndex " << Base.FrameIndex << "\n"; > + cerr << "isRIPRel " << isRIPRel << " Scale" << Scale << "\n"; > + cerr << "IndexReg "; if (IndexReg.Val!=0) IndexReg.Val->dump(); > + else cerr << "nul"; > + cerr << " Disp " << Disp << "\n"; > + cerr << "GV "; if (GV) GV->dump(); > + else cerr << "nul"; > + cerr << " CP "; if (CP) CP->dump(); > + else cerr << "nul"; > + cerr << "\n"; > + cerr << "ES "; if (ES) cerr << ES; else cerr << "nul"; > + cerr << " JT" << JT << " Align" << Align << "\n"; > + } > }; > } > > @@ -676,6 +694,7 @@ > /// addressing mode. > bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM, > bool isRoot, unsigned Depth) { > +DOUT << "MatchAddress: "; DEBUG(AM.dump()); > // Limit recursion. > if (Depth > 5) > return MatchAddressBase(N, AM, isRoot, Depth); > @@ -707,6 +726,9 @@ > } > > case X86ISD::Wrapper: { > +DOUT << "Wrapper: 64bit " << Subtarget->is64Bit(); > +DOUT << " AM "; DEBUG(AM.dump()); DOUT << "\n"; > +DOUT << "AlreadySelected " << AlreadySelected << "\n"; > bool is64Bit = Subtarget->is64Bit(); > // Under X86-64 non-small code model, GV (and friends) are 64- > bits. > // Also, base and index reg must be 0 in order to use rip as base. > > Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=54656&r1=54655&r2=54656&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Aug 11 > 18:46:25 2008 > @@ -194,12 +194,14 @@ > bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, > bool DumpAsm, > MachineCodeEmitter &MCE) { > // FIXME: Move this to TargetJITInfo! > - if (DefRelocModel == Reloc::Default) > + // Do not override 64-bit setting made in X86TargetMachine(). > + if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) > setRelocationModel(Reloc::Static); > > - // JIT cannot ensure globals are placed in the lower 4G of address. > + // 64-bit JIT places everything in the same buffer except > external functions. > + // Use small code model but hack the call instruction for > externals. > if (Subtarget.is64Bit()) > - setCodeModel(CodeModel::Large); > + setCodeModel(CodeModel::Small); > > PM.add(createX86CodeEmitterPass(*this, MCE)); > if (DumpAsm) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Tue Aug 12 12:04:13 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 12 Aug 2008 10:04:13 -0700 Subject: [llvm-commits] [llvm] r54656 - in /llvm/trunk/lib: ExecutionEngine/JIT/JITEmitter.cpp Target/X86/X86CodeEmitter.cpp Target/X86/X86ISelDAGToDAG.cpp Target/X86/X86TargetMachine.cpp In-Reply-To: References: <200808112346.m7BNkQ28022561@zion.cs.uiuc.edu> Message-ID: <5BE9E5ED-503F-49A0-980A-5226C1AD1967@apple.com> Yeah, I know. Investigating. We can back it out if there's demand, but it only affects x86-64 JIT. On Aug 12, 2008, at 10:01 AMPDT, Dan Gohman wrote: > Hi Dale, > > This is causing a bunch of regressions on x86-64 JIT, > for example MultiSource/Applications/Burg. Can you investigate? > > Thanks, > > Dan > > On Aug 11, 2008, at 4:46 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Mon Aug 11 18:46:25 2008 >> New Revision: 54656 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=54656&view=rev >> Log: >> Some fixes for x86-64 JIT. Make it use small code >> model, except for external calls; this makes >> addressing modes PC-relative. Incomplete. >> >> The assertion at the top of Emitter::runOnMachineFunction >> was obviously bogus (always true) so I removed it. >> If someone knows what the correct test should be to cover >> all the various targets, please fix. >> >> >> Modified: >> llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp >> llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp >> llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp >> llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> >> Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original) >> +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Aug 11 >> 18:46:25 2008 >> @@ -920,9 +920,22 @@ >> Relocations.clear(); >> >> #ifndef NDEBUG >> + { >> + DOUT << std::hex; >> + int i; >> + unsigned char* q = FnStart; >> + for (i=1; q!=FnEnd; q++, i++) { >> + if (i%8==1) >> + DOUT << "0x" << (long)q << ": "; >> + DOUT<< (unsigned short)*q << " "; >> + if (i%8==0) >> + DOUT<<"\n"; >> + } >> + DOUT << std::dec; >> if (sys::hasDisassembler()) >> DOUT << "Disassembled code:\n" >> << sys::disassembleBuffer(FnStart, FnEnd-FnStart, >> (uintptr_t)FnStart); >> + } >> #endif >> if (ExceptionHandling) { >> uintptr_t ActualSize = 0; >> >> Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=54656&r1=54655&r2=54656&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Mon Aug 11 18:46:25 >> 2008 >> @@ -106,10 +106,7 @@ >> } >> >> bool Emitter::runOnMachineFunction(MachineFunction &MF) { >> - assert((MF.getTarget().getRelocationModel() != Reloc::Default || >> - MF.getTarget().getRelocationModel() != Reloc::Static) && >> - "JIT relocation model must be set to static or default!"); >> - >> + >> MCE.setModuleInfo(&getAnalysis()); >> >> II = TM.getInstrInfo(); >> @@ -517,11 +514,16 @@ >> >> if (CurOp != NumOps) { >> const MachineOperand &MO = MI.getOperand(CurOp++); >> +DOUT << "RawFrm CurOp " << CurOp << "\n"; >> +DOUT << "isMachineBasicBlock " << MO.isMachineBasicBlock() << "\n"; >> +DOUT << "isGlobalAddress " << MO.isGlobalAddress() << "\n"; >> +DOUT << "isExternalSymbol " << MO.isExternalSymbol() << "\n"; >> +DOUT << "isImmediate " << MO.isImmediate() << "\n"; >> if (MO.isMachineBasicBlock()) { >> emitPCRelativeBlockAddress(MO.getMBB()); >> } else if (MO.isGlobalAddress()) { >> - bool NeedStub = (Is64BitMode && TM.getCodeModel() == >> CodeModel::Large) >> - || Opcode == X86::TAILJMPd; >> + // Assume undefined functions may be outside the Small >> codespace. >> + bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; >> emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, >> 0, 0, NeedStub); >> } else if (MO.isExternalSymbol()) { >> @@ -545,8 +547,6 @@ >> else { >> unsigned rt = Is64BitMode ? X86::reloc_pcrel_word >> : (IsPIC ? X86::reloc_picrel_word : >> X86::reloc_absolute_word); >> - if (Opcode == X86::MOV64ri) >> - rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? >> if (MO1.isGlobalAddress()) { >> bool NeedStub = isa(MO1.getGlobal()); >> bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); >> @@ -617,8 +617,6 @@ >> else { >> unsigned rt = Is64BitMode ? X86::reloc_pcrel_word >> : (IsPIC ? X86::reloc_picrel_word : >> X86::reloc_absolute_word); >> - if (Opcode == X86::MOV64ri32) >> - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? >> if (MO1.isGlobalAddress()) { >> bool NeedStub = isa(MO1.getGlobal()); >> bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); >> @@ -654,8 +652,6 @@ >> else { >> unsigned rt = Is64BitMode ? X86::reloc_pcrel_word >> : (IsPIC ? X86::reloc_picrel_word : >> X86::reloc_absolute_word); >> - if (Opcode == X86::MOV64mi32) >> - rt = X86::reloc_absolute_word; // FIXME: add X86II flag? >> if (MO.isGlobalAddress()) { >> bool NeedStub = isa(MO.getGlobal()); >> bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); >> >> Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=54656&r1=54655&r2=54656&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 11 >> 18:46:25 2008 >> @@ -35,6 +35,7 @@ >> #include "llvm/Support/Compiler.h" >> #include "llvm/Support/Debug.h" >> #include "llvm/Support/MathExtras.h" >> +#include "llvm/Support/Streams.h" >> #include "llvm/ADT/SmallPtrSet.h" >> #include "llvm/ADT/Statistic.h" >> #include >> @@ -77,6 +78,23 @@ >> : BaseType(RegBase), isRIPRel(false), Scale(1), IndexReg(), >> Disp(0), >> GV(0), CP(0), ES(0), JT(-1), Align(0) { >> } >> + void dump() { >> + cerr << "X86ISelAddressMode " << this << "\n"; >> + cerr << "Base.Reg "; if (Base.Reg.Val!=0) Base.Reg.Val- >> >dump(); >> + else cerr << "nul"; >> + cerr << " Base.FrameIndex " << Base.FrameIndex << "\n"; >> + cerr << "isRIPRel " << isRIPRel << " Scale" << Scale << "\n"; >> + cerr << "IndexReg "; if (IndexReg.Val!=0) IndexReg.Val- >> >dump(); >> + else cerr << "nul"; >> + cerr << " Disp " << Disp << "\n"; >> + cerr << "GV "; if (GV) GV->dump(); >> + else cerr << "nul"; >> + cerr << " CP "; if (CP) CP->dump(); >> + else cerr << "nul"; >> + cerr << "\n"; >> + cerr << "ES "; if (ES) cerr << ES; else cerr << "nul"; >> + cerr << " JT" << JT << " Align" << Align << "\n"; >> + } >> }; >> } >> >> @@ -676,6 +694,7 @@ >> /// addressing mode. >> bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM, >> bool isRoot, unsigned Depth) { >> +DOUT << "MatchAddress: "; DEBUG(AM.dump()); >> // Limit recursion. >> if (Depth > 5) >> return MatchAddressBase(N, AM, isRoot, Depth); >> @@ -707,6 +726,9 @@ >> } >> >> case X86ISD::Wrapper: { >> +DOUT << "Wrapper: 64bit " << Subtarget->is64Bit(); >> +DOUT << " AM "; DEBUG(AM.dump()); DOUT << "\n"; >> +DOUT << "AlreadySelected " << AlreadySelected << "\n"; >> bool is64Bit = Subtarget->is64Bit(); >> // Under X86-64 non-small code model, GV (and friends) are 64- >> bits. >> // Also, base and index reg must be 0 in order to use rip as base. >> >> Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=54656&r1=54655&r2=54656&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Aug 11 >> 18:46:25 2008 >> @@ -194,12 +194,14 @@ >> bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, >> bool DumpAsm, >> MachineCodeEmitter &MCE) { >> // FIXME: Move this to TargetJITInfo! >> - if (DefRelocModel == Reloc::Default) >> + // Do not override 64-bit setting made in X86TargetMachine(). >> + if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) >> setRelocationModel(Reloc::Static); >> >> - // JIT cannot ensure globals are placed in the lower 4G of >> address. >> + // 64-bit JIT places everything in the same buffer except >> external functions. >> + // Use small code model but hack the call instruction for >> externals. >> if (Subtarget.is64Bit()) >> - setCodeModel(CodeModel::Large); >> + setCodeModel(CodeModel::Small); >> >> PM.add(createX86CodeEmitterPass(*this, MCE)); >> if (DumpAsm) >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gohman at apple.com Tue Aug 12 12:41:12 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 12 Aug 2008 17:41:12 -0000 Subject: [llvm-commits] [llvm] r54687 - /llvm/trunk/lib/Support/FoldingSet.cpp Message-ID: <200808121741.m7CHfixi005478@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 12 12:40:22 2008 New Revision: 54687 URL: http://llvm.org/viewvc/llvm-project?rev=54687&view=rev Log: Avoid repeatedly reallocating the FoldingSetNodeID when searching through multiple nodes in a bucket. Modified: llvm/trunk/lib/Support/FoldingSet.cpp Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=54687&r1=54686&r2=54687&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Tue Aug 12 12:40:22 2008 @@ -232,6 +232,7 @@ Buckets[NumBuckets] = reinterpret_cast(-1); // Walk the old buckets, rehashing nodes into their new place. + FoldingSetNodeID ID; for (unsigned i = 0; i != OldNumBuckets; ++i) { void *Probe = OldBuckets[i]; if (!Probe) continue; @@ -241,9 +242,9 @@ NodeInBucket->SetNextInBucket(0); // Insert the node into the new bucket, after recomputing the hash. - FoldingSetNodeID ID; GetNodeProfile(ID, NodeInBucket); InsertNode(NodeInBucket, GetBucketFor(ID, Buckets, NumBuckets)); + ID.clear(); } } @@ -262,13 +263,14 @@ InsertPos = 0; + FoldingSetNodeID OtherID; while (Node *NodeInBucket = GetNextPtr(Probe)) { - FoldingSetNodeID OtherID; GetNodeProfile(OtherID, NodeInBucket); if (OtherID == ID) return NodeInBucket; Probe = NodeInBucket->getNextInBucket(); + OtherID.clear(); } // Didn't find the node, return null with the bucket as the InsertPos. From gohman at apple.com Tue Aug 12 12:43:18 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 12 Aug 2008 17:43:18 -0000 Subject: [llvm-commits] [llvm] r54688 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <200808121743.m7CHhMC4005543@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 12 12:42:33 2008 New Revision: 54688 URL: http://llvm.org/viewvc/llvm-project?rev=54688&view=rev Log: Correct the filename in the top-of-file comment. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=54688&r1=54687&r2=54688&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Aug 12 12:42:33 2008 @@ -1,4 +1,4 @@ -//===----- ScheduleDAGList.cpp - Reg pressure reduction list scheduler ----===// +//===----- ScheduleDAGRRList.cpp - Reg pressure reduction list scheduler --===// // // The LLVM Compiler Infrastructure // From dalej at apple.com Tue Aug 12 13:23:56 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 12 Aug 2008 18:23:56 -0000 Subject: [llvm-commits] [llvm] r54692 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200808121823.m7CINul8007085@zion.cs.uiuc.edu> Author: johannes Date: Tue Aug 12 13:23:48 2008 New Revision: 54692 URL: http://llvm.org/viewvc/llvm-project?rev=54692&view=rev Log: In the absence of a linker to build the GOT, use the 32-bit non_lazy_ptr mechanism on x86-64 Darwin JIT. Fixes a bunch of last night's failures. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=54692&r1=54691&r2=54692&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Aug 12 13:23:48 2008 @@ -251,7 +251,9 @@ } bool Emitter::gvNeedsLazyPtr(const GlobalValue *GV) { - return !Is64BitMode && + // For Darwin, simulate the linktime GOT by using the same lazy-pointer + // mechanism as 32-bit mode. + return (!Is64BitMode || TM.getSubtarget().isTargetDarwin()) && TM.getSubtarget().GVRequiresExtraLoad(GV, TM, false); } From grosbach at apple.com Tue Aug 12 13:34:48 2008 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 12 Aug 2008 18:34:48 -0000 Subject: [llvm-commits] [llvm] r54695 - /llvm/trunk/lib/Target/ARM/README-Thumb.txt Message-ID: <200808121834.m7CIYnhJ007617@zion.cs.uiuc.edu> Author: grosbach Date: Tue Aug 12 13:34:45 2008 New Revision: 54695 URL: http://llvm.org/viewvc/llvm-project?rev=54695&view=rev Log: Whitespace cleanup. Test commit. Modified: llvm/trunk/lib/Target/ARM/README-Thumb.txt Modified: llvm/trunk/lib/Target/ARM/README-Thumb.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README-Thumb.txt?rev=54695&r1=54694&r2=54695&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/README-Thumb.txt (original) +++ llvm/trunk/lib/Target/ARM/README-Thumb.txt Tue Aug 12 13:34:45 2008 @@ -4,6 +4,7 @@ * Add support for compiling functions in both ARM and Thumb mode, then taking the smallest. + * Add support for compiling individual basic blocks in thumb mode, when in a larger ARM function. This can be used for presumed cold code, like paths to abort (failure path of asserts), EH handling code, etc. From baldrick at free.fr Tue Aug 12 13:49:16 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 12 Aug 2008 20:49:16 +0200 Subject: [llvm-commits] [llvm] r54692 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp In-Reply-To: <200808121823.m7CINul8007085@zion.cs.uiuc.edu> References: <200808121823.m7CINul8007085@zion.cs.uiuc.edu> Message-ID: <200808122049.17219.baldrick@free.fr> > In the absence of a linker to build the GOT, use the 32-bit > non_lazy_ptr mechanism on x86-64 Darwin JIT. Fixes a bunch > of last night's failures. There were a bunch of JIT failures on x86-64 linux too... Ciao, Duncan. From dalej at apple.com Tue Aug 12 15:13:55 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 12 Aug 2008 13:13:55 -0700 Subject: [llvm-commits] [llvm] r54692 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp In-Reply-To: <200808122049.17219.baldrick@free.fr> References: <200808121823.m7CINul8007085@zion.cs.uiuc.edu> <200808122049.17219.baldrick@free.fr> Message-ID: <16732F84-97B1-46F8-A552-81EAB11DE942@apple.com> On Aug 12, 2008, at 11:49 AMPDT, Duncan Sands wrote: >> In the absence of a linker to build the GOT, use the 32-bit >> non_lazy_ptr mechanism on x86-64 Darwin JIT. Fixes a bunch >> of last night's failures. > > There were a bunch of JIT failures on x86-64 linux too... So there are, and not all the same ones. I guess I'll put x86-64 Linux behavior back the way it was. On Darwin we need JIT codegen to be PC-relative, which it wasn't, but AFAIK there is no such need on Linux... From gohman at apple.com Tue Aug 12 15:17:33 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 12 Aug 2008 20:17:33 -0000 Subject: [llvm-commits] [llvm] r54697 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/avoid-smax.ll Message-ID: <200808122017.m7CKHYEw011514@zion.cs.uiuc.edu> Author: djg Date: Tue Aug 12 15:17:31 2008 New Revision: 54697 URL: http://llvm.org/viewvc/llvm-project?rev=54697&view=rev Log: Extend ScalarEvolution's executesAtLeastOnce logic to be able to continue past the first conditional branch when looking for a relevant test. This helps it avoid using MAX expressions in loop trip counts in more cases. Added: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=54697&r1=54696&r2=54697&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Aug 12 15:17:31 2008 @@ -2709,66 +2709,68 @@ SCEV *LHS, SCEV *RHS) { BasicBlock *Preheader = L->getLoopPreheader(); BasicBlock *PreheaderDest = L->getHeader(); - if (Preheader == 0) return false; - BranchInst *LoopEntryPredicate = - dyn_cast(Preheader->getTerminator()); - if (!LoopEntryPredicate) return false; - - // This might be a critical edge broken out. If the loop preheader ends in - // an unconditional branch to the loop, check to see if the preheader has a - // single predecessor, and if so, look for its terminator. - while (LoopEntryPredicate->isUnconditional()) { - PreheaderDest = Preheader; - Preheader = Preheader->getSinglePredecessor(); - if (!Preheader) return false; // Multiple preds. - - LoopEntryPredicate = + // Starting at the preheader, climb up the predecessor chain, as long as + // there are unique predecessors, looking for a conditional branch that + // protects the loop. + // + // This is a conservative apporoximation of a climb of the + // control-dependence predecessors. + + for (; Preheader; PreheaderDest = Preheader, + Preheader = Preheader->getSinglePredecessor()) { + + BranchInst *LoopEntryPredicate = dyn_cast(Preheader->getTerminator()); - if (!LoopEntryPredicate) return false; - } + if (!LoopEntryPredicate || + LoopEntryPredicate->isUnconditional()) + continue; + + ICmpInst *ICI = dyn_cast(LoopEntryPredicate->getCondition()); + if (!ICI) continue; + + // Now that we found a conditional branch that dominates the loop, check to + // see if it is the comparison we are looking for. + Value *PreCondLHS = ICI->getOperand(0); + Value *PreCondRHS = ICI->getOperand(1); + ICmpInst::Predicate Cond; + if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) + Cond = ICI->getPredicate(); + else + Cond = ICI->getInversePredicate(); + + switch (Cond) { + case ICmpInst::ICMP_UGT: + if (isSigned) continue; + std::swap(PreCondLHS, PreCondRHS); + Cond = ICmpInst::ICMP_ULT; + break; + case ICmpInst::ICMP_SGT: + if (!isSigned) continue; + std::swap(PreCondLHS, PreCondRHS); + Cond = ICmpInst::ICMP_SLT; + break; + case ICmpInst::ICMP_ULT: + if (isSigned) continue; + break; + case ICmpInst::ICMP_SLT: + if (!isSigned) continue; + break; + default: + continue; + } - ICmpInst *ICI = dyn_cast(LoopEntryPredicate->getCondition()); - if (!ICI) return false; + if (!PreCondLHS->getType()->isInteger()) continue; - // Now that we found a conditional branch that dominates the loop, check to - // see if it is the comparison we are looking for. - Value *PreCondLHS = ICI->getOperand(0); - Value *PreCondRHS = ICI->getOperand(1); - ICmpInst::Predicate Cond; - if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) - Cond = ICI->getPredicate(); - else - Cond = ICI->getInversePredicate(); - - switch (Cond) { - case ICmpInst::ICMP_UGT: - if (isSigned) return false; - std::swap(PreCondLHS, PreCondRHS); - Cond = ICmpInst::ICMP_ULT; - break; - case ICmpInst::ICMP_SGT: - if (!isSigned) return false; - std::swap(PreCondLHS, PreCondRHS); - Cond = ICmpInst::ICMP_SLT; - break; - case ICmpInst::ICMP_ULT: - if (isSigned) return false; - break; - case ICmpInst::ICMP_SLT: - if (!isSigned) return false; - break; - default: - return false; + SCEVHandle PreCondLHSSCEV = getSCEV(PreCondLHS); + SCEVHandle PreCondRHSSCEV = getSCEV(PreCondRHS); + if ((LHS == PreCondLHSSCEV && RHS == PreCondRHSSCEV) || + (LHS == SE.getNotSCEV(PreCondRHSSCEV) && + RHS == SE.getNotSCEV(PreCondLHSSCEV))) + return true; } - if (!PreCondLHS->getType()->isInteger()) return false; - - SCEVHandle PreCondLHSSCEV = getSCEV(PreCondLHS); - SCEVHandle PreCondRHSSCEV = getSCEV(PreCondRHS); - return (LHS == PreCondLHSSCEV && RHS == PreCondRHSSCEV) || - (LHS == SE.getNotSCEV(PreCondRHSSCEV) && - RHS == SE.getNotSCEV(PreCondLHSSCEV)); + return false; } /// HowManyLessThans - Return the number of times a backedge containing the Added: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll?rev=54697&view=auto ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll (added) +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll Tue Aug 12 15:17:31 2008 @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb3: ( -1 + %n) iterations!} + +; We don't want to use a max in the trip count expression in +; this testcase. + +define void @foo(i32 %n, i32* %p, i32* %q) nounwind { +entry: + icmp sgt i32 %n, 0 + br i1 %0, label %bb, label %return + +bb: + load i32* %q, align 4 + icmp eq i32 %1, 0 + br i1 %2, label %return, label %bb3.preheader + +bb3.preheader: + br label %bb3 + +bb3: + %i.0 = phi i32 [ %7, %bb3 ], [ 0, %bb3.preheader ] + getelementptr i32* %p, i32 %i.0 + load i32* %3, align 4 + add i32 %4, 1 + getelementptr i32* %p, i32 %i.0 + store i32 %5, i32* %6, align 4 + add i32 %i.0, 1 + icmp slt i32 %7, %n + br i1 %8, label %bb3, label %return.loopexit + +return.loopexit: + br label %return + +return: + ret void +} From baldrick at free.fr Tue Aug 12 15:39:37 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 12 Aug 2008 20:39:37 -0000 Subject: [llvm-commits] [llvm] r54698 - in /llvm/trunk/include/llvm/Support: ConstantFolder.h IRBuilder.h NullFolder.h TargetFolder.h Message-ID: <200808122039.m7CKdhQl012199@zion.cs.uiuc.edu> Author: baldrick Date: Tue Aug 12 15:39:27 2008 New Revision: 54698 URL: http://llvm.org/viewvc/llvm-project?rev=54698&view=rev Log: Add a NullFolder class that doesn't fold constants. This may be used as the second IRBuilder template parameter, the idea being that people learning LLVM may find it helpful (several people asked on IRC if it was possible to turn off constant folding because it made it hard for them to see what was going on). Compiles, but otherwise completely untested. Added: llvm/trunk/include/llvm/Support/NullFolder.h Modified: llvm/trunk/include/llvm/Support/ConstantFolder.h llvm/trunk/include/llvm/Support/IRBuilder.h llvm/trunk/include/llvm/Support/TargetFolder.h Modified: llvm/trunk/include/llvm/Support/ConstantFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantFolder.h?rev=54698&r1=54697&r2=54698&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ConstantFolder.h (original) +++ llvm/trunk/include/llvm/Support/ConstantFolder.h Tue Aug 12 15:39:27 2008 @@ -134,8 +134,20 @@ // Compare Instructions //===--------------------------------------------------------------------===// - Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, - Constant *RHS) const { + Constant *CreateICmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return ConstantExpr::getCompare(P, LHS, RHS); + } + Constant *CreateFCmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return ConstantExpr::getCompare(P, LHS, RHS); + } + Constant *CreateVICmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return ConstantExpr::getCompare(P, LHS, RHS); + } + Constant *CreateVFCmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { return ConstantExpr::getCompare(P, LHS, RHS); } Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=54698&r1=54697&r2=54698&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Aug 12 15:39:27 2008 @@ -493,14 +493,14 @@ const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return Folder.CreateCompare(P, LC, RC); + return Folder.CreateICmp(P, LC, RC); return Insert(new ICmpInst(P, LHS, RHS), Name); } Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return Folder.CreateCompare(P, LC, RC); + return Folder.CreateFCmp(P, LC, RC); return Insert(new FCmpInst(P, LHS, RHS), Name); } @@ -508,14 +508,14 @@ const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return Folder.CreateCompare(P, LC, RC); + return Folder.CreateVICmp(P, LC, RC); return Insert(new VICmpInst(P, LHS, RHS), Name); } Value *CreateVFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const char *Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) - return Folder.CreateCompare(P, LC, RC); + return Folder.CreateVFCmp(P, LC, RC); return Insert(new VFCmpInst(P, LHS, RHS), Name); } Added: llvm/trunk/include/llvm/Support/NullFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NullFolder.h?rev=54698&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/NullFolder.h (added) +++ llvm/trunk/include/llvm/Support/NullFolder.h Tue Aug 12 15:39:27 2008 @@ -0,0 +1,178 @@ +//=====-- llvm/Support/NullFolder.h - Constant folding helper -*- C++ -*-=====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the NullFolder class, a helper for IRBuilder. It provides +// IRBuilder with a set of methods for creating unfolded constants. This is +// useful for learners trying to understand how LLVM IR works, and who don't +// want details to be hidden by the constant folder. For general constant +// creation and folding, use ConstantExpr and the routines in +// llvm/Analysis/ConstantFolding.h. +// +// Note: since it is not actually possible to create unfolded constants, this +// class returns values rather than constants. The values do not have names, +// even if names were provided to IRBuilder, which may be confusing. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_NULLFOLDER_H +#define LLVM_SUPPORT_NULLFOLDER_H + +#include "llvm/Constants.h" +#include "llvm/Instructions.h" + +namespace llvm { + +/// NullFolder - Create "constants" (actually, values) with no folding. +class NullFolder { +public: + + //===--------------------------------------------------------------------===// + // Binary Operators + //===--------------------------------------------------------------------===// + + Value *CreateAdd(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateAdd(LHS, RHS); + } + Value *CreateSub(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateSub(LHS, RHS); + } + Value *CreateMul(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateMul(LHS, RHS); + } + Value *CreateUDiv(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateUDiv(LHS, RHS); + } + Value *CreateSDiv(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateSDiv(LHS, RHS); + } + Value *CreateFDiv(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateFDiv(LHS, RHS); + } + Value *CreateURem(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateURem(LHS, RHS); + } + Value *CreateSRem(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateSRem(LHS, RHS); + } + Value *CreateFRem(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateFRem(LHS, RHS); + } + Value *CreateShl(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateShl(LHS, RHS); + } + Value *CreateLShr(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateLShr(LHS, RHS); + } + Value *CreateAShr(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateAShr(LHS, RHS); + } + Value *CreateAnd(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateAnd(LHS, RHS); + } + Value *CreateOr(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateOr(LHS, RHS); + } + Value *CreateXor(Constant *LHS, Constant *RHS) const { + return BinaryOperator::CreateXor(LHS, RHS); + } + + Value *CreateBinOp(Instruction::BinaryOps Opc, + Constant *LHS, Constant *RHS) const { + return BinaryOperator::Create(Opc, LHS, RHS); + } + + //===--------------------------------------------------------------------===// + // Unary Operators + //===--------------------------------------------------------------------===// + + Value *CreateNeg(Constant *C) const { + return BinaryOperator::CreateNeg(C); + } + Value *CreateNot(Constant *C) const { + return BinaryOperator::CreateNot(C); + } + + //===--------------------------------------------------------------------===// + // Memory Instructions + //===--------------------------------------------------------------------===// + + Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, + unsigned NumIdx) const { + return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); + } + Value *CreateGetElementPtr(Constant *C, Value* const *IdxList, + unsigned NumIdx) const { + return GetElementPtrInst::Create(C, IdxList, IdxList+NumIdx); + } + + //===--------------------------------------------------------------------===// + // Cast/Conversion Operators + //===--------------------------------------------------------------------===// + + Value *CreateCast(Instruction::CastOps Op, Constant *C, + const Type *DestTy) const { + return CastInst::Create(Op, C, DestTy); + } + Value *CreateIntCast(Constant *C, const Type *DestTy, + bool isSigned) const { + return CastInst::CreateIntegerCast(C, DestTy, isSigned); + } + + //===--------------------------------------------------------------------===// + // Compare Instructions + //===--------------------------------------------------------------------===// + + Value *CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + return new ICmpInst(P, LHS, RHS); + } + Value *CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + return new FCmpInst(P, LHS, RHS); + } + Value *CreateVICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + return new VICmpInst(P, LHS, RHS); + } + Value *CreateVFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { + return new VFCmpInst(P, LHS, RHS); + } + + //===--------------------------------------------------------------------===// + // Other Instructions + //===--------------------------------------------------------------------===// + + Value *CreateSelect(Constant *C, Constant *True, Constant *False) const { + return SelectInst::Create(C, True, False); + } + + Value *CreateExtractElement(Constant *Vec, Constant *Idx) const { + return new ExtractElementInst(Vec, Idx); + } + + Value *CreateInsertElement(Constant *Vec, Constant *NewElt, + Constant *Idx) const { + return InsertElementInst::Create(Vec, NewElt, Idx); + } + + Value *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { + return new ShuffleVectorInst(V1, V2, Mask); + } + + Value *CreateExtractValue(Constant *Agg, const unsigned *IdxList, + unsigned NumIdx) const { + return ExtractValueInst::Create(Agg, IdxList, IdxList+NumIdx); + } + + Value *CreateInsertValue(Constant *Agg, Constant *Val, + const unsigned *IdxList, unsigned NumIdx) const { + return InsertValueInst::Create(Agg, Val, IdxList, IdxList+NumIdx); + } +}; + +} + +#endif Modified: llvm/trunk/include/llvm/Support/TargetFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=54698&r1=54697&r2=54698&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/TargetFolder.h (original) +++ llvm/trunk/include/llvm/Support/TargetFolder.h Tue Aug 12 15:39:27 2008 @@ -154,8 +154,20 @@ // Compare Instructions //===--------------------------------------------------------------------===// - Constant *CreateCompare(CmpInst::Predicate P, Constant *LHS, - Constant *RHS) const { + Constant *CreateICmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); + } + Constant *CreateFCmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); + } + Constant *CreateVICmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { + return Fold(ConstantExpr::getCompare(P, LHS, RHS)); + } + Constant *CreateVFCmp(CmpInst::Predicate P, Constant *LHS, + Constant *RHS) const { return Fold(ConstantExpr::getCompare(P, LHS, RHS)); } From dalej at apple.com Tue Aug 12 16:02:09 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 12 Aug 2008 21:02:09 -0000 Subject: [llvm-commits] [llvm] r54700 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86TargetMachine.cpp Message-ID: <200808122102.m7CL2Atv013106@zion.cs.uiuc.edu> Author: johannes Date: Tue Aug 12 16:02:08 2008 New Revision: 54700 URL: http://llvm.org/viewvc/llvm-project?rev=54700&view=rev Log: Make x86-64 JIT changes Darwin-specific. Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=54700&r1=54699&r2=54700&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Aug 12 16:02:08 2008 @@ -525,7 +525,11 @@ emitPCRelativeBlockAddress(MO.getMBB()); } else if (MO.isGlobalAddress()) { // Assume undefined functions may be outside the Small codespace. - bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; + bool NeedStub = + (Is64BitMode && + (TM.getCodeModel() == CodeModel::Large || + TM.getSubtarget().isTargetDarwin())) || + Opcode == X86::TAILJMPd; emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, 0, 0, NeedStub); } else if (MO.isExternalSymbol()) { @@ -549,6 +553,9 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + // This should not occur on Darwin for relocatable objects. + if (Opcode == X86::MOV64ri) + rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -619,6 +626,8 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + if (Opcode == X86::MOV64ri32) + rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -654,6 +663,8 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + if (Opcode == X86::MOV64mi32) + rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO.isGlobalAddress()) { bool NeedStub = isa(MO.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=54700&r1=54699&r2=54700&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Aug 12 16:02:08 2008 @@ -194,14 +194,20 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - // Do not override 64-bit setting made in X86TargetMachine(). - if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) + // On Darwin, do not override 64-bit setting made in X86TargetMachine(). + if (DefRelocModel == Reloc::Default && + (!Subtarget.isTargetDarwin() || !Subtarget.is64Bit())) setRelocationModel(Reloc::Static); // 64-bit JIT places everything in the same buffer except external functions. - // Use small code model but hack the call instruction for externals. - if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Small); + // On Darwin, use small code model but hack the call instruction for + // externals. Elsewhere, do not assume globals are in the lower 4G. + if (Subtarget.is64Bit()) { + if (Subtarget.isTargetDarwin()) + setCodeModel(CodeModel::Small); + else + setCodeModel(CodeModel::Large); + } PM.add(createX86CodeEmitterPass(*this, MCE)); if (DumpAsm) From sabre at nondot.org Tue Aug 12 16:11:01 2008 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Aug 2008 16:11:01 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08/.htaccess Message-ID: <200808122111.m7CLB1hj013570@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08: .htaccess updated: 1.1 -> 1.2 --- Log message: add another mime type --- Diffs of the changes: (+1 -0) .htaccess | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/devmtg/2008-08/.htaccess diff -u llvm-www/devmtg/2008-08/.htaccess:1.1 llvm-www/devmtg/2008-08/.htaccess:1.2 --- llvm-www/devmtg/2008-08/.htaccess:1.1 Mon Aug 4 16:47:38 2008 +++ llvm-www/devmtg/2008-08/.htaccess Tue Aug 12 16:09:12 2008 @@ -2,3 +2,4 @@ AddType audio/x-m4a m4a AddType video/x-m4v m4v AddType video/mp4 mp4 +AddType video/3gpp 3gp From grosbach at apple.com Tue Aug 12 16:13:56 2008 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 12 Aug 2008 21:13:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54702 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> Author: grosbach Date: Tue Aug 12 16:13:55 2008 New Revision: 54702 URL: http://llvm.org/viewvc/llvm-project?rev=54702&view=rev Log: LLVM dylib needs the ARM backend as well. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=54702&r1=54701&r2=54702&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Tue Aug 12 16:13:55 2008 @@ -1152,10 +1152,10 @@ $(error Unsuported LLVM Target $(target)) endif -# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc backends. +# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc/arm backends. # See below for more details. ifdef BUILD_LLVM_INTO_A_DYLIB -LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc) +LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc arm) endif # We use llvm-config to determine the libraries that we need to link in our From grosbach at apple.com Tue Aug 12 16:16:20 2008 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 12 Aug 2008 21:16:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54703 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <200808122116.m7CLGL6A013872@zion.cs.uiuc.edu> Author: grosbach Date: Tue Aug 12 16:16:20 2008 New Revision: 54703 URL: http://llvm.org/viewvc/llvm-project?rev=54703&view=rev Log: Apple-style build symlinks to usr/bin to be based on targets, not hosts. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=54703&r1=54702&r2=54703&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Tue Aug 12 16:16:20 2008 @@ -575,9 +575,9 @@ ln -s -f ../llvm-gcc-$MAJ_VERS/bin/llvm-g++-$MAJ_VERS llvm-g++ || exit 1 # FIXME: This is a hack to get things working. -for h in $HOSTS ; do - ln -s -f ../llvm-gcc-$MAJ_VERS/bin/$h-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS $h-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS || exit 1 - ln -s -f ../llvm-gcc-$MAJ_VERS/bin/$h-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS $h-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS || exit 1 +for t in $TARGETS ; do + ln -s -f ../llvm-gcc-$MAJ_VERS/bin/$t-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS $t-apple-darwin$DARWIN_VERS-llvm-gcc-$MAJ_VERS || exit 1 + ln -s -f ../llvm-gcc-$MAJ_VERS/bin/$t-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS $t-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS || exit 1 done # Copy one of the libllvmgcc.dylib's up to libexec/gcc. From isanbard at gmail.com Tue Aug 12 16:55:54 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 21:55:54 -0000 Subject: [llvm-commits] [llvm] r54705 - /llvm/trunk/CREDITS.TXT Message-ID: <200808122155.m7CLtsbS015128@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 16:55:54 2008 New Revision: 54705 URL: http://llvm.org/viewvc/llvm-project?rev=54705&view=rev Log: Update. Remove bogus webpage. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=54705&r1=54704&r2=54705&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Tue Aug 12 16:55:54 2008 @@ -266,7 +266,6 @@ N: Bill Wendling E: isanbard at gmail.com -W: http://web.mac.com/bwendling/ D: Darwin exception handling D: MMX & SSSE3 instructions D: SPEC2006 support From isanbard at gmail.com Tue Aug 12 17:21:22 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 22:21:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54706 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200808122221.m7CMLMZw015930@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 17:21:20 2008 New Revision: 54706 URL: http://llvm.org/viewvc/llvm-project?rev=54706&view=rev Log: Test commit: Remove tabs. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=54706&r1=54705&r2=54706&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Aug 12 17:21:20 2008 @@ -82,7 +82,7 @@ #endif /* LLVM LOCAL end */ -#define OBJC_VOID_AT_END void_list_node +#define OBJC_VOID_AT_END void_list_node /* APPLE LOCAL radar 4506893 */ static bool in_objc_property_setter_name_context = false; @@ -104,15 +104,15 @@ if method names contain underscores. -- rms. */ #ifndef OBJC_GEN_METHOD_LABEL #define OBJC_GEN_METHOD_LABEL(BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME, NUM) \ - do { \ - char *temp; \ - sprintf ((BUF), "_%s_%s_%s_%s", \ - ((IS_INST) ? "i" : "c"), \ - (CLASS_NAME), \ - ((CAT_NAME)? (CAT_NAME) : ""), \ - (SEL_NAME)); \ - for (temp = (BUF); *temp; temp++) \ - if (*temp == ':') *temp = '_'; \ + do { \ + char *temp; \ + sprintf ((BUF), "_%s_%s_%s_%s", \ + ((IS_INST) ? "i" : "c"), \ + (CLASS_NAME), \ + ((CAT_NAME)? (CAT_NAME) : ""), \ + (SEL_NAME)); \ + for (temp = (BUF); *temp; temp++) \ + if (*temp == ':') *temp = '_'; \ } while (0) #endif /* APPLE LOCAL begin radar 4862848 */ @@ -175,8 +175,8 @@ #define NEW_PROTOCOL_VERSION 3 /* (Decide if these can ever be validly changed.) */ -#define OBJC_ENCODE_INLINE_DEFS 0 -#define OBJC_ENCODE_DONT_INLINE_DEFS 1 +#define OBJC_ENCODE_INLINE_DEFS 0 +#define OBJC_ENCODE_DONT_INLINE_DEFS 1 /*** Private Interface (procedures) ***/ @@ -14174,7 +14174,6 @@ /* APPLE LOCAL begin ObjC new abi */ /* APPLE LOCAL begin radar 5811191 - blocks */ decl = self_decl; -#ifndef OBJCPLUS if (cur_block) { /* Find a 'self' declaration in this block. If not found, @@ -14182,16 +14181,17 @@ if (lookup_name_in_block (DECL_NAME (decl), &decl)) decl = lookup_name (DECL_NAME (decl)); else { +#ifndef OBJCPLUS if (building_block_byref_decl) { warning (0, "ivar %qs may not be declared inside the 'byref' block - ignored", IDENTIFIER_POINTER (id)); return error_mark_node; } +#endif decl = build_block_ref_decl (DECL_NAME (decl), decl); } gcc_assert (decl); } -#endif base = build_indirect_ref (decl, "->"); /* APPLE LOCAL end radar 5811191 - blocks */ if ((ivar = objc_v2_build_ivar_ref (base, id))) From isanbard at gmail.com Tue Aug 12 18:15:46 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 12 Aug 2008 23:15:46 -0000 Subject: [llvm-commits] [llvm] r54707 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200808122315.m7CNFltQ017870@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 18:15:44 2008 New Revision: 54707 URL: http://llvm.org/viewvc/llvm-project?rev=54707&view=rev Log: Remove tabs. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=54707&r1=54706&r2=54707&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Aug 12 18:15:44 2008 @@ -988,7 +988,7 @@ // We permit two users of the load: setcc comparing against the null // pointer, and a getelementptr of a specific form. for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); - UI != E; ++UI) { + UI != E; ++UI) { // Comparison against null is ok. if (ICmpInst *ICI = dyn_cast(*UI)) { if (!isa(ICI->getOperand(1))) @@ -1611,7 +1611,7 @@ // See if the function address is passed as an argument. for (User::op_iterator i = User->op_begin() + 1, e = User->op_end(); - i != e; ++i) + i != e; ++i) if (*i == F) return false; } return true; From dalej at apple.com Tue Aug 12 18:20:24 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 12 Aug 2008 23:20:24 -0000 Subject: [llvm-commits] [llvm] r54708 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200808122320.m7CNKOTw018027@zion.cs.uiuc.edu> Author: johannes Date: Tue Aug 12 18:20:24 2008 New Revision: 54708 URL: http://llvm.org/viewvc/llvm-project?rev=54708&view=rev Log: When resolving a stub in x86-64 JIT, use a PC-relative branch rather than the absolute address if the target is within range. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=54708&r1=54707&r2=54708&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Tue Aug 12 18:20:24 2008 @@ -352,7 +352,8 @@ // Rewrite the call target... so that we don't end up here every time we // execute the call. #if defined (X86_64_JIT) - *(intptr_t *)(RetAddr - 0xa) = NewVal; + if (!isStub) + *(intptr_t *)(RetAddr - 0xa) = NewVal; #else *(intptr_t *)RetAddr = (intptr_t)(NewVal-RetAddr-4); #endif @@ -363,7 +364,18 @@ // when the requested function finally gets called. This also makes the // 0xCD byte (interrupt) dead, so the marker doesn't effect anything. #if defined (X86_64_JIT) - ((unsigned char*)RetAddr)[0] = (2 | (4 << 3) | (3 << 6)); + // If the target address is within 32-bit range of the stub, use a + // PC-relative branch instead of loading the actual address. (This is + // considerably shorter than the 64-bit immediate load already there.) + // We assume here intptr_t is 64 bits. + intptr_t diff = NewVal-RetAddr+7; + if (diff >= -2147483648LL && diff <= 2147483647LL) { + *(unsigned char*)(RetAddr-0xc) = 0xE9; + *(intptr_t *)(RetAddr-0xb) = diff & 0xffffffff; + } else { + *(intptr_t *)(RetAddr - 0xa) = NewVal; + ((unsigned char*)RetAddr)[0] = (2 | (4 << 3) | (3 << 6)); + } #else ((unsigned char*)RetAddr)[-1] = 0xE9; #endif From dpatel at apple.com Tue Aug 12 21:05:15 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Aug 2008 02:05:15 -0000 Subject: [llvm-commits] [llvm] r54710 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll Message-ID: <200808130205.m7D25GeJ023127@zion.cs.uiuc.edu> Author: dpatel Date: Tue Aug 12 21:05:14 2008 New Revision: 54710 URL: http://llvm.org/viewvc/llvm-project?rev=54710&view=rev Log: Check sign to detect overflow before changing compare stride. Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54710&r1=54709&r2=54710&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Aug 12 21:05:14 2008 @@ -1542,6 +1542,12 @@ Value *NewIncV = NULL; int64_t Scale = 1; + // Check stride constant and the comparision constant signs to detect + // overflow. + if (ICmpInst::isSignedPredicate(Predicate) && + (CmpVal & SignBit) != (CmpSSInt & SignBit)) + return Cond; + // Look for a suitable stride / iv as replacement. std::stable_sort(StrideOrder.begin(), StrideOrder.end(), StrideCompare()); for (unsigned i = 0, e = StrideOrder.size(); i != e; ++i) { @@ -1640,11 +1646,12 @@ // before the branch. See // test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-*.ll // for an example of this situation. - if (!Cond->hasOneUse()) + if (!Cond->hasOneUse()) { for (BasicBlock::iterator I = Cond, E = Cond->getParent()->end(); I != E; ++I) if (I == NewIncV) return Cond; + } if (NewCmpVal != CmpVal) { // Create a new compare instruction using new stride / iv. Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll?rev=54710&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll (added) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll Tue Aug 12 21:05:14 2008 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep add | count 2 +; PR 2662 + at g_3 = common global i16 0 ; [#uses=2] +@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] + +define void @func_1() nounwind { +entry: + br label %bb + +bb: ; preds = %bb, %entry + %l_2.0.reg2mem.0 = phi i16 [ 0, %entry ], [ %t1, %bb ] ; [#uses=2] + %t0 = shl i16 %l_2.0.reg2mem.0, 1 ; :0 [#uses=1] + volatile store i16 %t0, i16* @g_3, align 2 + %t1 = add i16 %l_2.0.reg2mem.0, -3 ; :1 [#uses=2] + %t2 = icmp slt i16 %t1, 1 ; :2 [#uses=1] + br i1 %t2, label %bb, label %return + +return: ; preds = %bb + ret void +} + +define i32 @main() nounwind { +entry: + tail call void @func_1( ) nounwind + volatile load i16* @g_3, align 2 ; :0 [#uses=1] + zext i16 %0 to i32 ; :1 [#uses=1] + tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %1 ) nounwind ; :2 [#uses=0] + ret i32 0 +} + +declare i32 @printf(i8*, ...) nounwind From isanbard at gmail.com Tue Aug 12 21:49:36 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 13 Aug 2008 02:49:36 -0000 Subject: [llvm-commits] [llvm] r54711 - /llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200808130249.m7D2nabB024565@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 21:49:35 2008 New Revision: 54711 URL: http://llvm.org/viewvc/llvm-project?rev=54711&view=rev Log: Pull r54692 into llvmCore-2064: In the absence of a linker to build the GOT, use the 32-bit non_lazy_ptr mechanism on x86-64 Darwin JIT. Fixes a bunch of last night's failures. Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp?rev=54711&r1=54710&r2=54711&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp Tue Aug 12 21:49:35 2008 @@ -251,7 +251,9 @@ } bool Emitter::gvNeedsLazyPtr(const GlobalValue *GV) { - return !Is64BitMode && + // For Darwin, simulate the linktime GOT by using the same lazy-pointer + // mechanism as 32-bit mode. + return (!Is64BitMode || TM.getSubtarget().isTargetDarwin()) && TM.getSubtarget().GVRequiresExtraLoad(GV, TM, false); } From isanbard at gmail.com Tue Aug 12 21:50:19 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 13 Aug 2008 02:50:19 -0000 Subject: [llvm-commits] [llvm] r54712 - in /llvm/tags/Apple/llvmCore-2064/lib/Target/X86: X86CodeEmitter.cpp X86TargetMachine.cpp Message-ID: <200808130250.m7D2oKLZ024599@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 21:50:19 2008 New Revision: 54712 URL: http://llvm.org/viewvc/llvm-project?rev=54712&view=rev Log: Pull r54700 into llvmCore-2064: Make x86-64 JIT changes Darwin-specific. Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp?rev=54712&r1=54711&r2=54712&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86CodeEmitter.cpp Tue Aug 12 21:50:19 2008 @@ -525,7 +525,11 @@ emitPCRelativeBlockAddress(MO.getMBB()); } else if (MO.isGlobalAddress()) { // Assume undefined functions may be outside the Small codespace. - bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd; + bool NeedStub = + (Is64BitMode && + (TM.getCodeModel() == CodeModel::Large || + TM.getSubtarget().isTargetDarwin())) || + Opcode == X86::TAILJMPd; emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word, 0, 0, NeedStub); } else if (MO.isExternalSymbol()) { @@ -549,6 +553,9 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + // This should not occur on Darwin for relocatable objects. + if (Opcode == X86::MOV64ri) + rt = X86::reloc_absolute_dword; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -619,6 +626,8 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + if (Opcode == X86::MOV64ri32) + rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO1.isGlobalAddress()) { bool NeedStub = isa(MO1.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO1.getGlobal()); @@ -654,6 +663,8 @@ else { unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word); + if (Opcode == X86::MOV64mi32) + rt = X86::reloc_absolute_word; // FIXME: add X86II flag? if (MO.isGlobalAddress()) { bool NeedStub = isa(MO.getGlobal()); bool isLazy = gvNeedsLazyPtr(MO.getGlobal()); Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp?rev=54712&r1=54711&r2=54712&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86TargetMachine.cpp Tue Aug 12 21:50:19 2008 @@ -194,14 +194,20 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - // Do not override 64-bit setting made in X86TargetMachine(). - if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit()) + // On Darwin, do not override 64-bit setting made in X86TargetMachine(). + if (DefRelocModel == Reloc::Default && + (!Subtarget.isTargetDarwin() || !Subtarget.is64Bit())) setRelocationModel(Reloc::Static); // 64-bit JIT places everything in the same buffer except external functions. - // Use small code model but hack the call instruction for externals. - if (Subtarget.is64Bit()) - setCodeModel(CodeModel::Small); + // On Darwin, use small code model but hack the call instruction for + // externals. Elsewhere, do not assume globals are in the lower 4G. + if (Subtarget.is64Bit()) { + if (Subtarget.isTargetDarwin()) + setCodeModel(CodeModel::Small); + else + setCodeModel(CodeModel::Large); + } PM.add(createX86CodeEmitterPass(*this, MCE)); if (DumpAsm) From isanbard at gmail.com Tue Aug 12 21:50:50 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 13 Aug 2008 02:50:50 -0000 Subject: [llvm-commits] [llvm] r54713 - /llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp Message-ID: <200808130250.m7D2ooSE024627@zion.cs.uiuc.edu> Author: void Date: Tue Aug 12 21:50:50 2008 New Revision: 54713 URL: http://llvm.org/viewvc/llvm-project?rev=54713&view=rev Log: Pull r54708 into llvmCore-2064: When resolving a stub in x86-64 JIT, use a PC-relative branch rather than the absolute address if the target is within range. Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp Modified: llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp?rev=54713&r1=54712&r2=54713&view=diff ============================================================================== --- llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/tags/Apple/llvmCore-2064/lib/Target/X86/X86JITInfo.cpp Tue Aug 12 21:50:50 2008 @@ -352,7 +352,8 @@ // Rewrite the call target... so that we don't end up here every time we // execute the call. #if defined (X86_64_JIT) - *(intptr_t *)(RetAddr - 0xa) = NewVal; + if (!isStub) + *(intptr_t *)(RetAddr - 0xa) = NewVal; #else *(intptr_t *)RetAddr = (intptr_t)(NewVal-RetAddr-4); #endif @@ -363,7 +364,18 @@ // when the requested function finally gets called. This also makes the // 0xCD byte (interrupt) dead, so the marker doesn't effect anything. #if defined (X86_64_JIT) - ((unsigned char*)RetAddr)[0] = (2 | (4 << 3) | (3 << 6)); + // If the target address is within 32-bit range of the stub, use a + // PC-relative branch instead of loading the actual address. (This is + // considerably shorter than the 64-bit immediate load already there.) + // We assume here intptr_t is 64 bits. + intptr_t diff = NewVal-RetAddr+7; + if (diff >= -2147483648LL && diff <= 2147483647LL) { + *(unsigned char*)(RetAddr-0xc) = 0xE9; + *(intptr_t *)(RetAddr-0xb) = diff & 0xffffffff; + } else { + *(intptr_t *)(RetAddr - 0xa) = NewVal; + ((unsigned char*)RetAddr)[0] = (2 | (4 << 3) | (3 << 6)); + } #else ((unsigned char*)RetAddr)[-1] = 0xE9; #endif From kremenek at apple.com Tue Aug 12 22:55:40 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 13 Aug 2008 03:55:40 -0000 Subject: [llvm-commits] [llvm] r54718 - /llvm/tags/checker/checker-76/ Message-ID: <200808130355.m7D3tepQ026440@zion.cs.uiuc.edu> Author: kremenek Date: Tue Aug 12 22:55:40 2008 New Revision: 54718 URL: http://llvm.org/viewvc/llvm-project?rev=54718&view=rev Log: Tagging checker-76. Added: llvm/tags/checker/checker-76/ - copied from r54717, llvm/trunk/ From bruno.cardoso at gmail.com Wed Aug 13 02:13:41 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Wed, 13 Aug 2008 07:13:41 -0000 Subject: [llvm-commits] [llvm] r54724 - in /llvm/trunk/lib/Target/Mips: MipsAsmPrinter.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrInfo.td MipsSubtarget.cpp Message-ID: <200808130713.m7D7DfDW032554@zion.cs.uiuc.edu> Author: bruno Date: Wed Aug 13 02:13:40 2008 New Revision: 54724 URL: http://llvm.org/viewvc/llvm-project?rev=54724&view=rev Log: Removed SELECT_CC custom lowering. This is not needed anymore, the SELECT node is lowered properly and covers everything LowerSELECT_CC did. Added method printUnsignedImm in AsmPrinter to print uimm16 operands. This avoid the ugly instruction by instruction checking in printOperand. Added a swap instruction present in the allegrex core. Added two conditional instructions present in the allegrex core : MOVZ and MOVN. They both allow a more efficient SELECT operation for integers. Also added SELECT patterns to optimize MOVZ and MOVN usage. The brcond and setcc patterns were cleaned: redundant and suboptimal patterns were removed. The suboptimals were replaced by more efficient ones. Fixed some instructions that were using immZExt16 instead of immSExt16. Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=54724&r1=54723&r2=54724&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Wed Aug 13 02:13:40 2008 @@ -62,6 +62,7 @@ bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); void printOperand(const MachineInstr *MI, int opNum); + void printUnsignedImm(const MachineInstr *MI, int opNum); void printMemOperand(const MachineInstr *MI, int opNum, const char *Modifier = 0); void printFCCOperand(const MachineInstr *MI, int opNum, @@ -383,11 +384,7 @@ break; case MachineOperand::MO_Immediate: - if ((MI->getOpcode() == Mips::SLTiu) || (MI->getOpcode() == Mips::ORi) || - (MI->getOpcode() == Mips::LUi) || (MI->getOpcode() == Mips::ANDi)) - O << (unsigned short int)MO.getImm(); - else - O << (short int)MO.getImm(); + O << (short int)MO.getImm(); break; case MachineOperand::MO_MachineBasicBlock: @@ -407,7 +404,6 @@ << '_' << MO.getIndex(); break; - // FIXME: Verify correct case MachineOperand::MO_ConstantPoolIndex: O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_" << MO.getIndex(); @@ -421,6 +417,16 @@ } void MipsAsmPrinter:: +printUnsignedImm(const MachineInstr *MI, int opNum) +{ + const MachineOperand &MO = MI->getOperand(opNum); + if (MO.getType() == MachineOperand::MO_Immediate) + O << (unsigned short int)MO.getImm(); + else + printOperand(MI, opNum); +} + +void MipsAsmPrinter:: printMemOperand(const MachineInstr *MI, int opNum, const char *Modifier) { // when using stack locations for not load/store instructions Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=54724&r1=54723&r2=54724&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Wed Aug 13 02:13:40 2008 @@ -46,6 +46,7 @@ case MipsISD::Lo : return "MipsISD::Lo"; case MipsISD::GPRel : return "MipsISD::GPRel"; case MipsISD::Ret : return "MipsISD::Ret"; + case MipsISD::CMov : return "MipsISD::CMov"; case MipsISD::SelectCC : return "MipsISD::SelectCC"; case MipsISD::FPSelectCC : return "MipsISD::FPSelectCC"; case MipsISD::FPBrcond : return "MipsISD::FPBrcond"; @@ -99,7 +100,6 @@ setOperationAction(ISD::ConstantPool, MVT::i32, Custom); setOperationAction(ISD::SELECT, MVT::f32, Custom); setOperationAction(ISD::SELECT, MVT::i32, Custom); - setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); setOperationAction(ISD::SETCC, MVT::f32, Custom); setOperationAction(ISD::BRCOND, MVT::Other, Custom); setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom); @@ -120,8 +120,6 @@ setOperationAction(ISD::CTPOP, MVT::i32, Expand); setOperationAction(ISD::CTTZ, MVT::i32, Expand); setOperationAction(ISD::ROTL, MVT::i32, Expand); - setOperationAction(ISD::ROTR, MVT::i32, Expand); - setOperationAction(ISD::BSWAP, MVT::i32, Expand); setOperationAction(ISD::SHL_PARTS, MVT::i32, Expand); setOperationAction(ISD::SRA_PARTS, MVT::i32, Expand); setOperationAction(ISD::SRL_PARTS, MVT::i32, Expand); @@ -149,6 +147,9 @@ if (!Subtarget->hasBitCount()) setOperationAction(ISD::CTLZ, MVT::i32, Expand); + if (!Subtarget->hasSwap()) + setOperationAction(ISD::BSWAP, MVT::i32, Expand); + setStackPointerRegisterToSaveRestore(Mips::SP); computeRegisterProperties(); } @@ -176,7 +177,6 @@ case ISD::OR: return LowerANDOR(Op, DAG); case ISD::RET: return LowerRET(Op, DAG); case ISD::SELECT: return LowerSELECT(Op, DAG); - case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG); case ISD::SETCC: return LowerSETCC(Op, DAG); } return SDValue(); @@ -450,32 +450,24 @@ SDValue True = Op.getOperand(1); SDValue False = Op.getOperand(2); - // if the incomming condition comes from fpcmp, the select - // operation must use FPSelectCC, otherwise SelectCC. - if (Cond.getOpcode() != MipsISD::FPCmp) + // if the incomming condition comes from a integer compare, the select + // operation must be SelectCC or a conditional move if the subtarget + // supports it. + if (Cond.getOpcode() != MipsISD::FPCmp) { + if (Subtarget->hasCondMov() && !True.getValueType().isFloatingPoint()) + return Op; return DAG.getNode(MipsISD::SelectCC, True.getValueType(), Cond, True, False); - + } + + // if the incomming condition comes from fpcmp, the select + // operation must use FPSelectCC. SDValue CCNode = Cond.getOperand(2); return DAG.getNode(MipsISD::FPSelectCC, True.getValueType(), Cond, True, False, CCNode); } SDValue MipsTargetLowering:: -LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) -{ - SDValue LHS = Op.getOperand(0); - SDValue RHS = Op.getOperand(1); - SDValue True = Op.getOperand(2); - SDValue False = Op.getOperand(3); - SDValue CC = Op.getOperand(4); - - SDValue SetCCRes = DAG.getNode(ISD::SETCC, LHS.getValueType(), LHS, RHS, CC); - return DAG.getNode(MipsISD::SelectCC, True.getValueType(), - SetCCRes, True, False); -} - -SDValue MipsTargetLowering:: LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) { GlobalValue *GV = cast(Op)->getGlobal(); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=54724&r1=54723&r2=54724&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Wed Aug 13 02:13:40 2008 @@ -40,6 +40,9 @@ // Handle gp_rel (small data/bss sections) relocation. GPRel, + // Conditional Move + CMov, + // Select CC Pseudo Instruction SelectCC, @@ -99,7 +102,6 @@ SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); SDValue LowerRET(SDValue Op, SelectionDAG &DAG); - SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG); SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG); SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=54724&r1=54723&r2=54724&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Wed Aug 13 02:13:40 2008 @@ -21,6 +21,9 @@ def SDT_MipsJmpLink : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>; def SDT_MipsSelectCC : SDTypeProfile<1, 3, [SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>, SDTCisInt<1>]>; +def SDT_MipsCMov : SDTypeProfile<1, 4, [SDTCisSameAs<0, 1>, + SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, + SDTCisInt<4>]>; def SDT_MipsCallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; def SDT_MipsCallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>; @@ -48,11 +51,16 @@ // Select Condition Code def MipsSelectCC : SDNode<"MipsISD::SelectCC", SDT_MipsSelectCC>; +// Conditional Move +def MipsCMov : SDNode<"MipsISD::CMov", SDT_MipsCMov>; + //===----------------------------------------------------------------------===// // Mips Instruction Predicate Definitions. //===----------------------------------------------------------------------===// def HasSEInReg : Predicate<"Subtarget.hasSEInReg()">; def HasBitCount : Predicate<"Subtarget.hasBitCount()">; +def HasSwap : Predicate<"Subtarget.hasSwap()">; +def HasCondMov : Predicate<"Subtarget.hasCondMov()">; //===----------------------------------------------------------------------===// // Mips Operand, Complex Patterns and Transformations Definitions. @@ -61,10 +69,14 @@ // Instruction operand types def brtarget : Operand; def calltarget : Operand; -def uimm16 : Operand; def simm16 : Operand; def shamt : Operand; +// Unsigned Operand +def uimm16 : Operand { + let PrintMethod = "printUnsignedImm"; +} + // Address operand def mem : Operand { let PrintMethod = "printMemOperand"; @@ -143,6 +155,14 @@ !strconcat(instr_asm, "\t$dst, $b, $c"), [(set CPURegs:$dst, (OpNode CPURegs:$b, imm_type:$c))], IIAlu>; +class ArithOverflowI op, string instr_asm, SDNode OpNode, + Operand Od, PatLeaf imm_type> : + FI< op, + (outs CPURegs:$dst), + (ins CPURegs:$b, Od:$c), + !strconcat(instr_asm, "\t$dst, $b, $c"), + [], IIAlu>; + // Arithmetic Multiply ADD/SUB let rd=0 in class MArithR func, string instr_asm> : @@ -352,6 +372,18 @@ !strconcat(instr_asm, "\t$dst, $src"), [(set CPURegs:$dst, (sext_inreg CPURegs:$src, vt))], NoItinerary>; +// Byte Swap +class ByteSwap func, string instr_asm>: + FR< 0x1f, func, (outs CPURegs:$dst), (ins CPURegs:$src), + !strconcat(instr_asm, "\t$dst, $src"), + [(set CPURegs:$dst, (bswap CPURegs:$src))], NoItinerary>; + +// Conditional Move +class CondMov func, string instr_asm, PatLeaf MovCode>: + FR< 0x00, func, (outs CPURegs:$dst), (ins CPURegs:$F, CPURegs:$T, + CPURegs:$cond), !strconcat(instr_asm, "\t$dst, $T, $cond"), + [(set CPURegs:$dst, (MipsCMov CPURegs:$F, CPURegs:$T, + CPURegs:$cond, MovCode))], NoItinerary>; //===----------------------------------------------------------------------===// // Pseudo instructions @@ -402,10 +434,10 @@ //===----------------------------------------------------------------------===// /// Arithmetic Instructions (ALU Immediate) -def ADDiu : ArithI<0x09, "addiu", add, uimm16, immZExt16>; -def ADDi : ArithI<0x08, "addi", add, simm16, immSExt16>; +def ADDiu : ArithI<0x09, "addiu", add, simm16, immSExt16>; +def ADDi : ArithOverflowI<0x08, "addi", add, simm16, immSExt16>; def SLTi : SetCC_I<0x0a, "slti", setlt, simm16, immSExt16>; -def SLTiu : SetCC_I<0x0b, "sltiu", setult, uimm16, immZExt16>; +def SLTiu : SetCC_I<0x0b, "sltiu", setult, simm16, immSExt16>; def ANDi : LogicI<0x0c, "andi", and>; def ORi : LogicI<0x0d, "ori", or>; def XORi : LogicI<0x0e, "xori", xor>; @@ -495,8 +527,23 @@ /// Count Leading let Predicates = [HasBitCount] in { - def CLZ : CountLeading<0b010110, "clz", ctlz>; -//def CLO : CountLeading<0b010110, "clo">; + let rt = 0 in + def CLZ : CountLeading<0b010110, "clz", ctlz>; +} + +/// Byte Swap +let Predicates = [HasSwap] in { + let shamt = 0x3, rs = 0 in + def WSBW : ByteSwap<0x20, "wsbw">; +} + +/// Conditional Move +def MIPS_CMOV_ZERO : PatLeaf<(i32 0)>; +def MIPS_CMOV_NZERO : PatLeaf<(i32 1)>; + +let Predicates = [HasCondMov], isTwoAddress = 1 in { + def MOVN : CondMov<0x0a, "movn", MIPS_CMOV_NZERO>; + def MOVZ : CondMov<0x0b, "movz", MIPS_CMOV_ZERO>; } /// No operation @@ -573,55 +620,65 @@ (NOR CPURegs:$in, ZERO)>; // extended load and stores -def : Pat<(i32 (extloadi1 addr:$src)), (LBu addr:$src)>; -def : Pat<(i32 (extloadi8 addr:$src)), (LBu addr:$src)>; -def : Pat<(i32 (extloadi16 addr:$src)), (LHu addr:$src)>; +def : Pat<(extloadi1 addr:$src), (LBu addr:$src)>; +def : Pat<(extloadi8 addr:$src), (LBu addr:$src)>; +def : Pat<(extloadi16 addr:$src), (LHu addr:$src)>; // peepholes def : Pat<(store (i32 0), addr:$dst), (SW ZERO, addr:$dst)>; // brcond patterns -// direct match equal/notequal zero branches def : Pat<(brcond (setne CPURegs:$lhs, 0), bb:$dst), (BNE CPURegs:$lhs, ZERO, bb:$dst)>; def : Pat<(brcond (seteq CPURegs:$lhs, 0), bb:$dst), (BEQ CPURegs:$lhs, ZERO, bb:$dst)>; def : Pat<(brcond (setge CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BGEZ (SUB CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; + (BEQ (SLT CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; def : Pat<(brcond (setuge CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BGEZ (SUBu CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; - -def : Pat<(brcond (setgt CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BGTZ (SUB CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; -def : Pat<(brcond (setugt CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BGTZ (SUBu CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; + (BEQ (SLTu CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; +def : Pat<(brcond (setge CPURegs:$lhs, immSExt16:$rhs), bb:$dst), + (BEQ (SLTi CPURegs:$lhs, immSExt16:$rhs), ZERO, bb:$dst)>; +def : Pat<(brcond (setuge CPURegs:$lhs, immSExt16:$rhs), bb:$dst), + (BEQ (SLTiu CPURegs:$lhs, immSExt16:$rhs), ZERO, bb:$dst)>; def : Pat<(brcond (setle CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BLEZ (SUB CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; + (BEQ (SLT CPURegs:$rhs, CPURegs:$lhs), ZERO, bb:$dst)>; def : Pat<(brcond (setule CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BLEZ (SUBu CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; - -def : Pat<(brcond (setlt CPURegs:$lhs, immSExt16:$rhs), bb:$dst), - (BNE (SLTi CPURegs:$lhs, immSExt16:$rhs), ZERO, bb:$dst)>; -def : Pat<(brcond (setult CPURegs:$lhs, immZExt16:$rhs), bb:$dst), - (BNE (SLTiu CPURegs:$lhs, immZExt16:$rhs), ZERO, bb:$dst)>; -def : Pat<(brcond (setlt CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BNE (SLT CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; -def : Pat<(brcond (setult CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BNE (SLTu CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; - -def : Pat<(brcond (setlt CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BLTZ (SUB CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; -def : Pat<(brcond (setult CPURegs:$lhs, CPURegs:$rhs), bb:$dst), - (BLTZ (SUBu CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>; + (BEQ (SLTu CPURegs:$rhs, CPURegs:$lhs), ZERO, bb:$dst)>; -// generic brcond pattern def : Pat<(brcond CPURegs:$cond, bb:$dst), (BNE CPURegs:$cond, ZERO, bb:$dst)>; -// setcc patterns, only matched when there -// is no brcond following a setcc operation +// select patterns +def : Pat<(select (setge CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLT CPURegs:$lhs, CPURegs:$rhs))>; +def : Pat<(select (setuge CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLTu CPURegs:$lhs, CPURegs:$rhs))>; +def : Pat<(select (setge CPURegs:$lhs, immSExt16:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLTi CPURegs:$lhs, immSExt16:$rhs))>; +def : Pat<(select (setuge CPURegs:$lh, immSExt16:$rh), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLTiu CPURegs:$lh, immSExt16:$rh))>; + +def : Pat<(select (setle CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLT CPURegs:$rhs, CPURegs:$lhs))>; +def : Pat<(select (setule CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (SLTu CPURegs:$rhs, CPURegs:$lhs))>; + +def : Pat<(select (seteq CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVZ CPURegs:$F, CPURegs:$T, (XOR CPURegs:$lhs, CPURegs:$rhs))>; +def : Pat<(select (setne CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), + (MOVN CPURegs:$F, CPURegs:$T, (XOR CPURegs:$lhs, CPURegs:$rhs))>; + +def : Pat<(select CPURegs:$cond, CPURegs:$T, CPURegs:$F), + (MOVN CPURegs:$F, CPURegs:$T, CPURegs:$cond)>; + +// setcc patterns +def : Pat<(seteq CPURegs:$lhs, CPURegs:$rhs), + (SLTu (XOR CPURegs:$lhs, CPURegs:$rhs), 1)>; +def : Pat<(setne CPURegs:$lhs, CPURegs:$rhs), + (SLTu ZERO, (XOR CPURegs:$lhs, CPURegs:$rhs))>; + def : Pat<(setle CPURegs:$lhs, CPURegs:$rhs), (XORi (SLT CPURegs:$rhs, CPURegs:$lhs), 1)>; def : Pat<(setule CPURegs:$lhs, CPURegs:$rhs), @@ -637,18 +694,10 @@ def : Pat<(setuge CPURegs:$lhs, CPURegs:$rhs), (XORi (SLTu CPURegs:$lhs, CPURegs:$rhs), 1)>; -def : Pat<(setne CPURegs:$lhs, CPURegs:$rhs), - (OR (SLT CPURegs:$lhs, CPURegs:$rhs), - (SLT CPURegs:$rhs, CPURegs:$lhs))>; - -def : Pat<(seteq CPURegs:$lhs, CPURegs:$rhs), - (XORi (OR (SLT CPURegs:$lhs, CPURegs:$rhs), - (SLT CPURegs:$rhs, CPURegs:$lhs)), 1)>; - def : Pat<(setge CPURegs:$lhs, immSExt16:$rhs), (XORi (SLTi CPURegs:$lhs, immSExt16:$rhs), 1)>; -def : Pat<(setuge CPURegs:$lhs, immZExt16:$rhs), - (XORi (SLTiu CPURegs:$lhs, immZExt16:$rhs), 1)>; +def : Pat<(setuge CPURegs:$lhs, immSExt16:$rhs), + (XORi (SLTiu CPURegs:$lhs, immSExt16:$rhs), 1)>; //===----------------------------------------------------------------------===// // Floating Point Support Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=54724&r1=54723&r2=54724&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Wed Aug 13 02:13:40 2008 @@ -58,6 +58,8 @@ HasVFPU = true; // Enables Allegrex Vector FPU (not supported yet) HasSEInReg = true; HasBitCount = true; + HasSwap = true; + HasCondMov = true; } // Abicall is the default for O32 ABI and is ignored From baldrick at free.fr Wed Aug 13 03:56:51 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 13 Aug 2008 08:56:51 -0000 Subject: [llvm-commits] [llvm] r54725 - in /llvm/trunk/include/llvm/Support: NoFolder.h NullFolder.h Message-ID: <200808130856.m7D8up4Z017289@zion.cs.uiuc.edu> Author: baldrick Date: Wed Aug 13 03:56:48 2008 New Revision: 54725 URL: http://llvm.org/viewvc/llvm-project?rev=54725&view=rev Log: Rename this, in case people think that NullFolder has something to do with folding null values. Added: llvm/trunk/include/llvm/Support/NoFolder.h (contents, props changed) - copied, changed from r54698, llvm/trunk/include/llvm/Support/NullFolder.h Removed: llvm/trunk/include/llvm/Support/NullFolder.h Copied: llvm/trunk/include/llvm/Support/NoFolder.h (from r54698, llvm/trunk/include/llvm/Support/NullFolder.h) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?p2=llvm/trunk/include/llvm/Support/NoFolder.h&p1=llvm/trunk/include/llvm/Support/NullFolder.h&r1=54698&r2=54725&rev=54725&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/NullFolder.h (original) +++ llvm/trunk/include/llvm/Support/NoFolder.h Wed Aug 13 03:56:48 2008 @@ -1,4 +1,4 @@ -//=====-- llvm/Support/NullFolder.h - Constant folding helper -*- C++ -*-=====// +//======-- llvm/Support/NoFolder.h - Constant folding helper -*- C++ -*-======// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines the NullFolder class, a helper for IRBuilder. It provides +// This file defines the NoFolder class, a helper for IRBuilder. It provides // IRBuilder with a set of methods for creating unfolded constants. This is // useful for learners trying to understand how LLVM IR works, and who don't // want details to be hidden by the constant folder. For general constant @@ -28,8 +28,8 @@ namespace llvm { -/// NullFolder - Create "constants" (actually, values) with no folding. -class NullFolder { +/// NoFolder - Create "constants" (actually, values) with no folding. +class NoFolder { public: //===--------------------------------------------------------------------===// Propchange: llvm/trunk/include/llvm/Support/NoFolder.h ------------------------------------------------------------------------------ svn:mergeinfo = Removed: llvm/trunk/include/llvm/Support/NullFolder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NullFolder.h?rev=54724&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/NullFolder.h (original) +++ llvm/trunk/include/llvm/Support/NullFolder.h (removed) @@ -1,178 +0,0 @@ -//=====-- llvm/Support/NullFolder.h - Constant folding helper -*- C++ -*-=====// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the NullFolder class, a helper for IRBuilder. It provides -// IRBuilder with a set of methods for creating unfolded constants. This is -// useful for learners trying to understand how LLVM IR works, and who don't -// want details to be hidden by the constant folder. For general constant -// creation and folding, use ConstantExpr and the routines in -// llvm/Analysis/ConstantFolding.h. -// -// Note: since it is not actually possible to create unfolded constants, this -// class returns values rather than constants. The values do not have names, -// even if names were provided to IRBuilder, which may be confusing. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_NULLFOLDER_H -#define LLVM_SUPPORT_NULLFOLDER_H - -#include "llvm/Constants.h" -#include "llvm/Instructions.h" - -namespace llvm { - -/// NullFolder - Create "constants" (actually, values) with no folding. -class NullFolder { -public: - - //===--------------------------------------------------------------------===// - // Binary Operators - //===--------------------------------------------------------------------===// - - Value *CreateAdd(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateAdd(LHS, RHS); - } - Value *CreateSub(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateSub(LHS, RHS); - } - Value *CreateMul(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateMul(LHS, RHS); - } - Value *CreateUDiv(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateUDiv(LHS, RHS); - } - Value *CreateSDiv(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateSDiv(LHS, RHS); - } - Value *CreateFDiv(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateFDiv(LHS, RHS); - } - Value *CreateURem(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateURem(LHS, RHS); - } - Value *CreateSRem(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateSRem(LHS, RHS); - } - Value *CreateFRem(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateFRem(LHS, RHS); - } - Value *CreateShl(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateShl(LHS, RHS); - } - Value *CreateLShr(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateLShr(LHS, RHS); - } - Value *CreateAShr(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateAShr(LHS, RHS); - } - Value *CreateAnd(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateAnd(LHS, RHS); - } - Value *CreateOr(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateOr(LHS, RHS); - } - Value *CreateXor(Constant *LHS, Constant *RHS) const { - return BinaryOperator::CreateXor(LHS, RHS); - } - - Value *CreateBinOp(Instruction::BinaryOps Opc, - Constant *LHS, Constant *RHS) const { - return BinaryOperator::Create(Opc, LHS, RHS); - } - - //===--------------------------------------------------------------------===// - // Unary Operators - //===--------------------------------------------------------------------===// - - Value *CreateNeg(Constant *C) const { - return BinaryOperator::CreateNeg(C); - } - Value *CreateNot(Constant *C) const { - return BinaryOperator::CreateNot(C); - } - - //===--------------------------------------------------------------------===// - // Memory Instructions - //===--------------------------------------------------------------------===// - - Constant *CreateGetElementPtr(Constant *C, Constant* const *IdxList, - unsigned NumIdx) const { - return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); - } - Value *CreateGetElementPtr(Constant *C, Value* const *IdxList, - unsigned NumIdx) const { - return GetElementPtrInst::Create(C, IdxList, IdxList+NumIdx); - } - - //===--------------------------------------------------------------------===// - // Cast/Conversion Operators - //===--------------------------------------------------------------------===// - - Value *CreateCast(Instruction::CastOps Op, Constant *C, - const Type *DestTy) const { - return CastInst::Create(Op, C, DestTy); - } - Value *CreateIntCast(Constant *C, const Type *DestTy, - bool isSigned) const { - return CastInst::CreateIntegerCast(C, DestTy, isSigned); - } - - //===--------------------------------------------------------------------===// - // Compare Instructions - //===--------------------------------------------------------------------===// - - Value *CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return new ICmpInst(P, LHS, RHS); - } - Value *CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return new FCmpInst(P, LHS, RHS); - } - Value *CreateVICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return new VICmpInst(P, LHS, RHS); - } - Value *CreateVFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const { - return new VFCmpInst(P, LHS, RHS); - } - - //===--------------------------------------------------------------------===// - // Other Instructions - //===--------------------------------------------------------------------===// - - Value *CreateSelect(Constant *C, Constant *True, Constant *False) const { - return SelectInst::Create(C, True, False); - } - - Value *CreateExtractElement(Constant *Vec, Constant *Idx) const { - return new ExtractElementInst(Vec, Idx); - } - - Value *CreateInsertElement(Constant *Vec, Constant *NewElt, - Constant *Idx) const { - return InsertElementInst::Create(Vec, NewElt, Idx); - } - - Value *CreateShuffleVector(Constant *V1, Constant *V2, Constant *Mask) const { - return new ShuffleVectorInst(V1, V2, Mask); - } - - Value *CreateExtractValue(Constant *Agg, const unsigned *IdxList, - unsigned NumIdx) const { - return ExtractValueInst::Create(Agg, IdxList, IdxList+NumIdx); - } - - Value *CreateInsertValue(Constant *Agg, Constant *Val, - const unsigned *IdxList, unsigned NumIdx) const { - return InsertValueInst::Create(Agg, Val, IdxList, IdxList+NumIdx); - } -}; - -} - -#endif From resistor at mac.com Wed Aug 13 12:25:46 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 17:25:46 -0000 Subject: [llvm-commits] [llvm] r54741 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200808131725.m7DHPlfW006346@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 12:25:42 2008 New Revision: 54741 URL: http://llvm.org/viewvc/llvm-project?rev=54741&view=rev Log: 1) Merge entire live intervals instead of parts of them. 2) Conditionalize temporary insertion if we don't need it. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54741&r1=54740&r2=54741&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Aug 13 12:25:42 2008 @@ -141,8 +141,7 @@ void ScheduleCopies(MachineBasicBlock* MBB, std::set& pushed); void InsertCopies(MachineDomTreeNode* MBB, SmallPtrSet& v); - void mergeLiveIntervals(unsigned primary, unsigned secondary, - MachineBasicBlock* pred); + void mergeLiveIntervals(unsigned primary, unsigned secondary); }; } @@ -725,16 +724,29 @@ if (!copy_set.empty()) { std::pair curr = *copy_set.begin(); copy_set.erase(curr.first); - - const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(curr.first); - - // Insert a copy from dest to a new temporary t at the end of b - unsigned t = MF->getRegInfo().createVirtualRegister(RC); - TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), t, - curr.second, RC, RC); - map[curr.second] = t; - worklist.insert(curr); + + LiveInterval& I = LI.getInterval(curr.second); + MachineBasicBlock::iterator term = MBB->getFirstTerminator(); + unsigned endIdx = 0; + if (term != MBB->end()) + endIdx = LI.getInstructionIndex(term); + else + endIdx = LI.getMBBEndIdx(MBB); + + if (I.liveAt(endIdx)) { + const TargetRegisterClass *RC = + MF->getRegInfo().getRegClass(curr.first); + + // Insert a copy from dest to a new temporary t at the end of b + unsigned t = MF->getRegInfo().createVirtualRegister(RC); + TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), t, + curr.second, RC, RC); + map[curr.second] = t; + + MachineBasicBlock::iterator TI = MBB->getFirstTerminator(); + InsertedPHIDests.push_back(std::make_pair(t, --TI)); + } } } @@ -749,11 +761,13 @@ // PHI, we don't create multiple overlapping live intervals. std::set RegHandled; for (SmallVector, 4>::iterator I = - InsertedPHIDests.begin(), E = InsertedPHIDests.end(); I != E; ++I) + InsertedPHIDests.begin(), E = InsertedPHIDests.end(); I != E; ++I) { + unsigned bar = 0; if (RegHandled.insert(I->first).second && !LI.getOrCreateInterval(I->first).liveAt( LI.getMBBEndIdx(I->second->getParent()))) LI.addLiveRangeToEndOfBlock(I->first, I->second); + } } /// InsertCopies - insert copies into MBB and all of its successors @@ -816,63 +830,23 @@ } void StrongPHIElimination::mergeLiveIntervals(unsigned primary, - unsigned secondary, - MachineBasicBlock* pred) { + unsigned secondary) { LiveIntervals& LI = getAnalysis(); LiveInterval& LHS = LI.getOrCreateInterval(primary); LiveInterval& RHS = LI.getOrCreateInterval(secondary); LI.computeNumbering(); - const LiveRange* RangeMergingIn = - RHS.getLiveRangeContaining(LI.getMBBEndIdx(pred)); - VNInfo* RHSVN = RangeMergingIn->valno; - VNInfo* NewVN = LHS.getNextValue(RangeMergingIn->valno->def, - RangeMergingIn->valno->copy, - LI.getVNInfoAllocator()); - - // If we discover that a live range was defined by a two-addr - // instruction, we need to merge over the input as well, even if - // it has a different VNInfo. - SmallPtrSet MergedVNs; - MergedVNs.insert(RHSVN); - + + SmallVector VNSet (RHS.vni_begin(), RHS.vni_end()); DenseMap VNMap; - VNMap.insert(std::make_pair(RangeMergingIn->valno, NewVN)); - - // Find all VNs that are the inputs to two-address instructiosn - // chaining upwards from the VN we're trying to merge. - bool addedVN = true; - while (addedVN) { - addedVN = false; - unsigned defIndex = RHSVN->def; - - if (defIndex != ~0U) { - MachineInstr* instr = LI.getInstructionFromIndex(defIndex); - - for (unsigned i = 0; i < instr->getNumOperands(); ++i) { - if (instr->getOperand(i).isReg() && - instr->getOperand(i).getReg() == secondary) - if (instr->isRegReDefinedByTwoAddr(secondary, i)) { - RHSVN = RHS.getLiveRangeContaining(defIndex-1)->valno; - addedVN = true; - - VNInfo* NextVN = LHS.getNextValue(RHSVN->def, - RHSVN->copy, - LI.getVNInfoAllocator()); - VNMap.insert(std::make_pair(RHSVN, NextVN)); - - break; - } - } - } - } - - // Merge VNs from RHS into LHS using the mapping we computed above. - for (DenseMap::iterator VI = VNMap.begin(), - VE = VNMap.end(); VI != VE; ++VI) { - LHS.MergeValueInAsValue(RHS, VI->first, VI->second); - RHS.removeValNo(VI->first); + for (SmallVector::iterator VI = VNSet.begin(), + VE = VNSet.end(); VI != VE; ++VI) { + VNInfo* NewVN = LHS.getNextValue((*VI)->def, + (*VI)->copy, + LI.getVNInfoAllocator()); + LHS.MergeValueInAsValue(RHS, *VI, NewVN); + RHS.removeValNo(*VI); } if (RHS.begin() == RHS.end()) @@ -925,7 +899,7 @@ std::map::iterator SI = I->second.begin(); if (SI->first != I->first) { - mergeLiveIntervals(I->first, SI->first, SI->second); + mergeLiveIntervals(I->first, SI->first); Fn.getRegInfo().replaceRegWith(SI->first, I->first); if (RenameSets.count(SI->first)) { From resistor at mac.com Wed Aug 13 12:45:32 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 17:45:32 -0000 Subject: [llvm-commits] [llvm] r54742 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200808131745.m7DHji9Q007040@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 12:44:52 2008 New Revision: 54742 URL: http://llvm.org/viewvc/llvm-project?rev=54742&view=rev Log: Get rid of unused variable. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54742&r1=54741&r2=54742&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Aug 13 12:44:52 2008 @@ -762,7 +762,6 @@ std::set RegHandled; for (SmallVector, 4>::iterator I = InsertedPHIDests.begin(), E = InsertedPHIDests.end(); I != E; ++I) { - unsigned bar = 0; if (RegHandled.insert(I->first).second && !LI.getOrCreateInterval(I->first).liveAt( LI.getMBBEndIdx(I->second->getParent()))) From dalej at apple.com Wed Aug 13 12:54:23 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 17:54:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54743 - /llvm-gcc-4.2/trunk/gcc/config.gcc Message-ID: <200808131754.m7DHsXKH007458@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 12:54:05 2008 New Revision: 54743 URL: http://llvm.org/viewvc/llvm-project?rev=54743&view=rev Log: Add dependency for llvm-i386-target.h Modified: llvm-gcc-4.2/trunk/gcc/config.gcc Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=54743&r1=54742&r2=54743&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Wed Aug 13 12:54:05 2008 @@ -381,6 +381,13 @@ tm_file="i386/biarch64.h ${tm_file}" ;; esac +## LLVM LOCAL begin add dependency for llvm-i386-target.h +case ${target} in +x86_64-*-* | i686-*-* | i386-*-*) + tm_file="i386/llvm-i386-target.h ${tm_file}" + ;; +esac +## LLVM LOCAL end # On a.out targets, we need to use collect2. case ${target} in From dalej at apple.com Wed Aug 13 13:40:25 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 18:40:25 -0000 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp Message-ID: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 13:40:23 2008 New Revision: 54744 URL: http://llvm.org/viewvc/llvm-project?rev=54744&view=rev Log: Add read/write support for X86's sseregparm. Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=54744&r1=54743&r2=54744&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Wed Aug 13 13:40:23 2008 @@ -483,6 +483,7 @@ KEYWORD("coldcc", COLDCC_TOK); KEYWORD("x86_stdcallcc", X86_STDCALLCC_TOK); KEYWORD("x86_fastcallcc", X86_FASTCALLCC_TOK); + KEYWORD("x86_ssecallcc", X86_SSECALLCC_TOK); KEYWORD("signext", SIGNEXT); KEYWORD("zeroext", ZEROEXT); Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=54744&r1=54743&r2=54744&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Wed Aug 13 13:40:23 2008 @@ -1082,6 +1082,7 @@ %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK +%token X86_SSECALLCC_TOK %token DATALAYOUT %type OptCallingConv %type OptParamAttrs ParamAttr @@ -1237,6 +1238,7 @@ COLDCC_TOK { $$ = CallingConv::Cold; } | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | X86_FASTCALLCC_TOK { $$ = CallingConv::X86_FastCall; } | + X86_SSECALLCC_TOK { $$ = CallingConv::X86_SSECall; } | CC_TOK EUINT64VAL { if ((unsigned)$2 != $2) GEN_ERROR("Calling conv too large"); Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=54744&r1=54743&r2=54744&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Aug 13 13:40:23 2008 @@ -1084,6 +1084,7 @@ case CallingConv::Cold: Out << "coldcc "; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; case CallingConv::X86_FastCall: Out << "x86_fastcallcc "; break; + case CallingConv::X86_SSECall: Out << "x86_ssecallcc "; break; default: Out << "cc" << F->getCallingConv() << " "; break; } @@ -1318,6 +1319,7 @@ case CallingConv::Cold: Out << " coldcc"; break; case CallingConv::X86_StdCall: Out << " x86_stdcallcc"; break; case CallingConv::X86_FastCall: Out << " x86_fastcallcc"; break; + case CallingConv::X86_SSECall: Out << " x86_ssecallcc"; break; default: Out << " cc" << CI->getCallingConv(); break; } @@ -1360,6 +1362,7 @@ case CallingConv::Cold: Out << " coldcc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; case CallingConv::X86_FastCall: Out << "x86_fastcallcc "; break; + case CallingConv::X86_SSECall: Out << "x86_ssecallcc "; break; default: Out << " cc" << II->getCallingConv(); break; } Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=54744&r1=54743&r2=54744&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Aug 13 13:40:23 2008 @@ -488,6 +488,7 @@ default: break; case CallingConv::C: + case CallingConv::X86_SSECall: break; case CallingConv::Fast: case CallingConv::Cold: From dalej at apple.com Wed Aug 13 13:41:46 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 18:41:46 -0000 Subject: [llvm-commits] [llvm] r54745 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200808131841.m7DIflUq009315@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 13:41:46 2008 New Revision: 54745 URL: http://llvm.org/viewvc/llvm-project?rev=54745&view=rev Log: Generated files for 54744. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=54745&r1=54744&r2=54745&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Aug 13 13:41:46 2008 @@ -139,94 +139,95 @@ COLDCC_TOK = 320, X86_STDCALLCC_TOK = 321, X86_FASTCALLCC_TOK = 322, - DATALAYOUT = 323, - RET = 324, - BR = 325, - SWITCH = 326, - INVOKE = 327, - UNWIND = 328, - UNREACHABLE = 329, - ADD = 330, - SUB = 331, - MUL = 332, - UDIV = 333, - SDIV = 334, - FDIV = 335, - UREM = 336, - SREM = 337, - FREM = 338, - AND = 339, - OR = 340, - XOR = 341, - SHL = 342, - LSHR = 343, - ASHR = 344, - ICMP = 345, - FCMP = 346, - VICMP = 347, - VFCMP = 348, - EQ = 349, - NE = 350, - SLT = 351, - SGT = 352, - SLE = 353, - SGE = 354, - ULT = 355, - UGT = 356, - ULE = 357, - UGE = 358, - OEQ = 359, - ONE = 360, - OLT = 361, - OGT = 362, - OLE = 363, - OGE = 364, - ORD = 365, - UNO = 366, - UEQ = 367, - UNE = 368, - MALLOC = 369, - ALLOCA = 370, - FREE = 371, - LOAD = 372, - STORE = 373, - GETELEMENTPTR = 374, - TRUNC = 375, - ZEXT = 376, - SEXT = 377, - FPTRUNC = 378, - FPEXT = 379, - BITCAST = 380, - UITOFP = 381, - SITOFP = 382, - FPTOUI = 383, - FPTOSI = 384, - INTTOPTR = 385, - PTRTOINT = 386, - PHI_TOK = 387, - SELECT = 388, - VAARG = 389, - EXTRACTELEMENT = 390, - INSERTELEMENT = 391, - SHUFFLEVECTOR = 392, - GETRESULT = 393, - EXTRACTVALUE = 394, - INSERTVALUE = 395, - SIGNEXT = 396, - ZEROEXT = 397, - NORETURN = 398, - INREG = 399, - SRET = 400, - NOUNWIND = 401, - NOALIAS = 402, - BYVAL = 403, - NEST = 404, - READNONE = 405, - READONLY = 406, - GC = 407, - DEFAULT = 408, - HIDDEN = 409, - PROTECTED = 410 + X86_SSECALLCC_TOK = 323, + DATALAYOUT = 324, + RET = 325, + BR = 326, + SWITCH = 327, + INVOKE = 328, + UNWIND = 329, + UNREACHABLE = 330, + ADD = 331, + SUB = 332, + MUL = 333, + UDIV = 334, + SDIV = 335, + FDIV = 336, + UREM = 337, + SREM = 338, + FREM = 339, + AND = 340, + OR = 341, + XOR = 342, + SHL = 343, + LSHR = 344, + ASHR = 345, + ICMP = 346, + FCMP = 347, + VICMP = 348, + VFCMP = 349, + EQ = 350, + NE = 351, + SLT = 352, + SGT = 353, + SLE = 354, + SGE = 355, + ULT = 356, + UGT = 357, + ULE = 358, + UGE = 359, + OEQ = 360, + ONE = 361, + OLT = 362, + OGT = 363, + OLE = 364, + OGE = 365, + ORD = 366, + UNO = 367, + UEQ = 368, + UNE = 369, + MALLOC = 370, + ALLOCA = 371, + FREE = 372, + LOAD = 373, + STORE = 374, + GETELEMENTPTR = 375, + TRUNC = 376, + ZEXT = 377, + SEXT = 378, + FPTRUNC = 379, + FPEXT = 380, + BITCAST = 381, + UITOFP = 382, + SITOFP = 383, + FPTOUI = 384, + FPTOSI = 385, + INTTOPTR = 386, + PTRTOINT = 387, + PHI_TOK = 388, + SELECT = 389, + VAARG = 390, + EXTRACTELEMENT = 391, + INSERTELEMENT = 392, + SHUFFLEVECTOR = 393, + GETRESULT = 394, + EXTRACTVALUE = 395, + INSERTVALUE = 396, + SIGNEXT = 397, + ZEROEXT = 398, + NORETURN = 399, + INREG = 400, + SRET = 401, + NOUNWIND = 402, + NOALIAS = 403, + BYVAL = 404, + NEST = 405, + READNONE = 406, + READONLY = 407, + GC = 408, + DEFAULT = 409, + HIDDEN = 410, + PROTECTED = 411 }; #endif /* Tokens. */ @@ -295,100 +296,101 @@ #define COLDCC_TOK 320 #define X86_STDCALLCC_TOK 321 #define X86_FASTCALLCC_TOK 322 -#define DATALAYOUT 323 -#define RET 324 -#define BR 325 -#define SWITCH 326 -#define INVOKE 327 -#define UNWIND 328 -#define UNREACHABLE 329 -#define ADD 330 -#define SUB 331 -#define MUL 332 -#define UDIV 333 -#define SDIV 334 -#define FDIV 335 -#define UREM 336 -#define SREM 337 -#define FREM 338 -#define AND 339 -#define OR 340 -#define XOR 341 -#define SHL 342 -#define LSHR 343 -#define ASHR 344 -#define ICMP 345 -#define FCMP 346 -#define VICMP 347 -#define VFCMP 348 -#define EQ 349 -#define NE 350 -#define SLT 351 -#define SGT 352 -#define SLE 353 -#define SGE 354 -#define ULT 355 -#define UGT 356 -#define ULE 357 -#define UGE 358 -#define OEQ 359 -#define ONE 360 -#define OLT 361 -#define OGT 362 -#define OLE 363 -#define OGE 364 -#define ORD 365 -#define UNO 366 -#define UEQ 367 -#define UNE 368 -#define MALLOC 369 -#define ALLOCA 370 -#define FREE 371 -#define LOAD 372 -#define STORE 373 -#define GETELEMENTPTR 374 -#define TRUNC 375 -#define ZEXT 376 -#define SEXT 377 -#define FPTRUNC 378 -#define FPEXT 379 -#define BITCAST 380 -#define UITOFP 381 -#define SITOFP 382 -#define FPTOUI 383 -#define FPTOSI 384 -#define INTTOPTR 385 -#define PTRTOINT 386 -#define PHI_TOK 387 -#define SELECT 388 -#define VAARG 389 -#define EXTRACTELEMENT 390 -#define INSERTELEMENT 391 -#define SHUFFLEVECTOR 392 -#define GETRESULT 393 -#define EXTRACTVALUE 394 -#define INSERTVALUE 395 -#define SIGNEXT 396 -#define ZEROEXT 397 -#define NORETURN 398 -#define INREG 399 -#define SRET 400 -#define NOUNWIND 401 -#define NOALIAS 402 -#define BYVAL 403 -#define NEST 404 -#define READNONE 405 -#define READONLY 406 -#define GC 407 -#define DEFAULT 408 -#define HIDDEN 409 -#define PROTECTED 410 +#define X86_SSECALLCC_TOK 323 +#define DATALAYOUT 324 +#define RET 325 +#define BR 326 +#define SWITCH 327 +#define INVOKE 328 +#define UNWIND 329 +#define UNREACHABLE 330 +#define ADD 331 +#define SUB 332 +#define MUL 333 +#define UDIV 334 +#define SDIV 335 +#define FDIV 336 +#define UREM 337 +#define SREM 338 +#define FREM 339 +#define AND 340 +#define OR 341 +#define XOR 342 +#define SHL 343 +#define LSHR 344 +#define ASHR 345 +#define ICMP 346 +#define FCMP 347 +#define VICMP 348 +#define VFCMP 349 +#define EQ 350 +#define NE 351 +#define SLT 352 +#define SGT 353 +#define SLE 354 +#define SGE 355 +#define ULT 356 +#define UGT 357 +#define ULE 358 +#define UGE 359 +#define OEQ 360 +#define ONE 361 +#define OLT 362 +#define OGT 363 +#define OLE 364 +#define OGE 365 +#define ORD 366 +#define UNO 367 +#define UEQ 368 +#define UNE 369 +#define MALLOC 370 +#define ALLOCA 371 +#define FREE 372 +#define LOAD 373 +#define STORE 374 +#define GETELEMENTPTR 375 +#define TRUNC 376 +#define ZEXT 377 +#define SEXT 378 +#define FPTRUNC 379 +#define FPEXT 380 +#define BITCAST 381 +#define UITOFP 382 +#define SITOFP 383 +#define FPTOUI 384 +#define FPTOSI 385 +#define INTTOPTR 386 +#define PTRTOINT 387 +#define PHI_TOK 388 +#define SELECT 389 +#define VAARG 390 +#define EXTRACTELEMENT 391 +#define INSERTELEMENT 392 +#define SHUFFLEVECTOR 393 +#define GETRESULT 394 +#define EXTRACTVALUE 395 +#define INSERTVALUE 396 +#define SIGNEXT 397 +#define ZEROEXT 398 +#define NORETURN 399 +#define INREG 400 +#define SRET 401 +#define NOUNWIND 402 +#define NOALIAS 403 +#define BYVAL 404 +#define NEST 405 +#define READNONE 406 +#define READONLY 407 +#define GC 408 +#define DEFAULT 409 +#define HIDDEN 410 +#define PROTECTED 411 /* Copy the first part of user declarations. */ -#line 14 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1362,7 +1364,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 967 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1411,7 +1413,7 @@ llvm::FCmpInst::Predicate FPredicate; } /* Line 193 of yacc.c. */ -#line 1415 "llvmAsmParser.tab.c" +#line 1417 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -1424,7 +1426,7 @@ /* Line 216 of yacc.c. */ -#line 1428 "llvmAsmParser.tab.c" +#line 1430 "llvmAsmParser.tab.c" #ifdef short # undef short @@ -1639,20 +1641,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 44 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2360 +#define YYLAST 2381 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 170 +#define YYNTOKENS 171 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 86 /* YYNRULES -- Number of rules. */ -#define YYNRULES 342 +#define YYNRULES 343 /* YYNRULES -- Number of states. */ -#define YYNSTATES 701 +#define YYNSTATES 702 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 410 +#define YYMAXUTOK 411 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -1664,15 +1666,15 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 156, 157, 160, 2, 159, 2, 2, 2, 2, 2, + 157, 158, 161, 2, 160, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 165, 158, 166, 2, 2, 2, 2, 2, 2, 2, + 166, 159, 167, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 162, 161, 164, 2, 2, 2, 2, 2, 169, + 2, 163, 162, 165, 2, 2, 2, 2, 2, 170, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 163, 2, 2, 167, 2, 168, 2, 2, 2, 2, + 164, 2, 2, 168, 2, 169, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1701,7 +1703,7 @@ 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155 + 155, 156 }; #if YYDEBUG @@ -1719,188 +1721,188 @@ 140, 142, 144, 146, 147, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 169, 171, 173, 175, 176, 178, 180, 181, 183, 185, 187, 189, 190, 192, 194, - 195, 197, 199, 201, 203, 205, 208, 210, 212, 214, - 216, 218, 220, 222, 224, 226, 229, 230, 233, 235, - 237, 239, 241, 243, 245, 246, 249, 250, 253, 254, - 257, 258, 262, 265, 266, 268, 269, 273, 275, 278, - 280, 282, 284, 286, 288, 290, 292, 294, 296, 300, - 302, 305, 311, 317, 323, 329, 333, 336, 342, 347, - 350, 352, 354, 356, 360, 362, 366, 368, 369, 371, - 375, 380, 384, 388, 393, 398, 402, 409, 415, 418, - 421, 424, 427, 430, 433, 436, 439, 442, 445, 448, - 451, 458, 464, 473, 480, 487, 495, 503, 511, 519, - 526, 535, 544, 550, 558, 562, 564, 566, 568, 570, - 571, 574, 581, 583, 584, 586, 589, 590, 594, 595, - 599, 603, 607, 611, 612, 621, 622, 632, 633, 643, - 649, 652, 656, 658, 662, 666, 670, 674, 676, 677, - 683, 687, 689, 693, 695, 696, 707, 709, 711, 716, - 718, 720, 723, 727, 728, 730, 732, 734, 736, 738, - 740, 742, 744, 746, 748, 750, 754, 758, 761, 764, - 768, 771, 777, 782, 784, 790, 792, 794, 796, 798, - 800, 802, 805, 807, 811, 814, 817, 821, 824, 825, - 827, 830, 833, 837, 847, 857, 866, 881, 883, 885, - 892, 898, 901, 908, 916, 921, 926, 933, 940, 941, - 942, 946, 949, 953, 956, 958, 964, 970, 977, 984, - 991, 998, 1003, 1010, 1015, 1020, 1027, 1034, 1037, 1046, - 1048, 1050, 1051, 1055, 1062, 1066, 1073, 1076, 1082, 1090, - 1096, 1101, 1106 + 195, 197, 199, 201, 203, 205, 207, 210, 212, 214, + 216, 218, 220, 222, 224, 226, 228, 231, 232, 235, + 237, 239, 241, 243, 245, 247, 248, 251, 252, 255, + 256, 259, 260, 264, 267, 268, 270, 271, 275, 277, + 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, + 302, 304, 307, 313, 319, 325, 331, 335, 338, 344, + 349, 352, 354, 356, 358, 362, 364, 368, 370, 371, + 373, 377, 382, 386, 390, 395, 400, 404, 411, 417, + 420, 423, 426, 429, 432, 435, 438, 441, 444, 447, + 450, 453, 460, 466, 475, 482, 489, 497, 505, 513, + 521, 528, 537, 546, 552, 560, 564, 566, 568, 570, + 572, 573, 576, 583, 585, 586, 588, 591, 592, 596, + 597, 601, 605, 609, 613, 614, 623, 624, 634, 635, + 645, 651, 654, 658, 660, 664, 668, 672, 676, 678, + 679, 685, 689, 691, 695, 697, 698, 709, 711, 713, + 718, 720, 722, 725, 729, 730, 732, 734, 736, 738, + 740, 742, 744, 746, 748, 750, 752, 756, 760, 763, + 766, 770, 773, 779, 784, 786, 792, 794, 796, 798, + 800, 802, 804, 807, 809, 813, 816, 819, 823, 826, + 827, 829, 832, 835, 839, 849, 859, 868, 883, 885, + 887, 894, 900, 903, 910, 918, 923, 928, 935, 942, + 943, 944, 948, 951, 955, 958, 960, 966, 972, 979, + 986, 993, 1000, 1005, 1012, 1017, 1022, 1029, 1036, 1039, + 1048, 1050, 1052, 1053, 1057, 1064, 1068, 1075, 1078, 1084, + 1092, 1098, 1103, 1108 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 216, 0, -1, 75, -1, 76, -1, 77, -1, 78, - -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, - -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, - -1, 86, -1, 120, -1, 121, -1, 122, -1, 123, - -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, - -1, 129, -1, 130, -1, 131, -1, 94, -1, 95, - -1, 96, -1, 97, -1, 98, -1, 99, -1, 100, - -1, 101, -1, 102, -1, 103, -1, 104, -1, 105, - -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, - -1, 111, -1, 112, -1, 113, -1, 100, -1, 101, - -1, 102, -1, 103, -1, 26, -1, 27, -1, 11, + 217, 0, -1, 76, -1, 77, -1, 78, -1, 79, + -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, + -1, 88, -1, 89, -1, 90, -1, 85, -1, 86, + -1, 87, -1, 121, -1, 122, -1, 123, -1, 124, + -1, 125, -1, 126, -1, 127, -1, 128, -1, 129, + -1, 130, -1, 131, -1, 132, -1, 95, -1, 96, + -1, 97, -1, 98, -1, 99, -1, 100, -1, 101, + -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, + -1, 107, -1, 108, -1, 109, -1, 110, -1, 111, + -1, 112, -1, 113, -1, 114, -1, 101, -1, 102, + -1, 103, -1, 104, -1, 26, -1, 27, -1, 11, -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, - -1, 19, -1, 22, -1, 24, -1, 178, -1, -1, - 55, 156, 4, 157, -1, -1, 178, 158, -1, -1, - 20, -1, 23, -1, 184, -1, -1, 182, 158, -1, + -1, 19, -1, 22, -1, 24, -1, 179, -1, -1, + 55, 157, 4, 158, -1, -1, 179, 159, -1, -1, + 20, -1, 23, -1, 185, -1, -1, 183, 159, -1, 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, - 49, -1, 46, -1, 48, -1, 51, -1, -1, 153, - -1, 154, -1, 155, -1, -1, 46, -1, 48, -1, + 49, -1, 46, -1, 48, -1, 51, -1, -1, 154, + -1, 155, -1, 156, -1, -1, 46, -1, 48, -1, -1, 42, -1, 43, -1, 44, -1, 47, -1, -1, 44, -1, 42, -1, -1, 63, -1, 64, -1, 65, - -1, 66, -1, 67, -1, 62, 4, -1, 142, -1, - 121, -1, 141, -1, 122, -1, 144, -1, 145, -1, - 147, -1, 148, -1, 149, -1, 54, 4, -1, -1, - 193, 192, -1, 143, -1, 146, -1, 142, -1, 141, - -1, 150, -1, 151, -1, -1, 195, 194, -1, -1, - 152, 22, -1, -1, 54, 4, -1, -1, 159, 54, - 4, -1, 34, 22, -1, -1, 199, -1, -1, 159, - 202, 201, -1, 199, -1, 54, 4, -1, 11, -1, - 12, -1, 13, -1, 16, -1, 15, -1, 14, -1, - 17, -1, 50, -1, 203, -1, 204, 180, 160, -1, - 238, -1, 161, 4, -1, 204, 156, 208, 157, 195, - -1, 10, 156, 208, 157, 195, -1, 162, 4, 163, - 204, 164, -1, 165, 4, 163, 204, 166, -1, 167, - 209, 168, -1, 167, 168, -1, 165, 167, 209, 168, - 166, -1, 165, 167, 168, 166, -1, 204, 193, -1, - 204, -1, 10, -1, 205, -1, 207, 159, 205, -1, - 207, -1, 207, 159, 39, -1, 39, -1, -1, 204, - -1, 209, 159, 204, -1, 204, 162, 212, 164, -1, - 204, 162, 164, -1, 204, 169, 22, -1, 204, 165, - 212, 166, -1, 204, 167, 212, 168, -1, 204, 167, - 168, -1, 204, 165, 167, 212, 168, 166, -1, 204, - 165, 167, 168, 166, -1, 204, 40, -1, 204, 41, - -1, 204, 238, -1, 204, 211, -1, 204, 25, -1, - 176, 3, -1, 176, 5, -1, 176, 4, -1, 176, - 6, -1, 11, 26, -1, 11, 27, -1, 177, 9, - -1, 173, 156, 210, 38, 204, 157, -1, 119, 156, - 210, 250, 157, -1, 133, 156, 210, 159, 210, 159, - 210, 157, -1, 171, 156, 210, 159, 210, 157, -1, - 172, 156, 210, 159, 210, 157, -1, 90, 174, 156, - 210, 159, 210, 157, -1, 91, 175, 156, 210, 159, - 210, 157, -1, 92, 174, 156, 210, 159, 210, 157, - -1, 93, 175, 156, 210, 159, 210, 157, -1, 135, - 156, 210, 159, 210, 157, -1, 136, 156, 210, 159, - 210, 159, 210, 157, -1, 137, 156, 210, 159, 210, - 159, 210, 157, -1, 139, 156, 210, 251, 157, -1, - 140, 156, 210, 159, 210, 251, 157, -1, 212, 159, - 210, -1, 210, -1, 32, -1, 33, -1, 37, -1, - -1, 206, 238, -1, 125, 156, 215, 38, 204, 157, - -1, 217, -1, -1, 218, -1, 217, 218, -1, -1, - 31, 219, 234, -1, -1, 30, 220, 235, -1, 60, - 59, 224, -1, 181, 18, 204, -1, 181, 18, 10, - -1, -1, 183, 187, 214, 213, 210, 180, 221, 201, - -1, -1, 183, 185, 187, 214, 213, 210, 180, 222, - 201, -1, -1, 183, 186, 187, 214, 213, 204, 180, - 223, 201, -1, 183, 187, 35, 190, 215, -1, 52, - 225, -1, 56, 158, 226, -1, 22, -1, 53, 158, - 22, -1, 68, 158, 22, -1, 162, 227, 164, -1, - 227, 159, 22, -1, 22, -1, -1, 228, 159, 204, - 193, 179, -1, 204, 193, 179, -1, 228, -1, 228, - 159, 39, -1, 39, -1, -1, 191, 206, 182, 156, - 229, 157, 195, 200, 197, 196, -1, 28, -1, 167, - -1, 189, 187, 230, 231, -1, 29, -1, 168, -1, - 242, 233, -1, 188, 187, 230, -1, -1, 61, -1, - 3, -1, 4, -1, 5, -1, 6, -1, 9, -1, - 26, -1, 27, -1, 40, -1, 41, -1, 25, -1, - 165, 212, 166, -1, 162, 212, 164, -1, 162, 164, - -1, 169, 22, -1, 167, 212, 168, -1, 167, 168, - -1, 165, 167, 212, 168, 166, -1, 165, 167, 168, - 166, -1, 211, -1, 59, 236, 22, 159, 22, -1, - 7, -1, 8, -1, 178, -1, 182, -1, 238, -1, - 237, -1, 204, 239, -1, 240, -1, 241, 159, 240, - -1, 242, 243, -1, 232, 243, -1, 244, 181, 245, - -1, 244, 247, -1, -1, 21, -1, 69, 241, -1, - 69, 10, -1, 70, 17, 239, -1, 70, 11, 239, - 159, 17, 239, 159, 17, 239, -1, 71, 176, 239, - 159, 17, 239, 162, 246, 164, -1, 71, 176, 239, - 159, 17, 239, 162, 164, -1, 72, 191, 206, 239, - 156, 249, 157, 195, 38, 17, 239, 73, 17, 239, - -1, 73, -1, 74, -1, 246, 176, 237, 159, 17, - 239, -1, 176, 237, 159, 17, 239, -1, 181, 253, - -1, 204, 162, 239, 159, 239, 164, -1, 248, 159, - 162, 239, 159, 239, 164, -1, 204, 193, 239, 193, - -1, 17, 193, 239, 193, -1, 249, 159, 204, 193, - 239, 193, -1, 249, 159, 17, 193, 239, 193, -1, - -1, -1, 250, 159, 240, -1, 159, 4, -1, 251, - 159, 4, -1, 58, 57, -1, 57, -1, 171, 204, - 239, 159, 239, -1, 172, 204, 239, 159, 239, -1, - 90, 174, 204, 239, 159, 239, -1, 91, 175, 204, - 239, 159, 239, -1, 92, 174, 204, 239, 159, 239, - -1, 93, 175, 204, 239, 159, 239, -1, 173, 240, - 38, 204, -1, 133, 240, 159, 240, 159, 240, -1, - 134, 240, 159, 204, -1, 135, 240, 159, 240, -1, - 136, 240, 159, 240, 159, 240, -1, 137, 240, 159, - 240, 159, 240, -1, 132, 248, -1, 252, 191, 206, - 239, 156, 249, 157, 195, -1, 255, -1, 36, -1, - -1, 114, 204, 198, -1, 114, 204, 159, 11, 239, - 198, -1, 115, 204, 198, -1, 115, 204, 159, 11, - 239, 198, -1, 116, 240, -1, 254, 117, 204, 239, - 198, -1, 254, 118, 240, 159, 204, 239, 198, -1, - 138, 204, 239, 159, 4, -1, 119, 204, 239, 250, - -1, 139, 204, 239, 251, -1, 140, 204, 239, 159, - 204, 239, 251, -1 + -1, 66, -1, 67, -1, 68, -1, 62, 4, -1, + 143, -1, 122, -1, 142, -1, 123, -1, 145, -1, + 146, -1, 148, -1, 149, -1, 150, -1, 54, 4, + -1, -1, 194, 193, -1, 144, -1, 147, -1, 143, + -1, 142, -1, 151, -1, 152, -1, -1, 196, 195, + -1, -1, 153, 22, -1, -1, 54, 4, -1, -1, + 160, 54, 4, -1, 34, 22, -1, -1, 200, -1, + -1, 160, 203, 202, -1, 200, -1, 54, 4, -1, + 11, -1, 12, -1, 13, -1, 16, -1, 15, -1, + 14, -1, 17, -1, 50, -1, 204, -1, 205, 181, + 161, -1, 239, -1, 162, 4, -1, 205, 157, 209, + 158, 196, -1, 10, 157, 209, 158, 196, -1, 163, + 4, 164, 205, 165, -1, 166, 4, 164, 205, 167, + -1, 168, 210, 169, -1, 168, 169, -1, 166, 168, + 210, 169, 167, -1, 166, 168, 169, 167, -1, 205, + 194, -1, 205, -1, 10, -1, 206, -1, 208, 160, + 206, -1, 208, -1, 208, 160, 39, -1, 39, -1, + -1, 205, -1, 210, 160, 205, -1, 205, 163, 213, + 165, -1, 205, 163, 165, -1, 205, 170, 22, -1, + 205, 166, 213, 167, -1, 205, 168, 213, 169, -1, + 205, 168, 169, -1, 205, 166, 168, 213, 169, 167, + -1, 205, 166, 168, 169, 167, -1, 205, 40, -1, + 205, 41, -1, 205, 239, -1, 205, 212, -1, 205, + 25, -1, 177, 3, -1, 177, 5, -1, 177, 4, + -1, 177, 6, -1, 11, 26, -1, 11, 27, -1, + 178, 9, -1, 174, 157, 211, 38, 205, 158, -1, + 120, 157, 211, 251, 158, -1, 134, 157, 211, 160, + 211, 160, 211, 158, -1, 172, 157, 211, 160, 211, + 158, -1, 173, 157, 211, 160, 211, 158, -1, 91, + 175, 157, 211, 160, 211, 158, -1, 92, 176, 157, + 211, 160, 211, 158, -1, 93, 175, 157, 211, 160, + 211, 158, -1, 94, 176, 157, 211, 160, 211, 158, + -1, 136, 157, 211, 160, 211, 158, -1, 137, 157, + 211, 160, 211, 160, 211, 158, -1, 138, 157, 211, + 160, 211, 160, 211, 158, -1, 140, 157, 211, 252, + 158, -1, 141, 157, 211, 160, 211, 252, 158, -1, + 213, 160, 211, -1, 211, -1, 32, -1, 33, -1, + 37, -1, -1, 207, 239, -1, 126, 157, 216, 38, + 205, 158, -1, 218, -1, -1, 219, -1, 218, 219, + -1, -1, 31, 220, 235, -1, -1, 30, 221, 236, + -1, 60, 59, 225, -1, 182, 18, 205, -1, 182, + 18, 10, -1, -1, 184, 188, 215, 214, 211, 181, + 222, 202, -1, -1, 184, 186, 188, 215, 214, 211, + 181, 223, 202, -1, -1, 184, 187, 188, 215, 214, + 205, 181, 224, 202, -1, 184, 188, 35, 191, 216, + -1, 52, 226, -1, 56, 159, 227, -1, 22, -1, + 53, 159, 22, -1, 69, 159, 22, -1, 163, 228, + 165, -1, 228, 160, 22, -1, 22, -1, -1, 229, + 160, 205, 194, 180, -1, 205, 194, 180, -1, 229, + -1, 229, 160, 39, -1, 39, -1, -1, 192, 207, + 183, 157, 230, 158, 196, 201, 198, 197, -1, 28, + -1, 168, -1, 190, 188, 231, 232, -1, 29, -1, + 169, -1, 243, 234, -1, 189, 188, 231, -1, -1, + 61, -1, 3, -1, 4, -1, 5, -1, 6, -1, + 9, -1, 26, -1, 27, -1, 40, -1, 41, -1, + 25, -1, 166, 213, 167, -1, 163, 213, 165, -1, + 163, 165, -1, 170, 22, -1, 168, 213, 169, -1, + 168, 169, -1, 166, 168, 213, 169, 167, -1, 166, + 168, 169, 167, -1, 212, -1, 59, 237, 22, 160, + 22, -1, 7, -1, 8, -1, 179, -1, 183, -1, + 239, -1, 238, -1, 205, 240, -1, 241, -1, 242, + 160, 241, -1, 243, 244, -1, 233, 244, -1, 245, + 182, 246, -1, 245, 248, -1, -1, 21, -1, 70, + 242, -1, 70, 10, -1, 71, 17, 240, -1, 71, + 11, 240, 160, 17, 240, 160, 17, 240, -1, 72, + 177, 240, 160, 17, 240, 163, 247, 165, -1, 72, + 177, 240, 160, 17, 240, 163, 165, -1, 73, 192, + 207, 240, 157, 250, 158, 196, 38, 17, 240, 74, + 17, 240, -1, 74, -1, 75, -1, 247, 177, 238, + 160, 17, 240, -1, 177, 238, 160, 17, 240, -1, + 182, 254, -1, 205, 163, 240, 160, 240, 165, -1, + 249, 160, 163, 240, 160, 240, 165, -1, 205, 194, + 240, 194, -1, 17, 194, 240, 194, -1, 250, 160, + 205, 194, 240, 194, -1, 250, 160, 17, 194, 240, + 194, -1, -1, -1, 251, 160, 241, -1, 160, 4, + -1, 252, 160, 4, -1, 58, 57, -1, 57, -1, + 172, 205, 240, 160, 240, -1, 173, 205, 240, 160, + 240, -1, 91, 175, 205, 240, 160, 240, -1, 92, + 176, 205, 240, 160, 240, -1, 93, 175, 205, 240, + 160, 240, -1, 94, 176, 205, 240, 160, 240, -1, + 174, 241, 38, 205, -1, 134, 241, 160, 241, 160, + 241, -1, 135, 241, 160, 205, -1, 136, 241, 160, + 241, -1, 137, 241, 160, 241, 160, 241, -1, 138, + 241, 160, 241, 160, 241, -1, 133, 249, -1, 253, + 192, 207, 240, 157, 250, 158, 196, -1, 256, -1, + 36, -1, -1, 115, 205, 199, -1, 115, 205, 160, + 11, 240, 199, -1, 116, 205, 199, -1, 116, 205, + 160, 11, 240, 199, -1, 117, 241, -1, 255, 118, + 205, 240, 199, -1, 255, 119, 241, 160, 205, 240, + 199, -1, 139, 205, 240, 160, 4, -1, 120, 205, + 240, 251, -1, 140, 205, 240, 252, -1, 141, 205, + 240, 160, 205, 240, 252, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, - 1132, 1133, 1133, 1133, 1133, 1133, 1133, 1134, 1134, 1134, - 1134, 1134, 1134, 1135, 1135, 1135, 1135, 1135, 1135, 1138, - 1138, 1139, 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1146, - 1146, 1147, 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151, - 1151, 1152, 1152, 1153, 1154, 1159, 1160, 1160, 1160, 1160, - 1160, 1162, 1162, 1162, 1163, 1163, 1165, 1166, 1170, 1174, - 1179, 1179, 1181, 1182, 1187, 1193, 1194, 1195, 1196, 1197, - 1198, 1202, 1203, 1204, 1208, 1209, 1210, 1211, 1215, 1216, - 1217, 1221, 1222, 1223, 1224, 1225, 1229, 1230, 1231, 1234, - 1235, 1236, 1237, 1238, 1239, 1240, 1247, 1248, 1249, 1250, - 1251, 1252, 1253, 1254, 1255, 1256, 1260, 1261, 1266, 1267, - 1268, 1269, 1270, 1271, 1274, 1275, 1280, 1281, 1288, 1289, - 1295, 1296, 1305, 1313, 1314, 1319, 1320, 1321, 1326, 1339, - 1339, 1339, 1339, 1339, 1339, 1339, 1342, 1346, 1350, 1357, - 1362, 1370, 1399, 1424, 1429, 1439, 1449, 1453, 1463, 1470, - 1479, 1486, 1491, 1496, 1503, 1504, 1511, 1518, 1526, 1532, - 1544, 1572, 1588, 1615, 1643, 1669, 1689, 1715, 1735, 1747, - 1754, 1820, 1830, 1840, 1846, 1856, 1862, 1872, 1878, 1884, - 1897, 1909, 1930, 1938, 1944, 1955, 1960, 1965, 1970, 1975, - 1981, 1987, 1993, 2001, 2012, 2016, 2024, 2024, 2027, 2027, - 2030, 2042, 2063, 2068, 2076, 2077, 2081, 2081, 2085, 2085, - 2088, 2091, 2115, 2127, 2126, 2138, 2137, 2147, 2146, 2157, - 2197, 2200, 2206, 2216, 2220, 2225, 2227, 2232, 2237, 2246, - 2256, 2267, 2271, 2280, 2289, 2294, 2423, 2423, 2425, 2434, - 2434, 2436, 2441, 2453, 2457, 2462, 2466, 2470, 2475, 2480, - 2484, 2488, 2492, 2496, 2500, 2504, 2526, 2548, 2554, 2567, - 2579, 2584, 2596, 2602, 2606, 2616, 2620, 2624, 2629, 2636, - 2636, 2642, 2651, 2656, 2661, 2665, 2674, 2683, 2692, 2696, - 2704, 2724, 2728, 2733, 2744, 2763, 2772, 2858, 2862, 2869, - 2880, 2893, 2903, 2914, 2924, 2935, 2943, 2953, 2960, 2963, - 2964, 2972, 2978, 2987, 2991, 2996, 3012, 3029, 3043, 3057, - 3071, 3085, 3097, 3105, 3112, 3118, 3124, 3130, 3145, 3235, - 3240, 3244, 3251, 3258, 3268, 3275, 3285, 3293, 3307, 3324, - 3338, 3353, 3368 + 0, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, + 1133, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1135, + 1135, 1135, 1135, 1136, 1136, 1136, 1136, 1136, 1136, 1139, + 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1143, 1143, 1147, + 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152, + 1152, 1153, 1153, 1154, 1155, 1160, 1161, 1161, 1161, 1161, + 1161, 1163, 1163, 1163, 1164, 1164, 1166, 1167, 1171, 1175, + 1180, 1180, 1182, 1183, 1188, 1194, 1195, 1196, 1197, 1198, + 1199, 1203, 1204, 1205, 1209, 1210, 1211, 1212, 1216, 1217, + 1218, 1222, 1223, 1224, 1225, 1226, 1230, 1231, 1232, 1235, + 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1249, 1250, 1251, + 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1262, 1263, 1268, + 1269, 1270, 1271, 1272, 1273, 1276, 1277, 1282, 1283, 1290, + 1291, 1297, 1298, 1307, 1315, 1316, 1321, 1322, 1323, 1328, + 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1344, 1348, 1352, + 1359, 1364, 1372, 1401, 1426, 1431, 1441, 1451, 1455, 1465, + 1472, 1481, 1488, 1493, 1498, 1505, 1506, 1513, 1520, 1528, + 1534, 1546, 1574, 1590, 1617, 1645, 1671, 1691, 1717, 1737, + 1749, 1756, 1822, 1832, 1842, 1848, 1858, 1864, 1874, 1880, + 1886, 1899, 1911, 1932, 1940, 1946, 1957, 1962, 1967, 1972, + 1977, 1983, 1989, 1995, 2003, 2014, 2018, 2026, 2026, 2029, + 2029, 2032, 2044, 2065, 2070, 2078, 2079, 2083, 2083, 2087, + 2087, 2090, 2093, 2117, 2129, 2128, 2140, 2139, 2149, 2148, + 2159, 2199, 2202, 2208, 2218, 2222, 2227, 2229, 2234, 2239, + 2248, 2258, 2269, 2273, 2282, 2291, 2296, 2425, 2425, 2427, + 2436, 2436, 2438, 2443, 2455, 2459, 2464, 2468, 2472, 2477, + 2482, 2486, 2490, 2494, 2498, 2502, 2506, 2528, 2550, 2556, + 2569, 2581, 2586, 2598, 2604, 2608, 2618, 2622, 2626, 2631, + 2638, 2638, 2644, 2653, 2658, 2663, 2667, 2676, 2685, 2694, + 2698, 2706, 2726, 2730, 2735, 2746, 2765, 2774, 2860, 2864, + 2871, 2882, 2895, 2905, 2916, 2926, 2937, 2945, 2955, 2962, + 2965, 2966, 2974, 2980, 2989, 2993, 2998, 3014, 3031, 3045, + 3059, 3073, 3087, 3099, 3107, 3114, 3120, 3126, 3132, 3147, + 3237, 3242, 3246, 3253, 3260, 3270, 3277, 3287, 3295, 3309, + 3326, 3340, 3355, 3370 }; #endif @@ -1921,23 +1923,23 @@ "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", - "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", - "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", - "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP", - "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", - "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", - "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", - "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", - "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", - "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", - "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT", - "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", - "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('", - "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", - "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", - "IPredicates", "FPredicates", "IntType", "FPType", "LocalName", - "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName", - "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", + "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", + "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", + "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", + "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", + "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", + "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", + "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", + "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", + "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", + "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", + "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", + "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", + "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", + "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", + "CastOps", "IPredicates", "FPredicates", "IntType", "FPType", + "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign", + "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", @@ -1977,49 +1979,50 @@ 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 40, 41, 61, 44, - 42, 92, 91, 120, 93, 60, 62, 123, 125, 99 + 405, 406, 407, 408, 409, 410, 411, 40, 41, 61, + 44, 42, 92, 91, 120, 93, 60, 62, 123, 125, + 99 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_uint16 yyr1[] = { - 0, 170, 171, 171, 171, 171, 171, 171, 171, 171, - 171, 172, 172, 172, 172, 172, 172, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, + 0, 171, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 173, 173, 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 176, 177, 177, 177, 177, - 177, 178, 178, 178, 179, 179, 180, 180, 181, 181, - 182, 182, 183, 183, 184, 185, 185, 185, 185, 185, - 185, 186, 186, 186, 187, 187, 187, 187, 188, 188, - 188, 189, 189, 189, 189, 189, 190, 190, 190, 191, - 191, 191, 191, 191, 191, 191, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 193, 193, 194, 194, - 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, - 198, 198, 199, 200, 200, 201, 201, 202, 202, 203, - 203, 203, 203, 203, 203, 203, 204, 204, 204, 204, - 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, - 206, 206, 207, 207, 208, 208, 208, 208, 209, 209, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 177, 178, 178, 178, 178, + 178, 179, 179, 179, 180, 180, 181, 181, 182, 182, + 183, 183, 184, 184, 185, 186, 186, 186, 186, 186, + 186, 187, 187, 187, 188, 188, 188, 188, 189, 189, + 189, 190, 190, 190, 190, 190, 191, 191, 191, 192, + 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, + 193, 193, 193, 193, 193, 193, 193, 194, 194, 195, + 195, 195, 195, 195, 195, 196, 196, 197, 197, 198, + 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, + 204, 204, 204, 204, 204, 204, 204, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + 206, 207, 207, 208, 208, 209, 209, 209, 209, 210, + 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 212, 212, 213, 213, 214, 214, - 215, 215, 216, 216, 217, 217, 219, 218, 220, 218, - 218, 218, 218, 221, 218, 222, 218, 223, 218, 218, - 218, 218, 224, 225, 225, 226, 227, 227, 227, 228, - 228, 229, 229, 229, 229, 230, 231, 231, 232, 233, - 233, 234, 235, 236, 236, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 238, 238, 238, 238, 239, - 239, 240, 241, 241, 242, 242, 243, 244, 244, 244, - 245, 245, 245, 245, 245, 245, 245, 245, 245, 246, - 246, 247, 248, 248, 249, 249, 249, 249, 249, 250, - 250, 251, 251, 252, 252, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255 + 211, 212, 212, 212, 212, 212, 212, 212, 212, 212, + 212, 212, 212, 212, 212, 213, 213, 214, 214, 215, + 215, 216, 216, 217, 217, 218, 218, 220, 219, 221, + 219, 219, 219, 219, 222, 219, 223, 219, 224, 219, + 219, 219, 219, 225, 226, 226, 227, 228, 228, 228, + 229, 229, 230, 230, 230, 230, 231, 232, 232, 233, + 234, 234, 235, 236, 237, 237, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 239, 239, 239, 239, + 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, + 245, 246, 246, 246, 246, 246, 246, 246, 246, 246, + 247, 247, 248, 249, 249, 250, 250, 250, 250, 250, + 251, 251, 252, 252, 253, 253, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 255, 255, 256, 256, 256, 256, 256, 256, 256, + 256, 256, 256, 256 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -2035,31 +2038,31 @@ 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 0, 2, 1, 1, - 1, 1, 1, 1, 0, 2, 0, 2, 0, 2, - 0, 3, 2, 0, 1, 0, 3, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 2, 5, 5, 5, 5, 3, 2, 5, 4, 2, - 1, 1, 1, 3, 1, 3, 1, 0, 1, 3, - 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 0, 2, 1, + 1, 1, 1, 1, 1, 0, 2, 0, 2, 0, + 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 1, 2, 5, 5, 5, 5, 3, 2, 5, 4, + 2, 1, 1, 1, 3, 1, 3, 1, 0, 1, + 3, 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 5, 8, 6, 6, 7, 7, 7, 7, 6, - 8, 8, 5, 7, 3, 1, 1, 1, 1, 0, - 2, 6, 1, 0, 1, 2, 0, 3, 0, 3, - 3, 3, 3, 0, 8, 0, 9, 0, 9, 5, - 2, 3, 1, 3, 3, 3, 3, 1, 0, 5, - 3, 1, 3, 1, 0, 10, 1, 1, 4, 1, - 1, 2, 3, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 2, 2, 3, - 2, 5, 4, 1, 5, 1, 1, 1, 1, 1, - 1, 2, 1, 3, 2, 2, 3, 2, 0, 1, - 2, 2, 3, 9, 9, 8, 14, 1, 1, 6, - 5, 2, 6, 7, 4, 4, 6, 6, 0, 0, - 3, 2, 3, 2, 1, 5, 5, 6, 6, 6, - 6, 4, 6, 4, 4, 6, 6, 2, 8, 1, - 1, 0, 3, 6, 3, 6, 2, 5, 7, 5, - 4, 4, 7 + 2, 6, 5, 8, 6, 6, 7, 7, 7, 7, + 6, 8, 8, 5, 7, 3, 1, 1, 1, 1, + 0, 2, 6, 1, 0, 1, 2, 0, 3, 0, + 3, 3, 3, 3, 0, 8, 0, 9, 0, 9, + 5, 2, 3, 1, 3, 3, 3, 3, 1, 0, + 5, 3, 1, 3, 1, 0, 10, 1, 1, 4, + 1, 1, 2, 3, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, + 3, 2, 5, 4, 1, 5, 1, 1, 1, 1, + 1, 1, 2, 1, 3, 2, 2, 3, 2, 0, + 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, + 6, 5, 2, 6, 7, 4, 4, 6, 6, 0, + 0, 3, 2, 3, 2, 1, 5, 5, 6, 6, + 6, 6, 4, 6, 4, 4, 6, 6, 2, 8, + 1, 1, 0, 3, 6, 3, 6, 2, 5, 7, + 5, 4, 4, 7 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -2067,747 +2070,751 @@ means the default is an error. */ static const yytype_uint16 yydefact[] = { - 73, 61, 70, 62, 71, 63, 218, 216, 0, 0, - 0, 0, 0, 0, 84, 72, 0, 73, 214, 88, - 91, 0, 0, 230, 0, 0, 68, 0, 74, 75, + 73, 61, 70, 62, 71, 63, 219, 217, 0, 0, + 0, 0, 0, 0, 84, 72, 0, 73, 215, 88, + 91, 0, 0, 231, 0, 0, 68, 0, 74, 75, 77, 76, 78, 81, 79, 82, 80, 83, 85, 86, - 87, 84, 84, 209, 1, 215, 89, 90, 84, 219, - 92, 93, 94, 95, 84, 288, 217, 288, 0, 0, - 238, 231, 232, 220, 275, 276, 222, 139, 140, 141, - 144, 143, 142, 145, 146, 0, 0, 0, 0, 277, - 278, 147, 221, 149, 209, 209, 96, 208, 0, 99, - 99, 289, 285, 69, 249, 250, 251, 284, 233, 234, - 237, 0, 167, 150, 0, 0, 0, 0, 156, 168, - 0, 0, 167, 0, 0, 0, 98, 97, 0, 206, - 207, 0, 0, 100, 101, 102, 103, 104, 0, 252, - 0, 331, 287, 0, 235, 166, 116, 162, 164, 0, - 0, 0, 0, 0, 0, 155, 0, 0, 148, 0, - 0, 161, 0, 160, 0, 229, 139, 140, 141, 144, - 143, 142, 0, 0, 67, 67, 105, 0, 246, 247, - 248, 330, 314, 0, 0, 0, 0, 99, 297, 298, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, - 15, 16, 11, 12, 13, 0, 0, 0, 0, 0, - 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 286, 99, 301, - 0, 329, 236, 159, 0, 124, 67, 67, 158, 0, - 169, 0, 124, 67, 67, 0, 210, 187, 188, 183, - 185, 184, 186, 189, 182, 178, 179, 0, 0, 0, + 87, 84, 84, 210, 1, 216, 89, 90, 84, 220, + 92, 93, 94, 95, 84, 289, 218, 289, 0, 0, + 239, 232, 233, 221, 276, 277, 223, 140, 141, 142, + 145, 144, 143, 146, 147, 0, 0, 0, 0, 278, + 279, 148, 222, 150, 210, 210, 96, 209, 0, 99, + 99, 290, 286, 69, 250, 251, 252, 285, 234, 235, + 238, 0, 168, 151, 0, 0, 0, 0, 157, 169, + 0, 0, 168, 0, 0, 0, 98, 97, 0, 207, + 208, 0, 0, 100, 101, 102, 103, 104, 105, 0, + 253, 0, 332, 288, 0, 236, 167, 117, 163, 165, + 0, 0, 0, 0, 0, 0, 156, 0, 0, 149, + 0, 0, 162, 0, 161, 0, 230, 140, 141, 142, + 145, 144, 143, 0, 0, 67, 67, 106, 0, 247, + 248, 249, 331, 315, 0, 0, 0, 0, 99, 298, + 299, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 14, 15, 16, 11, 12, 13, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 287, 99, + 302, 0, 330, 237, 160, 0, 125, 67, 67, 159, + 0, 170, 0, 125, 67, 67, 0, 211, 188, 189, + 184, 186, 185, 187, 190, 183, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 181, 180, 223, 0, 313, - 291, 67, 282, 290, 0, 0, 55, 0, 0, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 53, 54, 49, 50, 51, 52, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 0, 0, 0, 130, - 130, 336, 67, 67, 327, 0, 0, 0, 0, 0, - 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, - 107, 109, 108, 106, 110, 111, 112, 113, 114, 117, - 165, 163, 152, 153, 154, 157, 66, 151, 225, 227, + 0, 0, 0, 0, 0, 0, 182, 181, 224, 0, + 314, 292, 67, 283, 291, 0, 0, 55, 0, 0, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 0, 53, 54, 49, 50, 51, 52, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, + 131, 131, 337, 67, 67, 328, 0, 0, 0, 0, + 0, 67, 67, 67, 67, 67, 0, 0, 0, 0, + 0, 108, 110, 109, 107, 111, 112, 113, 114, 115, + 118, 166, 164, 153, 154, 155, 158, 66, 152, 226, + 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 172, 206, 0, 0, 0, 176, 0, + 173, 0, 0, 0, 136, 245, 256, 257, 258, 259, + 260, 265, 261, 262, 263, 264, 254, 0, 0, 0, + 0, 274, 281, 280, 282, 0, 0, 293, 0, 0, + 67, 67, 67, 67, 0, 333, 0, 335, 310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 171, 205, 0, 0, 0, 175, 0, 172, - 0, 0, 0, 135, 244, 255, 256, 257, 258, 259, - 264, 260, 261, 262, 263, 253, 0, 0, 0, 0, - 273, 280, 279, 281, 0, 0, 292, 0, 0, 67, - 67, 67, 67, 0, 332, 0, 334, 309, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 67, 0, 115, 121, 120, 118, 119, 122, - 123, 125, 135, 135, 0, 0, 0, 0, 0, 309, - 0, 0, 0, 0, 0, 0, 0, 170, 156, 168, - 0, 173, 174, 0, 0, 0, 0, 224, 243, 116, - 241, 0, 254, 0, 267, 0, 0, 0, 270, 0, - 268, 283, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 340, 0, 0, 0, 323, 324, 0, 0, - 0, 0, 341, 0, 0, 0, 321, 0, 130, 0, - 226, 228, 67, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 204, 177, 0, 0, 0, 0, - 0, 0, 137, 135, 65, 0, 124, 0, 266, 156, - 0, 265, 269, 0, 0, 308, 0, 0, 0, 0, - 130, 131, 130, 0, 0, 0, 0, 0, 0, 339, - 311, 0, 67, 315, 316, 308, 0, 337, 67, 211, - 0, 0, 0, 0, 191, 0, 0, 0, 0, 202, - 0, 176, 0, 0, 67, 132, 138, 136, 64, 240, - 242, 116, 133, 0, 272, 0, 0, 0, 116, 116, - 0, 317, 318, 319, 320, 333, 335, 310, 0, 0, - 322, 325, 326, 312, 0, 0, 130, 0, 0, 0, - 0, 0, 199, 0, 0, 0, 193, 194, 190, 65, - 134, 128, 274, 271, 0, 0, 0, 0, 124, 0, - 302, 0, 342, 124, 338, 195, 196, 197, 198, 0, - 0, 0, 203, 239, 0, 126, 0, 295, 0, 0, - 107, 109, 116, 116, 0, 116, 116, 303, 328, 192, - 200, 201, 129, 0, 245, 293, 0, 294, 0, 305, - 304, 0, 0, 0, 127, 0, 0, 0, 116, 116, - 0, 0, 0, 307, 306, 300, 0, 0, 299, 0, - 296 + 0, 0, 0, 67, 0, 116, 122, 121, 119, 120, + 123, 124, 126, 136, 136, 0, 0, 0, 0, 0, + 310, 0, 0, 0, 0, 0, 0, 0, 171, 157, + 169, 0, 174, 175, 0, 0, 0, 0, 225, 244, + 117, 242, 0, 255, 0, 268, 0, 0, 0, 271, + 0, 269, 284, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 341, 0, 0, 0, 324, 325, 0, + 0, 0, 0, 342, 0, 0, 0, 322, 0, 131, + 0, 227, 229, 67, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 205, 178, 0, 0, 0, + 0, 0, 0, 138, 136, 65, 0, 125, 0, 267, + 157, 0, 266, 270, 0, 0, 309, 0, 0, 0, + 0, 131, 132, 131, 0, 0, 0, 0, 0, 0, + 340, 312, 0, 67, 316, 317, 309, 0, 338, 67, + 212, 0, 0, 0, 0, 192, 0, 0, 0, 0, + 203, 0, 177, 0, 0, 67, 133, 139, 137, 64, + 241, 243, 117, 134, 0, 273, 0, 0, 0, 117, + 117, 0, 318, 319, 320, 321, 334, 336, 311, 0, + 0, 323, 326, 327, 313, 0, 0, 131, 0, 0, + 0, 0, 0, 200, 0, 0, 0, 194, 195, 191, + 65, 135, 129, 275, 272, 0, 0, 0, 0, 125, + 0, 303, 0, 343, 125, 339, 196, 197, 198, 199, + 0, 0, 0, 204, 240, 0, 127, 0, 296, 0, + 0, 108, 110, 117, 117, 0, 117, 117, 304, 329, + 193, 201, 202, 130, 0, 246, 294, 0, 295, 0, + 306, 305, 0, 0, 0, 128, 0, 0, 0, 117, + 117, 0, 0, 0, 308, 307, 301, 0, 0, 300, + 0, 297 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 272, 273, 274, 299, 316, 162, 163, 79, 589, + -1, 273, 274, 275, 300, 317, 163, 164, 79, 590, 113, 12, 80, 14, 15, 41, 42, 43, 48, 54, - 118, 128, 349, 233, 441, 352, 674, 655, 414, 532, - 631, 467, 533, 81, 164, 137, 154, 138, 139, 110, - 373, 400, 374, 121, 88, 155, 16, 17, 18, 20, - 19, 383, 442, 443, 63, 23, 61, 101, 470, 471, - 129, 170, 55, 96, 56, 49, 473, 401, 83, 403, - 282, 283, 57, 92, 93, 227, 659, 132, 324, 600, - 492, 502, 228, 229, 230, 231 + 118, 129, 350, 234, 442, 353, 675, 656, 415, 533, + 632, 468, 534, 81, 165, 138, 155, 139, 140, 110, + 374, 401, 375, 121, 88, 156, 16, 17, 18, 20, + 19, 384, 443, 444, 63, 23, 61, 101, 471, 472, + 130, 171, 55, 96, 56, 49, 474, 402, 83, 404, + 283, 284, 57, 92, 93, 228, 660, 133, 325, 601, + 493, 503, 229, 230, 231, 232 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -608 +#define YYPACT_NINF -623 static const yytype_int16 yypact[] = { - 492, -608, -608, -608, -608, -608, -608, -608, 1, -93, - 14, -48, 39, -39, -3, -608, 132, 926, -608, 61, - 261, -14, 6, -608, -15, 148, -608, 1840, -608, -608, - -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, - -608, 69, 69, 88, -608, -608, -608, -608, 69, -608, - -608, -608, -608, -608, 69, 120, -608, -11, 158, 166, - 184, -608, -608, -608, -608, -608, 53, -608, -608, -608, - -608, -608, -608, -608, -608, 212, 222, 10, 812, -608, - -608, -608, 9, -608, 201, 201, 168, -608, 56, 253, - 253, -608, -608, 323, -608, -608, -608, -608, -608, -608, - -608, 66, 1570, -608, 85, 93, 1260, 53, -608, 9, - -101, 121, 1570, 133, 56, 56, -608, -608, 1588, -608, - -608, 1869, 305, -608, -608, -608, -608, -608, 1915, -608, - -12, 2220, -608, 303, -608, -608, 9, -608, 176, 170, - 2001, 2001, 177, -91, 2001, -608, 344, 193, -608, 1869, - 2001, 53, 199, 9, 432, -608, 296, 347, 348, 354, - 356, 357, 283, 362, 1365, 317, -608, 55, -608, -608, - -608, -608, -608, 316, 2033, 94, 363, 253, -608, -608, - -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, - -608, -608, -608, -608, -608, 464, 280, 464, 280, 2001, - 2001, 2001, 2001, -608, -608, -608, -608, -608, -608, -608, - -608, -608, -608, -608, -608, 2001, 2001, 2001, 2001, 2001, - 2001, 2001, 2001, 2001, 2001, 2001, 2001, -608, 253, -608, - 43, -608, -608, 192, 1620, -608, -35, -40, -608, 209, - 9, 219, -608, 317, -23, 1588, -608, -608, -608, -608, - -608, -608, -608, -608, -608, -608, -608, 464, 280, 464, - 280, 221, 243, 245, 246, 247, 250, 251, 1749, 2051, - 1305, 386, 254, 256, 257, -608, -608, -608, 259, -608, - 53, 913, -608, 258, 1080, 1080, -608, 1080, 1915, -608, - -608, -608, -608, -608, -608, -608, -608, -608, -608, 2001, - -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, - -608, -608, -608, -608, -608, -608, 2001, 2001, 2001, -29, - -17, -608, 913, -34, 260, 262, 263, 264, 267, 268, - 913, 913, 913, 913, 913, 378, 1915, 2001, 2001, 416, - -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, - -608, -608, 124, -608, -608, -608, -608, 124, -608, 133, - 390, 273, 274, 275, 282, 1869, 1869, 1869, 1869, 1869, - 1869, 1869, -608, -608, 81, 1500, -104, -608, -89, -608, - 1869, 1869, 1869, 277, 1781, -608, -608, -608, -608, -608, - -608, -608, -608, -608, -608, 382, 1799, 2080, 1529, 422, - -608, -608, -608, -608, 2001, 286, -608, 287, 1080, 913, - 913, 913, 913, 36, -608, 49, -608, -608, 1080, 285, - 2001, 2001, 2001, 2001, 2001, 289, 290, 294, 298, 301, - 2001, 1080, 913, 311, -608, -608, -608, -608, -608, -608, - -608, -608, 277, 277, 2001, 1869, 1869, 1869, 1869, -608, - 312, 313, 314, 319, 290, 320, 1869, -608, 309, 1214, - -87, -608, -608, 321, 322, 424, -1, -608, -608, 9, - 331, 334, -608, 454, -608, 99, 1547, -21, -608, -64, - -608, -608, 476, 477, 339, 338, 340, 341, 342, 1080, - 494, 1080, 343, 358, 1080, 359, 9, -608, 361, 365, - 509, 517, 366, 2001, 1080, 1080, 9, 370, 369, 2001, - -608, -608, 11, 374, 377, 381, 383, 82, 1869, 1869, - 1869, 1869, 90, 1869, -608, -608, 375, 1869, 1869, 2001, - 521, 541, -608, 277, 37, 1822, -608, 387, -608, 384, - -51, -608, -608, 1080, 1080, 2098, 1080, 1080, 1080, 1080, - 369, -608, 369, 2001, 1080, 388, 2001, 2001, 2001, -608, - -608, 545, 913, -608, -608, 2098, 497, -608, 913, -608, - 1869, 1869, 1869, 1869, -608, 394, 397, 396, 409, -608, - 290, -608, 412, 413, 46, -608, -608, -608, -608, -608, - -608, 9, 86, 553, -608, 414, 419, 417, 27, 9, - 119, -608, -608, -608, -608, -608, -608, -608, 423, 1080, - -608, -608, -608, -608, 290, 167, 369, 431, 433, 434, - 439, 1869, -608, 1869, 1869, 187, -608, -608, -608, 37, - -608, 527, -608, -608, 572, -2, 762, 762, -608, 2121, - -608, 435, 366, -608, -608, -608, -608, -608, -608, 440, - 441, 443, -608, -608, 597, 452, 1080, -608, 568, 2, - 455, 456, -608, -608, 118, 27, 9, -608, 124, -608, - -608, -608, -608, 592, -608, -608, 458, -608, 568, 192, - 192, 598, 762, 762, -608, 601, 461, 1080, -608, -608, - 1080, 604, 549, 192, 192, -608, 1080, 606, -608, 1080, - -608 + 493, -623, -623, -623, -623, -623, -623, -623, 18, -104, + 15, -100, 70, -57, -3, -623, 148, 542, -623, 191, + 228, -29, 9, -623, 44, 159, -623, 1927, -623, -623, + -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, + -623, 33, 33, 222, -623, -623, -623, -623, 33, -623, + -623, -623, -623, -623, 33, 196, -623, -10, 201, 208, + 218, -623, -623, -623, -623, -623, 93, -623, -623, -623, + -623, -623, -623, -623, -623, 256, 262, 2, 624, -623, + -623, -623, 10, -623, 250, 250, 235, -623, 78, 310, + 310, -623, -623, 254, -623, -623, -623, -623, -623, -623, + -623, -32, 1645, -623, 125, 139, 806, 93, -623, 10, + -109, 137, 1645, 153, 78, 78, -623, -623, 1686, -623, + -623, 1945, 314, -623, -623, -623, -623, -623, -623, 1974, + -623, -12, 2208, -623, 301, -623, -623, 10, -623, 167, + 177, 1992, 1992, 170, -107, 1992, -623, 334, 193, -623, + 1945, 1992, 93, 197, 10, 205, -623, 63, 346, 347, + 348, 349, 355, 243, 357, 1509, 312, -623, 122, -623, + -623, -623, -623, -623, 324, 2033, 129, 371, 310, -623, + -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, + -623, -623, -623, -623, -623, -623, 245, 548, 245, 548, + 1992, 1992, 1992, 1992, -623, -623, -623, -623, -623, -623, + -623, -623, -623, -623, -623, -623, 1992, 1992, 1992, 1992, + 1992, 1992, 1992, 1992, 1992, 1992, 1992, 1992, -623, 310, + -623, 39, -623, -623, 331, 1704, -623, -31, -28, -623, + 216, 10, 226, -623, 312, 8, 1686, -623, -623, -623, + -623, -623, -623, -623, -623, -623, -623, -623, 245, 548, + 245, 548, 229, 230, 231, 232, 233, 234, 236, 1745, + 2051, 1126, 370, 237, 246, 247, -623, -623, -623, 251, + -623, 93, 908, -623, 240, 1076, 1076, -623, 1076, 1974, + -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, + 1992, -623, -623, -623, -623, -623, -623, -623, -623, -623, + -623, -623, -623, -623, -623, -623, -623, 1992, 1992, 1992, + -40, 22, -623, 908, 6, 242, 249, 253, 257, 258, + 260, 908, 908, 908, 908, 908, 369, 1974, 1992, 1992, + 407, -623, -623, -623, -623, -623, -623, -623, -623, -623, + -623, -623, -623, 158, -623, -623, -623, -623, 158, -623, + 153, 376, 259, 264, 265, 266, 1945, 1945, 1945, 1945, + 1945, 1945, 1945, -623, -623, 66, 1170, -111, -623, -88, + -623, 1945, 1945, 1945, 267, 1764, -623, -623, -623, -623, + -623, -623, -623, -623, -623, -623, 363, 1808, 2107, 1403, + 406, -623, -623, -623, -623, 1992, 269, -623, 270, 1076, + 908, 908, 908, 908, 25, -623, 43, -623, -623, 1076, + 268, 1992, 1992, 1992, 1992, 1992, 272, 277, 279, 280, + 281, 1992, 1076, 908, 284, -623, -623, -623, -623, -623, + -623, -623, -623, 267, 267, 1992, 1945, 1945, 1945, 1945, + -623, 285, 286, 287, 288, 277, 289, 1945, -623, 283, + 1357, -87, -623, -623, 292, 295, 418, 16, -623, -623, + 10, 297, 300, -623, 439, -623, 73, 1449, -59, -623, + -69, -623, -623, 446, 454, 315, 322, 332, 335, 336, + 1076, 487, 1076, 338, 339, 1076, 340, 10, -623, 341, + 342, 490, 499, 354, 1992, 1076, 1076, 10, 361, 359, + 1992, -623, -623, 3, 362, 365, 366, 367, 130, 1945, + 1945, 1945, 1945, 146, 1945, -623, -623, 374, 1945, 1945, + 1992, 507, 517, -623, 267, 119, 1866, -623, 377, -623, + 379, -65, -623, -623, 1076, 1076, 2154, 1076, 1076, 1076, + 1076, 359, -623, 359, 1992, 1076, 383, 1992, 1992, 1992, + -623, -623, 530, 908, -623, -623, 2154, 494, -623, 908, + -623, 1945, 1945, 1945, 1945, -623, 384, 389, 390, 391, + -623, 277, -623, 394, 396, 28, -623, -623, -623, -623, + -623, -623, 10, -20, 533, -623, 392, 403, 393, 23, + 10, 161, -623, -623, -623, -623, -623, -623, -623, 402, + 1076, -623, -623, -623, -623, 277, 168, 359, 410, 411, + 412, 413, 1945, -623, 1945, 1945, 176, -623, -623, -623, + 119, -623, 522, -623, -623, 561, -1, 756, 756, -623, + 2213, -623, 414, 354, -623, -623, -623, -623, -623, -623, + 422, 423, 424, -623, -623, 584, 436, 1076, -623, 1222, + 1, 433, 434, -623, -623, 173, 23, 10, -623, 158, + -623, -623, -623, -623, 570, -623, -623, 435, -623, 1222, + 331, 331, 579, 756, 756, -623, 580, 440, 1076, -623, + -623, 1076, 582, 527, 331, 331, -623, 1076, 588, -623, + 1076, -623 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -608, 493, 495, 499, -174, -164, -170, -608, 0, -4, - -146, 535, 5, -608, -608, -608, -608, 58, -608, -608, - -608, -141, -608, -445, -608, -238, -608, -608, -295, 40, - -608, -393, -608, -608, -26, 399, -125, -608, 519, 528, - -86, -162, -262, 157, 269, 391, -608, -608, 618, -608, - -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, - 547, -608, -608, -608, -608, -608, -608, -607, -80, 174, - -189, -608, -608, 581, -608, -608, -608, -608, -608, 74, - 191, -443, -608, -608, -608, -608 + -623, 477, 478, 480, -164, -152, -170, -623, 0, -17, + -146, 523, 4, -623, -623, -623, -623, 64, -623, -623, + -623, -145, -623, -445, -623, -238, -623, -623, -295, 26, + -623, -421, -623, -623, -26, 380, -127, -623, 506, 515, + -86, -162, -262, 89, 223, 378, -623, -623, 605, -623, + -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, + 535, -623, -623, -623, -623, -623, -623, -622, -80, 174, + -189, -623, -623, 566, -623, -623, -623, -623, -623, 60, + 178, -437, -623, -623, -623, -623 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -214 +#define YYTABLE_NINF -215 static const yytype_int16 yytable[] = { - 11, 82, 275, 167, 357, 13, 287, 376, 378, 286, - 91, 522, 321, 286, 105, 111, 168, 11, 94, 277, - 111, 111, 13, 317, 534, 416, 111, 325, 326, 327, - 328, 329, 111, 530, 318, 165, 288, 335, 111, 29, - 30, 31, 32, 33, 34, 35, 36, 489, 37, 510, - 511, 676, 109, 531, 21, 456, 1, 27, 144, 3, - 491, 5, 461, 243, 111, 24, 111, 145, 144, 22, - 456, 686, 456, 25, 246, 2, 136, 239, 4, 462, - 109, 526, -145, 361, 276, 363, 136, 336, 119, 120, - 490, 339, 153, 11, 362, 456, 364, 358, 359, 84, - 85, 111, 153, 490, 542, 284, 89, 46, 456, 47, - 26, 285, 90, 460, 236, 237, 112, 595, 240, 28, - 530, 112, 112, 86, 244, 87, 354, 112, 418, 353, - 413, -67, 44, 112, 475, 477, 479, 625, 456, 112, - 587, 91, 415, -67, 58, 541, 629, 60, 281, 433, - 38, 39, 40, 636, 637, 169, 681, 95, 340, 341, - 337, 338, 657, 408, 59, 112, 677, 112, 569, -67, - 62, 642, 278, 319, 320, 281, 322, 106, 342, 343, - 98, 344, 345, -145, 346, 347, 348, -145, 99, 323, - 281, 281, 281, 281, 281, 330, 331, 332, 333, 334, - 281, 402, 112, 628, 402, 402, 100, 402, 136, 102, - 116, 431, 117, 567, 540, 481, 103, 679, 680, 153, - 682, 683, 38, 39, 40, 133, 104, 435, 436, 437, - 134, 495, 438, 497, 498, 499, 439, 440, 87, 574, - 456, 553, 402, 693, 694, 457, 339, 579, 140, 561, - 402, 402, 402, 402, 402, 605, 141, 606, 456, 435, - 436, 437, 153, 538, 438, 435, 436, 437, 439, 440, - 438, 149, 150, 409, 439, 440, 638, 146, 639, 449, - 450, 451, 452, 453, 454, 455, 249, 250, 251, 252, - 410, 411, 412, 148, 463, 464, 465, 275, 592, -55, - -55, -55, -55, 50, 51, 52, 300, 301, 53, 166, - 153, 432, 281, 340, 341, 122, 123, 124, 125, 126, - 127, 644, 247, 248, 643, 232, 639, 235, 402, 402, - 402, 402, 402, 342, 343, 234, 344, 345, 402, 346, - 347, 348, 1, 238, 652, 3, 561, 5, 241, 459, - 242, 402, 402, 114, 115, 245, -56, -57, 469, 513, - 514, 515, 516, -60, 607, -59, -58, 610, 611, 612, - 524, 253, 111, 279, 286, 355, 356, 365, 281, 276, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 281, 496, 281, 281, 281, 366, - 664, 367, 368, 369, 506, 668, 370, 371, 379, 402, - 380, 402, 381, 382, 402, 384, 430, 404, 512, 419, - 434, 420, 421, 422, 402, 402, 423, 424, 444, 445, - 446, 447, 575, 576, 577, 578, 466, 580, 448, 64, - 65, 582, 583, 472, 480, 482, 483, 494, 500, 501, - 459, 1, 2, 503, 3, 4, 5, 504, 405, 406, - 505, 407, 529, 402, 402, 658, 402, 402, 402, 402, - 509, 518, 519, 520, 402, 525, 537, 562, 521, 523, - 527, 528, 402, 568, 617, 618, 619, 620, 402, 678, - 535, 536, -213, 543, 544, 545, 417, 546, 551, 547, - 548, 549, 553, 584, 425, 426, 427, 428, 429, 591, - -69, 1, 2, 559, 3, 4, 5, 554, 556, 599, - 557, 560, 6, 7, 558, 561, 565, 281, 566, 402, - 281, 281, 281, 570, 588, 649, 571, 650, 651, 599, - 572, 581, 573, 585, 8, 586, 593, 609, 9, 613, - 594, 490, 10, 621, 622, 623, 402, 402, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 624, 626, - 627, 385, 386, 387, 388, 632, 402, 389, 634, 635, - 633, 654, 484, 485, 486, 487, 488, 640, 645, 656, - 646, 647, 493, 390, 391, 392, 648, 669, 670, 667, - 671, 672, 402, 402, 673, 507, 508, 402, 393, 394, - 402, -18, -19, 666, 684, 687, 402, 685, 690, 402, - 691, 696, 697, 699, 224, 653, 225, 395, 131, 588, - 226, 147, 630, 351, 143, 45, 360, 130, 97, 615, - 517, 0, 0, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 257, 258, - 259, 260, 0, 550, 0, 552, 0, 0, 555, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 563, 564, - 0, 0, 0, 0, 0, 0, 0, 261, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 0, 262, 0, 263, 264, 265, 0, 266, 267, 0, - 0, 0, 0, 0, 0, 0, 0, 596, 597, 0, - 601, 602, 603, 604, 0, 0, 0, 0, 608, 0, - 396, 0, 0, 397, 0, 398, 614, 399, 0, 0, - 0, 0, 616, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 385, 386, 387, 388, 64, - 65, 389, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 2, 641, 3, 4, 5, 390, 391, 392, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 393, 394, 0, 0, 0, 0, 0, 0, - 662, 663, 0, 0, 0, 0, 339, 0, 0, 64, - 65, 395, 107, 67, 68, 69, 70, 71, 72, 73, - 675, 1, 2, 0, 3, 4, 5, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 257, 258, 259, 260, 688, 689, 0, 0, - 0, 692, 74, 0, 695, 0, 0, 0, 0, 0, - 698, 0, 0, 700, 0, 0, 0, 0, 0, 0, - 0, 261, 203, 660, 661, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 0, 262, 0, 263, 264, 265, - 0, 266, 267, 342, 343, 0, 344, 345, 0, 346, - 347, 348, 0, 0, 0, 0, 385, 386, 387, 388, - 64, 65, 389, 0, 396, 0, -212, 397, 0, 398, - 0, 399, 1, 2, 0, 3, 4, 5, 390, 391, - 392, 0, 0, 0, -69, 1, 2, 0, 3, 4, - 5, 0, 0, 393, 394, 0, 6, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, - 0, 0, 395, 75, 76, 0, 0, 77, 8, 78, - 108, 0, 9, 0, 0, 0, 10, 0, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 257, 258, 259, 260, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 11, 82, 168, 276, 13, 358, 105, 288, 377, 379, + 287, 91, 287, 322, 531, 111, 169, 11, 523, 94, + 278, 13, 511, 512, 111, 535, 417, 111, 326, 327, + 328, 329, 330, 289, 318, 166, 490, 677, 336, 29, + 30, 31, 32, 33, 34, 35, 36, 319, 37, 457, + 531, 145, 109, 145, 492, 24, 462, 687, 111, 26, + 146, 111, 240, 111, 244, 111, -55, -55, -55, -55, + 532, 21, 457, 457, 25, 247, 137, 111, -146, 491, + 109, 463, 527, 111, 337, 277, 137, 22, 27, 248, + 249, 457, 154, 11, 362, 457, 364, 491, 359, 360, + 543, 457, 28, 154, 596, 84, 85, 363, 542, 365, + 119, 120, 89, 588, 461, 237, 238, 112, 90, 241, + 414, -67, 436, 437, 438, 245, 112, 439, 134, 112, + 58, 440, 441, 135, 354, 476, 478, 480, 1, 355, + 285, 3, 2, 5, 626, 4, 286, 630, 44, 282, + 434, 38, 39, 40, 637, 638, 170, 338, 339, 95, + 112, 570, 409, 112, 658, 112, 678, 112, 59, 419, + 106, -67, 279, 340, 320, 321, 282, 323, 643, 112, + -146, 62, 416, -67, -146, 112, 629, 38, 39, 40, + 324, 282, 282, 282, 282, 282, 331, 332, 333, 334, + 335, 282, 403, 150, 151, 403, 403, 60, 403, 137, + 432, 682, 64, 65, 568, 541, 482, 91, 680, 681, + 154, 683, 684, 98, 1, 2, 457, 3, 4, 5, + 99, 458, 496, 457, 498, 499, 500, 46, 539, 47, + 100, 341, 342, 403, 694, 695, 250, 251, 252, 253, + 102, 403, 403, 403, 403, 403, 606, 86, 607, 87, + 103, 343, 344, 154, 345, 346, 104, 347, 348, 349, + 50, 51, 52, 1, 410, 53, 3, 116, 5, 117, + 450, 451, 452, 453, 454, 455, 456, 87, 575, 141, + 554, 411, 412, 413, 147, 464, 465, 466, 276, 593, + 436, 437, 438, 142, 580, 439, 562, 114, 115, 440, + 441, 154, 433, 282, 149, 436, 437, 438, 167, 639, + 439, 640, 645, 233, 440, 441, 644, 235, 640, 403, + 403, 403, 403, 403, 653, 236, 562, 239, 242, 403, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 460, 243, 403, 403, 246, -56, -57, -60, -59, 470, + 514, 515, 516, 517, -58, 608, 254, 111, 611, 612, + 613, 525, 122, 123, 124, 125, 126, 127, 128, 282, + 277, 280, 287, 356, 357, 340, 366, 367, 368, 369, + 370, 371, 380, 372, 381, 282, 497, 282, 282, 282, + 405, 665, 420, 382, 383, 507, 669, 431, 385, 421, + 403, 435, 403, 422, 445, 403, 446, 423, 424, 513, + 425, 447, 448, 449, 473, 403, 403, 467, 481, 483, + 484, 495, 501, 576, 577, 578, 579, 502, 581, 504, + 505, 506, 583, 584, 510, 519, 520, 521, 522, 524, + 526, 460, 528, 341, 342, 529, 530, 536, 537, 406, + 407, 538, 408, 544, 403, 403, 659, 403, 403, 403, + 403, 545, 546, 343, 344, 403, 345, 346, 563, 347, + 348, 349, 547, 403, 569, 618, 619, 620, 621, 403, + 679, 552, 548, -214, 560, 549, 550, 418, 554, 555, + 557, 558, 559, 561, 585, 426, 427, 428, 429, 430, + 592, -69, 1, 2, 562, 3, 4, 5, 566, 567, + 600, 587, 571, 6, 7, 572, 573, 574, 282, 586, + 403, 282, 282, 282, 614, 589, 650, 594, 651, 652, + 600, 582, -213, 610, 622, 8, 595, 623, 491, 9, + 624, 625, 627, 10, 628, 633, 636, 403, 403, 634, + -69, 1, 2, 635, 3, 4, 5, 641, 646, 647, + 648, 649, 6, 7, 301, 302, 655, 403, 657, 668, + 670, 671, 672, 485, 486, 487, 488, 489, 673, 674, + -18, -19, 685, 494, 8, 686, 688, 691, 9, 697, + 692, 698, 10, 403, 403, 700, 508, 509, 403, 225, + 226, 403, 227, 654, 667, 352, 132, 403, 148, 631, + 403, 144, 45, 97, 361, 131, 616, 0, 518, 0, + 589, 64, 65, 0, 107, 67, 68, 69, 70, 71, + 72, 73, 0, 1, 2, 0, 3, 4, 5, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 0, 551, 0, 553, 0, 0, 556, + 0, 0, 0, 0, 74, 0, 0, 0, 0, 564, + 565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 261, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 0, 262, 0, 263, 264, - 265, 0, 266, 267, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, - 0, 0, 0, 0, 0, 396, 0, 0, 397, 0, - 398, 0, 399, 385, 386, 387, 388, 64, 65, 389, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 2, 0, 3, 4, 5, 390, 391, 392, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 393, 394, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 395, + 0, 0, 0, 0, 0, 0, 0, 0, 597, 598, + 0, 602, 603, 604, 605, 0, 0, 0, 0, 609, + 0, 0, 0, 0, 0, 0, 0, 615, 0, 0, + 0, 0, 0, 617, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 386, + 387, 388, 389, 64, 65, 390, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, + 5, 391, 392, 393, 642, 0, 75, 76, 0, 0, + 77, 0, 78, 108, 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 257, 258, 259, 260, 0, 0, 0, 0, 0, 0, + 340, 663, 664, 64, 65, 396, 107, 67, 68, 69, + 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, + 5, 676, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 258, 259, 260, + 261, 0, 0, 0, 0, 0, 74, 689, 690, 0, + 0, 0, 693, 0, 0, 696, 0, 0, 0, 0, + 0, 699, 0, 0, 701, 0, 262, 204, 661, 662, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 0, + 263, 0, 264, 265, 266, 0, 267, 268, 343, 344, + 0, 345, 346, 0, 347, 348, 349, 0, 0, 0, + 0, 386, 387, 388, 389, 64, 65, 390, 0, 397, + 0, 0, 398, 0, 399, 0, 400, 1, 2, 0, + 3, 4, 5, 391, 392, 393, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 0, 262, 0, 263, 264, 265, 0, 266, - 267, 64, 65, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 2, 0, 3, 4, 5, 254, - 0, 0, 396, 0, 0, 397, 0, 398, 0, 399, - 0, 0, 0, 0, 255, 256, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 64, 65, 111, - 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, - 2, 0, 3, 4, 5, 0, 0, 0, 0, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 257, 258, 259, 260, 0, 0, - 74, 0, 64, 65, 0, 107, 156, 157, 158, 159, - 160, 161, 73, 0, 1, 2, 0, 3, 4, 5, - 0, 0, 0, 261, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 0, 262, 0, 263, - 264, 265, 0, 266, 267, 74, 0, 0, 0, 0, + 0, 0, 0, 111, 0, 0, 0, 396, 75, 76, + 0, 0, 77, 0, 78, 143, 0, 0, 0, 0, + 0, 0, 0, 0, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 258, + 259, 260, 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 112, 0, 64, 65, -67, 0, 268, 0, 0, 269, - 0, 270, 0, 271, 1, 2, 0, 3, 4, 5, - 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 256, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 111, 75, 76, 0, 0, 77, 0, 78, 142, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 262, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 0, 263, 0, 264, 265, 266, 0, 267, 268, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 257, 258, 259, 260, 0, - 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, - 77, 0, 78, 377, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 261, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 0, 262, 0, - 263, 264, 265, 0, 266, 267, 0, 64, 65, 0, - 107, 156, 157, 158, 159, 160, 161, 73, 0, 1, - 2, 112, 3, 4, 5, 0, 0, 268, 0, 0, - 269, 0, 270, 0, 271, 0, 64, 65, 0, 107, - 156, 157, 158, 159, 160, 161, 73, 0, 1, 2, - 74, 3, 4, 5, 64, 65, 0, 107, 156, 157, - 158, 159, 160, 161, 73, 0, 1, 2, 0, 3, - 4, 5, 0, 0, 0, 0, 0, 64, 65, 74, - 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, - 2, 0, 3, 4, 5, 64, 65, 74, 151, 67, - 68, 69, 70, 71, 72, 73, 0, 1, 2, 135, - 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, - 74, 0, 0, 0, 0, 0, 0, 64, 65, 0, - 107, 67, 68, 69, 70, 71, 72, 73, 74, 1, - 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 350, - 0, 75, 76, 0, 0, 77, 0, 78, 458, 0, - 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, + 0, 397, 0, 0, 398, 0, 399, 0, 400, 386, + 387, 388, 389, 64, 65, 390, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, + 5, 391, 392, 393, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 0, 77, 0, 78, 478, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, - 0, 0, 77, 152, 78, 539, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 396, 107, 157, 158, 159, + 160, 161, 162, 73, 0, 1, 2, 0, 3, 4, + 5, 0, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 258, 259, 260, + 261, 0, 0, 0, 0, 0, 74, 64, 65, 0, + 107, 157, 158, 159, 160, 161, 162, 73, 0, 1, + 2, 0, 3, 4, 5, 0, 262, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 0, + 263, 0, 264, 265, 266, 0, 267, 268, 0, 0, + 74, 0, 0, 0, 0, 386, 387, 388, 389, 0, + 0, 390, 0, 0, 0, 0, 0, 0, 0, 397, + 0, 0, 398, 0, 399, 0, 400, 391, 392, 393, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 78, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, - 76, 0, 0, 77, 0, 78, 64, 65, 0, 107, - 156, 157, 158, 159, 160, 161, 73, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 78, 64, 65, - 0, 107, 67, 68, 69, 70, 71, 72, 73, 74, - 1, 2, 0, 3, 4, 5, 64, 65, 0, 107, - 156, 157, 158, 159, 160, 161, 73, 0, 1, 2, - 468, 3, 4, 5, 0, 0, 0, 0, 0, 64, - 65, 74, 107, 67, 68, 69, 70, 71, 72, 73, - 0, 1, 2, 0, 3, 4, 5, 64, 65, 74, - 66, 67, 68, 69, 70, 71, 72, 73, 0, 1, - 2, 590, 3, 4, 5, 0, 0, 0, 0, 0, - 0, 0, 74, 0, 0, 0, 64, 65, 0, 107, - 156, 157, 158, 159, 160, 161, 73, 0, 1, 2, - 74, 3, 4, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 372, 77, 0, 78, 0, 0, 74, - 0, 0, 64, 65, 0, 151, 67, 68, 69, 70, - 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, - 0, 0, 75, 76, 0, 0, 77, 0, 78, 0, + 0, 396, 0, 0, 0, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 378, 0, 0, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 258, 259, 260, 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 0, 474, 77, 74, 78, 0, 0, 0, + 0, 0, 75, 76, 0, 0, 77, 0, 78, 459, + 0, 0, 262, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 0, 263, 0, 264, 265, + 266, 0, 267, 268, 64, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, + 4, 5, 255, 0, 0, 397, 0, 0, 398, 0, + 399, 0, 400, 0, 0, 0, 0, 256, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, + 64, 65, 111, 107, 157, 158, 159, 160, 161, 162, + 73, 0, 1, 2, 0, 3, 4, 5, 0, 0, + 0, 0, 0, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 258, 259, + 260, 261, 0, 74, 0, 0, 64, 65, 0, 107, + 157, 158, 159, 160, 161, 162, 73, 0, 1, 2, + 0, 3, 4, 5, 0, 0, 0, 262, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 0, 263, 0, 264, 265, 266, 0, 267, 268, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 78, 64, 65, - 0, 107, 67, 68, 69, 70, 71, 72, 73, 0, + 0, 0, 0, 0, 112, 0, 64, 65, -67, 0, + 269, 0, 0, 270, 0, 271, 0, 272, 1, 2, + 0, 3, 4, 5, 255, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, + 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 111, 75, 76, 0, 0, 77, + 0, 78, 479, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 258, 259, 260, 261, 0, 0, 0, 0, 0, 0, + 0, 75, 76, 0, 0, 77, 0, 78, 540, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 0, 263, 0, 264, 265, 266, 0, 267, + 268, 0, 64, 65, 0, 107, 67, 68, 69, 70, + 71, 72, 73, 0, 1, 2, 112, 3, 4, 5, + 0, 0, 269, 0, 0, 270, 0, 271, 0, 272, + 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 74, 152, 67, 68, 69, + 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, + 5, 64, 65, 0, 107, 67, 68, 69, 70, 71, + 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, + 0, 0, 0, 351, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 74, 107, 157, 158, 159, 160, + 161, 162, 73, 0, 1, 2, 0, 3, 4, 5, + 0, 64, 65, 0, 107, 67, 68, 69, 70, 71, + 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, + 0, 0, 0, 469, 0, 0, 0, 75, 76, 0, + 0, 77, 153, 78, 74, 64, 65, 0, 107, 157, + 158, 159, 160, 161, 162, 73, 0, 1, 2, 0, + 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 0, 0, 0, 74, 0, + 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, + 77, 0, 78, 64, 65, 0, 107, 67, 68, 69, + 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 591, 0, 75, 76, 0, + 373, 77, 0, 78, 0, 0, 74, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, + 77, 0, 78, 0, 64, 65, 0, 66, 67, 68, + 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, + 4, 5, 64, 65, 0, 107, 157, 158, 159, 160, + 161, 162, 73, 0, 1, 2, 0, 3, 4, 5, + 75, 76, 0, 475, 77, 0, 78, 74, 0, 0, + 0, 64, 65, 0, 152, 67, 68, 69, 70, 71, + 72, 73, 0, 1, 2, 74, 3, 4, 5, 64, + 65, 0, 107, 67, 68, 69, 70, 71, 72, 73, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 74, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, + 64, 65, 74, 281, 67, 68, 69, 70, 71, 72, + 73, 0, 1, 2, 0, 3, 4, 5, 64, 65, + 0, 107, 157, 158, 159, 160, 161, 162, 73, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, - 75, 76, 0, 0, 77, 0, 78, 0, 0, 0, - 64, 65, 0, 280, 67, 68, 69, 70, 71, 72, - 73, 74, 1, 2, 0, 3, 4, 5, 64, 65, - 0, 107, 156, 157, 158, 159, 160, 161, 73, 0, - 1, 2, 0, 3, 4, 5, 75, 76, 0, 0, - 77, 0, 78, 74, 0, 0, 0, 64, 65, 0, - 107, 156, 157, 158, 159, 160, 161, 73, 0, 1, - 2, 74, 3, 4, 5, 64, 65, 0, 107, 67, - 68, 69, 70, 71, 72, 598, 0, 1, 2, 0, - 3, 4, 5, 0, 0, 0, 0, 0, 64, 65, - 74, 107, 67, 68, 69, 70, 71, 72, 665, 0, - 1, 2, 0, 3, 4, 5, 0, 0, 74, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 76, 0, 0, 77, 0, 78, 0, - 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 0, 0, 0, 0, 0, 75, + 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, + 0, 74, 0, 0, 0, 0, 0, 75, 76, 0, + 0, 77, 0, 78, 64, 65, 0, 107, 157, 158, + 159, 160, 161, 162, 73, 0, 1, 2, 0, 3, + 4, 5, 0, 0, 0, 0, 75, 76, 0, 0, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 0, 74, 77, 0, + 78, 64, 65, 0, 107, 67, 68, 69, 70, 71, + 72, 599, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, - 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 76, 0, 0, 77, 0, 375, 0, + 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, + 0, 78, 0, 0, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 76, 0, 0, 77, 0, 376, + 64, 65, 0, 107, 67, 68, 69, 70, 71, 72, + 666, 0, 1, 2, 0, 3, 4, 5, 0, 0, + 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 0, 173, 174, 0, 0, 75, + 76, 0, 0, 77, 0, 477, 0, 0, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, + 77, 0, 78, 200, 201, 202, 0, 0, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 0, 0, 77, 0, 476, 0, 0, - 0, 0, 0, 0, 0, 0, 171, 0, 0, 75, - 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 172, 173, 0, - 0, 0, 75, 76, 0, 0, 77, 0, 78, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 199, 200, 201, 0, 0, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223 + 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, + 0, 78 }; static const yytype_int16 yycheck[] = { - 0, 27, 164, 128, 242, 0, 176, 269, 270, 11, - 21, 454, 201, 11, 4, 55, 28, 17, 29, 165, - 55, 55, 17, 197, 469, 320, 55, 216, 217, 218, - 219, 220, 55, 34, 198, 121, 177, 226, 55, 42, - 43, 44, 45, 46, 47, 48, 49, 11, 51, 442, - 443, 658, 78, 54, 53, 159, 19, 18, 159, 22, - 11, 24, 166, 149, 55, 158, 55, 168, 159, 68, - 159, 678, 159, 59, 154, 20, 102, 168, 23, 168, - 106, 168, 55, 257, 164, 259, 112, 228, 32, 33, - 54, 54, 118, 93, 258, 159, 260, 243, 244, 41, - 42, 55, 128, 54, 168, 11, 48, 46, 159, 48, - 158, 17, 54, 375, 140, 141, 156, 168, 144, 158, - 34, 156, 156, 35, 150, 37, 166, 156, 162, 164, - 159, 160, 0, 156, 396, 397, 398, 580, 159, 156, - 533, 21, 159, 160, 158, 166, 591, 162, 174, 338, - 153, 154, 155, 598, 599, 167, 38, 168, 121, 122, - 117, 118, 164, 288, 158, 156, 164, 156, 157, 160, - 22, 614, 167, 199, 200, 201, 202, 167, 141, 142, - 22, 144, 145, 156, 147, 148, 149, 160, 22, 215, + 0, 27, 129, 165, 0, 243, 4, 177, 270, 271, + 11, 21, 11, 202, 34, 55, 28, 17, 455, 29, + 166, 17, 443, 444, 55, 470, 321, 55, 217, 218, + 219, 220, 221, 178, 198, 121, 11, 659, 227, 42, + 43, 44, 45, 46, 47, 48, 49, 199, 51, 160, + 34, 160, 78, 160, 11, 159, 167, 679, 55, 159, + 169, 55, 169, 55, 150, 55, 3, 4, 5, 6, + 54, 53, 160, 160, 59, 155, 102, 55, 55, 54, + 106, 169, 169, 55, 229, 165, 112, 69, 18, 26, + 27, 160, 118, 93, 258, 160, 260, 54, 244, 245, + 169, 160, 159, 129, 169, 41, 42, 259, 167, 261, + 32, 33, 48, 534, 376, 141, 142, 157, 54, 145, + 160, 161, 142, 143, 144, 151, 157, 147, 160, 157, + 159, 151, 152, 165, 165, 397, 398, 399, 19, 167, + 11, 22, 20, 24, 581, 23, 17, 592, 0, 175, + 339, 154, 155, 156, 599, 600, 168, 118, 119, 169, + 157, 158, 289, 157, 165, 157, 165, 157, 159, 163, + 168, 161, 168, 54, 200, 201, 202, 203, 615, 157, + 157, 22, 160, 161, 161, 157, 158, 154, 155, 156, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 281, 156, 157, 284, 285, 22, 287, 234, 156, - 42, 336, 44, 508, 476, 404, 4, 662, 663, 245, - 665, 666, 153, 154, 155, 159, 4, 141, 142, 143, - 164, 420, 146, 422, 423, 424, 150, 151, 37, 157, - 159, 159, 322, 688, 689, 164, 54, 157, 163, 159, - 330, 331, 332, 333, 334, 550, 163, 552, 159, 141, - 142, 143, 288, 164, 146, 141, 142, 143, 150, 151, - 146, 114, 115, 299, 150, 151, 157, 156, 159, 365, - 366, 367, 368, 369, 370, 371, 3, 4, 5, 6, - 316, 317, 318, 160, 380, 381, 382, 459, 536, 3, - 4, 5, 6, 42, 43, 44, 26, 27, 47, 4, - 336, 337, 338, 121, 122, 62, 63, 64, 65, 66, - 67, 616, 26, 27, 157, 22, 159, 157, 408, 409, - 410, 411, 412, 141, 142, 159, 144, 145, 418, 147, - 148, 149, 19, 166, 157, 22, 159, 24, 4, 375, - 157, 431, 432, 84, 85, 156, 9, 9, 384, 445, - 446, 447, 448, 9, 553, 9, 9, 556, 557, 558, - 456, 9, 55, 57, 11, 166, 157, 156, 404, 459, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 420, 421, 422, 423, 424, 156, - 638, 156, 156, 156, 430, 643, 156, 156, 22, 489, - 156, 491, 156, 156, 494, 156, 38, 159, 444, 159, - 4, 159, 159, 159, 504, 505, 159, 159, 38, 156, - 156, 156, 518, 519, 520, 521, 159, 523, 156, 7, - 8, 527, 528, 61, 22, 159, 159, 162, 159, 159, - 476, 19, 20, 159, 22, 23, 24, 159, 284, 285, - 159, 287, 38, 543, 544, 635, 546, 547, 548, 549, - 159, 159, 159, 159, 554, 166, 22, 503, 159, 159, - 159, 159, 562, 509, 570, 571, 572, 573, 568, 659, - 159, 157, 0, 17, 17, 156, 322, 159, 4, 159, - 159, 159, 159, 529, 330, 331, 332, 333, 334, 535, - 18, 19, 20, 4, 22, 23, 24, 159, 159, 545, - 159, 4, 30, 31, 159, 159, 156, 553, 159, 609, - 556, 557, 558, 159, 534, 621, 159, 623, 624, 565, - 159, 166, 159, 22, 52, 4, 159, 159, 56, 4, - 166, 54, 60, 159, 157, 159, 636, 637, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 159, 157, - 157, 3, 4, 5, 6, 22, 656, 9, 159, 162, - 166, 54, 408, 409, 410, 411, 412, 164, 157, 17, - 157, 157, 418, 25, 26, 27, 157, 157, 157, 164, - 157, 4, 682, 683, 152, 431, 432, 687, 40, 41, - 690, 156, 156, 639, 22, 17, 696, 159, 17, 699, - 159, 17, 73, 17, 131, 629, 131, 59, 93, 629, - 131, 112, 592, 234, 106, 17, 245, 90, 57, 565, - 449, -1, -1, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, -1, 489, -1, 491, -1, -1, 494, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 504, 505, - -1, -1, -1, -1, -1, -1, -1, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - -1, 133, -1, 135, 136, 137, -1, 139, 140, -1, - -1, -1, -1, -1, -1, -1, -1, 543, 544, -1, - 546, 547, 548, 549, -1, -1, -1, -1, 554, -1, - 162, -1, -1, 165, -1, 167, 562, 169, -1, -1, - -1, -1, 568, -1, -1, -1, -1, -1, -1, -1, + 226, 227, 282, 114, 115, 285, 286, 163, 288, 235, + 337, 38, 7, 8, 509, 477, 405, 21, 663, 664, + 246, 666, 667, 22, 19, 20, 160, 22, 23, 24, + 22, 165, 421, 160, 423, 424, 425, 46, 165, 48, + 22, 122, 123, 323, 689, 690, 3, 4, 5, 6, + 157, 331, 332, 333, 334, 335, 551, 35, 553, 37, + 4, 142, 143, 289, 145, 146, 4, 148, 149, 150, + 42, 43, 44, 19, 300, 47, 22, 42, 24, 44, + 366, 367, 368, 369, 370, 371, 372, 37, 158, 164, + 160, 317, 318, 319, 157, 381, 382, 383, 460, 537, + 142, 143, 144, 164, 158, 147, 160, 84, 85, 151, + 152, 337, 338, 339, 161, 142, 143, 144, 4, 158, + 147, 160, 617, 22, 151, 152, 158, 160, 160, 409, + 410, 411, 412, 413, 158, 158, 160, 167, 4, 419, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 376, 158, 432, 433, 157, 9, 9, 9, 9, 385, + 446, 447, 448, 449, 9, 554, 9, 55, 557, 558, + 559, 457, 62, 63, 64, 65, 66, 67, 68, 405, + 460, 57, 11, 167, 158, 54, 157, 157, 157, 157, + 157, 157, 22, 157, 157, 421, 422, 423, 424, 425, + 160, 639, 160, 157, 157, 431, 644, 38, 157, 160, + 490, 4, 492, 160, 38, 495, 157, 160, 160, 445, + 160, 157, 157, 157, 61, 505, 506, 160, 22, 160, + 160, 163, 160, 519, 520, 521, 522, 160, 524, 160, + 160, 160, 528, 529, 160, 160, 160, 160, 160, 160, + 167, 477, 160, 122, 123, 160, 38, 160, 158, 285, + 286, 22, 288, 17, 544, 545, 636, 547, 548, 549, + 550, 17, 157, 142, 143, 555, 145, 146, 504, 148, + 149, 150, 160, 563, 510, 571, 572, 573, 574, 569, + 660, 4, 160, 0, 4, 160, 160, 323, 160, 160, + 160, 160, 160, 4, 530, 331, 332, 333, 334, 335, + 536, 18, 19, 20, 160, 22, 23, 24, 157, 160, + 546, 4, 160, 30, 31, 160, 160, 160, 554, 22, + 610, 557, 558, 559, 4, 535, 622, 160, 624, 625, + 566, 167, 0, 160, 160, 52, 167, 158, 54, 56, + 160, 160, 158, 60, 158, 22, 163, 637, 638, 167, + 18, 19, 20, 160, 22, 23, 24, 165, 158, 158, + 158, 158, 30, 31, 26, 27, 54, 657, 17, 165, + 158, 158, 158, 409, 410, 411, 412, 413, 4, 153, + 157, 157, 22, 419, 52, 160, 17, 17, 56, 17, + 160, 74, 60, 683, 684, 17, 432, 433, 688, 132, + 132, 691, 132, 630, 640, 235, 93, 697, 112, 593, + 700, 106, 17, 57, 246, 90, 566, -1, 450, -1, + 630, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 490, -1, 492, -1, -1, 495, + -1, -1, -1, -1, 50, -1, -1, -1, -1, 505, + 506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3, 4, 5, 6, 7, - 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 609, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, - 636, 637, -1, -1, -1, -1, 54, -1, -1, 7, - 8, 59, 10, 11, 12, 13, 14, 15, 16, 17, - 656, 19, 20, -1, 22, 23, 24, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 682, 683, -1, -1, - -1, 687, 50, -1, 690, -1, -1, -1, -1, -1, - 696, -1, -1, 699, -1, -1, -1, -1, -1, -1, - -1, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, -1, 133, -1, 135, 136, 137, - -1, 139, 140, 141, 142, -1, 144, 145, -1, 147, - 148, 149, -1, -1, -1, -1, 3, 4, 5, 6, - 7, 8, 9, -1, 162, -1, 0, 165, -1, 167, - -1, 169, 19, 20, -1, 22, 23, 24, 25, 26, - 27, -1, -1, -1, 18, 19, 20, -1, 22, 23, - 24, -1, -1, 40, 41, -1, 30, 31, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, - -1, -1, 59, 161, 162, -1, -1, 165, 52, 167, - 168, -1, 56, -1, -1, -1, 60, -1, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 544, 545, + -1, 547, 548, 549, 550, -1, -1, -1, -1, 555, + -1, -1, -1, -1, -1, -1, -1, 563, -1, -1, + -1, -1, -1, 569, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, + 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, + 24, 25, 26, 27, 610, -1, 162, 163, -1, -1, + 166, -1, 168, 169, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 54, 637, 638, 7, 8, 59, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, 657, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, -1, -1, -1, -1, -1, 50, 683, 684, -1, + -1, -1, 688, -1, -1, 691, -1, -1, -1, -1, + -1, 697, -1, -1, 700, -1, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, + 134, -1, 136, 137, 138, -1, 140, 141, 142, 143, + -1, 145, 146, -1, 148, 149, 150, -1, -1, -1, + -1, 3, 4, 5, 6, 7, 8, 9, -1, 163, + -1, -1, 166, -1, 168, -1, 170, 19, 20, -1, + 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, -1, 133, -1, 135, 136, - 137, -1, 139, 140, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 156, - -1, -1, -1, -1, -1, 162, -1, -1, 165, -1, - 167, -1, 169, 3, 4, 5, 6, 7, 8, 9, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, + -1, -1, -1, 55, -1, -1, -1, 59, 162, 163, + -1, -1, 166, -1, 168, 169, -1, -1, -1, -1, + -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, -1, -1, -1, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, -1, 134, -1, 136, 137, 138, -1, 140, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 157, -1, -1, -1, -1, + -1, 163, -1, -1, 166, -1, 168, -1, 170, 3, + 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, + 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, -1, 133, -1, 135, 136, 137, -1, 139, - 140, 7, 8, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, -1, 22, 23, 24, 25, - -1, -1, 162, -1, -1, 165, -1, 167, -1, 169, - -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 7, 8, 55, + -1, -1, -1, 7, 8, 59, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, -1, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, -1, -1, -1, -1, -1, 50, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, -1, -1, -1, -1, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, - 50, -1, 7, 8, -1, 10, 11, 12, 13, 14, - 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, - -1, -1, -1, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, -1, 133, -1, 135, - 136, 137, -1, 139, 140, 50, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 156, -1, 7, 8, 160, -1, 162, -1, -1, 165, - -1, 167, -1, 169, 19, 20, -1, 22, 23, 24, - 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, + 20, -1, 22, 23, 24, -1, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, + 134, -1, 136, 137, 138, -1, 140, 141, -1, -1, + 50, -1, -1, -1, -1, 3, 4, 5, 6, -1, + -1, 9, -1, -1, -1, -1, -1, -1, -1, 163, + -1, -1, 166, -1, 168, -1, 170, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 55, 161, 162, -1, -1, 165, -1, 167, 168, -1, + -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, - -1, -1, -1, -1, -1, -1, 161, 162, -1, -1, - 165, -1, 167, 168, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, -1, 133, -1, - 135, 136, 137, -1, 139, 140, -1, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, 156, 22, 23, 24, -1, -1, 162, -1, -1, - 165, -1, 167, -1, 169, -1, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - 50, 22, 23, 24, 7, 8, -1, 10, 11, 12, - 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, - 23, 24, -1, -1, -1, -1, -1, 7, 8, 50, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, 7, 8, 50, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, 39, - 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, - 50, -1, -1, -1, -1, -1, -1, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, 50, 19, - 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, - -1, 161, 162, -1, -1, 165, -1, 167, 168, -1, - 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, -1, 162, 163, + -1, -1, 166, -1, 168, 169, -1, -1, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 161, 162, -1, -1, 165, -1, 167, 168, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 161, 162, - -1, -1, 165, 125, 167, 168, -1, -1, -1, -1, + -1, -1, 162, 163, -1, -1, 166, -1, 168, 169, + -1, -1, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, -1, 134, -1, 136, 137, + 138, -1, 140, 141, 7, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 19, 20, -1, 22, + 23, 24, 25, -1, -1, 163, -1, -1, 166, -1, + 168, -1, 170, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 161, 162, -1, -1, 165, -1, 167, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, - 162, -1, -1, 165, -1, 167, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, 161, 162, -1, -1, 165, -1, 167, 7, 8, - -1, 10, 11, 12, 13, 14, 15, 16, 17, 50, - 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, + 7, 8, 55, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, + -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, -1, 50, -1, -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - 39, 22, 23, 24, -1, -1, -1, -1, -1, 7, - 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, - -1, 19, 20, -1, 22, 23, 24, 7, 8, 50, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, 39, 22, 23, 24, -1, -1, -1, -1, -1, - -1, -1, 50, -1, -1, -1, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - 50, 22, 23, 24, -1, -1, -1, -1, -1, -1, + -1, 22, 23, 24, -1, -1, -1, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + -1, 134, -1, 136, 137, 138, -1, 140, 141, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 161, 162, -1, 164, 165, -1, 167, -1, -1, 50, - -1, -1, 7, 8, -1, 10, 11, 12, 13, 14, + -1, -1, -1, -1, 157, -1, 7, 8, 161, -1, + 163, -1, -1, 166, -1, 168, -1, 170, 19, 20, + -1, 22, 23, 24, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, + 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 55, 162, 163, -1, -1, 166, + -1, 168, 169, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, -1, -1, -1, -1, -1, -1, + -1, 162, 163, -1, -1, 166, -1, 168, 169, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, -1, 134, -1, 136, 137, 138, -1, 140, + 141, -1, 7, 8, -1, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, 157, 22, 23, 24, + -1, -1, 163, -1, -1, 166, -1, 168, -1, 170, + -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 7, 8, 50, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, + -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, + -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, + -1, -1, 7, 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, - -1, -1, 161, 162, -1, -1, 165, -1, 167, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 161, 162, -1, 164, 165, 50, 167, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 161, 162, -1, -1, 165, -1, 167, 7, 8, + -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, + -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, + -1, -1, -1, 39, -1, -1, -1, 162, 163, -1, + -1, 166, 126, 168, 50, 7, 8, -1, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 162, 163, + -1, -1, 166, -1, 168, -1, -1, -1, 50, -1, + -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, + 166, -1, 168, 7, 8, -1, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 39, -1, 162, 163, -1, + 165, 166, -1, 168, -1, -1, 50, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, + 166, -1, 168, -1, 7, 8, -1, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, + 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, + 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, + 162, 163, -1, 165, 166, -1, 168, 50, -1, -1, + -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, 50, 22, 23, 24, 7, + 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, 50, -1, -1, -1, 162, 163, + -1, -1, 166, -1, 168, -1, -1, -1, -1, -1, + 7, 8, 50, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, - 161, 162, -1, -1, 165, -1, 167, -1, -1, -1, - 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, - 17, 50, 19, 20, -1, 22, 23, 24, 7, 8, - -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, - 19, 20, -1, 22, 23, 24, 161, 162, -1, -1, - 165, -1, 167, 50, -1, -1, -1, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, 50, 22, 23, 24, 7, 8, -1, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, -1, -1, -1, -1, -1, 7, 8, - 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, - 19, 20, -1, 22, 23, 24, -1, -1, 50, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 161, 162, -1, -1, 165, -1, 167, -1, - -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 50, -1, -1, -1, -1, -1, 162, + 163, -1, -1, 166, -1, 168, -1, -1, -1, -1, + -1, 50, -1, -1, -1, -1, -1, 162, 163, -1, + -1, 166, -1, 168, 7, 8, -1, 10, 11, 12, + 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, + 23, 24, -1, -1, -1, -1, 162, 163, -1, -1, + 166, -1, 168, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 162, 163, -1, 50, 166, -1, + 168, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 161, 162, -1, -1, 165, -1, - 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 161, 162, -1, -1, 165, -1, 167, -1, + -1, -1, -1, -1, -1, 162, 163, -1, -1, 166, + -1, 168, -1, -1, 50, -1, -1, -1, -1, -1, + -1, -1, -1, 162, 163, -1, -1, 166, -1, 168, + 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, + -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 50, -1, 57, 58, -1, -1, 162, + 163, -1, -1, 166, -1, 168, -1, -1, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, + 166, -1, 168, 115, 116, 117, -1, -1, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 161, 162, -1, -1, 165, -1, 167, -1, -1, - -1, -1, -1, -1, -1, -1, 36, -1, -1, 161, - 162, -1, -1, 165, -1, 167, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 57, 58, -1, - -1, -1, 161, 162, -1, -1, 165, -1, 167, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 114, 115, 116, -1, -1, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140 + -1, -1, -1, -1, -1, 162, 163, -1, -1, 166, + -1, 168 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_uint16 yystos[] = { 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, - 60, 178, 181, 182, 183, 184, 216, 217, 218, 220, - 219, 53, 68, 225, 158, 59, 158, 18, 158, 42, - 43, 44, 45, 46, 47, 48, 49, 51, 153, 154, - 155, 185, 186, 187, 0, 218, 46, 48, 188, 235, - 42, 43, 44, 47, 189, 232, 234, 242, 158, 158, - 162, 226, 22, 224, 7, 8, 10, 11, 12, 13, - 14, 15, 16, 17, 50, 161, 162, 165, 167, 178, - 182, 203, 204, 238, 187, 187, 35, 37, 214, 187, - 187, 21, 243, 244, 29, 168, 233, 243, 22, 22, - 22, 227, 156, 4, 4, 4, 167, 10, 168, 204, - 209, 55, 156, 180, 214, 214, 42, 44, 190, 32, - 33, 213, 62, 63, 64, 65, 66, 67, 191, 230, - 230, 181, 247, 159, 164, 39, 204, 205, 207, 208, - 163, 163, 168, 209, 159, 168, 156, 208, 160, 213, - 213, 10, 125, 204, 206, 215, 11, 12, 13, 14, - 15, 16, 176, 177, 204, 210, 4, 206, 28, 167, - 231, 36, 57, 58, 69, 70, 71, 72, 73, 74, + 60, 179, 182, 183, 184, 185, 217, 218, 219, 221, + 220, 53, 69, 226, 159, 59, 159, 18, 159, 42, + 43, 44, 45, 46, 47, 48, 49, 51, 154, 155, + 156, 186, 187, 188, 0, 219, 46, 48, 189, 236, + 42, 43, 44, 47, 190, 233, 235, 243, 159, 159, + 163, 227, 22, 225, 7, 8, 10, 11, 12, 13, + 14, 15, 16, 17, 50, 162, 163, 166, 168, 179, + 183, 204, 205, 239, 188, 188, 35, 37, 215, 188, + 188, 21, 244, 245, 29, 169, 234, 244, 22, 22, + 22, 228, 157, 4, 4, 4, 168, 10, 169, 205, + 210, 55, 157, 181, 215, 215, 42, 44, 191, 32, + 33, 214, 62, 63, 64, 65, 66, 67, 68, 192, + 231, 231, 182, 248, 160, 165, 39, 205, 206, 208, + 209, 164, 164, 169, 210, 160, 169, 157, 209, 161, + 214, 214, 10, 126, 205, 207, 216, 11, 12, 13, + 14, 15, 16, 177, 178, 205, 211, 4, 207, 28, + 168, 232, 36, 57, 58, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 114, - 115, 116, 119, 120, 121, 122, 123, 124, 125, 126, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 171, 172, 173, 245, 252, 253, - 254, 255, 22, 193, 159, 157, 204, 204, 166, 168, - 204, 4, 157, 210, 204, 156, 238, 26, 27, 3, - 4, 5, 6, 9, 25, 40, 41, 90, 91, 92, - 93, 119, 133, 135, 136, 137, 139, 140, 162, 165, - 167, 169, 171, 172, 173, 211, 238, 180, 182, 57, - 10, 204, 240, 241, 11, 17, 11, 176, 191, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 174, - 26, 27, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 175, 174, 175, 204, - 204, 240, 204, 204, 248, 240, 240, 240, 240, 240, - 204, 204, 204, 204, 204, 240, 191, 117, 118, 54, - 121, 122, 141, 142, 144, 145, 147, 148, 149, 192, - 39, 205, 195, 164, 166, 166, 157, 195, 180, 180, - 215, 174, 175, 174, 175, 156, 156, 156, 156, 156, - 156, 156, 164, 210, 212, 167, 212, 168, 212, 22, - 156, 156, 156, 221, 156, 3, 4, 5, 6, 9, - 25, 26, 27, 40, 41, 59, 162, 165, 167, 169, - 211, 237, 238, 239, 159, 239, 239, 239, 206, 204, - 204, 204, 204, 159, 198, 159, 198, 239, 162, 159, - 159, 159, 159, 159, 159, 239, 239, 239, 239, 239, - 38, 206, 204, 240, 4, 141, 142, 143, 146, 150, - 151, 194, 222, 223, 38, 156, 156, 156, 156, 210, - 210, 210, 210, 210, 210, 210, 159, 164, 168, 204, - 212, 166, 168, 210, 210, 210, 159, 201, 39, 204, - 228, 229, 61, 236, 164, 212, 167, 212, 168, 212, - 22, 240, 159, 159, 239, 239, 239, 239, 239, 11, - 54, 11, 250, 239, 162, 240, 204, 240, 240, 240, - 159, 159, 251, 159, 159, 159, 204, 239, 239, 159, - 201, 201, 204, 210, 210, 210, 210, 250, 159, 159, - 159, 159, 251, 159, 210, 166, 168, 159, 159, 38, - 34, 54, 199, 202, 193, 159, 157, 22, 164, 168, - 212, 166, 168, 17, 17, 156, 159, 159, 159, 159, - 239, 4, 239, 159, 159, 239, 159, 159, 159, 4, - 4, 159, 204, 239, 239, 156, 159, 198, 204, 157, - 159, 159, 159, 159, 157, 210, 210, 210, 210, 157, - 210, 166, 210, 210, 204, 22, 4, 201, 178, 179, - 39, 204, 195, 159, 166, 168, 239, 239, 17, 204, - 249, 239, 239, 239, 239, 198, 198, 240, 239, 159, - 240, 240, 240, 4, 239, 249, 239, 210, 210, 210, - 210, 159, 157, 159, 159, 251, 157, 157, 157, 193, - 199, 200, 22, 166, 159, 162, 193, 193, 157, 159, - 164, 239, 251, 157, 198, 157, 157, 157, 157, 210, - 210, 210, 157, 179, 54, 197, 17, 164, 176, 246, - 121, 122, 239, 239, 195, 17, 204, 164, 195, 157, - 157, 157, 4, 152, 196, 239, 237, 164, 176, 193, - 193, 38, 193, 193, 22, 159, 237, 17, 239, 239, - 17, 159, 239, 193, 193, 239, 17, 73, 239, 17, - 239 + 137, 138, 139, 140, 141, 172, 173, 174, 246, 253, + 254, 255, 256, 22, 194, 160, 158, 205, 205, 167, + 169, 205, 4, 158, 211, 205, 157, 239, 26, 27, + 3, 4, 5, 6, 9, 25, 40, 41, 91, 92, + 93, 94, 120, 134, 136, 137, 138, 140, 141, 163, + 166, 168, 170, 172, 173, 174, 212, 239, 181, 183, + 57, 10, 205, 241, 242, 11, 17, 11, 177, 192, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 175, 26, 27, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 176, 175, 176, + 205, 205, 241, 205, 205, 249, 241, 241, 241, 241, + 241, 205, 205, 205, 205, 205, 241, 192, 118, 119, + 54, 122, 123, 142, 143, 145, 146, 148, 149, 150, + 193, 39, 206, 196, 165, 167, 167, 158, 196, 181, + 181, 216, 175, 176, 175, 176, 157, 157, 157, 157, + 157, 157, 157, 165, 211, 213, 168, 213, 169, 213, + 22, 157, 157, 157, 222, 157, 3, 4, 5, 6, + 9, 25, 26, 27, 40, 41, 59, 163, 166, 168, + 170, 212, 238, 239, 240, 160, 240, 240, 240, 207, + 205, 205, 205, 205, 160, 199, 160, 199, 240, 163, + 160, 160, 160, 160, 160, 160, 240, 240, 240, 240, + 240, 38, 207, 205, 241, 4, 142, 143, 144, 147, + 151, 152, 195, 223, 224, 38, 157, 157, 157, 157, + 211, 211, 211, 211, 211, 211, 211, 160, 165, 169, + 205, 213, 167, 169, 211, 211, 211, 160, 202, 39, + 205, 229, 230, 61, 237, 165, 213, 168, 213, 169, + 213, 22, 241, 160, 160, 240, 240, 240, 240, 240, + 11, 54, 11, 251, 240, 163, 241, 205, 241, 241, + 241, 160, 160, 252, 160, 160, 160, 205, 240, 240, + 160, 202, 202, 205, 211, 211, 211, 211, 251, 160, + 160, 160, 160, 252, 160, 211, 167, 169, 160, 160, + 38, 34, 54, 200, 203, 194, 160, 158, 22, 165, + 169, 213, 167, 169, 17, 17, 157, 160, 160, 160, + 160, 240, 4, 240, 160, 160, 240, 160, 160, 160, + 4, 4, 160, 205, 240, 240, 157, 160, 199, 205, + 158, 160, 160, 160, 160, 158, 211, 211, 211, 211, + 158, 211, 167, 211, 211, 205, 22, 4, 202, 179, + 180, 39, 205, 196, 160, 167, 169, 240, 240, 17, + 205, 250, 240, 240, 240, 240, 199, 199, 241, 240, + 160, 241, 241, 241, 4, 240, 250, 240, 211, 211, + 211, 211, 160, 158, 160, 160, 252, 158, 158, 158, + 194, 200, 201, 22, 167, 160, 163, 194, 194, 158, + 160, 165, 240, 252, 158, 199, 158, 158, 158, 158, + 211, 211, 211, 158, 180, 54, 198, 17, 165, 177, + 247, 122, 123, 240, 240, 196, 17, 205, 165, 196, + 158, 158, 158, 4, 153, 197, 240, 238, 165, 177, + 194, 194, 38, 194, 194, 22, 160, 238, 17, 240, + 240, 17, 160, 240, 194, 194, 240, 17, 74, 240, + 17, 240 }; #define yyerrok (yyerrstatus = 0) @@ -3622,152 +3629,152 @@ switch (yyn) { case 29: -#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1139 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1139 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1140 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1140 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1141 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1141 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1150 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1150 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1151 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1151 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1152 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1152 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1153 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1154 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1154 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1163 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1165 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} break; case 67: -#line 1166 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1167 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal)=0; ;} break; case 68: -#line 1170 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1171 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3775,7 +3782,7 @@ break; case 69: -#line 1174 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3783,7 +3790,7 @@ break; case 73: -#line 1182 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3791,7 +3798,7 @@ break; case 74: -#line 1187 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3799,157 +3806,162 @@ break; case 75: -#line 1193 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 76: -#line 1194 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 77: -#line 1195 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 78: -#line 1196 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 79: -#line 1197 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 80: -#line 1198 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} break; case 81: -#line 1202 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 82: -#line 1203 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 83: -#line 1204 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 84: -#line 1208 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 85: -#line 1209 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 86: -#line 1210 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 87: -#line 1211 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 88: -#line 1215 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 89: -#line 1216 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 90: -#line 1217 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 91: -#line 1221 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 92: -#line 1222 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 93: -#line 1223 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 94: -#line 1224 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 95: -#line 1225 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 96: -#line 1229 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 97: -#line 1230 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 98: -#line 1231 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 99: -#line 1234 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 100: -#line 1235 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 101: -#line 1236 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 102: -#line 1237 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 103: -#line 1238 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 104: -#line 1239 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 105: -#line 1240 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_SSECall; ;} + break; + + case 106: +#line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3958,130 +3970,130 @@ ;} break; - case 106: -#line 1247 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} - break; - case 107: -#line 1248 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 108: -#line 1249 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::SExt; ;} +#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 109: -#line 1250 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 110: -#line 1251 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::InReg; ;} +#line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 111: -#line 1252 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} +#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::InReg; ;} break; case 112: -#line 1253 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} +#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} break; case 113: -#line 1254 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} +#line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} break; case 114: -#line 1255 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::Nest; ;} +#line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} break; case 115: -#line 1256 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::Nest; ;} + break; + + case 116: +#line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} break; - case 116: -#line 1260 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 117: +#line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; - case 117: -#line 1261 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 118: +#line 1263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; - case 118: -#line 1266 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 119: +#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} break; - case 119: -#line 1267 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 120: +#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} break; - case 120: -#line 1268 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 121: +#line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; - case 121: -#line 1269 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 122: +#line 1271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; - case 122: -#line 1270 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 123: +#line 1272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} break; - case 123: -#line 1271 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 124: +#line 1273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} break; - case 124: -#line 1274 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 125: +#line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; - case 125: -#line 1275 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 126: +#line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; - case 126: -#line 1280 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 127: +#line 1282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 127: -#line 1281 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 128: +#line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); ;} break; - case 128: -#line 1288 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 129: +#line 1290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 129: -#line 1289 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 130: +#line 1291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4090,13 +4102,13 @@ ;} break; - case 130: -#line 1295 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 131: +#line 1297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 131: -#line 1296 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 132: +#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -4105,8 +4117,8 @@ ;} break; - case 132: -#line 1305 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 133: +#line 1307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') @@ -4116,28 +4128,28 @@ ;} break; - case 133: -#line 1313 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 134: +#line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 134: -#line 1314 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 135: +#line 1316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; - case 135: -#line 1319 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 136: +#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 136: -#line 1320 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 137: +#line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 137: -#line 1321 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 138: +#line 1323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -4145,8 +4157,8 @@ ;} break; - case 138: -#line 1326 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 139: +#line 1328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -4155,24 +4167,24 @@ ;} break; - case 146: -#line 1342 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 147: +#line 1344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ;} break; - case 147: -#line 1346 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 148: +#line 1348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR ;} break; - case 148: -#line 1350 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 149: +#line 1352 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -4182,8 +4194,8 @@ ;} break; - case 149: -#line 1357 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 150: +#line 1359 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -4191,8 +4203,8 @@ ;} break; - case 150: -#line 1362 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 151: +#line 1364 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -4203,8 +4215,8 @@ ;} break; - case 151: -#line 1370 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 152: +#line 1372 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4236,8 +4248,8 @@ ;} break; - case 152: -#line 1399 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 153: +#line 1401 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4264,8 +4276,8 @@ ;} break; - case 153: -#line 1424 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 154: +#line 1426 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4273,8 +4285,8 @@ ;} break; - case 154: -#line 1429 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 155: +#line 1431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4287,8 +4299,8 @@ ;} break; - case 155: -#line 1439 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 156: +#line 1441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4301,16 +4313,16 @@ ;} break; - case 156: -#line 1449 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 157: +#line 1451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ;} break; - case 157: -#line 1453 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 158: +#line 1455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4323,16 +4335,16 @@ ;} break; - case 158: -#line 1463 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 159: +#line 1465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ;} break; - case 159: -#line 1470 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 160: +#line 1472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -4341,8 +4353,8 @@ ;} break; - case 160: -#line 1479 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 161: +#line 1481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4352,15 +4364,15 @@ ;} break; - case 161: -#line 1486 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 162: +#line 1488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; - case 162: -#line 1491 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 163: +#line 1493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4368,16 +4380,16 @@ ;} break; - case 163: -#line 1496 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 164: +#line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR ;} break; - case 165: -#line 1504 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 166: +#line 1506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4387,8 +4399,8 @@ ;} break; - case 166: -#line 1511 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 167: +#line 1513 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4398,16 +4410,16 @@ ;} break; - case 167: -#line 1518 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 168: +#line 1520 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR ;} break; - case 168: -#line 1526 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 169: +#line 1528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4416,8 +4428,8 @@ ;} break; - case 169: -#line 1532 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 170: +#line 1534 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4425,8 +4437,8 @@ ;} break; - case 170: -#line 1544 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 171: +#line 1546 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4457,8 +4469,8 @@ ;} break; - case 171: -#line 1572 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 172: +#line 1574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4477,8 +4489,8 @@ ;} break; - case 172: -#line 1588 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 173: +#line 1590 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4508,8 +4520,8 @@ ;} break; - case 173: -#line 1615 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 174: +#line 1617 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4540,8 +4552,8 @@ ;} break; - case 174: -#line 1643 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 175: +#line 1645 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4570,8 +4582,8 @@ ;} break; - case 175: -#line 1669 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 176: +#line 1671 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4594,8 +4606,8 @@ ;} break; - case 176: -#line 1689 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 177: +#line 1691 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4624,8 +4636,8 @@ ;} break; - case 177: -#line 1715 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 178: +#line 1717 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4648,8 +4660,8 @@ ;} break; - case 178: -#line 1735 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 179: +#line 1737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4664,8 +4676,8 @@ ;} break; - case 179: -#line 1747 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 180: +#line 1749 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4675,8 +4687,8 @@ ;} break; - case 180: -#line 1754 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 181: +#line 1756 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4745,8 +4757,8 @@ ;} break; - case 181: -#line 1820 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 182: +#line 1822 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4759,8 +4771,8 @@ ;} break; - case 182: -#line 1830 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 183: +#line 1832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4773,8 +4785,8 @@ ;} break; - case 183: -#line 1840 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 184: +#line 1842 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4783,8 +4795,8 @@ ;} break; - case 184: -#line 1846 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 185: +#line 1848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4797,8 +4809,8 @@ ;} break; - case 185: -#line 1856 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 186: +#line 1858 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4807,8 +4819,8 @@ ;} break; - case 186: -#line 1862 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 187: +#line 1864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4821,8 +4833,8 @@ ;} break; - case 187: -#line 1872 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 188: +#line 1874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant true must have type i1"); @@ -4831,8 +4843,8 @@ ;} break; - case 188: -#line 1878 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 189: +#line 1880 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants if (cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) GEN_ERROR("Constant false must have type i1"); @@ -4841,8 +4853,8 @@ ;} break; - case 189: -#line 1884 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 190: +#line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4856,8 +4868,8 @@ ;} break; - case 190: -#line 1897 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 191: +#line 1899 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4872,8 +4884,8 @@ ;} break; - case 191: -#line 1909 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 192: +#line 1911 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4897,8 +4909,8 @@ ;} break; - case 192: -#line 1930 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 193: +#line 1932 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4909,8 +4921,8 @@ ;} break; - case 193: -#line 1938 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 194: +#line 1940 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4919,8 +4931,8 @@ ;} break; - case 194: -#line 1944 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 195: +#line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4934,8 +4946,8 @@ ;} break; - case 195: -#line 1955 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 196: +#line 1957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4943,8 +4955,8 @@ ;} break; - case 196: -#line 1960 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 197: +#line 1962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4952,8 +4964,8 @@ ;} break; - case 197: -#line 1965 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 198: +#line 1967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vicmp operand types must match"); @@ -4961,8 +4973,8 @@ ;} break; - case 198: -#line 1970 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 199: +#line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("vfcmp operand types must match"); @@ -4970,8 +4982,8 @@ ;} break; - case 199: -#line 1975 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 200: +#line 1977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4980,8 +4992,8 @@ ;} break; - case 200: -#line 1981 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 201: +#line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4990,8 +5002,8 @@ ;} break; - case 201: -#line 1987 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 202: +#line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -5000,8 +5012,8 @@ ;} break; - case 202: -#line 1993 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 203: +#line 1995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("ExtractValue requires an aggregate operand"); @@ -5012,8 +5024,8 @@ ;} break; - case 203: -#line 2001 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 204: +#line 2003 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa((yyvsp[(3) - (7)].ConstVal)->getType())) GEN_ERROR("InsertValue requires an aggregate operand"); @@ -5024,16 +5036,16 @@ ;} break; - case 204: -#line 2012 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 205: +#line 2014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR ;} break; - case 205: -#line 2016 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 206: +#line 2018 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -5041,28 +5053,28 @@ ;} break; - case 206: -#line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 207: +#line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 207: -#line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 208: +#line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 208: -#line 2027 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 209: +#line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 209: -#line 2027 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 210: +#line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 210: -#line 2030 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 211: +#line 2032 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -5077,8 +5089,8 @@ ;} break; - case 211: -#line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 212: +#line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -5093,8 +5105,8 @@ ;} break; - case 212: -#line 2063 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 213: +#line 2065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5102,8 +5114,8 @@ ;} break; - case 213: -#line 2068 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 214: +#line 2070 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -5111,40 +5123,40 @@ ;} break; - case 216: -#line 2081 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 217: +#line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; - case 217: -#line 2081 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 218: +#line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; - case 218: -#line 2085 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 219: +#line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; - case 219: -#line 2085 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 220: +#line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 220: -#line 2088 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 221: +#line 2090 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 221: -#line 2091 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 222: +#line 2093 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -5171,8 +5183,8 @@ ;} break; - case 222: -#line 2115 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 223: +#line 2117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -5186,8 +5198,8 @@ ;} break; - case 223: -#line 2127 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 224: +#line 2129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (6)].ConstVal) == 0) @@ -5198,15 +5210,15 @@ ;} break; - case 224: -#line 2134 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 225: +#line 2136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 225: -#line 2138 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 226: +#line 2140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (7)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -5215,15 +5227,15 @@ ;} break; - case 226: -#line 2143 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 227: +#line 2145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 227: -#line 2147 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 228: +#line 2149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); @@ -5233,16 +5245,16 @@ ;} break; - case 228: -#line 2153 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 229: +#line 2155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 229: -#line 2157 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 230: +#line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5285,22 +5297,22 @@ ;} break; - case 230: -#line 2197 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 231: +#line 2199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 231: -#line 2200 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 232: +#line 2202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 232: -#line 2206 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 233: +#line 2208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5312,24 +5324,24 @@ ;} break; - case 233: -#line 2216 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 234: +#line 2218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); ;} break; - case 234: -#line 2220 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 235: +#line 2222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); ;} break; - case 236: -#line 2227 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 237: +#line 2229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5337,8 +5349,8 @@ ;} break; - case 237: -#line 2232 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 238: +#line 2234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5346,15 +5358,15 @@ ;} break; - case 238: -#line 2237 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 239: +#line 2239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 239: -#line 2246 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 240: +#line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5367,8 +5379,8 @@ ;} break; - case 240: -#line 2256 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 241: +#line 2258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5381,16 +5393,16 @@ ;} break; - case 241: -#line 2267 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 242: +#line 2269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR ;} break; - case 242: -#line 2271 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 243: +#line 2273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5402,8 +5414,8 @@ ;} break; - case 243: -#line 2280 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 244: +#line 2282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5415,16 +5427,16 @@ ;} break; - case 244: -#line 2289 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 245: +#line 2291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR ;} break; - case 245: -#line 2295 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 246: +#line 2297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! @@ -5554,8 +5566,8 @@ ;} break; - case 248: -#line 2425 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 249: +#line 2427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5566,16 +5578,16 @@ ;} break; - case 251: -#line 2436 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 252: +#line 2438 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 252: -#line 2441 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 253: +#line 2443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5585,40 +5597,40 @@ ;} break; - case 253: -#line 2453 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 254: +#line 2455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 254: -#line 2457 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 255: +#line 2459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 255: -#line 2462 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 256: +#line 2464 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 256: -#line 2466 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 257: +#line 2468 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 257: -#line 2470 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 258: +#line 2472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); delete (yyvsp[(1) - (1)].APIntVal); @@ -5626,8 +5638,8 @@ ;} break; - case 258: -#line 2475 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 259: +#line 2477 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); delete (yyvsp[(1) - (1)].APIntVal); @@ -5635,56 +5647,56 @@ ;} break; - case 259: -#line 2480 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 260: +#line 2482 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR ;} break; - case 260: -#line 2484 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 261: +#line 2486 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR ;} break; - case 261: -#line 2488 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 262: +#line 2490 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR ;} break; - case 262: -#line 2492 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 263: +#line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR ;} break; - case 263: -#line 2496 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 264: +#line 2498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; - case 264: -#line 2500 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 265: +#line 2502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR ;} break; - case 265: -#line 2504 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 266: +#line 2506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5709,8 +5721,8 @@ ;} break; - case 266: -#line 2526 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 267: +#line 2528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5735,8 +5747,8 @@ ;} break; - case 267: -#line 2548 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 268: +#line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Use undef instead of an array because it's inconvenient to determine // the element type at this point, there being no elements to examine. @@ -5745,8 +5757,8 @@ ;} break; - case 268: -#line 2554 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 269: +#line 2556 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); const Type *ETy = Type::Int8Ty; @@ -5762,8 +5774,8 @@ ;} break; - case 269: -#line 2567 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 270: +#line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(2) - (3)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) @@ -5778,8 +5790,8 @@ ;} break; - case 270: -#line 2579 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 271: +#line 2581 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector()); (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector())); @@ -5787,8 +5799,8 @@ ;} break; - case 271: -#line 2584 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 272: +#line 2586 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements((yyvsp[(3) - (5)].ConstVector)->size()); for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) @@ -5803,8 +5815,8 @@ ;} break; - case 272: -#line 2596 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 273: +#line 2598 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = StructType::get(std::vector(), /*isPacked=*/true); @@ -5813,16 +5825,16 @@ ;} break; - case 273: -#line 2602 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 274: +#line 2604 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR ;} break; - case 274: -#line 2606 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 275: +#line 2608 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5831,24 +5843,24 @@ ;} break; - case 275: -#line 2616 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 276: +#line 2618 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR ;} break; - case 276: -#line 2620 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 277: +#line 2622 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR ;} break; - case 277: -#line 2624 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 278: +#line 2626 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5856,8 +5868,8 @@ ;} break; - case 278: -#line 2629 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 279: +#line 2631 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5865,8 +5877,8 @@ ;} break; - case 281: -#line 2642 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 282: +#line 2644 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5876,8 +5888,8 @@ ;} break; - case 282: -#line 2651 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 283: +#line 2653 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); @@ -5885,32 +5897,32 @@ ;} break; - case 283: -#line 2656 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 284: +#line 2658 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR ;} break; - case 284: -#line 2661 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 285: +#line 2663 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 285: -#line 2665 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 286: +#line 2667 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; - case 286: -#line 2674 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 287: +#line 2676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5921,8 +5933,8 @@ ;} break; - case 287: -#line 2683 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 288: +#line 2685 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -5934,16 +5946,16 @@ ;} break; - case 288: -#line 2692 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 289: +#line 2694 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR ;} break; - case 289: -#line 2696 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 290: +#line 2698 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -5952,8 +5964,8 @@ ;} break; - case 290: -#line 2704 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 291: +#line 2706 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... ValueList &VL = *(yyvsp[(2) - (2)].ValueList); assert(!VL.empty() && "Invalid ret operands!"); @@ -5976,16 +5988,16 @@ ;} break; - case 291: -#line 2724 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 292: +#line 2726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = ReturnInst::Create(); CHECK_FOR_ERROR ;} break; - case 292: -#line 2728 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 293: +#line 2730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5993,8 +6005,8 @@ ;} break; - case 293: -#line 2733 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 294: +#line 2735 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) GEN_ERROR("Branch condition must have type i1"); @@ -6008,8 +6020,8 @@ ;} break; - case 294: -#line 2744 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 295: +#line 2746 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -6031,8 +6043,8 @@ ;} break; - case 295: -#line 2763 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 296: +#line 2765 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -6044,8 +6056,8 @@ ;} break; - case 296: -#line 2773 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 297: +#line 2775 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6133,24 +6145,24 @@ ;} break; - case 297: -#line 2858 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 298: +#line 2860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR ;} break; - case 298: -#line 2862 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 299: +#line 2864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR ;} break; - case 299: -#line 2869 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 300: +#line 2871 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -6164,8 +6176,8 @@ ;} break; - case 300: -#line 2880 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 301: +#line 2882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -6180,8 +6192,8 @@ ;} break; - case 301: -#line 2893 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 302: +#line 2895 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -6192,8 +6204,8 @@ ;} break; - case 302: -#line 2903 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 303: +#line 2905 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -6207,8 +6219,8 @@ ;} break; - case 303: -#line 2914 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 304: +#line 2916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -6219,8 +6231,8 @@ ;} break; - case 304: -#line 2924 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 305: +#line 2926 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6234,8 +6246,8 @@ ;} break; - case 305: -#line 2935 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 306: +#line 2937 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -6246,8 +6258,8 @@ ;} break; - case 306: -#line 2943 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 307: +#line 2945 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -6260,8 +6272,8 @@ ;} break; - case 307: -#line 2953 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 308: +#line 2955 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); @@ -6271,18 +6283,18 @@ ;} break; - case 308: -#line 2960 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 309: +#line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; - case 309: -#line 2963 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 310: +#line 2965 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); ;} break; - case 310: -#line 2964 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 311: +#line 2966 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -6290,8 +6302,8 @@ ;} break; - case 311: -#line 2972 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 312: +#line 2974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = new std::vector(); if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) @@ -6300,8 +6312,8 @@ ;} break; - case 312: -#line 2978 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 313: +#line 2980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) @@ -6311,24 +6323,24 @@ ;} break; - case 313: -#line 2987 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 314: +#line 2989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 314: -#line 2991 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 315: +#line 2993 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 315: -#line 2996 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 316: +#line 2998 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6347,8 +6359,8 @@ ;} break; - case 316: -#line 3012 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 317: +#line 3014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6368,8 +6380,8 @@ ;} break; - case 317: -#line 3029 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 318: +#line 3031 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6386,8 +6398,8 @@ ;} break; - case 318: -#line 3043 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 319: +#line 3045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6404,8 +6416,8 @@ ;} break; - case 319: -#line 3057 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 320: +#line 3059 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6422,8 +6434,8 @@ ;} break; - case 320: -#line 3071 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 321: +#line 3073 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -6440,8 +6452,8 @@ ;} break; - case 321: -#line 3085 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 322: +#line 3087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6456,8 +6468,8 @@ ;} break; - case 322: -#line 3097 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 323: +#line 3099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -6468,8 +6480,8 @@ ;} break; - case 323: -#line 3105 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 324: +#line 3107 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -6479,8 +6491,8 @@ ;} break; - case 324: -#line 3112 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 325: +#line 3114 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -6489,8 +6501,8 @@ ;} break; - case 325: -#line 3118 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 326: +#line 3120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6499,8 +6511,8 @@ ;} break; - case 326: -#line 3124 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 327: +#line 3126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6509,8 +6521,8 @@ ;} break; - case 327: -#line 3130 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 328: +#line 3132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6528,8 +6540,8 @@ ;} break; - case 328: -#line 3146 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 329: +#line 3148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6621,32 +6633,32 @@ ;} break; - case 329: -#line 3235 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 330: +#line 3237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR ;} break; - case 330: -#line 3240 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 331: +#line 3242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 331: -#line 3244 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 332: +#line 3246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 332: -#line 3251 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 333: +#line 3253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6656,8 +6668,8 @@ ;} break; - case 333: -#line 3258 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 334: +#line 3260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6670,8 +6682,8 @@ ;} break; - case 334: -#line 3268 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 335: +#line 3270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6681,8 +6693,8 @@ ;} break; - case 335: -#line 3275 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 336: +#line 3277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6695,8 +6707,8 @@ ;} break; - case 336: -#line 3285 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 337: +#line 3287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6706,8 +6718,8 @@ ;} break; - case 337: -#line 3293 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 338: +#line 3295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6724,8 +6736,8 @@ ;} break; - case 338: -#line 3307 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 339: +#line 3309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6745,8 +6757,8 @@ ;} break; - case 339: -#line 3324 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 340: +#line 3326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -6763,8 +6775,8 @@ ;} break; - case 340: -#line 3338 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 341: +#line 3340 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6782,8 +6794,8 @@ ;} break; - case 341: -#line 3353 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 342: +#line 3355 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6801,8 +6813,8 @@ ;} break; - case 342: -#line 3368 "/llvm/lib/AsmParser/llvmAsmParser.y" + case 343: +#line 3370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); @@ -6824,7 +6836,7 @@ /* Line 1267 of yacc.c. */ -#line 6828 "llvmAsmParser.tab.c" +#line 6840 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -7038,7 +7050,7 @@ } -#line 3387 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3389 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=54745&r1=54744&r2=54745&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Wed Aug 13 13:41:46 2008 @@ -104,94 +104,95 @@ COLDCC_TOK = 320, X86_STDCALLCC_TOK = 321, X86_FASTCALLCC_TOK = 322, - DATALAYOUT = 323, - RET = 324, - BR = 325, - SWITCH = 326, - INVOKE = 327, - UNWIND = 328, - UNREACHABLE = 329, - ADD = 330, - SUB = 331, - MUL = 332, - UDIV = 333, - SDIV = 334, - FDIV = 335, - UREM = 336, - SREM = 337, - FREM = 338, - AND = 339, - OR = 340, - XOR = 341, - SHL = 342, - LSHR = 343, - ASHR = 344, - ICMP = 345, - FCMP = 346, - VICMP = 347, - VFCMP = 348, - EQ = 349, - NE = 350, - SLT = 351, - SGT = 352, - SLE = 353, - SGE = 354, - ULT = 355, - UGT = 356, - ULE = 357, - UGE = 358, - OEQ = 359, - ONE = 360, - OLT = 361, - OGT = 362, - OLE = 363, - OGE = 364, - ORD = 365, - UNO = 366, - UEQ = 367, - UNE = 368, - MALLOC = 369, - ALLOCA = 370, - FREE = 371, - LOAD = 372, - STORE = 373, - GETELEMENTPTR = 374, - TRUNC = 375, - ZEXT = 376, - SEXT = 377, - FPTRUNC = 378, - FPEXT = 379, - BITCAST = 380, - UITOFP = 381, - SITOFP = 382, - FPTOUI = 383, - FPTOSI = 384, - INTTOPTR = 385, - PTRTOINT = 386, - PHI_TOK = 387, - SELECT = 388, - VAARG = 389, - EXTRACTELEMENT = 390, - INSERTELEMENT = 391, - SHUFFLEVECTOR = 392, - GETRESULT = 393, - EXTRACTVALUE = 394, - INSERTVALUE = 395, - SIGNEXT = 396, - ZEROEXT = 397, - NORETURN = 398, - INREG = 399, - SRET = 400, - NOUNWIND = 401, - NOALIAS = 402, - BYVAL = 403, - NEST = 404, - READNONE = 405, - READONLY = 406, - GC = 407, - DEFAULT = 408, - HIDDEN = 409, - PROTECTED = 410 + X86_SSECALLCC_TOK = 323, + DATALAYOUT = 324, + RET = 325, + BR = 326, + SWITCH = 327, + INVOKE = 328, + UNWIND = 329, + UNREACHABLE = 330, + ADD = 331, + SUB = 332, + MUL = 333, + UDIV = 334, + SDIV = 335, + FDIV = 336, + UREM = 337, + SREM = 338, + FREM = 339, + AND = 340, + OR = 341, + XOR = 342, + SHL = 343, + LSHR = 344, + ASHR = 345, + ICMP = 346, + FCMP = 347, + VICMP = 348, + VFCMP = 349, + EQ = 350, + NE = 351, + SLT = 352, + SGT = 353, + SLE = 354, + SGE = 355, + ULT = 356, + UGT = 357, + ULE = 358, + UGE = 359, + OEQ = 360, + ONE = 361, + OLT = 362, + OGT = 363, + OLE = 364, + OGE = 365, + ORD = 366, + UNO = 367, + UEQ = 368, + UNE = 369, + MALLOC = 370, + ALLOCA = 371, + FREE = 372, + LOAD = 373, + STORE = 374, + GETELEMENTPTR = 375, + TRUNC = 376, + ZEXT = 377, + SEXT = 378, + FPTRUNC = 379, + FPEXT = 380, + BITCAST = 381, + UITOFP = 382, + SITOFP = 383, + FPTOUI = 384, + FPTOSI = 385, + INTTOPTR = 386, + PTRTOINT = 387, + PHI_TOK = 388, + SELECT = 389, + VAARG = 390, + EXTRACTELEMENT = 391, + INSERTELEMENT = 392, + SHUFFLEVECTOR = 393, + GETRESULT = 394, + EXTRACTVALUE = 395, + INSERTVALUE = 396, + SIGNEXT = 397, + ZEROEXT = 398, + NORETURN = 399, + INREG = 400, + SRET = 401, + NOUNWIND = 402, + NOALIAS = 403, + BYVAL = 404, + NEST = 405, + READNONE = 406, + READONLY = 407, + GC = 408, + DEFAULT = 409, + HIDDEN = 410, + PROTECTED = 411 }; #endif /* Tokens. */ @@ -260,101 +261,102 @@ #define COLDCC_TOK 320 #define X86_STDCALLCC_TOK 321 #define X86_FASTCALLCC_TOK 322 -#define DATALAYOUT 323 -#define RET 324 -#define BR 325 -#define SWITCH 326 -#define INVOKE 327 -#define UNWIND 328 -#define UNREACHABLE 329 -#define ADD 330 -#define SUB 331 -#define MUL 332 -#define UDIV 333 -#define SDIV 334 -#define FDIV 335 -#define UREM 336 -#define SREM 337 -#define FREM 338 -#define AND 339 -#define OR 340 -#define XOR 341 -#define SHL 342 -#define LSHR 343 -#define ASHR 344 -#define ICMP 345 -#define FCMP 346 -#define VICMP 347 -#define VFCMP 348 -#define EQ 349 -#define NE 350 -#define SLT 351 -#define SGT 352 -#define SLE 353 -#define SGE 354 -#define ULT 355 -#define UGT 356 -#define ULE 357 -#define UGE 358 -#define OEQ 359 -#define ONE 360 -#define OLT 361 -#define OGT 362 -#define OLE 363 -#define OGE 364 -#define ORD 365 -#define UNO 366 -#define UEQ 367 -#define UNE 368 -#define MALLOC 369 -#define ALLOCA 370 -#define FREE 371 -#define LOAD 372 -#define STORE 373 -#define GETELEMENTPTR 374 -#define TRUNC 375 -#define ZEXT 376 -#define SEXT 377 -#define FPTRUNC 378 -#define FPEXT 379 -#define BITCAST 380 -#define UITOFP 381 -#define SITOFP 382 -#define FPTOUI 383 -#define FPTOSI 384 -#define INTTOPTR 385 -#define PTRTOINT 386 -#define PHI_TOK 387 -#define SELECT 388 -#define VAARG 389 -#define EXTRACTELEMENT 390 -#define INSERTELEMENT 391 -#define SHUFFLEVECTOR 392 -#define GETRESULT 393 -#define EXTRACTVALUE 394 -#define INSERTVALUE 395 -#define SIGNEXT 396 -#define ZEROEXT 397 -#define NORETURN 398 -#define INREG 399 -#define SRET 400 -#define NOUNWIND 401 -#define NOALIAS 402 -#define BYVAL 403 -#define NEST 404 -#define READNONE 405 -#define READONLY 406 -#define GC 407 -#define DEFAULT 408 -#define HIDDEN 409 -#define PROTECTED 410 +#define X86_SSECALLCC_TOK 323 +#define DATALAYOUT 324 +#define RET 325 +#define BR 326 +#define SWITCH 327 +#define INVOKE 328 +#define UNWIND 329 +#define UNREACHABLE 330 +#define ADD 331 +#define SUB 332 +#define MUL 333 +#define UDIV 334 +#define SDIV 335 +#define FDIV 336 +#define UREM 337 +#define SREM 338 +#define FREM 339 +#define AND 340 +#define OR 341 +#define XOR 342 +#define SHL 343 +#define LSHR 344 +#define ASHR 345 +#define ICMP 346 +#define FCMP 347 +#define VICMP 348 +#define VFCMP 349 +#define EQ 350 +#define NE 351 +#define SLT 352 +#define SGT 353 +#define SLE 354 +#define SGE 355 +#define ULT 356 +#define UGT 357 +#define ULE 358 +#define UGE 359 +#define OEQ 360 +#define ONE 361 +#define OLT 362 +#define OGT 363 +#define OLE 364 +#define OGE 365 +#define ORD 366 +#define UNO 367 +#define UEQ 368 +#define UNE 369 +#define MALLOC 370 +#define ALLOCA 371 +#define FREE 372 +#define LOAD 373 +#define STORE 374 +#define GETELEMENTPTR 375 +#define TRUNC 376 +#define ZEXT 377 +#define SEXT 378 +#define FPTRUNC 379 +#define FPEXT 380 +#define BITCAST 381 +#define UITOFP 382 +#define SITOFP 383 +#define FPTOUI 384 +#define FPTOSI 385 +#define INTTOPTR 386 +#define PTRTOINT 387 +#define PHI_TOK 388 +#define SELECT 389 +#define VAARG 390 +#define EXTRACTELEMENT 391 +#define INSERTELEMENT 392 +#define SHUFFLEVECTOR 393 +#define GETRESULT 394 +#define EXTRACTVALUE 395 +#define INSERTVALUE 396 +#define SIGNEXT 397 +#define ZEROEXT 398 +#define NORETURN 399 +#define INREG 400 +#define SRET 401 +#define NOUNWIND 402 +#define NOALIAS 403 +#define BYVAL 404 +#define NEST 405 +#define READNONE 406 +#define READONLY 407 +#define GC 408 +#define DEFAULT 409 +#define HIDDEN 410 +#define PROTECTED 411 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 967 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -403,7 +405,7 @@ llvm::FCmpInst::Predicate FPredicate; } /* Line 1529 of yacc.c. */ -#line 407 "llvmAsmParser.tab.h" +#line 409 "llvmAsmParser.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=54745&r1=54744&r2=54745&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Wed Aug 13 13:41:46 2008 @@ -1082,6 +1082,7 @@ %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK +%token X86_SSECALLCC_TOK %token DATALAYOUT %type OptCallingConv %type OptParamAttrs ParamAttr @@ -1237,6 +1238,7 @@ COLDCC_TOK { $$ = CallingConv::Cold; } | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | X86_FASTCALLCC_TOK { $$ = CallingConv::X86_FastCall; } | + X86_SSECALLCC_TOK { $$ = CallingConv::X86_SSECall; } | CC_TOK EUINT64VAL { if ((unsigned)$2 != $2) GEN_ERROR("Calling conv too large"); From dalej at apple.com Wed Aug 13 13:42:42 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 18:42:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54746 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Message-ID: <200808131842.m7DIghl3009379@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 13:42:42 2008 New Revision: 54746 URL: http://llvm.org/viewvc/llvm-project?rev=54746&view=rev Log: Honor -msseregparam as well as the attribute. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=54746&r1=54745&r2=54746&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Wed Aug 13 13:42:42 2008 @@ -29,7 +29,9 @@ } else if (lookup_attribute("fastcall", type_attributes)) { \ CC = CallingConv::X86_FastCall; \ } else if (!TARGET_64BIT && \ - lookup_attribute("sseregparm", type_attributes)){\ + (TARGET_SSEREGPARM || \ + lookup_attribute("sseregparm", \ + type_attributes))){ \ CC = CallingConv::X86_SSECall; \ } \ } From gohman at apple.com Wed Aug 13 14:00:41 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 19:00:41 -0000 Subject: [llvm-commits] [test-suite] r54747 - /test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c Message-ID: <200808131900.m7DJ0i6J010078@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 14:00:25 2008 New Revision: 54747 URL: http://llvm.org/viewvc/llvm-project?rev=54747&view=rev Log: Use , fixing an infelicity on platforms where size_t is not unsigned int. Modified: test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c Modified: test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c?rev=54747&r1=54746&r2=54747&view=diff ============================================================================== --- test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c (original) +++ test-suite/trunk/SingleSource/Benchmarks/Dhrystone/dry.c Wed Aug 13 14:00:25 2008 @@ -80,8 +80,7 @@ /*#include "defns.h"*/ -void *malloc(unsigned); -void free(void*); +#include /* Define if should use homemade str* functions. */ @@ -154,7 +153,6 @@ typedef RecordType * RecordPtr; typedef int boolean; -#define NULL 0 #define TRUE 1 #define FALSE 0 From gohman at apple.com Wed Aug 13 14:47:41 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 19:47:41 -0000 Subject: [llvm-commits] [llvm] r54749 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200808131947.m7DJlf23013071@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 14:47:40 2008 New Revision: 54749 URL: http://llvm.org/viewvc/llvm-project?rev=54749&view=rev Log: Rename SelectionDAGISel's FastISel to Fast, to begin to make room for the new FastISel instruction selection code. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=54749&r1=54748&r2=54749&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Wed Aug 13 14:47:40 2008 @@ -42,12 +42,12 @@ MachineBasicBlock *BB; AliasAnalysis *AA; CollectorMetadata *GCI; - bool FastISel; + bool Fast; std::vector TopOrder; static char ID; explicit SelectionDAGISel(TargetLowering &tli, bool fast = false) : - FunctionPass((intptr_t)&ID), TLI(tli), GCI(0), FastISel(fast), DAGSize(0) {} + FunctionPass((intptr_t)&ID), TLI(tli), GCI(0), Fast(fast), DAGSize(0) {} TargetLowering &getTargetLowering() { return TLI; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=54749&r1=54748&r2=54749&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Aug 13 14:47:40 2008 @@ -5379,7 +5379,7 @@ if (ViewISelDAGs) DAG.viewGraph("isel input for " + BlockName); - if (!FastISel && EnableValueProp) + if (!Fast && EnableValueProp) ComputeLiveOutVRegInfo(DAG); // Third, instruction select all of the operations to machine code, adding the @@ -5448,7 +5448,7 @@ BasicBlock *LLVMBB = &*I; PHINodesToUpdate.clear(); - if (!FastISel || !SISel.SelectBasicBlock(LLVMBB, FuncInfo.MBBMap[LLVMBB])) + if (!Fast || !SISel.SelectBasicBlock(LLVMBB, FuncInfo.MBBMap[LLVMBB])) SelectBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator); FinishBasicBlock(LLVMBB, MF, FuncInfo, PHINodesToUpdate, NodeAllocator); } @@ -5696,7 +5696,7 @@ RegisterScheduler::setDefault(Ctor); } - ScheduleDAG *Scheduler = Ctor(this, &DAG, BB, FastISel); + ScheduleDAG *Scheduler = Ctor(this, &DAG, BB, Fast); Scheduler->Run(); return Scheduler; From gohman at apple.com Wed Aug 13 14:55:03 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 19:55:03 -0000 Subject: [llvm-commits] [llvm] r54750 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp utils/TableGen/DAGISelEmitter.cpp Message-ID: <200808131955.m7DJt4UH013358@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 14:55:00 2008 New Revision: 54750 URL: http://llvm.org/viewvc/llvm-project?rev=54750&view=rev Log: Oops, check in these files too, for the FastISel -> Fast rename. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=54750&r1=54749&r2=54750&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Aug 13 14:55:00 2008 @@ -314,7 +314,7 @@ bool X86DAGToDAGISel::CanBeFoldedBy(SDNode *N, SDNode *U, SDNode *Root) const { - if (FastISel) return false; + if (Fast) return false; // If U use can somehow reach N through another path then U can't fold N or // it will create a cycle. e.g. In the following diagram, U can reach N @@ -579,7 +579,7 @@ CurBB = BB; // BB can change as result of isel. DEBUG(BB->dump()); - if (!FastISel) + if (!Fast) PreprocessForRMW(DAG); // FIXME: This should only happen when not -fast. Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=54750&r1=54749&r2=54750&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Aug 13 14:55:00 2008 @@ -429,7 +429,7 @@ NumInputRootOps = N->getNumChildren(); if (DisablePatternForFastISel(N, CGP)) - emitCheck("!FastISel"); + emitCheck("!Fast"); std::string PredicateCheck; for (unsigned i = 0, e = Predicates->getSize(); i != e; ++i) { From anton at korobeynikov.info Wed Aug 13 15:10:36 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 14 Aug 2008 00:10:36 +0400 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> Message-ID: <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> Hi, Dale > Add read/write support for X86's sseregparm. Why don't use inreg attribute for this? It seems, you don't need new CC for sseregparm. --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From anton at korobeynikov.info Wed Aug 13 15:12:38 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 14 Aug 2008 00:12:38 +0400 Subject: [llvm-commits] [llvm-gcc-4.2] r54746 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h In-Reply-To: <200808131842.m7DIghl3009379@zion.cs.uiuc.edu> References: <200808131842.m7DIghl3009379@zion.cs.uiuc.edu> Message-ID: <4FC1B728-EB7F-42E0-8067-E7367AAC5651@korobeynikov.info> Hello, Dale > > + (TARGET_SSEREGPARM || \ > + lookup_attribute("sseregparm", \ > + type_attributes))){ \ What's about check for TARGET_SSE_MATH also? With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080814/ccb54edb/attachment.html From dalej at apple.com Wed Aug 13 15:18:29 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 13:18:29 -0700 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> Message-ID: <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> On Aug 13, 2008, at 1:10 PMPDT, Anton Korobeynikov wrote: > Hi, Dale > >> Add read/write support for X86's sseregparm. > Why don't use inreg attribute for this? It seems, you don't need new > CC for sseregparm. It does that for parameters (already did); the issue is return values. (And it's not new, it was there, just not fully implemented. See X86CallingConv.td.) > > > + (TARGET_SSEREGPARM || \ > + lookup_attribute("sseregparm", \ > + type_attributes))){ \ > > What's about check for TARGET_SSE_MATH also? Yeah, thanks, that should be checked somewhere, let me look. From gohman at apple.com Wed Aug 13 15:19:42 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 20:19:42 -0000 Subject: [llvm-commits] [llvm] r54751 - in /llvm/trunk: Makefile.rules include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp utils/TableGen/FastISelEmitter.cpp utils/TableGen/FastISelEmitter.h utils/TableGen/TableGen.cpp Message-ID: <200808132019.m7DKJhjA014322@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 15:19:35 2008 New Revision: 54751 URL: http://llvm.org/viewvc/llvm-project?rev=54751&view=rev Log: Initial checkin of the new "fast" instruction selection support. See the comments in FastISelEmitter.cpp for details on what this is. This is currently experimental and unusable. Added: llvm/trunk/include/llvm/CodeGen/FastISel.h llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/trunk/utils/TableGen/FastISelEmitter.cpp llvm/trunk/utils/TableGen/FastISelEmitter.h Modified: llvm/trunk/Makefile.rules llvm/trunk/utils/TableGen/TableGen.cpp Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=54751&r1=54750&r2=54751&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Wed Aug 13 15:19:35 2008 @@ -1296,9 +1296,14 @@ $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \ $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir - $(Echo) "Building $( &ValueMap); + +protected: + virtual unsigned FastEmit_(MVT::SimpleValueType VT, + ISD::NodeType Opcode); + virtual unsigned FastEmit_r(MVT::SimpleValueType VT, + ISD::NodeType Opcode, unsigned Op0); + virtual unsigned FastEmit_rr(MVT::SimpleValueType VT, + ISD::NodeType Opcode, + unsigned Op0, unsigned Op1); + + unsigned FastEmitInst_(unsigned MachineInstOpcode, + const TargetRegisterClass *RC); + unsigned FastEmitInst_r(unsigned MachineInstOpcode, + const TargetRegisterClass *RC, + unsigned Op0); + unsigned FastEmitInst_rr(unsigned MachineInstOpcode, + const TargetRegisterClass *RC, + unsigned Op0, unsigned Op1); +}; + +} + +#endif Added: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=54751&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (added) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Aug 13 15:19:35 2008 @@ -0,0 +1,104 @@ +///===-- FastISel.cpp - Implementation of the FastISel class --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the implementation of the FastISel class. +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/FastISel.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" +using namespace llvm; + +BasicBlock::iterator +FastISel::SelectInstructions(BasicBlock::iterator Begin, BasicBlock::iterator End, + DenseMap &ValueMap) { + BasicBlock::iterator I = Begin; + + for (; I != End; ++I) { + switch (I->getOpcode()) { + case Instruction::Add: { + unsigned Op0 = ValueMap[I->getOperand(0)]; + unsigned Op1 = ValueMap[I->getOperand(1)]; + MVT VT = MVT::getMVT(I->getType(), /*HandleUnknown=*/true); + if (VT == MVT::Other || !VT.isSimple()) { + // Unhandled type. Halt "fast" selection and bail. + return I; + } + unsigned ResultReg = FastEmit_rr(VT.getSimpleVT(), ISD::ADD, Op0, Op1); + ValueMap[I] = ResultReg; + break; + } + default: + // Unhandled instruction. Halt "fast" selection and bail. + return I; + } + } + + return I; +} + +unsigned FastISel::FastEmit_(MVT::SimpleValueType, ISD::NodeType) { + return 0; +} + +unsigned FastISel::FastEmit_r(MVT::SimpleValueType, ISD::NodeType, + unsigned /*Op0*/) { + return 0; +} + +unsigned FastISel::FastEmit_rr(MVT::SimpleValueType, ISD::NodeType, + unsigned /*Op0*/, unsigned /*Op0*/) { + return 0; +} + +unsigned FastISel::FastEmitInst_(unsigned MachineInstOpcode, + const TargetRegisterClass* RC) { + MachineRegisterInfo &MRI = MF->getRegInfo(); + const TargetInstrDesc &II = TII->get(MachineInstOpcode); + MachineInstr *MI = BuildMI(*MF, II); + unsigned ResultReg = MRI.createVirtualRegister(RC); + + MI->addOperand(MachineOperand::CreateReg(ResultReg, true)); + + MBB->push_back(MI); + return ResultReg; +} + +unsigned FastISel::FastEmitInst_r(unsigned MachineInstOpcode, + const TargetRegisterClass *RC, + unsigned Op0) { + MachineRegisterInfo &MRI = MF->getRegInfo(); + const TargetInstrDesc &II = TII->get(MachineInstOpcode); + MachineInstr *MI = BuildMI(*MF, II); + unsigned ResultReg = MRI.createVirtualRegister(RC); + + MI->addOperand(MachineOperand::CreateReg(ResultReg, true)); + MI->addOperand(MachineOperand::CreateReg(Op0, false)); + + MBB->push_back(MI); + return ResultReg; +} + +unsigned FastISel::FastEmitInst_rr(unsigned MachineInstOpcode, + const TargetRegisterClass *RC, + unsigned Op0, unsigned Op1) { + MachineRegisterInfo &MRI = MF->getRegInfo(); + const TargetInstrDesc &II = TII->get(MachineInstOpcode); + MachineInstr *MI = BuildMI(*MF, II); + unsigned ResultReg = MRI.createVirtualRegister(RC); + + MI->addOperand(MachineOperand::CreateReg(ResultReg, true)); + MI->addOperand(MachineOperand::CreateReg(Op0, false)); + MI->addOperand(MachineOperand::CreateReg(Op1, false)); + + MBB->push_back(MI); + return ResultReg; +} Added: llvm/trunk/utils/TableGen/FastISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=54751&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (added) +++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Wed Aug 13 15:19:35 2008 @@ -0,0 +1,362 @@ +//===- FastISelEmitter.cpp - Generate an instruction selector -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This tablegen backend emits a "fast" instruction selector. +// +// This instruction selection method is designed to emit very poor code +// quickly. Also, it is not designed to do much lowering, so most illegal +// types (e.g. i64 on 32-bit targets) and operations (e.g. calls) are not +// supported and cannot easily be added. Blocks containing operations +// that are not supported need to be handled by a more capable selector, +// such as the SelectionDAG selector. +// +// The intended use for "fast" instruction selection is "-O0" mode +// compilation, where the quality of the generated code is irrelevant when +// weighed against the speed at which the code can be generated. +// +// If compile time is so important, you might wonder why we don't just +// skip codegen all-together, emit LLVM bytecode files, and execute them +// with an interpreter. The answer is that it would complicate linking and +// debugging, and also because that isn't how a compiler is expected to +// work in some circles. +// +// If you need better generated code or more lowering than what this +// instruction selector provides, use the SelectionDAG (DAGISel) instruction +// selector instead. If you're looking here because SelectionDAG isn't fast +// enough, consider looking into improving the SelectionDAG infastructure +// instead. At the time of this writing there remain several major +// opportunities for improvement. +// +//===----------------------------------------------------------------------===// + +#include "FastISelEmitter.h" +#include "Record.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Streams.h" +#include "llvm/ADT/VectorExtras.h" +using namespace llvm; + +namespace { + +struct OperandsSignature { + std::vector Operands; + + bool operator<(const OperandsSignature &O) const { + return Operands < O.Operands; + } + + bool empty() const { return Operands.empty(); } + + void PrintParameters(std::ostream &OS) const { + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { + if (Operands[i] == "r") { + OS << "unsigned Op" << i; + } else { + assert("Unknown operand kind!"); + abort(); + } + if (i + 1 != e) + OS << ", "; + } + } + + void PrintArguments(std::ostream &OS) const { + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { + if (Operands[i] == "r") { + OS << "Op" << i; + } else { + assert("Unknown operand kind!"); + abort(); + } + if (i + 1 != e) + OS << ", "; + } + } + + void PrintManglingSuffix(std::ostream &OS) const { + for (unsigned i = 0, e = Operands.size(); i != e; ++i) { + OS << Operands[i]; + } + } +}; + +struct InstructionMemo { + std::string Name; + const CodeGenRegisterClass *RC; +}; + +} + +static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) { + return CGP.getSDNodeInfo(Op).getEnumName(); +} + +static std::string getLegalCName(std::string OpName) { + std::string::size_type pos = OpName.find("::"); + if (pos != std::string::npos) + OpName.replace(pos, 2, "_"); + return OpName; +} + +void FastISelEmitter::run(std::ostream &OS) { + EmitSourceFileHeader("\"Fast\" Instruction Selector for the " + + CGP.getTargetInfo().getName() + " target", OS); + + const CodeGenTarget &Target = CGP.getTargetInfo(); + + // Get the namespace to insert instructions into. Make sure not to pick up + // "TargetInstrInfo" by accidentally getting the namespace off the PHI + // instruction or something. + std::string InstNS; + for (CodeGenTarget::inst_iterator i = Target.inst_begin(), + e = Target.inst_end(); i != e; ++i) { + InstNS = i->second.Namespace; + if (InstNS != "TargetInstrInfo") + break; + } + + OS << "namespace llvm {\n"; + OS << "namespace " << InstNS << " {\n"; + OS << "class FastISel;\n"; + OS << "}\n"; + OS << "}\n"; + OS << "\n"; + + if (!InstNS.empty()) InstNS += "::"; + + typedef std::map TypeMap; + typedef std::map OpcodeTypeMap; + typedef std::map OperandsOpcodeTypeMap; + OperandsOpcodeTypeMap SimplePatterns; + + // Create the supported type signatures. + OperandsSignature KnownOperands; + SimplePatterns[KnownOperands] = OpcodeTypeMap(); + KnownOperands.Operands.push_back("r"); + SimplePatterns[KnownOperands] = OpcodeTypeMap(); + KnownOperands.Operands.push_back("r"); + SimplePatterns[KnownOperands] = OpcodeTypeMap(); + + for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), + E = CGP.ptm_end(); I != E; ++I) { + const PatternToMatch &Pattern = *I; + + // For now, just look at Instructions, so that we don't have to worry + // about emitting multiple instructions for a pattern. + TreePatternNode *Dst = Pattern.getDstPattern(); + if (Dst->isLeaf()) continue; + Record *Op = Dst->getOperator(); + if (!Op->isSubClassOf("Instruction")) + continue; + CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName()); + if (II.OperandList.empty()) + continue; + Record *Op0Rec = II.OperandList[0].Rec; + if (!Op0Rec->isSubClassOf("RegisterClass")) + continue; + const CodeGenRegisterClass *DstRC = &Target.getRegisterClass(Op0Rec); + if (!DstRC) + continue; + + // Inspect the pattern. + TreePatternNode *InstPatNode = Pattern.getSrcPattern(); + if (!InstPatNode) continue; + if (InstPatNode->isLeaf()) continue; + + Record *InstPatOp = InstPatNode->getOperator(); + std::string OpcodeName = getOpcodeName(InstPatOp, CGP); + MVT::SimpleValueType VT = InstPatNode->getTypeNum(0); + + // For now, filter out instructions which just set a register to + // an Operand, like MOV32ri. + if (InstPatOp->isSubClassOf("Operand")) + continue; + + // Check all the operands. For now only accept register operands. + OperandsSignature Operands; + for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) { + TreePatternNode *Op = InstPatNode->getChild(i); + if (!Op->isLeaf()) + goto continue_label; + DefInit *OpDI = dynamic_cast(Op->getLeafValue()); + if (!OpDI) + goto continue_label; + Record *OpLeafRec = OpDI->getDef(); + if (!OpLeafRec->isSubClassOf("RegisterClass")) + goto continue_label; + const CodeGenRegisterClass *RC = &Target.getRegisterClass(OpLeafRec); + if (!RC) + goto continue_label; + if (Op->getTypeNum(0) != VT) + goto continue_label; + Operands.Operands.push_back("r"); + } + + // If it's not a known signature, ignore it. + if (!SimplePatterns.count(Operands)) + continue; + + // Ok, we found a pattern that we can handle. Remember it. + { + InstructionMemo Memo = { Pattern.getDstPattern()->getOperator()->getName(), + DstRC }; + SimplePatterns[Operands][OpcodeName][VT] = Memo; + } + + continue_label:; + } + + OS << "#include \"llvm/CodeGen/FastISel.h\"\n"; + OS << "\n"; + OS << "namespace llvm {\n"; + OS << "\n"; + + // Declare the target FastISel class. + OS << "class " << InstNS << "FastISel : public llvm::FastISel {\n"; + for (OperandsOpcodeTypeMap::const_iterator OI = SimplePatterns.begin(), + OE = SimplePatterns.end(); OI != OE; ++OI) { + const OperandsSignature &Operands = OI->first; + const OpcodeTypeMap &OTM = OI->second; + + for (OpcodeTypeMap::const_iterator I = OTM.begin(), E = OTM.end(); + I != E; ++I) { + const std::string &Opcode = I->first; + const TypeMap &TM = I->second; + + for (TypeMap::const_iterator TI = TM.begin(), TE = TM.end(); + TI != TE; ++TI) { + MVT::SimpleValueType VT = TI->first; + + OS << " unsigned FastEmit_" << getLegalCName(Opcode) + << "_" << getLegalCName(getName(VT)) << "("; + Operands.PrintParameters(OS); + OS << ");\n"; + } + + OS << " unsigned FastEmit_" << getLegalCName(Opcode) + << "(MVT::SimpleValueType VT"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintParameters(OS); + OS << ");\n"; + } + + OS << "unsigned FastEmit_"; + Operands.PrintManglingSuffix(OS); + OS << "(MVT::SimpleValueType VT, ISD::NodeType Opcode"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintParameters(OS); + OS << ");\n"; + } + OS << "public:\n"; + OS << " FastISel(MachineBasicBlock *mbb, MachineFunction *mf, "; + OS << "const TargetInstrInfo *tii) : llvm::FastISel(mbb, mf, tii) {}\n"; + OS << "};\n"; + OS << "\n"; + + // Define the target FastISel creation function. + OS << "llvm::FastISel *" << InstNS + << "createFastISel(MachineBasicBlock *mbb, MachineFunction *mf, "; + OS << "const TargetInstrInfo *tii) {\n"; + OS << " return new " << InstNS << "FastISel(mbb, mf, tii);\n"; + OS << "}\n"; + OS << "\n"; + + // Now emit code for all the patterns that we collected. + for (OperandsOpcodeTypeMap::const_iterator OI = SimplePatterns.begin(), + OE = SimplePatterns.end(); OI != OE; ++OI) { + const OperandsSignature &Operands = OI->first; + const OpcodeTypeMap &OTM = OI->second; + + for (OpcodeTypeMap::const_iterator I = OTM.begin(), E = OTM.end(); + I != E; ++I) { + const std::string &Opcode = I->first; + const TypeMap &TM = I->second; + + OS << "// FastEmit functions for " << Opcode << ".\n"; + OS << "\n"; + + // Emit one function for each opcode,type pair. + for (TypeMap::const_iterator TI = TM.begin(), TE = TM.end(); + TI != TE; ++TI) { + MVT::SimpleValueType VT = TI->first; + const InstructionMemo &Memo = TI->second; + + OS << "unsigned " << InstNS << "FastISel::FastEmit_" + << getLegalCName(Opcode) + << "_" << getLegalCName(getName(VT)) << "("; + Operands.PrintParameters(OS); + OS << ") {\n"; + OS << " return FastEmitInst_"; + Operands.PrintManglingSuffix(OS); + OS << "(" << InstNS << Memo.Name << ", "; + OS << InstNS << Memo.RC->getName() << "RegisterClass"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintArguments(OS); + OS << ");\n"; + OS << "}\n"; + OS << "\n"; + } + + // Emit one function for the opcode that demultiplexes based on the type. + OS << "unsigned " << InstNS << "FastISel::FastEmit_" + << getLegalCName(Opcode) << "(MVT::SimpleValueType VT"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintParameters(OS); + OS << ") {\n"; + OS << " switch (VT) {\n"; + for (TypeMap::const_iterator TI = TM.begin(), TE = TM.end(); + TI != TE; ++TI) { + MVT::SimpleValueType VT = TI->first; + std::string TypeName = getName(VT); + OS << " case " << TypeName << ": return FastEmit_" + << getLegalCName(Opcode) << "_" << getLegalCName(TypeName) << "("; + Operands.PrintArguments(OS); + OS << ");\n"; + } + OS << " default: return 0;\n"; + OS << " }\n"; + OS << "}\n"; + OS << "\n"; + } + + // Emit one function for the operand signature that demultiplexes based + // on opcode and type. + OS << "unsigned " << InstNS << "FastISel::FastEmit_"; + Operands.PrintManglingSuffix(OS); + OS << "(MVT::SimpleValueType VT, ISD::NodeType Opcode"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintParameters(OS); + OS << ") {\n"; + OS << " switch (Opcode) {\n"; + for (OpcodeTypeMap::const_iterator I = OTM.begin(), E = OTM.end(); + I != E; ++I) { + const std::string &Opcode = I->first; + + OS << " case " << Opcode << ": return FastEmit_" + << getLegalCName(Opcode) << "(VT"; + if (!Operands.empty()) + OS << ", "; + Operands.PrintArguments(OS); + OS << ");\n"; + } + OS << " default: return 0;\n"; + OS << " }\n"; + OS << "}\n"; + OS << "\n"; + } + + OS << "}\n"; +} + +// todo: really filter out Constants Added: llvm/trunk/utils/TableGen/FastISelEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.h?rev=54751&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/FastISelEmitter.h (added) +++ llvm/trunk/utils/TableGen/FastISelEmitter.h Wed Aug 13 15:19:35 2008 @@ -0,0 +1,38 @@ +//===- FastISelEmitter.h - Generate an instruction selector -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This tablegen backend emits a "fast" instruction selector. +// +//===----------------------------------------------------------------------===// + +#ifndef FASTISEL_EMITTER_H +#define FASTISEL_EMITTER_H + +#include "TableGenBackend.h" +#include "CodeGenDAGPatterns.h" +#include + +namespace llvm { + +/// FastISelEmitter - The top-level class which coordinates construction +/// and emission of the instruction selector. +/// +class FastISelEmitter : public TableGenBackend { + RecordKeeper &Records; + CodeGenDAGPatterns CGP; +public: + explicit FastISelEmitter(RecordKeeper &R) : Records(R), CGP(R) {} + + // run - Output the isel, returning true on failure. + void run(std::ostream &OS); +}; + +} // End llvm namespace + +#endif Modified: llvm/trunk/utils/TableGen/TableGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=54751&r1=54750&r2=54751&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TableGen.cpp (original) +++ llvm/trunk/utils/TableGen/TableGen.cpp Wed Aug 13 15:19:35 2008 @@ -29,6 +29,7 @@ #include "InstrEnumEmitter.h" #include "AsmWriterEmitter.h" #include "DAGISelEmitter.h" +#include "FastISelEmitter.h" #include "SubtargetEmitter.h" #include "IntrinsicEmitter.h" #include "LLVMCConfigurationEmitter.h" @@ -45,6 +46,7 @@ GenInstrEnums, GenInstrs, GenAsmWriter, GenCallingConv, GenDAGISel, + GenFastISel, GenSubtarget, GenIntrinsic, GenLLVMCConf, @@ -74,6 +76,8 @@ "Generate assembly writer"), clEnumValN(GenDAGISel, "gen-dag-isel", "Generate a DAG instruction selector"), + clEnumValN(GenFastISel, "gen-fast-isel", + "Generate a \"fast\" instruction selector"), clEnumValN(GenSubtarget, "gen-subtarget", "Generate subtarget enumerations"), clEnumValN(GenIntrinsic, "gen-intrinsic", @@ -177,6 +181,9 @@ case GenDAGISel: DAGISelEmitter(Records).run(*Out); break; + case GenFastISel: + FastISelEmitter(Records).run(*Out); + break; case GenSubtarget: SubtargetEmitter(Records).run(*Out); break; From baldrick at free.fr Wed Aug 13 15:20:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 13 Aug 2008 20:20:35 -0000 Subject: [llvm-commits] [llvm] r54752 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp test/FrontendAda/constant_fold.ads Message-ID: <200808132020.m7DKKZ3Q014396@zion.cs.uiuc.edu> Author: baldrick Date: Wed Aug 13 15:20:35 2008 New Revision: 54752 URL: http://llvm.org/viewvc/llvm-project?rev=54752&view=rev Log: Teach constant folding that an inttoptr of a ptrtoint can be turned into a bitcast if the integer is at least as wide as a pointer. Added: llvm/trunk/test/FrontendAda/constant_fold.ads Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=54752&r1=54751&r2=54752&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Aug 13 15:20:35 2008 @@ -378,6 +378,19 @@ } return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::IntToPtr: + // If the input is a ptrtoint, turn the pair into a ptr to ptr bitcast if + // the int size is >= the ptr size. This requires knowing the width of a + // pointer, so it can't be done in ConstantExpr::getCast. + if (ConstantExpr *CE = dyn_cast(Ops[0])) { + if (TD && CE->getOpcode() == Instruction::PtrToInt && + TD->getPointerSizeInBits() <= + CE->getType()->getPrimitiveSizeInBits()) { + Constant *Input = CE->getOperand(0); + Constant *C = FoldBitCast(Input, DestTy, *TD); + return C ? C : ConstantExpr::getBitCast(Input, DestTy); + } + } + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: Added: llvm/trunk/test/FrontendAda/constant_fold.ads URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendAda/constant_fold.ads?rev=54752&view=auto ============================================================================== --- llvm/trunk/test/FrontendAda/constant_fold.ads (added) +++ llvm/trunk/test/FrontendAda/constant_fold.ads Wed Aug 13 15:20:35 2008 @@ -0,0 +1,4 @@ +-- RUN: %llvmgcc -S -emit-llvm %s -o - | not grep ptrtoint +package Constant_Fold is + Error : exception; +end; From criswell at uiuc.edu Wed Aug 13 15:21:01 2008 From: criswell at uiuc.edu (John Criswell) Date: Wed, 13 Aug 2008 20:21:01 -0000 Subject: [llvm-commits] [poolalloc] r54753 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <200808132021.m7DKL1Gs014419@zion.cs.uiuc.edu> Author: criswell Date: Wed Aug 13 15:21:01 2008 New Revision: 54753 URL: http://llvm.org/viewvc/llvm-project?rev=54753&view=rev Log: Only create the fake DSGraphs if the function is not a vararg function. This could probably be done better, but this appears to work for now. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=54753&r1=54752&r2=54753&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Wed Aug 13 15:21:01 2008 @@ -45,7 +45,7 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { DSGraph &Graph = getOrCreateGraph(&*I); //If this is an true external, check it out - if (I->isDeclaration() && !I->isIntrinsic()) { + if (I->isDeclaration() && !I->isIntrinsic() && !(I->isVarArg())) { const std::string& Name = I->getName(); if (Name == "calloc" || Name == "malloc" || From dalej at apple.com Wed Aug 13 15:28:33 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 13 Aug 2008 13:28:33 -0700 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> Message-ID: <34B9D832-F5AF-4951-8CAA-96B90A02BFC8@apple.com> On Aug 13, 2008, at 1:18 PMPDT, Dale Johannesen wrote: >> >> + (TARGET_SSEREGPARM || \ >> + lookup_attribute("sseregparm", \ >> + type_attributes))){ \ >> >> What's about check for TARGET_SSE_MATH also? > > Yeah, thanks, that should be checked somewhere, let me look. This is OK: now what? /usr/local/bin/gcc -S -O3 t.c -static -fomit-frame-pointer - msseregparm -emit-llvm -mno-sse t.c:1: error: -msseregparm used without SSE enabled From dpatel at apple.com Wed Aug 13 15:31:11 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Aug 2008 20:31:11 -0000 Subject: [llvm-commits] [llvm] r54754 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200808132031.m7DKVBed014754@zion.cs.uiuc.edu> Author: dpatel Date: Wed Aug 13 15:31:11 2008 New Revision: 54754 URL: http://llvm.org/viewvc/llvm-project?rev=54754&view=rev Log: Rename. s/FindIVForUser/FindIVUserForCond/g Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54754&r1=54753&r2=54754&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Aug 13 15:31:11 2008 @@ -177,7 +177,7 @@ IVStrideUse* &CondUse, const SCEVHandle* &CondStride); void OptimizeIndvars(Loop *L); - bool FindIVForUser(ICmpInst *Cond, IVStrideUse *&CondUse, + bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, const SCEVHandle *&CondStride); bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); unsigned CheckForIVReuse(bool, bool, const SCEVHandle&, @@ -1453,10 +1453,10 @@ // different starting values, into different PHIs. } -/// FindIVForUser - If Cond has an operand that is an expression of an IV, +/// FindIVUserForCond - If Cond has an operand that is an expression of an IV, /// set the IV user and stride information and return true, otherwise return /// false. -bool LoopStrengthReduce::FindIVForUser(ICmpInst *Cond, IVStrideUse *&CondUse, +bool LoopStrengthReduce::FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, const SCEVHandle *&CondStride) { for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e && !CondUse; ++Stride) { @@ -1713,7 +1713,7 @@ IVStrideUse *CondUse = 0; const SCEVHandle *CondStride = 0; - if (!FindIVForUser(Cond, CondUse, CondStride)) + if (!FindIVUserForCond(Cond, CondUse, CondStride)) return; // setcc doesn't use the IV. // If possible, change stride and operands of the compare instruction to From daniel at zuster.org Wed Aug 13 15:43:56 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 13 Aug 2008 20:43:56 -0000 Subject: [llvm-commits] [llvm] r54756 - /llvm/trunk/utils/makellvm Message-ID: <200808132043.m7DKhvo7015096@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 13 15:43:56 2008 New Revision: 54756 URL: http://llvm.org/viewvc/llvm-project?rev=54756&view=rev Log: Update makellvm to return correct result code. Modified: llvm/trunk/utils/makellvm Modified: llvm/trunk/utils/makellvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/makellvm?rev=54756&r1=54755&r2=54756&view=diff ============================================================================== --- llvm/trunk/utils/makellvm (original) +++ llvm/trunk/utils/makellvm Wed Aug 13 15:43:56 2008 @@ -131,6 +131,7 @@ if ($doit == 1) then csh -f -c "$CMD" + set pstatus = $? else echo '(NOT EXECUTING) COMMAND:' echo " $CMD" From daniel at zuster.org Wed Aug 13 15:53:24 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 13 Aug 2008 20:53:24 -0000 Subject: [llvm-commits] [llvm] r54757 - /llvm/trunk/include/llvm/ADT/APSInt.h Message-ID: <200808132053.m7DKrPPq015398@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 13 15:53:17 2008 New Revision: 54757 URL: http://llvm.org/viewvc/llvm-project?rev=54757&view=rev Log: Add default constructor to APSInt - Creates uninitialized APInt. - Prevents need for embedding arbitrary constants when used as an out parameter, for example. Modified: llvm/trunk/include/llvm/ADT/APSInt.h Modified: llvm/trunk/include/llvm/ADT/APSInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=54757&r1=54756&r2=54757&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APSInt.h (original) +++ llvm/trunk/include/llvm/ADT/APSInt.h Wed Aug 13 15:53:17 2008 @@ -23,6 +23,9 @@ class APSInt : public APInt { bool IsUnsigned; public: + /// Default constructor that creates an uninitialized APInt. + explicit APSInt() {} + /// APSInt ctor - Create an APSInt with the specified width, default to /// unsigned. explicit APSInt(uint32_t BitWidth, bool isUnsigned = true) From daniel at zuster.org Wed Aug 13 15:54:16 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 13 Aug 2008 20:54:16 -0000 Subject: [llvm-commits] [llvm] r54758 - in /llvm/trunk: examples/BrainF/ tools/llvmc2/ tools/lto/ Message-ID: <200808132054.m7DKsGTB015432@zion.cs.uiuc.edu> Author: ddunbar Date: Wed Aug 13 15:54:16 2008 New Revision: 54758 URL: http://llvm.org/viewvc/llvm-project?rev=54758&view=rev Log: Add svn:ignore on several Release-Asserts directories Modified: llvm/trunk/examples/BrainF/ (props changed) llvm/trunk/tools/llvmc2/ (props changed) llvm/trunk/tools/lto/ (props changed) Propchange: llvm/trunk/examples/BrainF/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 13 15:54:16 2008 @@ -1,2 +1,3 @@ Release Debug +Release-Asserts Propchange: llvm/trunk/tools/llvmc2/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 13 15:54:16 2008 @@ -2,3 +2,4 @@ AutoGenerated.inc Debug Release +Release-Asserts Propchange: llvm/trunk/tools/lto/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Wed Aug 13 15:54:16 2008 @@ -1,2 +1,3 @@ Release Debug +Release-Asserts From gohman at apple.com Wed Aug 13 16:22:49 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 21:22:49 -0000 Subject: [llvm-commits] [llvm] r54760 - in /llvm/trunk: lib/Transforms/Scalar/SCCP.cpp test/Transforms/SCCP/empty-struct.ll Message-ID: <200808132122.m7DLMnVk016412@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 16:22:48 2008 New Revision: 54760 URL: http://llvm.org/viewvc/llvm-project?rev=54760&view=rev Log: Fix SCCP's handling of struct value loads and stores. SCCP doesn't track individual leaf values in such cases, so it needs to treat struct values as normal values in this case. Added: llvm/trunk/test/Transforms/SCCP/empty-struct.ll Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=54760&r1=54759&r2=54760&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Aug 13 16:22:48 2008 @@ -1583,7 +1583,6 @@ for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; if (Inst->getType() == Type::VoidTy || - isa(Inst->getType()) || isa(Inst)) continue; @@ -1760,7 +1759,6 @@ for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; if (Inst->getType() == Type::VoidTy || - isa(Inst->getType()) || isa(Inst)) continue; Added: llvm/trunk/test/Transforms/SCCP/empty-struct.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/empty-struct.ll?rev=54760&view=auto ============================================================================== --- llvm/trunk/test/Transforms/SCCP/empty-struct.ll (added) +++ llvm/trunk/test/Transforms/SCCP/empty-struct.ll Wed Aug 13 16:22:48 2008 @@ -0,0 +1,20 @@ +; RUN: llvm-as < %s > %t.bc +; RUN: llvm-ld %t.bc -o %t.sh +; PR2612 + + at current_foo = internal global { } zeroinitializer + +define i32 @main(...) { +entry: + %retval = alloca i32 ; [#uses=2] + store i32 0, i32* %retval + %local_foo = alloca { } ; <{ }*> [#uses=1] + load { }* @current_foo ; <{ }>:0 [#uses=1] + store { } %0, { }* %local_foo + br label %return + +return: ; preds = %entry + load i32* %retval ; :1 [#uses=1] + ret i32 %1 +} + From resistor at mac.com Wed Aug 13 16:24:25 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 21:24:25 -0000 Subject: [llvm-commits] [llvm] r54761 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200808132124.m7DLOP0P016469@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 16:24:24 2008 New Revision: 54761 URL: http://llvm.org/viewvc/llvm-project?rev=54761&view=rev Log: Switch this from std::map to DenseMap. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=54761&r1=54760&r2=54761&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Aug 13 16:24:24 2008 @@ -80,7 +80,7 @@ /// FunctionSize - The number of instructions present in the function uint64_t FunctionSize; - typedef std::map Mi2IndexMap; + typedef DenseMap Mi2IndexMap; Mi2IndexMap mi2iMap_; typedef std::vector Index2MiMap; From gohman at apple.com Wed Aug 13 16:24:30 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 14:24:30 -0700 Subject: [llvm-commits] [llvm] r54760 - in /llvm/trunk: lib/Transforms/Scalar/SCCP.cpp test/Transforms/SCCP/empty-struct.ll In-Reply-To: <200808132122.m7DLMnVk016412@zion.cs.uiuc.edu> References: <200808132122.m7DLMnVk016412@zion.cs.uiuc.edu> Message-ID: <1218662670.6407.1.camel@dgohman1> I forgot to mention that this patch was contribute by Richard Pennington! Dan On Wed, 2008-08-13 at 21:22 +0000, Dan Gohman wrote: > Author: djg > Date: Wed Aug 13 16:22:48 2008 > New Revision: 54760 > > URL: http://llvm.org/viewvc/llvm-project?rev=54760&view=rev > Log: > Fix SCCP's handling of struct value loads and stores. SCCP doesn't > track individual leaf values in such cases, so it needs to treat > struct values as normal values in this case. > > Added: > llvm/trunk/test/Transforms/SCCP/empty-struct.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/SCCP.cpp From resistor at mac.com Wed Aug 13 16:49:13 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 21:49:13 -0000 Subject: [llvm-commits] [llvm] r54763 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200808132149.m7DLnEMk017458@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 16:49:13 2008 New Revision: 54763 URL: http://llvm.org/viewvc/llvm-project?rev=54763&view=rev Log: Make the allocation of LiveIntervals explicit, rather than holding them in the r2iMap_ by value. This will prevent references to them from being invalidated if the map is changed. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=54763&r1=54762&r2=54763&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Aug 13 16:49:13 2008 @@ -86,7 +86,7 @@ typedef std::vector Index2MiMap; Index2MiMap i2miMap_; - typedef std::map Reg2IntervalMap; + typedef std::map Reg2IntervalMap; Reg2IntervalMap r2iMap_; BitVector allocatableRegs_; @@ -141,13 +141,13 @@ LiveInterval &getInterval(unsigned reg) { Reg2IntervalMap::iterator I = r2iMap_.find(reg); assert(I != r2iMap_.end() && "Interval does not exist for register"); - return I->second; + return *I->second; } const LiveInterval &getInterval(unsigned reg) const { Reg2IntervalMap::const_iterator I = r2iMap_.find(reg); assert(I != r2iMap_.end() && "Interval does not exist for register"); - return I->second; + return *I->second; } bool hasInterval(unsigned reg) const { @@ -237,7 +237,7 @@ Reg2IntervalMap::iterator I = r2iMap_.find(reg); if (I == r2iMap_.end()) I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg))); - return I->second; + return *I->second; } /// addLiveRangeToEndOfBlock - Given a register and an instruction, @@ -248,7 +248,9 @@ // Interval removal void removeInterval(unsigned Reg) { - r2iMap_.erase(Reg); + std::map::iterator I = r2iMap_.find(Reg); + delete I->second; + r2iMap_.erase(I); } /// isRemoved - returns true if the specified machine instr has been @@ -459,7 +461,7 @@ std::map &MBBVRegsMap, std::vector &NewLIs, float &SSWeight); - static LiveInterval createInterval(unsigned Reg); + static LiveInterval* createInterval(unsigned Reg); void printRegName(unsigned reg) const; }; Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=54763&r1=54762&r2=54763&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Aug 13 16:49:13 2008 @@ -71,6 +71,11 @@ } void LiveIntervals::releaseMemory() { + // Free the live intervals themselves. + for (std::map::iterator I = r2iMap_.begin(), + E = r2iMap_.end(); I != E; ++I) + delete I->second; + MBB2IdxMap.clear(); Idx2MBBMap.clear(); mi2iMap_.clear(); @@ -130,8 +135,8 @@ if (!OldI2MI.empty()) for (iterator OI = begin(), OE = end(); OI != OE; ++OI) { - for (LiveInterval::iterator LI = OI->second.begin(), - LE = OI->second.end(); LI != LE; ++LI) { + for (LiveInterval::iterator LI = OI->second->begin(), + LE = OI->second->end(); LI != LE; ++LI) { // Remap the start index of the live range to the corresponding new // number, or our best guess at what it _should_ correspond to if the @@ -174,8 +179,8 @@ } } - for (LiveInterval::vni_iterator VNI = OI->second.vni_begin(), - VNE = OI->second.vni_end(); VNI != VNE; ++VNI) { + for (LiveInterval::vni_iterator VNI = OI->second->vni_begin(), + VNE = OI->second->vni_end(); VNI != VNE; ++VNI) { VNInfo* vni = *VNI; // Remap the VNInfo def index, which works the same as the @@ -245,7 +250,7 @@ DOUT << "********** INTERVALS **********\n"; for (iterator I = begin(), E = end(); I != E; ++I) { - I->second.print(DOUT, tri_); + I->second->print(DOUT, tri_); DOUT << "\n"; } @@ -258,7 +263,7 @@ void LiveIntervals::print(std::ostream &O, const Module* ) const { O << "********** INTERVALS **********\n"; for (const_iterator I = begin(), E = end(); I != E; ++I) { - I->second.print(O, tri_); + I->second->print(O, tri_); O << "\n"; } @@ -729,10 +734,10 @@ } -LiveInterval LiveIntervals::createInterval(unsigned reg) { +LiveInterval* LiveIntervals::createInterval(unsigned reg) { float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ? HUGE_VALF : 0.0F; - return LiveInterval(reg, Weight); + return new LiveInterval(reg, Weight); } /// getVNInfoSourceReg - Helper function that parses the specified VNInfo Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=54763&r1=54762&r2=54763&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Aug 13 16:49:13 2008 @@ -323,11 +323,11 @@ "interval sets should be empty on initialization"); for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { - if (TargetRegisterInfo::isPhysicalRegister(i->second.reg)) { - reginfo_->setPhysRegUsed(i->second.reg); - fixed_.push_back(std::make_pair(&i->second, i->second.begin())); + if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) { + reginfo_->setPhysRegUsed(i->second->reg); + fixed_.push_back(std::make_pair(i->second, i->second->begin())); } else - unhandled_.push(&i->second); + unhandled_.push(i->second); } } @@ -385,11 +385,11 @@ MachineFunction::iterator EntryMBB = mf_->begin(); SmallVector LiveInMBBs; for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { - LiveInterval &cur = i->second; + LiveInterval &cur = *i->second; unsigned Reg = 0; bool isPhys = TargetRegisterInfo::isPhysicalRegister(cur.reg); if (isPhys) - Reg = i->second.reg; + Reg = cur.reg; else if (vrm_->isAssignedReg(cur.reg)) Reg = attemptTrivialCoalescing(cur, vrm_->getPhys(cur.reg)); if (!Reg) Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=54763&r1=54762&r2=54763&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Aug 13 16:49:13 2008 @@ -2091,7 +2091,7 @@ joinIntervals(); DOUT << "********** INTERVALS POST JOINING **********\n"; for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I){ - I->second.print(DOUT, tri_); + I->second->print(DOUT, tri_); DOUT << "\n"; } } @@ -2164,7 +2164,7 @@ } for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I) { - LiveInterval &LI = I->second; + LiveInterval &LI = *I->second; if (TargetRegisterInfo::isVirtualRegister(LI.reg)) { // If the live interval length is essentially zero, i.e. in every live // range the use follows def immediately, it doesn't make sense to spill From gohman at apple.com Wed Aug 13 16:51:37 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 21:51:37 -0000 Subject: [llvm-commits] [llvm] r54764 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/vector-variable-idx.ll Message-ID: <200808132151.m7DLpbFs017567@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 16:51:37 2008 New Revision: 54764 URL: http://llvm.org/viewvc/llvm-project?rev=54764&view=rev Log: Allow SelectionDAG to create EXTRACT_VECTOR_ELT nodes with non-constant indices. Only a few of the peephole checks require a constant index. Added: llvm/trunk/test/CodeGen/X86/vector-variable-idx.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=54764&r1=54763&r2=54764&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 13 16:51:37 2008 @@ -2302,15 +2302,14 @@ break; } case ISD::EXTRACT_VECTOR_ELT: - assert(N2C && "Bad EXTRACT_VECTOR_ELT!"); - // EXTRACT_VECTOR_ELT of an UNDEF is an UNDEF. if (N1.getOpcode() == ISD::UNDEF) return getNode(ISD::UNDEF, VT); // EXTRACT_VECTOR_ELT of CONCAT_VECTORS is often formed while lowering is // expanding copies of large vectors from registers. - if (N1.getOpcode() == ISD::CONCAT_VECTORS && + if (N2C && + N1.getOpcode() == ISD::CONCAT_VECTORS && N1.getNumOperands() > 0) { unsigned Factor = N1.getOperand(0).getValueType().getVectorNumElements(); @@ -2321,18 +2320,17 @@ // EXTRACT_VECTOR_ELT of BUILD_VECTOR is often formed while lowering is // expanding large vector constants. - if (N1.getOpcode() == ISD::BUILD_VECTOR) + if (N2C && N1.getOpcode() == ISD::BUILD_VECTOR) return N1.getOperand(N2C->getValue()); // EXTRACT_VECTOR_ELT of INSERT_VECTOR_ELT is often formed when vector // operations are lowered to scalars. - if (N1.getOpcode() == ISD::INSERT_VECTOR_ELT) - if (ConstantSDNode *IEC = dyn_cast(N1.getOperand(2))) { - if (IEC == N2C) - return N1.getOperand(1); - else - return getNode(ISD::EXTRACT_VECTOR_ELT, VT, N1.getOperand(0), N2); - } + if (N1.getOpcode() == ISD::INSERT_VECTOR_ELT) { + if (N1.getOperand(2) == N2) + return N1.getOperand(1); + else + return getNode(ISD::EXTRACT_VECTOR_ELT, VT, N1.getOperand(0), N2); + } break; case ISD::EXTRACT_ELEMENT: assert(N2C && (unsigned)N2C->getValue() < 2 && "Bad EXTRACT_ELEMENT!"); Added: llvm/trunk/test/CodeGen/X86/vector-variable-idx.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-variable-idx.ll?rev=54764&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vector-variable-idx.ll (added) +++ llvm/trunk/test/CodeGen/X86/vector-variable-idx.ll Wed Aug 13 16:51:37 2008 @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep movss | count 2 +; PR2676 + +define float @foo(<4 x float> %p, i32 %t) { + %z = extractelement <4 x float> %p, i32 %t + ret float %z +} +define <4 x float> @bar(<4 x float> %p, float %f, i32 %t) { + %z = insertelement <4 x float> %p, float %f, i32 %t + ret <4 x float> %z +} From daniel at zuster.org Wed Aug 13 17:02:31 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 13 Aug 2008 15:02:31 -0700 (PDT) Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue Message-ID: <806411.54424.qm@web54603.mail.re2.yahoo.com> The attached patch adds (pure virtual) eraseFromParent,releaseFromParent methods to GlobalValue. - Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: lift-eraseFromParent.patch Type: application/octet-stream Size: 2791 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080813/75dc6753/attachment.obj From resistor at mac.com Wed Aug 13 17:08:32 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 22:08:32 -0000 Subject: [llvm-commits] [llvm] r54765 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200808132208.m7DM8Wfw018199@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 17:08:30 2008 New Revision: 54765 URL: http://llvm.org/viewvc/llvm-project?rev=54765&view=rev Log: Move r2iMap_ over to DenseMap from std::map. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=54765&r1=54764&r2=54765&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Aug 13 17:08:30 2008 @@ -55,6 +55,20 @@ return LHS.first < RHS.first; } }; + + // Provide DenseMapInfo for unsigned. + template<> + struct DenseMapInfo { + static inline unsigned getEmptyKey() { return (unsigned)-1; } + static inline unsigned getTombstoneKey() { return (unsigned)-2; } + static unsigned getHashValue(const unsigned Val) { + return Val * 37; + } + static bool isEqual(const unsigned LHS, const unsigned RHS) { + return LHS == RHS; + } + static bool isPod() { return true; } + }; class LiveIntervals : public MachineFunctionPass { MachineFunction* mf_; @@ -86,7 +100,7 @@ typedef std::vector Index2MiMap; Index2MiMap i2miMap_; - typedef std::map Reg2IntervalMap; + typedef DenseMap Reg2IntervalMap; Reg2IntervalMap r2iMap_; BitVector allocatableRegs_; @@ -236,7 +250,7 @@ LiveInterval &getOrCreateInterval(unsigned reg) { Reg2IntervalMap::iterator I = r2iMap_.find(reg); if (I == r2iMap_.end()) - I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg))); + I = r2iMap_.insert(std::make_pair(reg, createInterval(reg))).first; return *I->second; } @@ -248,7 +262,7 @@ // Interval removal void removeInterval(unsigned Reg) { - std::map::iterator I = r2iMap_.find(Reg); + DenseMap::iterator I = r2iMap_.find(Reg); delete I->second; r2iMap_.erase(I); } Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=54765&r1=54764&r2=54765&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Aug 13 17:08:30 2008 @@ -72,7 +72,7 @@ void LiveIntervals::releaseMemory() { // Free the live intervals themselves. - for (std::map::iterator I = r2iMap_.begin(), + for (DenseMap::iterator I = r2iMap_.begin(), E = r2iMap_.end(); I != E; ++I) delete I->second; From resistor at mac.com Wed Aug 13 17:28:52 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 22:28:52 -0000 Subject: [llvm-commits] [llvm] r54766 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200808132228.m7DMSqxr018913@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 17:28:50 2008 New Revision: 54766 URL: http://llvm.org/viewvc/llvm-project?rev=54766&view=rev Log: Expunge the last uses of std::map from LiveIntervals. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=54766&r1=54765&r2=54766&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Aug 13 17:28:50 2008 @@ -28,7 +28,6 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Allocator.h" #include -#include namespace llvm { @@ -434,10 +433,10 @@ bool alsoFoldARestore(int Id, int index, unsigned vr, BitVector &RestoreMBBs, - std::map >&RestoreIdxes); + DenseMap >&RestoreIdxes); void eraseRestoreInfo(int Id, int index, unsigned vr, BitVector &RestoreMBBs, - std::map >&RestoreIdxes); + DenseMap >&RestoreIdxes); /// handleSpilledImpDefs - Remove IMPLICIT_DEF instructions which are being /// spilled and create empty intervals for their uses. @@ -460,7 +459,7 @@ VirtRegMap &vrm, const TargetRegisterClass* rc, SmallVector &ReMatIds, const MachineLoopInfo *loopInfo, unsigned &NewVReg, unsigned ImpUse, bool &HasDef, bool &HasUse, - std::map &MBBVRegsMap, + DenseMap &MBBVRegsMap, std::vector &NewLIs, float &SSWeight); void rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit, LiveInterval::Ranges::const_iterator &I, @@ -469,10 +468,10 @@ VirtRegMap &vrm, const TargetRegisterClass* rc, SmallVector &ReMatIds, const MachineLoopInfo *loopInfo, BitVector &SpillMBBs, - std::map > &SpillIdxes, + DenseMap > &SpillIdxes, BitVector &RestoreMBBs, - std::map > &RestoreIdxes, - std::map &MBBVRegsMap, + DenseMap > &RestoreIdxes, + DenseMap &MBBVRegsMap, std::vector &NewLIs, float &SSWeight); static LiveInterval* createInterval(unsigned Reg); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=54766&r1=54765&r2=54766&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Aug 13 17:28:50 2008 @@ -1091,7 +1091,7 @@ SmallVector &ReMatIds, const MachineLoopInfo *loopInfo, unsigned &NewVReg, unsigned ImpUse, bool &HasDef, bool &HasUse, - std::map &MBBVRegsMap, + DenseMap &MBBVRegsMap, std::vector &NewLIs, float &SSWeight) { MachineBasicBlock *MBB = MI->getParent(); unsigned loopDepth = loopInfo->getLoopDepth(MBB); @@ -1334,10 +1334,10 @@ SmallVector &ReMatIds, const MachineLoopInfo *loopInfo, BitVector &SpillMBBs, - std::map > &SpillIdxes, + DenseMap > &SpillIdxes, BitVector &RestoreMBBs, - std::map > &RestoreIdxes, - std::map &MBBVRegsMap, + DenseMap > &RestoreIdxes, + DenseMap &MBBVRegsMap, std::vector &NewLIs, float &SSWeight) { bool AllCanFold = true; unsigned NewVReg = 0; @@ -1404,7 +1404,7 @@ unsigned MBBId = MBB->getNumber(); unsigned ThisVReg = 0; if (TrySplit) { - std::map::const_iterator NVI = MBBVRegsMap.find(MBBId); + DenseMap::iterator NVI = MBBVRegsMap.find(MBBId); if (NVI != MBBVRegsMap.end()) { ThisVReg = NVI->second; // One common case: @@ -1466,7 +1466,7 @@ if (VNI) HasKill = anyKillInMBBAfterIdx(li, VNI, MBB, getDefIndex(index)); } - std::map >::iterator SII = + DenseMap >::iterator SII = SpillIdxes.find(MBBId); if (!HasKill) { if (SII == SpillIdxes.end()) { @@ -1499,14 +1499,14 @@ } if (HasUse) { - std::map >::iterator SII = + DenseMap >::iterator SII = SpillIdxes.find(MBBId); if (SII != SpillIdxes.end() && SII->second.back().vreg == NewVReg && (int)index > SII->second.back().index) // Use(s) following the last def, it's not safe to fold the spill. SII->second.back().canFold = false; - std::map >::iterator RII = + DenseMap >::iterator RII = RestoreIdxes.find(MBBId); if (RII != RestoreIdxes.end() && RII->second.back().vreg == NewVReg) // If we are splitting live intervals, only fold if it's the first @@ -1539,7 +1539,7 @@ bool LiveIntervals::alsoFoldARestore(int Id, int index, unsigned vr, BitVector &RestoreMBBs, - std::map > &RestoreIdxes) { + DenseMap > &RestoreIdxes) { if (!RestoreMBBs[Id]) return false; std::vector &Restores = RestoreIdxes[Id]; @@ -1553,7 +1553,7 @@ void LiveIntervals::eraseRestoreInfo(int Id, int index, unsigned vr, BitVector &RestoreMBBs, - std::map > &RestoreIdxes) { + DenseMap > &RestoreIdxes) { if (!RestoreMBBs[Id]) return; std::vector &Restores = RestoreIdxes[Id]; @@ -1613,10 +1613,10 @@ // Each bit specify whether it a spill is required in the MBB. BitVector SpillMBBs(mf_->getNumBlockIDs()); - std::map > SpillIdxes; + DenseMap > SpillIdxes; BitVector RestoreMBBs(mf_->getNumBlockIDs()); - std::map > RestoreIdxes; - std::map MBBVRegsMap; + DenseMap > RestoreIdxes; + DenseMap MBBVRegsMap; std::vector NewLIs; const TargetRegisterClass* rc = mri_->getRegClass(li.reg); From gohman at apple.com Wed Aug 13 18:12:38 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 13 Aug 2008 23:12:38 -0000 Subject: [llvm-commits] [llvm] r54767 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/srem1.ll Message-ID: <200808132312.m7DNCccS020092@zion.cs.uiuc.edu> Author: djg Date: Wed Aug 13 18:12:35 2008 New Revision: 54767 URL: http://llvm.org/viewvc/llvm-project?rev=54767&view=rev Log: Fix a bogus srem rule - a negative value srem'd by a power-of-2 can have a non-negative result; for example, -16%16 is 0. Also, clarify the related comments. This fixes PR2670. Added: llvm/trunk/test/Transforms/InstCombine/srem1.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=54767&r1=54766&r2=54767&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Wed Aug 13 18:12:35 2008 @@ -369,15 +369,13 @@ ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero2, KnownOne2, TD, Depth+1); - // The sign of a remainder is equal to the sign of the first - // operand (zero being positive). + // If the sign bit of the first operand is zero, the sign bit of + // the result is zero. If the first operand has no one bits below + // the second operand's single 1 bit, its sign will be zero. if (KnownZero2[BitWidth-1] || ((KnownZero2 & LowBits) == LowBits)) KnownZero2 |= ~LowBits; - else if (KnownOne2[BitWidth-1]) - KnownOne2 |= ~LowBits; KnownZero |= KnownZero2 & Mask; - KnownOne |= KnownOne2 & Mask; assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=54767&r1=54766&r2=54767&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Aug 13 18:12:35 2008 @@ -1656,15 +1656,13 @@ APInt Mask2 = LowBits | APInt::getSignBit(BitWidth); ComputeMaskedBits(Op.getOperand(0), Mask2,KnownZero2,KnownOne2,Depth+1); - // The sign of a remainder is equal to the sign of the first - // operand (zero being positive). + // If the sign bit of the first operand is zero, the sign bit of + // the result is zero. If the first operand has no one bits below + // the second operand's single 1 bit, its sign will be zero. if (KnownZero2[BitWidth-1] || ((KnownZero2 & LowBits) == LowBits)) KnownZero2 |= ~LowBits; - else if (KnownOne2[BitWidth-1]) - KnownOne2 |= ~LowBits; KnownZero |= KnownZero2 & Mask; - KnownOne |= KnownOne2 & Mask; assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=54767&r1=54766&r2=54767&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Aug 13 18:12:35 2008 @@ -1266,11 +1266,8 @@ if (LHSKnownZero[BitWidth-1] || ((LHSKnownZero & LowBits) == LowBits)) LHSKnownZero |= ~LowBits; - else if (LHSKnownOne[BitWidth-1]) - LHSKnownOne |= ~LowBits; KnownZero |= LHSKnownZero & DemandedMask; - KnownOne |= LHSKnownOne & DemandedMask; assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); } Added: llvm/trunk/test/Transforms/InstCombine/srem1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/srem1.ll?rev=54767&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/srem1.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/srem1.ll Wed Aug 13 18:12:35 2008 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | opt -instcombine +; PR2670 + + at g_127 = external global i32 ; [#uses=1] + +define i32 @func_56(i32 %p_58, i32 %p_59, i32 %p_61, i16 signext %p_62) nounwind { +entry: + %call = call i32 (...)* @rshift_s_s( i32 %p_61, i32 1 ) ; [#uses=1] + %conv = sext i32 %call to i64 ; [#uses=1] + %or = or i64 -1734012817166602727, %conv ; [#uses=1] + %rem = srem i64 %or, 1 ; [#uses=1] + %cmp = icmp eq i64 %rem, 1 ; [#uses=1] + %cmp.ext = zext i1 %cmp to i32 ; [#uses=1] + store i32 %cmp.ext, i32* @g_127 + ret i32 undef +} + +declare i32 @rshift_s_s(...) From resistor at mac.com Wed Aug 13 18:36:24 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 13 Aug 2008 23:36:24 -0000 Subject: [llvm-commits] [llvm] r54770 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200808132336.m7DNaPtp020813@zion.cs.uiuc.edu> Author: resistor Date: Wed Aug 13 18:36:23 2008 New Revision: 54770 URL: http://llvm.org/viewvc/llvm-project?rev=54770&view=rev Log: Get rid of a use of std::map. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=54770&r1=54769&r2=54770&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Aug 13 18:36:23 2008 @@ -64,7 +64,7 @@ /// compiled, and keeps track of which register classes have registers that /// belong to multiple classes or have aliases that are in other classes. EquivalenceClasses RelatedRegClasses; - std::map OneClassForEachPhysReg; + DenseMap OneClassForEachPhysReg; MachineFunction* mf_; MachineRegisterInfo* mri_; @@ -221,7 +221,7 @@ // belongs to, add info about aliases. We don't need to do this for targets // without register aliases. if (HasAliases) - for (std::map::iterator + for (DenseMap::iterator I = OneClassForEachPhysReg.begin(), E = OneClassForEachPhysReg.end(); I != E; ++I) for (const unsigned *AS = TRI.getAliasSet(I->first); *AS; ++AS) From dalej at apple.com Wed Aug 13 20:20:01 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 14 Aug 2008 01:20:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54772 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.c config/darwin.h objc/objc-act.c testsuite/objc.dg/property-metadata-1.m Message-ID: <200808140120.m7E1K2CP023706@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 20:20:00 2008 New Revision: 54772 URL: http://llvm.org/viewvc/llvm-project?rev=54772&view=rev Log: Use 'l' not 'L' as the prefix on some ObjC magic symbols that go in the __data section. A request from Darwin's linker guys, shouldn't affect any other target. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/objc/objc-act.c llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=54772&r1=54771&r2=54772&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Wed Aug 13 20:20:00 2008 @@ -1535,30 +1535,7 @@ /* LLVM LOCAL begin */ #ifdef ENABLE_LLVM -const char *darwin_objc_llvm_implicit_target_global_var_section(tree decl) { - const char *name; - - if (TREE_CODE(decl) == CONST_DECL) { - extern int flag_next_runtime; - tree typename = TYPE_NAME(TREE_TYPE(decl)); - if (TREE_CODE(typename) == TYPE_DECL) - typename = DECL_NAME(typename); - - if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_ObjCString")) { - if (flag_next_runtime) - return "__OBJC, __cstring_object,regular,no_dead_strip"; - else - return "__OBJC, __string_object,no_dead_strip"; - } else if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_CFString")) { - return "__DATA, __cfstring"; - } else { - return 0; - } - } - - /* Get a pointer to the name, past the L_OBJC_ prefix. */ - name = IDENTIFIER_POINTER (DECL_NAME (decl))+7; - +const char *darwin_objc_llvm_special_name_section(const char* name) { if (!strncmp (name, "CLASS_METHODS_", 14)) return "__OBJC,__cls_meth,regular,no_dead_strip"; else if (!strncmp (name, "INSTANCE_METHODS_", 17)) @@ -1579,6 +1556,8 @@ return "__TEXT,__cstring,cstring_literals"; else if (!strncmp (name, "METH_VAR_TYPE_", 14)) return "__TEXT,__cstring,cstring_literals"; + else if (!strncmp (name, "PROP_NAME_ATTR_", 15)) + return "__TEXT,__cstring,cstring_literals"; else if (!strncmp (name, "CLASS_REFERENCES", 16)) return "__OBJC,__cls_refs,literal_pointers,no_dead_strip"; else if (!strncmp (name, "CLASS_", 6)) @@ -1632,10 +1611,35 @@ return "__DATA, __objc_nlcatlist, regular, no_dead_strip"; else if (!strncmp (name, "PROTOCOL_REFERENCE_", 19)) return "__DATA, __objc_protorefs, regular, no_dead_strip"; - else + } + return 0; +} + +const char *darwin_objc_llvm_implicit_target_global_var_section(tree decl) { + const char *name; + + if (TREE_CODE(decl) == CONST_DECL) { + extern int flag_next_runtime; + tree typename = TYPE_NAME(TREE_TYPE(decl)); + if (TREE_CODE(typename) == TYPE_DECL) + typename = DECL_NAME(typename); + + if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_ObjCString")) { + if (flag_next_runtime) + return "__OBJC, __cstring_object,regular,no_dead_strip"; + else + return "__OBJC, __string_object,no_dead_strip"; + } else if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_CFString")) { + return "__DATA, __cfstring"; + } else { return 0; - } else - return 0; + } + } + + /* Get a pointer to the name, past the L_OBJC_ prefix. */ + name = IDENTIFIER_POINTER (DECL_NAME (decl))+7; + + return darwin_objc_llvm_special_name_section(name); } #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=54772&r1=54771&r2=54772&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Aug 13 20:20:00 2008 @@ -1419,10 +1419,12 @@ (((DECL_NAME (decl) && \ TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE && \ IDENTIFIER_POINTER (DECL_NAME (decl)) && \ - !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "L_OBJC_", 7)) || \ + (!strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "L_OBJC_", 7) || \ + !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "l_OBJC_", 7))) || \ TREE_CODE(decl) == CONST_DECL) ? \ darwin_objc_llvm_implicit_target_global_var_section(decl) : 0) const char *darwin_objc_llvm_implicit_target_global_var_section(tree); +const char *darwin_objc_llvm_special_name_section(const char*); /* Darwin X86-64 only supports PIC code generation. */ #if defined (TARGET_386) Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=54772&r1=54771&r2=54772&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Wed Aug 13 20:20:00 2008 @@ -4081,12 +4081,22 @@ /* LLVM LOCAL begin */ tree var = NULL_TREE; #ifdef ENABLE_LLVM - /* Darwin linker prefers to use 'L' as a prefix. GCC codegen handles this - later while emitting symbols, but fix it here for llvm. */ + /* Prefer to use 'L' as a prefix so symbols can be stripped at assembly + time. GCC codegen handles this later while emitting symbols, but fix + it here for llvm. */ + /* Special ObjC symbols in __data should use 'l' so the assembler + will not strip the symbol; the linker needs to see these, but + strip them after use. */ char *new_name; if (name && strncmp (name, "_OBJC_", 6) == 0) { new_name = alloca (strlen (name) + 2); +#if TARGET_MACHO + const char* section = darwin_objc_llvm_special_name_section(name+6); + new_name[0] = (section==0 || strcmp(section, "__DATA,__data")==0) + ? 'l' : 'L'; +#else new_name[0] = 'L'; +#endif strcpy (new_name + 1, name); var = build_decl (VAR_DECL, get_identifier (new_name), type); set_user_assembler_name (var, IDENTIFIER_POINTER (DECL_NAME (var))); @@ -6379,6 +6389,7 @@ { /* Darwin linker prefers to use 'L' as a prefix. GCC codegen handles this later while emitting symbols, but fix it here for llvm. */ + /* All these are in cstring, so none use 'l'. */ char *tbuf = alloca (strlen (buf) + 2); tbuf[0] = 'L'; strcpy (tbuf + 1, buf); Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m?rev=54772&r1=54771&r2=54772&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Wed Aug 13 20:20:00 2008 @@ -22,5 +22,5 @@ @dynamic referenceCount; @end -/* { dg-final { scan-assembler "L_OBJC_\\\$_PROP_LIST_GCObject:" } } */ -/* { dg-final { scan-assembler "L_OBJC_\\\$_PROP_PROTO_LIST_GCObject:" } } */ +/* { dg-final { scan-assembler "(L|l)_OBJC_\\\$_PROP_LIST_GCObject:" } } */ +/* { dg-final { scan-assembler "(L|l)_OBJC_\\\$_PROP_PROTO_LIST_GCObject:" } } */ From dalej at apple.com Wed Aug 13 20:23:51 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 14 Aug 2008 01:23:51 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54773 - /llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Message-ID: <200808140123.m7E1Npmn023813@zion.cs.uiuc.edu> Author: johannes Date: Wed Aug 13 20:23:51 2008 New Revision: 54773 URL: http://llvm.org/viewvc/llvm-project?rev=54773&view=rev Log: Add LLVM LOCAL comments. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m?rev=54773&r1=54772&r2=54773&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Wed Aug 13 20:23:51 2008 @@ -22,5 +22,7 @@ @dynamic referenceCount; @end +/* LLVM LOCAL begin adjust for leading 'l' */ /* { dg-final { scan-assembler "(L|l)_OBJC_\\\$_PROP_LIST_GCObject:" } } */ /* { dg-final { scan-assembler "(L|l)_OBJC_\\\$_PROP_PROTO_LIST_GCObject:" } } */ +/* LLVM LOCAL end */ From anton at korobeynikov.info Thu Aug 14 04:58:41 2008 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Thu, 14 Aug 2008 13:58:41 +0400 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> Message-ID: Hello, Dale > It does that for parameters (already did); the issue is return values. > (And it's not new, it was there, just not fully implemented. See > X86CallingConv.td.) Well, that's ok. But I'm just thinking about not to duplicate efforts. Why don't allow inreg attribute on return values and handle it in this way? It seems to be the most flexible solution. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From isanbard at gmail.com Thu Aug 14 05:23:01 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 14 Aug 2008 10:23:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54776 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200808141023.m7EAN2SL022711@zion.cs.uiuc.edu> Author: void Date: Thu Aug 14 05:23:00 2008 New Revision: 54776 URL: http://llvm.org/viewvc/llvm-project?rev=54776&view=rev Log: Don't mix declarations and code. Non-C99 compilers don't like this. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=54776&r1=54775&r2=54776&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Aug 14 05:23:00 2008 @@ -4091,9 +4091,11 @@ if (name && strncmp (name, "_OBJC_", 6) == 0) { new_name = alloca (strlen (name) + 2); #if TARGET_MACHO - const char* section = darwin_objc_llvm_special_name_section(name+6); - new_name[0] = (section==0 || strcmp(section, "__DATA,__data")==0) - ? 'l' : 'L'; + { + const char* section = darwin_objc_llvm_special_name_section(name+6); + new_name[0] = (section==0 || strcmp(section, "__DATA,__data")==0) + ? 'l' : 'L'; + } #else new_name[0] = 'L'; #endif From matthijs at stdin.nl Thu Aug 14 10:03:05 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 14 Aug 2008 15:03:05 -0000 Subject: [llvm-commits] [llvm] r54778 - /llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Message-ID: <200808141503.m7EF35lU000952@zion.cs.uiuc.edu> Author: matthijs Date: Thu Aug 14 10:03:05 2008 New Revision: 54778 URL: http://llvm.org/viewvc/llvm-project?rev=54778&view=rev Log: Replace two for loops with while(!X->use_empty()) loops. This prevents invalidating the iterator by deleting the current use. This fixes a segfault on 64 bit linux reported in PR2675. Also remove an unneeded if. Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=54778&r1=54777&r2=54778&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Thu Aug 14 10:03:05 2008 @@ -258,10 +258,8 @@ // ParamAttrs - Keep track of the parameter attributes for the arguments. SmallVector ArgAttrsVec; - for (Value::use_iterator FUI = F->use_begin(), FUE = F->use_end(); - FUI != FUE;) { - CallSite CS = CallSite::get(*FUI); - ++FUI; + while (!F->use_empty()) { + CallSite CS = CallSite::get(*F->use_begin()); Instruction *Call = CS.getInstruction(); const PAListPtr &PAL = F->getParamAttrs(); @@ -317,12 +315,12 @@ assert (Idx && "Unexpected getelementptr index!"); Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(), "evi", UGEP); - for (Value::use_iterator GI = UGEP->use_begin(), - GE = UGEP->use_end(); GI != GE; ++GI) { - if (LoadInst *L = dyn_cast(*GI)) { - L->replaceAllUsesWith(GR); - L->eraseFromParent(); - } + while(!UGEP->use_empty()) { + // isSafeToUpdateAllCallers has checked that all GEP uses are + // LoadInsts + LoadInst *L = cast(*UGEP->use_begin()); + L->replaceAllUsesWith(GR); + L->eraseFromParent(); } UGEP->eraseFromParent(); } From dalej at apple.com Thu Aug 14 11:35:22 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 14 Aug 2008 09:35:22 -0700 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> Message-ID: On Aug 14, 2008, at 2:58 AMPDT, Anton Korobeynikov wrote: > Hello, Dale > >> It does that for parameters (already did); the issue is return >> values. >> (And it's not new, it was there, just not fully implemented. See >> X86CallingConv.td.) > Well, that's ok. But I'm just thinking about not to duplicate efforts. > Why don't allow inreg attribute on return values and handle it in this > way? It seems to be the most flexible solution. Both the sseregparm and non-sseregparm conventions return the value in a register; but they use different registers. I suppose we could define 'inreg' to mean one or the other, but that seems very arbitrary to me. From clattner at apple.com Thu Aug 14 12:19:46 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 14 Aug 2008 10:19:46 -0700 Subject: [llvm-commits] [llvm] r54744 - in /llvm/trunk/lib: AsmParser/LLLexer.cpp AsmParser/llvmAsmParser.y VMCore/AsmWriter.cpp VMCore/Verifier.cpp In-Reply-To: References: <200808131840.m7DIeRfJ009161@zion.cs.uiuc.edu> <622EAEDF-7178-417D-A824-41499AC9F491@korobeynikov.info> <60277EC2-F289-4BFD-831B-5EF18B6AC5F1@apple.com> Message-ID: <3D96ACDF-49EC-4688-A71E-42426AB96F44@apple.com> On Aug 14, 2008, at 9:35 AM, Dale Johannesen wrote: > On Aug 14, 2008, at 2:58 AMPDT, Anton Korobeynikov wrote: >> Hello, Dale >> >>> It does that for parameters (already did); the issue is return >>> values. >>> (And it's not new, it was there, just not fully implemented. See >>> X86CallingConv.td.) >> Well, that's ok. But I'm just thinking about not to duplicate >> efforts. >> Why don't allow inreg attribute on return values and handle it in >> this >> way? It seems to be the most flexible solution. > > Both the sseregparm and non-sseregparm conventions return the value in > a register; but they use different registers. > I suppose we could define 'inreg' to mean one or the other, but that > seems very arbitrary to me. I agree that it is arbitrary, but "inreg" is already an arbitrary flag that is used to communicate between the front-ends and backends. I think it is simple enough to define that "inreg" for the x86 backend means to pass/return in an XMM register. To me, having a well defined semantics is more important than the actual spelling of the magic attribute. Like Anton, I prefer to use inreg on the result instead of introducing a new calling convention. Thank you for working on this Dale! -Chris From sabre at nondot.org Thu Aug 14 12:48:26 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 14 Aug 2008 12:48:26 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/index.html Message-ID: <200808141748.m7EHmQxs006283@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: index.html updated: 1.78 -> 1.79 --- Log message: Fix attribution --- Diffs of the changes: (+1 -1) index.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/pubs/index.html diff -u llvm-www/pubs/index.html:1.78 llvm-www/pubs/index.html:1.79 --- llvm-www/pubs/index.html:1.78 Sun Jul 20 16:12:32 2008 +++ llvm-www/pubs/index.html Thu Aug 14 12:47:48 2008 @@ -11,7 +11,7 @@
  • "Verifying Multi-threaded C Programs with SPIN"
    -Anna Zaks and Amir Pnueli
    +Anna Zaks and Rajeev Joshi
    Proc. International SPIN Workshop on Model Checking of Software (SPIN 2008), August 2008
  • From sabre at nondot.org Thu Aug 14 12:48:26 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 14 Aug 2008 12:48:26 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2008-08-SPIN-Pancam.html Message-ID: <200808141748.m7EHmQCT006282@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2008-08-SPIN-Pancam.html updated: 1.2 -> 1.3 --- Log message: Fix attribution --- Diffs of the changes: (+1 -1) 2008-08-SPIN-Pancam.html | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/pubs/2008-08-SPIN-Pancam.html diff -u llvm-www/pubs/2008-08-SPIN-Pancam.html:1.2 llvm-www/pubs/2008-08-SPIN-Pancam.html:1.3 --- llvm-www/pubs/2008-08-SPIN-Pancam.html:1.2 Sun Jul 20 16:16:17 2008 +++ llvm-www/pubs/2008-08-SPIN-Pancam.html Thu Aug 14 12:46:53 2008 @@ -11,7 +11,7 @@ Verifying Multi-threaded C Programs with SPIN
    - Anna Zaks and Amir Pnueli + Anna Zaks and Rajeev Joshi

    Abstract:

    From gohman at apple.com Thu Aug 14 13:13:53 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 18:13:53 -0000 Subject: [llvm-commits] [llvm] r54780 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h include/llvm/CodeGen/MachineLoopInfo.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LoopAligner.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/StrongPHIElimination.cpp lib/Transforms/IPO/LoopExtractor.cpp lib/Transforms/Scalar/LoopIndexSplit.cpp lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200808141813.m7EIDswW007141@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 13:13:49 2008 New Revision: 54780 URL: http://llvm.org/viewvc/llvm-project?rev=54780&view=rev Log: Use empty() instead of begin() == end(). Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h llvm/trunk/lib/CodeGen/LiveInterval.cpp llvm/trunk/lib/CodeGen/LoopAligner.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Thu Aug 14 13:13:49 2008 @@ -648,6 +648,7 @@ typedef typename std::vector*>::const_iterator iterator; iterator begin() const { return TopLevelLoops.begin(); } iterator end() const { return TopLevelLoops.end(); } + bool empty() const { return TopLevelLoops.empty(); } /// getLoopFor - Return the inner most loop that BB lives in. If a basic /// block is in no loop (for example the entry node), null is returned. @@ -947,6 +948,7 @@ typedef std::vector::const_iterator iterator; inline iterator begin() const { return LI->begin(); } inline iterator end() const { return LI->end(); } + bool empty() const { return LI->empty(); } /// getLoopFor - Return the inner most loop that BB lives in. If a basic /// block is in no loop (for example the entry node), null is returned. Modified: llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h Thu Aug 14 13:13:49 2008 @@ -92,6 +92,7 @@ typedef std::vector::const_iterator iterator; inline iterator begin() const { return LI->begin(); } inline iterator end() const { return LI->end(); } + bool empty() const { return LI->empty(); } /// getLoopFor - Return the inner most loop that BB lives in. If a basic /// block is in no loop (for example the entry node), null is returned. Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Aug 14 13:13:49 2008 @@ -547,7 +547,7 @@ /// used with an unknown definition value. void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers, BumpPtrAllocator &VNInfoAllocator) { - if (Clobbers.begin() == Clobbers.end()) return; + if (Clobbers.empty()) return; // Find a value # to use for the clobber ranges. If there is already a value# // for unknown values, use it. Modified: llvm/trunk/lib/CodeGen/LoopAligner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LoopAligner.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LoopAligner.cpp (original) +++ llvm/trunk/lib/CodeGen/LoopAligner.cpp Thu Aug 14 13:13:49 2008 @@ -46,7 +46,7 @@ bool LoopAligner::runOnMachineFunction(MachineFunction &MF) { const MachineLoopInfo *MLI = &getAnalysis(); - if (MLI->begin() == MLI->end()) + if (MLI->empty()) return false; // No loops. const TargetLowering *TLI = MF.getTarget().getTargetLowering(); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Aug 14 13:13:49 2008 @@ -1852,7 +1852,7 @@ JoinQueue = new JoinPriorityQueue(this); std::vector TryAgainList; - if (loopInfo->begin() == loopInfo->end()) { + if (loopInfo->empty()) { // If there are no loops in the function, join intervals in function order. for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) @@ -2049,7 +2049,7 @@ CopyMI->setDesc(tii_->get(TargetInstrInfo::IMPLICIT_DEF)); for (int i = CopyMI->getNumOperands() - 1, e = 0; i > e; --i) CopyMI->RemoveOperand(i); - bool NoUse = mri_->use_begin(SrcReg) == mri_->use_end(); + bool NoUse = mri_->use_empty(SrcReg); if (NoUse) { for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg), E = mri_->reg_end(); I != E; ) { Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Thu Aug 14 13:13:49 2008 @@ -848,7 +848,7 @@ RHS.removeValNo(*VI); } - if (RHS.begin() == RHS.end()) + if (RHS.empty()) LI.removeInterval(RHS.reg); } Modified: llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/LoopExtractor.cpp Thu Aug 14 13:13:49 2008 @@ -79,7 +79,7 @@ LoopInfo &LI = getAnalysis(); // If this function has no loops, there is nothing to do. - if (LI.begin() == LI.end()) + if (LI.empty()) return false; DominatorTree &DT = getAnalysis(); Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Aug 14 13:13:49 2008 @@ -1006,9 +1006,9 @@ // Remove split condition. SD.SplitCondition->eraseFromParent(); - if (Op0->use_begin() == Op0->use_end()) + if (Op0->use_empty()) Op0->eraseFromParent(); - if (Op1->use_begin() == Op1->use_end()) + if (Op1->use_empty()) Op1->eraseFromParent(); BranchInst *ExitInsn = Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=54780&r1=54779&r2=54780&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Aug 14 13:13:49 2008 @@ -107,7 +107,7 @@ CommonPreds.insert(*PI); // Shortcut, if there are no common predecessors, merging is always safe - if (CommonPreds.begin() == CommonPreds.end()) + if (CommonPreds.empty()) return true; // Look at all the phi nodes in Succ, to see if they present a conflict when From resistor at mac.com Thu Aug 14 13:34:23 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 18:34:23 -0000 Subject: [llvm-commits] [llvm] r54781 - in /llvm/trunk: lib/CodeGen/MachineInstr.cpp utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200808141834.m7EIYPj6007691@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 13:34:18 2008 New Revision: 54781 URL: http://llvm.org/viewvc/llvm-project?rev=54781&view=rev Log: Speed up addRegisterDead by adding more fast checks before performing the expensive subregister query, and by increasing the size of the subregister hashtable so that there are fewer collisions. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=54781&r1=54780&r2=54781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Aug 14 13:34:18 2008 @@ -834,7 +834,9 @@ // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) return true; - if (RegInfo->isSubRegister(IncomingReg, Reg)) + if (RegInfo->getSubRegisters(IncomingReg) && + RegInfo->getSuperRegisters(Reg) && + RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=54781&r1=54780&r2=54781&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Thu Aug 14 13:34:18 2008 @@ -473,10 +473,12 @@ NumSubRegs += RegisterSubRegs[Regs[i].TheDef].size(); } - unsigned SubregHashTableSize = NextPowerOf2(2 * NumSubRegs); + unsigned SubregHashTableSize = 2 * NextPowerOf2(2 * NumSubRegs); unsigned* SubregHashTable = new unsigned[2 * SubregHashTableSize]; std::fill(SubregHashTable, SubregHashTable + 2 * SubregHashTableSize, ~0U); + unsigned hashMisses = 0; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { Record* R = Regs[i].TheDef; for (std::set::iterator I = RegisterSubRegs[R].begin(), @@ -491,6 +493,8 @@ SubregHashTable[index*2+1] != ~0U) { index = (index + ProbeAmt) & (SubregHashTableSize-1); ProbeAmt += 2; + + hashMisses++; } SubregHashTable[index*2] = i; @@ -498,10 +502,12 @@ } } + OS << "\n\n // Number of hash collisions: " << hashMisses << "\n"; + if (SubregHashTableSize) { std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace"); - OS << "\n\n const unsigned SubregHashTable[] = { "; + OS << " const unsigned SubregHashTable[] = { "; for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) { if (i != 0) // Insert spaces for nice formatting. @@ -527,7 +533,7 @@ OS << " const unsigned SubregHashTableSize = " << SubregHashTableSize << ";\n"; } else { - OS << "\n\n const unsigned SubregHashTable[] = { ~0U, ~0U };\n" + OS << " const unsigned SubregHashTable[] = { ~0U, ~0U };\n" << " const unsigned SubregHashTableSize = 1;\n"; } From criswell at uiuc.edu Thu Aug 14 14:05:42 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 14 Aug 2008 19:05:42 -0000 Subject: [llvm-commits] [poolalloc] r54782 - /poolalloc/trunk/lib/DSA/Makefile Message-ID: <200808141905.m7EJ5go7008627@zion.cs.uiuc.edu> Author: criswell Date: Thu Aug 14 14:05:40 2008 New Revision: 54782 URL: http://llvm.org/viewvc/llvm-project?rev=54782&view=rev Log: Make a dynamic library version for use with opt. Modified: poolalloc/trunk/lib/DSA/Makefile Modified: poolalloc/trunk/lib/DSA/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Makefile?rev=54782&r1=54781&r2=54782&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Makefile (original) +++ poolalloc/trunk/lib/DSA/Makefile Thu Aug 14 14:05:40 2008 @@ -9,6 +9,7 @@ LEVEL = ../.. BUILD_RELINKED=1 +SHARED_LIBRARY=1 LIBRARYNAME = LLVMDataStructure CFlags += -fPIC From criswell at uiuc.edu Thu Aug 14 14:58:01 2008 From: criswell at uiuc.edu (John Criswell) Date: Thu, 14 Aug 2008 19:58:01 -0000 Subject: [llvm-commits] [poolalloc] r54783 - /poolalloc/trunk/lib/PoolAllocate/Makefile Message-ID: <200808141958.m7EJw16S010191@zion.cs.uiuc.edu> Author: criswell Date: Thu Aug 14 14:58:00 2008 New Revision: 54783 URL: http://llvm.org/viewvc/llvm-project?rev=54783&view=rev Log: Allow the pool allocation library to be used from opt. Modified: poolalloc/trunk/lib/PoolAllocate/Makefile Modified: poolalloc/trunk/lib/PoolAllocate/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Makefile?rev=54783&r1=54782&r2=54783&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/Makefile (original) +++ poolalloc/trunk/lib/PoolAllocate/Makefile Thu Aug 14 14:58:00 2008 @@ -7,6 +7,7 @@ # Give the name of a library. This will build a dynamic version. # BUILD_RELINKED=1 +SHARED_LIBRARY=1 LIBRARYNAME=poolalloc # From gohman at apple.com Thu Aug 14 15:04:46 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 20:04:46 -0000 Subject: [llvm-commits] [llvm] r54784 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/VMCore/Instructions.cpp lib/VMCore/Verifier.cpp test/CodeGen/Generic/vector-casts.ll Message-ID: <200808142004.m7EK4l7H010454@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 15:04:46 2008 New Revision: 54784 URL: http://llvm.org/viewvc/llvm-project?rev=54784&view=rev Log: Improve support for vector casts in LLVM IR and CodeGen. Added: llvm/trunk/test/CodeGen/Generic/vector-casts.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Aug 14 15:04:46 2008 @@ -3146,6 +3146,10 @@ MVT VT = N->getValueType(0); MVT EVT = N->getValueType(0); + // This transformation isn't valid for vector loads. + if (VT.isVector()) + return SDValue(); + // Special case: SIGN_EXTEND_INREG is basically truncating to EVT then // extended to VT. if (Opc == ISD::SIGN_EXTEND_INREG) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Aug 14 15:04:46 2008 @@ -201,6 +201,7 @@ SDValue EmitStackConvert(SDValue SrcOp, MVT SlotVT, MVT DestVT); SDValue ExpandBUILD_VECTOR(SDNode *Node); SDValue ExpandSCALAR_TO_VECTOR(SDNode *Node); + SDValue LegalizeINT_TO_FP(SDValue Result, bool isSigned, MVT DestTy, SDValue Op); SDValue ExpandLegalINT_TO_FP(bool isSigned, SDValue LegalOp, MVT DestVT); SDValue PromoteLegalINT_TO_FP(SDValue LegalOp, MVT DestVT, bool isSigned); SDValue PromoteLegalFP_TO_INT(SDValue LegalOp, MVT DestVT, bool isSigned); @@ -3623,51 +3624,8 @@ case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: { bool isSigned = Node->getOpcode() == ISD::SINT_TO_FP; - switch (getTypeAction(Node->getOperand(0).getValueType())) { - case Legal: - switch (TLI.getOperationAction(Node->getOpcode(), - Node->getOperand(0).getValueType())) { - default: assert(0 && "Unknown operation action!"); - case TargetLowering::Custom: - isCustom = true; - // FALLTHROUGH - case TargetLowering::Legal: - Tmp1 = LegalizeOp(Node->getOperand(0)); - Result = DAG.UpdateNodeOperands(Result, Tmp1); - if (isCustom) { - Tmp1 = TLI.LowerOperation(Result, DAG); - if (Tmp1.Val) Result = Tmp1; - } - break; - case TargetLowering::Expand: - Result = ExpandLegalINT_TO_FP(isSigned, - LegalizeOp(Node->getOperand(0)), - Node->getValueType(0)); - break; - case TargetLowering::Promote: - Result = PromoteLegalINT_TO_FP(LegalizeOp(Node->getOperand(0)), - Node->getValueType(0), - isSigned); - break; - } - break; - case Expand: - Result = ExpandIntToFP(Node->getOpcode() == ISD::SINT_TO_FP, - Node->getValueType(0), Node->getOperand(0)); - break; - case Promote: - Tmp1 = PromoteOp(Node->getOperand(0)); - if (isSigned) { - Tmp1 = DAG.getNode(ISD::SIGN_EXTEND_INREG, Tmp1.getValueType(), - Tmp1, DAG.getValueType(Node->getOperand(0).getValueType())); - } else { - Tmp1 = DAG.getZeroExtendInReg(Tmp1, - Node->getOperand(0).getValueType()); - } - Result = DAG.UpdateNodeOperands(Result, Tmp1); - Result = LegalizeOp(Result); // The 'op' is not necessarily legal! - break; - } + Result = LegalizeINT_TO_FP(Result, isSigned, + Node->getValueType(0), Node->getOperand(0)); break; } case ISD::TRUNCATE: @@ -5250,6 +5208,62 @@ return Result; } +/// LegalizeINT_TO_FP - Legalize a [US]INT_TO_FP operation. +/// +SDValue SelectionDAGLegalize:: +LegalizeINT_TO_FP(SDValue Result, bool isSigned, MVT DestTy, SDValue Op) { + bool isCustom = false; + SDValue Tmp1; + switch (getTypeAction(Op.getValueType())) { + case Legal: + switch (TLI.getOperationAction(isSigned ? ISD::SINT_TO_FP : ISD::UINT_TO_FP, + Op.getValueType())) { + default: assert(0 && "Unknown operation action!"); + case TargetLowering::Custom: + isCustom = true; + // FALLTHROUGH + case TargetLowering::Legal: + Tmp1 = LegalizeOp(Op); + if (Result.Val) + Result = DAG.UpdateNodeOperands(Result, Tmp1); + else + Result = DAG.getNode(isSigned ? ISD::SINT_TO_FP : ISD::UINT_TO_FP, + DestTy, Tmp1); + if (isCustom) { + Tmp1 = TLI.LowerOperation(Result, DAG); + if (Tmp1.Val) Result = Tmp1; + } + break; + case TargetLowering::Expand: + Result = ExpandLegalINT_TO_FP(isSigned, LegalizeOp(Op), DestTy); + break; + case TargetLowering::Promote: + Result = PromoteLegalINT_TO_FP(LegalizeOp(Op), DestTy, isSigned); + break; + } + break; + case Expand: + Result = ExpandIntToFP(isSigned, DestTy, Op); + break; + case Promote: + Tmp1 = PromoteOp(Op); + if (isSigned) { + Tmp1 = DAG.getNode(ISD::SIGN_EXTEND_INREG, Tmp1.getValueType(), + Tmp1, DAG.getValueType(Op.getValueType())); + } else { + Tmp1 = DAG.getZeroExtendInReg(Tmp1, + Op.getValueType()); + } + if (Result.Val) + Result = DAG.UpdateNodeOperands(Result, Tmp1); + else + Result = DAG.getNode(isSigned ? ISD::SINT_TO_FP : ISD::UINT_TO_FP, + DestTy, Tmp1); + Result = LegalizeOp(Result); // The 'op' is not necessarily legal! + break; + } + return Result; +} /// ExpandIntToFP - Expand a [US]INT_TO_FP operation. /// @@ -5258,6 +5272,26 @@ MVT SourceVT = Source.getValueType(); bool ExpandSource = getTypeAction(SourceVT) == Expand; + // Expand unsupported int-to-fp vector casts by unrolling them. + if (DestTy.isVector()) { + if (!ExpandSource) + return LegalizeOp(UnrollVectorOp(Source)); + MVT DestEltTy = DestTy.getVectorElementType(); + if (DestTy.getVectorNumElements() == 1) { + SDValue Scalar = ScalarizeVectorOp(Source); + SDValue Result = LegalizeINT_TO_FP(SDValue(), isSigned, + DestEltTy, Scalar); + return DAG.getNode(ISD::BUILD_VECTOR, DestTy, Result); + } + SDValue Lo, Hi; + SplitVectorOp(Source, Lo, Hi); + MVT SplitDestTy = MVT::getVectorVT(DestEltTy, + DestTy.getVectorNumElements() / 2); + SDValue LoResult = LegalizeINT_TO_FP(SDValue(), isSigned, SplitDestTy, Lo); + SDValue HiResult = LegalizeINT_TO_FP(SDValue(), isSigned, SplitDestTy, Hi); + return LegalizeOp(DAG.getNode(ISD::CONCAT_VECTORS, DestTy, LoResult, HiResult)); + } + // Special case for i32 source to take advantage of UINTTOFP_I32_F32, etc. if (!isSigned && SourceVT != MVT::i32) { // The integer value loaded will be incorrectly if the 'sign bit' of the @@ -5863,12 +5897,13 @@ SDValue Ch = LD->getChain(); // Legalize the chain. SDValue Ptr = LD->getBasePtr(); // Legalize the pointer. ISD::LoadExtType ExtType = LD->getExtensionType(); + const Value *SV = LD->getSrcValue(); int SVOffset = LD->getSrcValueOffset(); unsigned Alignment = LD->getAlignment(); bool isVolatile = LD->isVolatile(); if (ExtType == ISD::NON_EXTLOAD) { - Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), SVOffset, + Lo = DAG.getLoad(NVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); if (VT == MVT::f32 || VT == MVT::f64) { // f32->i32 or f64->i64 one to one expansion. @@ -5886,7 +5921,7 @@ DAG.getIntPtrConstant(IncrementSize)); SVOffset += IncrementSize; Alignment = MinAlign(Alignment, IncrementSize); - Hi = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), SVOffset, + Hi = DAG.getLoad(NVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); // Build a factor node to remember that this load is independent of the @@ -5904,7 +5939,7 @@ if ((VT == MVT::f64 && EVT == MVT::f32) || (VT == MVT::ppcf128 && (EVT==MVT::f64 || EVT==MVT::f32))) { // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND - SDValue Load = DAG.getLoad(EVT, Ch, Ptr, LD->getSrcValue(), + SDValue Load = DAG.getLoad(EVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); // Remember that we legalized the chain. AddLegalizedOperand(SDValue(Node, 1), LegalizeOp(Load.getValue(1))); @@ -5913,10 +5948,10 @@ } if (EVT == NVT) - Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), + Lo = DAG.getLoad(NVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); else - Lo = DAG.getExtLoad(ExtType, NVT, Ch, Ptr, LD->getSrcValue(), + Lo = DAG.getExtLoad(ExtType, NVT, Ch, Ptr, SV, SVOffset, EVT, isVolatile, Alignment); @@ -6817,6 +6852,7 @@ Hi = DAG.getNode(Node->getOpcode(), NewVT_Hi, LH, RH); break; } + case ISD::FP_ROUND: case ISD::FPOWI: { SDValue L, H; SplitVectorOp(Node->getOperand(0), L, H); @@ -6836,7 +6872,12 @@ case ISD::FP_TO_SINT: case ISD::FP_TO_UINT: case ISD::SINT_TO_FP: - case ISD::UINT_TO_FP: { + case ISD::UINT_TO_FP: + case ISD::TRUNCATE: + case ISD::ANY_EXTEND: + case ISD::SIGN_EXTEND: + case ISD::ZERO_EXTEND: + case ISD::FP_EXTEND: { SDValue L, H; SplitVectorOp(Node->getOperand(0), L, H); @@ -6848,18 +6889,31 @@ LoadSDNode *LD = cast(Node); SDValue Ch = LD->getChain(); SDValue Ptr = LD->getBasePtr(); + ISD::LoadExtType ExtType = LD->getExtensionType(); const Value *SV = LD->getSrcValue(); int SVOffset = LD->getSrcValueOffset(); + MVT MemoryVT = LD->getMemoryVT(); unsigned Alignment = LD->getAlignment(); bool isVolatile = LD->isVolatile(); - Lo = DAG.getLoad(NewVT_Lo, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); - unsigned IncrementSize = NewNumElts_Lo * NewEltVT.getSizeInBits()/8; + assert(LD->isUnindexed() && "Indexed vector loads are not supported yet!"); + SDValue Offset = DAG.getNode(ISD::UNDEF, Ptr.getValueType()); + + MVT MemNewEltVT = MemoryVT.getVectorElementType(); + MVT MemNewVT_Lo = MVT::getVectorVT(MemNewEltVT, NewNumElts_Lo); + MVT MemNewVT_Hi = MVT::getVectorVT(MemNewEltVT, NewNumElts_Hi); + + Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, + NewVT_Lo, Ch, Ptr, Offset, + SV, SVOffset, MemNewVT_Lo, isVolatile, Alignment); + unsigned IncrementSize = NewNumElts_Lo * MemNewEltVT.getSizeInBits()/8; Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); SVOffset += IncrementSize; Alignment = MinAlign(Alignment, IncrementSize); - Hi = DAG.getLoad(NewVT_Hi, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); + Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, + NewVT_Hi, Ch, Ptr, Offset, + SV, SVOffset, MemNewVT_Hi, isVolatile, Alignment); // Build a factor node to remember that this load is independent of the // other one. @@ -6951,11 +7005,21 @@ case ISD::FSQRT: case ISD::FSIN: case ISD::FCOS: + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: + case ISD::SIGN_EXTEND: + case ISD::ZERO_EXTEND: + case ISD::ANY_EXTEND: + case ISD::TRUNCATE: + case ISD::FP_EXTEND: Result = DAG.getNode(Node->getOpcode(), NewVT, ScalarizeVectorOp(Node->getOperand(0))); break; case ISD::FPOWI: + case ISD::FP_ROUND: Result = DAG.getNode(Node->getOpcode(), NewVT, ScalarizeVectorOp(Node->getOperand(0)), @@ -6965,11 +7029,20 @@ LoadSDNode *LD = cast(Node); SDValue Ch = LegalizeOp(LD->getChain()); // Legalize the chain. SDValue Ptr = LegalizeOp(LD->getBasePtr()); // Legalize the pointer. - + ISD::LoadExtType ExtType = LD->getExtensionType(); const Value *SV = LD->getSrcValue(); int SVOffset = LD->getSrcValueOffset(); - Result = DAG.getLoad(NewVT, Ch, Ptr, SV, SVOffset, - LD->isVolatile(), LD->getAlignment()); + MVT MemoryVT = LD->getMemoryVT(); + unsigned Alignment = LD->getAlignment(); + bool isVolatile = LD->isVolatile(); + + assert(LD->isUnindexed() && "Indexed vector loads are not supported yet!"); + SDValue Offset = DAG.getNode(ISD::UNDEF, Ptr.getValueType()); + + Result = DAG.getLoad(ISD::UNINDEXED, ExtType, + NewVT, Ch, Ptr, Offset, SV, SVOffset, + MemoryVT.getVectorElementType(), + isVolatile, Alignment); // Remember that we legalized the chain. AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1))); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Aug 14 15:04:46 2008 @@ -115,11 +115,16 @@ } SDValue DAGTypeLegalizer::ScalarizeVecRes_LOAD(LoadSDNode *N) { - assert(ISD::isNormalLoad(N) && "Extending load of one-element vector?"); - SDValue Result = DAG.getLoad(N->getValueType(0).getVectorElementType(), - N->getChain(), N->getBasePtr(), - N->getSrcValue(), N->getSrcValueOffset(), - N->isVolatile(), N->getAlignment()); + assert(N->isUnindexed() && "Indexed vector load?"); + + SDValue Result = DAG.getLoad(ISD::UNINDEXED, N->getExtensionType(), + N->getValueType(0).getVectorElementType(), + N->getChain(), N->getBasePtr(), + DAG.getNode(ISD::UNDEF, + N->getBasePtr().getValueType()), + N->getSrcValue(), N->getSrcValueOffset(), + N->getMemoryVT().getVectorElementType(), + N->isVolatile(), N->getAlignment()); // Legalized the chain result - switch anything that used the old chain to // use the new one. @@ -232,8 +237,17 @@ /// ScalarizeVecOp_STORE - If the value to store is a vector that needs to be /// scalarized, it must be <1 x ty>. Just store the element. SDValue DAGTypeLegalizer::ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo){ - assert(ISD::isNormalStore(N) && "Truncating store of one-element vector?"); + assert(N->isUnindexed() && "Indexed store of one-element vector?"); assert(OpNo == 1 && "Do not know how to scalarize this operand!"); + + if (N->isTruncatingStore()) + return DAG.getTruncStore(N->getChain(), + GetScalarizedVector(N->getOperand(1)), + N->getBasePtr(), + N->getSrcValue(), N->getSrcValueOffset(), + N->getMemoryVT().getVectorElementType(), + N->isVolatile(), N->getAlignment()); + return DAG.getStore(N->getChain(), GetScalarizedVector(N->getOperand(1)), N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(), N->isVolatile(), N->getAlignment()); @@ -460,33 +474,34 @@ MVT LoVT, HiVT; GetSplitDestVTs(LD->getValueType(0), LoVT, HiVT); + ISD::LoadExtType ExtType = LD->getExtensionType(); SDValue Ch = LD->getChain(); SDValue Ptr = LD->getBasePtr(); + SDValue Offset = DAG.getNode(ISD::UNDEF, Ptr.getValueType()); const Value *SV = LD->getSrcValue(); int SVOffset = LD->getSrcValueOffset(); + MVT MemoryVT = LD->getMemoryVT(); unsigned Alignment = LD->getAlignment(); bool isVolatile = LD->isVolatile(); - Lo = DAG.getLoad(LoVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); + MVT LoMemVT, HiMemVT; + GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT); - if (LD->getExtensionType() == ISD::NON_EXTLOAD) { - unsigned IncrementSize = LoVT.getSizeInBits()/8; - Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, - DAG.getIntPtrConstant(IncrementSize)); - SVOffset += IncrementSize; - Alignment = MinAlign(Alignment, IncrementSize); - Hi = DAG.getLoad(HiVT, Ch, Ptr, SV, SVOffset, isVolatile, Alignment); - - // Build a factor node to remember that this load is independent of the - // other one. - Ch = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo.getValue(1), - Hi.getValue(1)); - } else { - assert(LD->getExtensionType() == ISD::EXTLOAD && - "Unsupported vector extending load!"); - Hi = DAG.getNode(ISD::UNDEF, HiVT); - Ch = Lo.getValue(1); - } + Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, LoVT, Ch, Ptr, Offset, + SV, SVOffset, LoMemVT, isVolatile, Alignment); + + unsigned IncrementSize = LoMemVT.getSizeInBits()/8; + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + DAG.getIntPtrConstant(IncrementSize)); + SVOffset += IncrementSize; + Alignment = MinAlign(Alignment, IncrementSize); + Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, HiVT, Ch, Ptr, Offset, + SV, SVOffset, HiMemVT, isVolatile, Alignment); + + // Build a factor node to remember that this load is independent of the + // other one. + Ch = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo.getValue(1), + Hi.getValue(1)); // Legalized the chain result - switch anything that used the old chain to // use the new one. @@ -679,27 +694,44 @@ } SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) { - assert(ISD::isNormalStore(N) && "Truncating store of vector?"); + assert(N->isUnindexed() && "Indexed store of vector?"); assert(OpNo == 1 && "Can only split the stored value"); + bool isTruncating = N->isTruncatingStore(); SDValue Ch = N->getChain(); SDValue Ptr = N->getBasePtr(); int SVOffset = N->getSrcValueOffset(); + MVT MemoryVT = N->getMemoryVT(); unsigned Alignment = N->getAlignment(); bool isVol = N->isVolatile(); SDValue Lo, Hi; GetSplitVector(N->getOperand(1), Lo, Hi); - unsigned IncrementSize = Lo.getValueType().getSizeInBits()/8; + MVT LoMemVT, HiMemVT; + GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT); - Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, isVol, Alignment); + unsigned IncrementSize = LoMemVT.getSizeInBits()/8; + + if (isTruncating) + Lo = DAG.getTruncStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, + LoMemVT, isVol, Alignment); + else + Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, + isVol, Alignment); // Increment the pointer to the other half. Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); - Hi = DAG.getStore(Ch, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, - isVol, MinAlign(Alignment, IncrementSize)); + if (isTruncating) + Hi = DAG.getTruncStore(Ch, Hi, Ptr, + N->getSrcValue(), SVOffset+IncrementSize, + HiMemVT, + isVol, MinAlign(Alignment, IncrementSize)); + else + Hi = DAG.getStore(Ch, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, + isVol, MinAlign(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Aug 14 15:04:46 2008 @@ -2067,7 +2067,8 @@ unsigned OpOpcode = Operand.Val->getOpcode(); switch (Opcode) { case ISD::TokenFactor: - return Operand; // Factor of one node? No need. + case ISD::CONCAT_VECTORS: + return Operand; // Factor or concat of one node? No need. case ISD::FP_ROUND: assert(0 && "Invalid method to make FP_ROUND node"); case ISD::FP_EXTEND: assert(VT.isFloatingPoint() && @@ -2196,6 +2197,16 @@ if (N1.getOpcode() == ISD::EntryToken) return N2; if (N2.getOpcode() == ISD::EntryToken) return N1; break; + case ISD::CONCAT_VECTORS: + // A CONCAT_VECTOR with all operands BUILD_VECTOR can be simplified to + // one big BUILD_VECTOR. + if (N1.getOpcode() == ISD::BUILD_VECTOR && + N2.getOpcode() == ISD::BUILD_VECTOR) { + SmallVector Elts(N1.Val->op_begin(), N1.Val->op_end()); + Elts.insert(Elts.end(), N2.Val->op_begin(), N2.Val->op_end()); + return getNode(ISD::BUILD_VECTOR, VT, &Elts[0], Elts.size()); + } + break; case ISD::AND: assert(VT.isInteger() && N1.getValueType() == N2.getValueType() && N1.getValueType() == VT && "Binary operator types must match!"); @@ -2541,6 +2552,18 @@ ConstantSDNode *N1C = dyn_cast(N1.Val); ConstantSDNode *N2C = dyn_cast(N2.Val); switch (Opcode) { + case ISD::CONCAT_VECTORS: + // A CONCAT_VECTOR with all operands BUILD_VECTOR can be simplified to + // one big BUILD_VECTOR. + if (N1.getOpcode() == ISD::BUILD_VECTOR && + N2.getOpcode() == ISD::BUILD_VECTOR && + N3.getOpcode() == ISD::BUILD_VECTOR) { + SmallVector Elts(N1.Val->op_begin(), N1.Val->op_end()); + Elts.insert(Elts.end(), N2.Val->op_begin(), N2.Val->op_end()); + Elts.insert(Elts.end(), N3.Val->op_begin(), N3.Val->op_end()); + return getNode(ISD::BUILD_VECTOR, VT, &Elts[0], Elts.size()); + } + break; case ISD::SETCC: { // Use FoldSetCC to simplify SETCC's. SDValue Simp = FoldSetCC(VT, N1, N2, cast(N3)->get()); @@ -3179,7 +3202,8 @@ } else { // Extending load. if (VT.isVector()) - assert(EVT == VT.getVectorElementType() && "Invalid vector extload!"); + assert(EVT.getVectorNumElements() == VT.getVectorNumElements() && + "Invalid vector extload!"); else assert(EVT.bitsLT(VT) && "Should only be an extending load, not truncating!"); Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Aug 14 15:04:46 2008 @@ -2251,37 +2251,42 @@ switch (op) { default: return false; // This is an input error case Instruction::Trunc: - return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize > DstBitSize; + return SrcTy->isIntOrIntVector() && + DstTy->isIntOrIntVector()&& SrcBitSize > DstBitSize; case Instruction::ZExt: - return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize < DstBitSize; + return SrcTy->isIntOrIntVector() && + DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize; case Instruction::SExt: - return SrcTy->isInteger() && DstTy->isInteger()&& SrcBitSize < DstBitSize; + return SrcTy->isIntOrIntVector() && + DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize; case Instruction::FPTrunc: - return SrcTy->isFloatingPoint() && DstTy->isFloatingPoint() && - SrcBitSize > DstBitSize; + return SrcTy->isFPOrFPVector() && + DstTy->isFPOrFPVector() && + SrcBitSize > DstBitSize; case Instruction::FPExt: - return SrcTy->isFloatingPoint() && DstTy->isFloatingPoint() && - SrcBitSize < DstBitSize; + return SrcTy->isFPOrFPVector() && + DstTy->isFPOrFPVector() && + SrcBitSize < DstBitSize; case Instruction::UIToFP: case Instruction::SIToFP: if (const VectorType *SVTy = dyn_cast(SrcTy)) { if (const VectorType *DVTy = dyn_cast(DstTy)) { - return SVTy->getElementType()->isInteger() && - DVTy->getElementType()->isFloatingPoint() && + return SVTy->getElementType()->isIntOrIntVector() && + DVTy->getElementType()->isFPOrFPVector() && SVTy->getNumElements() == DVTy->getNumElements(); } } - return SrcTy->isInteger() && DstTy->isFloatingPoint(); + return SrcTy->isIntOrIntVector() && DstTy->isFPOrFPVector(); case Instruction::FPToUI: case Instruction::FPToSI: if (const VectorType *SVTy = dyn_cast(SrcTy)) { if (const VectorType *DVTy = dyn_cast(DstTy)) { - return SVTy->getElementType()->isFloatingPoint() && - DVTy->getElementType()->isInteger() && + return SVTy->getElementType()->isFPOrFPVector() && + DVTy->getElementType()->isIntOrIntVector() && SVTy->getNumElements() == DVTy->getNumElements(); } } - return SrcTy->isFloatingPoint() && DstTy->isInteger(); + return SrcTy->isFPOrFPVector() && DstTy->isIntOrIntVector(); case Instruction::PtrToInt: return isa(SrcTy) && DstTy->isInteger(); case Instruction::IntToPtr: Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=54784&r1=54783&r2=54784&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Aug 14 15:04:46 2008 @@ -665,8 +665,8 @@ unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); - Assert1(SrcTy->isInteger(), "Trunc only operates on integer", &I); - Assert1(DestTy->isInteger(), "Trunc only produces integer", &I); + Assert1(SrcTy->isIntOrIntVector(), "Trunc only operates on integer", &I); + Assert1(DestTy->isIntOrIntVector(), "Trunc only produces integer", &I); Assert1(SrcBitSize > DestBitSize,"DestTy too big for Trunc", &I); visitInstruction(I); @@ -678,8 +678,8 @@ const Type *DestTy = I.getType(); // Get the size of the types in bits, we'll need this later - Assert1(SrcTy->isInteger(), "ZExt only operates on integer", &I); - Assert1(DestTy->isInteger(), "ZExt only produces an integer", &I); + Assert1(SrcTy->isIntOrIntVector(), "ZExt only operates on integer", &I); + Assert1(DestTy->isIntOrIntVector(), "ZExt only produces an integer", &I); unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); @@ -697,8 +697,8 @@ unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); - Assert1(SrcTy->isInteger(), "SExt only operates on integer", &I); - Assert1(DestTy->isInteger(), "SExt only produces an integer", &I); + Assert1(SrcTy->isIntOrIntVector(), "SExt only operates on integer", &I); + Assert1(DestTy->isIntOrIntVector(), "SExt only produces an integer", &I); Assert1(SrcBitSize < DestBitSize,"Type too small for SExt", &I); visitInstruction(I); @@ -712,8 +712,8 @@ unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); - Assert1(SrcTy->isFloatingPoint(),"FPTrunc only operates on FP", &I); - Assert1(DestTy->isFloatingPoint(),"FPTrunc only produces an FP", &I); + Assert1(SrcTy->isFPOrFPVector(),"FPTrunc only operates on FP", &I); + Assert1(DestTy->isFPOrFPVector(),"FPTrunc only produces an FP", &I); Assert1(SrcBitSize > DestBitSize,"DestTy too big for FPTrunc", &I); visitInstruction(I); @@ -728,8 +728,8 @@ unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); - Assert1(SrcTy->isFloatingPoint(),"FPExt only operates on FP", &I); - Assert1(DestTy->isFloatingPoint(),"FPExt only produces an FP", &I); + Assert1(SrcTy->isFPOrFPVector(),"FPExt only operates on FP", &I); + Assert1(DestTy->isFPOrFPVector(),"FPExt only produces an FP", &I); Assert1(SrcBitSize < DestBitSize,"DestTy too small for FPExt", &I); visitInstruction(I); Added: llvm/trunk/test/CodeGen/Generic/vector-casts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/vector-casts.ll?rev=54784&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/Generic/vector-casts.ll (added) +++ llvm/trunk/test/CodeGen/Generic/vector-casts.ll Thu Aug 14 15:04:46 2008 @@ -0,0 +1,45 @@ +; RUN: llvm-as < %s | llc +; PR2671 + +define void @a(<2 x double>* %p, <2 x i8>* %q) { + %t = load <2 x double>* %p + %r = fptosi <2 x double> %t to <2 x i8> + store <2 x i8> %r, <2 x i8>* %q + ret void +} +define void @b(<2 x double>* %p, <2 x i8>* %q) { + %t = load <2 x double>* %p + %r = fptoui <2 x double> %t to <2 x i8> + store <2 x i8> %r, <2 x i8>* %q + ret void +} +define void @c(<2 x i8>* %p, <2 x double>* %q) { + %t = load <2 x i8>* %p + %r = sitofp <2 x i8> %t to <2 x double> + store <2 x double> %r, <2 x double>* %q + ret void +} +define void @d(<2 x i8>* %p, <2 x double>* %q) { + %t = load <2 x i8>* %p + %r = uitofp <2 x i8> %t to <2 x double> + store <2 x double> %r, <2 x double>* %q + ret void +} +define void @e(<2 x i8>* %p, <2 x i16>* %q) { + %t = load <2 x i8>* %p + %r = sext <2 x i8> %t to <2 x i16> + store <2 x i16> %r, <2 x i16>* %q + ret void +} +define void @f(<2 x i8>* %p, <2 x i16>* %q) { + %t = load <2 x i8>* %p + %r = zext <2 x i8> %t to <2 x i16> + store <2 x i16> %r, <2 x i16>* %q + ret void +} +define void @g(<2 x i16>* %p, <2 x i8>* %q) { + %t = load <2 x i16>* %p + %r = trunc <2 x i16> %t to <2 x i8> + store <2 x i8> %r, <2 x i8>* %q + ret void +} From resistor at mac.com Thu Aug 14 15:40:13 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 20:40:13 -0000 Subject: [llvm-commits] [llvm] r54785 - /llvm/trunk/lib/VMCore/LeakDetector.cpp Message-ID: <200808142040.m7EKeD1B011583@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 15:40:10 2008 New Revision: 54785 URL: http://llvm.org/viewvc/llvm-project?rev=54785&view=rev Log: Have LeakDetector use a SmallPtrSet instead of an std::set. Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp Modified: llvm/trunk/lib/VMCore/LeakDetector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LeakDetector.cpp?rev=54785&r1=54784&r2=54785&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/LeakDetector.cpp (original) +++ llvm/trunk/lib/VMCore/LeakDetector.cpp Thu Aug 14 15:40:10 2008 @@ -12,10 +12,10 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/LeakDetector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" #include "llvm/Value.h" -#include using namespace llvm; namespace { @@ -60,7 +60,7 @@ if (!Ts.empty()) { cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; - for (typename std::set::iterator I = Ts.begin(), + for (typename SmallPtrSet::iterator I = Ts.begin(), E = Ts.end(); I != E; ++I) { cerr << "\t"; PrinterTrait::print(*I); @@ -74,7 +74,7 @@ } private: - std::set Ts; + SmallPtrSet Ts; const T* Cache; const char* const Name; }; From gohman at apple.com Thu Aug 14 15:58:21 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 13:58:21 -0700 Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue In-Reply-To: <806411.54424.qm@web54603.mail.re2.yahoo.com> References: <806411.54424.qm@web54603.mail.re2.yahoo.com> Message-ID: <1218747501.6404.6.camel@dgohman1> Hi Daniel, It's not necessary to make the existing eraseFromParent and friends virtual; that's only needed if there will be subclasses of Function and and friends, which we don't really need. Just having the pure virtual declarations in GlobalValue should be sufficient to do what you want here. Dan On Wed, 2008-08-13 at 15:02 -0700, Daniel Dunbar wrote: > The attached patch adds (pure virtual) eraseFromParent,releaseFromParent methods > to GlobalValue. > > - Daniel > _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Thu Aug 14 15:58:31 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 14 Aug 2008 20:58:31 -0000 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: <200808142058.m7EKwVvB012218@zion.cs.uiuc.edu> Author: dpatel Date: Thu Aug 14 15:58:31 2008 New Revision: 54786 URL: http://llvm.org/viewvc/llvm-project?rev=54786&view=rev Log: If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation. Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54786&r1=54785&r2=54786&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Aug 14 15:58:31 2008 @@ -45,6 +45,7 @@ STATISTIC(NumInserted, "Number of PHIs inserted"); STATISTIC(NumVariable, "Number of PHIs with variable strides"); STATISTIC(NumEliminated , "Number of strides eliminated"); +STATISTIC(NumShadow , "Number of Shdow IVs optimized"); namespace { @@ -177,6 +178,10 @@ IVStrideUse* &CondUse, const SCEVHandle* &CondStride); void OptimizeIndvars(Loop *L); + + /// OptimizeShadowIV - If IV is used in a int-to-float cast + /// inside the loop then try to eliminate the cast opeation. + void OptimizeShadowIV(Loop *L); bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, const SCEVHandle *&CondStride); bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); @@ -1689,12 +1694,108 @@ return Cond; } +/// OptimizeShadowIV - If IV is used in a int-to-float cast +/// inside the loop then try to eliminate the cast opeation. +void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { + + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; + ++Stride) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[Stride]); + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); + + for (std::vector::iterator UI = SI->second.Users.begin(), + E = SI->second.Users.end(); UI != E; /* empty */) { + std::vector::iterator CandidateUI = UI; + UI++; + Instruction *ShadowUse = CandidateUI->User; + const Type *DestTy = NULL; + + /* If shadow use is a int->float cast then insert a second IV + to elminate this cast. + + for (unsigned i = 0; i < n; ++i) + foo((double)i); + + is trnasformed into + + double d = 0.0; + for (unsigned i = 0; i < n; ++i, ++d) + foo(d); + */ + UIToFPInst *UCast = dyn_cast(CandidateUI->User); + if (UCast) + DestTy = UCast->getDestTy(); + else { + SIToFPInst *SCast = dyn_cast(CandidateUI->User); + if (!SCast) continue; + DestTy = SCast->getDestTy(); + } + + PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); + if (!PH) continue; + if (PH->getNumIncomingValues() != 2) continue; + + unsigned Entry, Latch; + if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { + Entry = 0; + Latch = 1; + } else { + Entry = 1; + Latch = 0; + } + + ConstantInt *Init = dyn_cast(PH->getIncomingValue(Entry)); + if (!Init) continue; + ConstantFP *NewInit = ConstantFP::get(DestTy, Init->getZExtValue()); + + BinaryOperator *Incr = + dyn_cast(PH->getIncomingValue(Latch)); + if (!Incr) continue; + if (Incr->getOpcode() != Instruction::Add + && Incr->getOpcode() != Instruction::Sub) + continue; + + /* Initialize new IV, double d = 0.0 in above example. */ + ConstantInt *C = NULL; + if (Incr->getOperand(0) == PH) + C = dyn_cast(Incr->getOperand(1)); + else if (Incr->getOperand(1) == PH) + C = dyn_cast(Incr->getOperand(0)); + else + continue; + + if (!C) continue; + + /* create new icnrement. '++d' in above example. */ + ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); + BinaryOperator *NewIncr = + BinaryOperator::Create(Incr->getOpcode(), + NewInit, CFP, "IV.S.next.", Incr); + + /* Add new PHINode. */ + PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); + NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); + NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); + + /* Remove cast operation */ + ShadowUse->replaceAllUsesWith(NewPH); + ShadowUse->eraseFromParent(); + SI->second.Users.erase(CandidateUI); + NumShadow++; + break; + } + } +} + // OptimizeIndvars - Now that IVUsesByStride is set up with all of the indvar // uses in the loop, look to see if we can eliminate some, in favor of using // common indvars for the different uses. void LoopStrengthReduce::OptimizeIndvars(Loop *L) { // TODO: implement optzns here. + OptimizeShadowIV(L); + // Finally, get the terminating condition for the loop if possible. If we // can, we want to change it to use a post-incremented version of its // induction variable, to allow coalescing the live ranges for the IV into Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54786&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll (added) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Thu Aug 14 15:58:31 2008 @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" + +define void @foobar(i32 %n) nounwind { +entry: + icmp eq i32 %n, 0 ; :0 [#uses=2] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.nph + %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] + tail call void @bar( i32 %i.03 ) nounwind + uitofp i32 %i.03 to double ; :1 [#uses=1] + tail call void @foo( double %1 ) nounwind + %indvar.next = add i32 %i.03, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %umax ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret void +} + +declare void @bar(i32) + +declare void @foo(double) From resistor at mac.com Thu Aug 14 16:01:00 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 21:01:00 -0000 Subject: [llvm-commits] [llvm] r54787 - in /llvm/trunk/lib: CodeGen/UnreachableBlockElim.cpp Target/X86/X86FloatingPoint.cpp Message-ID: <200808142101.m7EL11nS012296@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 16:01:00 2008 New Revision: 54787 URL: http://llvm.org/viewvc/llvm-project?rev=54787&view=rev Log: Remove more uses of std::set. Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=54787&r1=54786&r2=54787&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original) +++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Thu Aug 14 16:01:00 2008 @@ -32,6 +32,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/SmallPtrSet.h" using namespace llvm; namespace { @@ -51,11 +52,11 @@ } bool UnreachableBlockElim::runOnFunction(Function &F) { - std::set Reachable; + SmallPtrSet Reachable; // Mark all reachable blocks. - for (df_ext_iterator I = df_ext_begin(&F, Reachable), - E = df_ext_end(&F, Reachable); I != E; ++I) + for (df_ext_iterator > I = + df_ext_begin(&F, Reachable), E = df_ext_end(&F, Reachable); I != E; ++I) /* Mark all reachable blocks */; // Loop over all dead blocks, remembering them and deleting all instructions @@ -101,11 +102,12 @@ const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y; bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { - std::set Reachable; + SmallPtrSet Reachable; // Mark all reachable blocks. - for (df_ext_iterator I = df_ext_begin(&F, Reachable), - E = df_ext_end(&F, Reachable); I != E; ++I) + for (df_ext_iterator > + I = df_ext_begin(&F, Reachable), E = df_ext_end(&F, Reachable); + I != E; ++I) /* Mark all reachable blocks */; // Loop over all dead blocks, remembering them and deleting all instructions Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=54787&r1=54786&r2=54787&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Thu Aug 14 16:01:00 2008 @@ -40,11 +40,11 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" #include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include -#include using namespace llvm; STATISTIC(NumFXCH, "Number of fxch instructions inserted"); @@ -192,11 +192,11 @@ // Process the function in depth first order so that we process at least one // of the predecessors for every reachable block in the function. - std::set Processed; + SmallPtrSet Processed; MachineBasicBlock *Entry = MF.begin(); bool Changed = false; - for (df_ext_iterator > + for (df_ext_iterator > I = df_ext_begin(Entry, Processed), E = df_ext_end(Entry, Processed); I != E; ++I) Changed |= processBasicBlock(MF, **I); From clattner at apple.com Thu Aug 14 16:05:46 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 14 Aug 2008 14:05:46 -0700 Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue In-Reply-To: <806411.54424.qm@web54603.mail.re2.yahoo.com> References: <806411.54424.qm@web54603.mail.re2.yahoo.com> Message-ID: <73DC4F4D-A520-48AF-94ED-D9554F86E52D@apple.com> On Aug 13, 2008, at 3:02 PM, Daniel Dunbar wrote: > The attached patch adds (pure virtual) > eraseFromParent,releaseFromParent methods > to GlobalValue. Hey Daniel, The problem with this patch is that it makes GlobalVariable::eraseFromParent virtual, regardless of whether you put the virtual keyword on it or not. Please follow the pattern used by TerminatorInst::getNumSuccessors() to avoid this. If C++ had a "final method" concept like java, we wouldn't need these hacks. -Chris From kremenek at apple.com Thu Aug 14 16:17:07 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 14 Aug 2008 21:17:07 -0000 Subject: [llvm-commits] [llvm] r54789 - /llvm/trunk/include/llvm/ADT/ImmutableMap.h Message-ID: <200808142117.m7ELH7YE012743@zion.cs.uiuc.edu> Author: kremenek Date: Thu Aug 14 16:17:07 2008 New Revision: 54789 URL: http://llvm.org/viewvc/llvm-project?rev=54789&view=rev Log: Removed redundant ctor. Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h Modified: llvm/trunk/include/llvm/ADT/ImmutableMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableMap.h?rev=54789&r1=54788&r2=54789&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableMap.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableMap.h Thu Aug 14 16:17:07 2008 @@ -76,7 +76,6 @@ /// should use a Factory object to create maps instead of directly /// invoking the constructor, but there are cases where make this /// constructor public is useful. - explicit ImmutableMap(TreeTy* R) : Root(R) {} explicit ImmutableMap(const TreeTy* R) : Root(const_cast(R)) {} class Factory { From daniel at zuster.org Thu Aug 14 16:17:10 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 14 Aug 2008 14:17:10 -0700 (PDT) Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue Message-ID: <760006.33786.qm@web54601.mail.re2.yahoo.com> > The problem with this patch is that it makes > GlobalVariable::eraseFromParent virtual, regardless of whether you put > the virtual keyword on it or not. Yes. However, GlobalValue already uses virtual methods so I didn't think this would be an issue. Will make the change if you want it, but then what is the justification for not using the pattern for the other virtual methods in GlobalValue. I find it hard to believe this is performance critical. - Daniel From kremenek at apple.com Thu Aug 14 16:17:28 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 14 Aug 2008 21:17:28 -0000 Subject: [llvm-commits] [llvm] r54790 - /llvm/tags/checker/checker-77/ Message-ID: <200808142117.m7ELHSnd012769@zion.cs.uiuc.edu> Author: kremenek Date: Thu Aug 14 16:17:28 2008 New Revision: 54790 URL: http://llvm.org/viewvc/llvm-project?rev=54790&view=rev Log: Tagging checker-77. Added: llvm/tags/checker/checker-77/ - copied from r54789, llvm/trunk/ From dpatel at apple.com Thu Aug 14 16:31:10 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 14 Aug 2008 21:31:10 -0000 Subject: [llvm-commits] [llvm] r54792 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200808142131.m7ELVA0g013200@zion.cs.uiuc.edu> Author: dpatel Date: Thu Aug 14 16:31:10 2008 New Revision: 54792 URL: http://llvm.org/viewvc/llvm-project?rev=54792&view=rev Log: Use DenseMap. Patch by Pratik Solanki. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=54792&r1=54791&r2=54792&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Aug 14 16:31:10 2008 @@ -138,7 +138,7 @@ /// class SCCPSolver : public InstVisitor { SmallSet BBExecutable;// The basic blocks that are executable - std::map ValueState; // The state each value is in. + DenseMap ValueState; // The state each value is in. /// GlobalValue - If we are tracking any values for the contents of a global /// variable, we keep a mapping from the constant accessor to the element of @@ -231,7 +231,7 @@ /// getValueMapping - Once we have solved for constants, return the mapping of /// LLVM values to LatticeVals. - std::map &getValueMapping() { + DenseMap &getValueMapping() { return ValueState; } @@ -311,7 +311,7 @@ // Instruction object, then use this accessor to get its value from the map. // inline LatticeVal &getValueState(Value *V) { - std::map::iterator I = ValueState.find(V); + DenseMap::iterator I = ValueState.find(V); if (I != ValueState.end()) return I->second; // Common case, in the map if (Constant *C = dyn_cast(V)) { @@ -1555,7 +1555,7 @@ // SmallSet &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector Insts; - std::map &Values = Solver.getValueMapping(); + DenseMap &Values = Solver.getValueMapping(); for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (!ExecutableBBs.count(BB)) { @@ -1701,7 +1701,7 @@ SmallSet &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector Insts; SmallVector BlocksToErase; - std::map &Values = Solver.getValueMapping(); + DenseMap &Values = Solver.getValueMapping(); for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); From gohman at apple.com Thu Aug 14 16:51:30 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 21:51:30 -0000 Subject: [llvm-commits] [llvm] r54793 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp Message-ID: <200808142151.m7ELpVHF013849@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 16:51:29 2008 New Revision: 54793 URL: http://llvm.org/viewvc/llvm-project?rev=54793&view=rev Log: Make FastISel's constructor protected, and give it a destructor. Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=54793&r1=54792&r2=54793&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/FastISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Thu Aug 14 16:51:29 2008 @@ -34,10 +34,6 @@ const TargetInstrInfo *TII; public: - FastISel(MachineBasicBlock *mbb, MachineFunction *mf, - const TargetInstrInfo *tii) - : MBB(mbb), MF(mf), TII(tii) {} - /// SelectInstructions - Do "fast" instruction selection over the /// LLVM IR instructions in the range [Begin, N) where N is either /// End or the first unsupported instruction. Return N. @@ -48,6 +44,12 @@ DenseMap &ValueMap); protected: + FastISel(MachineBasicBlock *mbb, MachineFunction *mf, + const TargetInstrInfo *tii) + : MBB(mbb), MF(mf), TII(tii) {} + + virtual ~FastISel(); + virtual unsigned FastEmit_(MVT::SimpleValueType VT, ISD::NodeType Opcode); virtual unsigned FastEmit_r(MVT::SimpleValueType VT, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=54793&r1=54792&r2=54793&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Aug 14 16:51:29 2008 @@ -45,6 +45,8 @@ return I; } +FastISel::~FastISel() {} + unsigned FastISel::FastEmit_(MVT::SimpleValueType, ISD::NodeType) { return 0; } From daniel at zuster.org Thu Aug 14 16:59:38 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 14 Aug 2008 14:59:38 -0700 (PDT) Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue (round 2) Message-ID: <909666.32410.qm@web54606.mail.re2.yahoo.com> Now with a little more feeling. The attached patch adds eraseFromParent,releaseFromParent methods to GlobalValue while avoiding the overhead of making those methods virtual on Function, GlobalAlias, and GlobalVariable. - Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: lift-eraseFromParent2.patch Type: application/octet-stream Size: 4476 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080814/44dee461/attachment.obj From kremenek at apple.com Thu Aug 14 17:06:07 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 14 Aug 2008 22:06:07 -0000 Subject: [llvm-commits] [llvm] r54795 - /llvm/tags/checker/checker-77/ Message-ID: <200808142206.m7EM67Li014280@zion.cs.uiuc.edu> Author: kremenek Date: Thu Aug 14 17:06:07 2008 New Revision: 54795 URL: http://llvm.org/viewvc/llvm-project?rev=54795&view=rev Log: Removing checker-77. Removed: llvm/tags/checker/checker-77/ From dalej at apple.com Thu Aug 14 17:06:46 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 14 Aug 2008 22:06:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54797 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200808142206.m7EM6klI014326@zion.cs.uiuc.edu> Author: johannes Date: Thu Aug 14 17:06:46 2008 New Revision: 54797 URL: http://llvm.org/viewvc/llvm-project?rev=54797&view=rev Log: Avoid creating an unused duplicate var_decl for some of the ObjC special symbols; this was making it as far as the .s file in llvm-gcc, a noticeable inefficiency. Patch brought over from Apple's gcc-4.2, and some unneeded LLVM local changes removed. Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=54797&r1=54796&r2=54797&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Aug 14 17:06:46 2008 @@ -364,7 +364,8 @@ }; static tree add_objc_string (tree, enum string_section); -static tree build_objc_string_decl (enum string_section); +/* APPLE LOCAL do not create an unreferenced decl */ +static tree build_objc_string_ident (enum string_section); static void build_selector_table_decl (void); /* Protocol additions. */ @@ -6301,7 +6302,8 @@ static tree add_objc_string (tree ident, enum string_section section) { - tree *chain, decl, type, string_expr; + /* APPLE LOCAL do not create an unreferenced decl */ + tree *chain, decl, type, string_expr, sectionname; hash *hash_table; hash hsh; @@ -6333,28 +6335,20 @@ return convert (string_type_node, build_unary_op (ADDR_EXPR, hsh->list->value, 1)); - decl = build_objc_string_decl (section); + /* APPLE LOCAL do not create an unreferenced decl */ + sectionname = build_objc_string_ident (section); type = build_array_type (char_type_node, build_index_type (build_int_cst (NULL_TREE, IDENTIFIER_LENGTH (ident)))); - decl = start_var_decl (type, IDENTIFIER_POINTER (DECL_NAME (decl))); + /* APPLE LOCAL do not create an unreferenced decl */ + decl = start_var_decl (type, IDENTIFIER_POINTER (sectionname)); string_expr = my_build_string (IDENTIFIER_LENGTH (ident) + 1, IDENTIFIER_POINTER (ident)); finish_var_decl (decl, string_expr); - /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM - /* This decl's name is special, it uses 'L' as a prefix. Ask llvm to not - add leading underscore by setting it as a user supplied asm name. */ - set_user_assembler_name (decl, IDENTIFIER_POINTER (DECL_NAME (decl))); - /* Let optimizer know that this decl is not removable. */ - DECL_PRESERVE_P (decl) = 1; -#endif - /* LLVM LOCAL end */ - hsh = hash_ident_enter (hash_table, ident); hash_add_attr (hsh, decl); *chain = tree_cons (decl, ident, *chain); @@ -6370,9 +6364,11 @@ static GTY(()) int property_name_attr_idx; static tree -build_objc_string_decl (enum string_section section) +/* APPLE LOCAL do not create an unreferenced decl */ +build_objc_string_ident (enum string_section section) { - tree decl, ident; +/* APPLE LOCAL begin do not create an unreferenced decl */ +/* APPLE LOCAL end do not create an unreferenced decl */ char buf[256]; if (section == class_names) @@ -6385,50 +6381,9 @@ else if (section == prop_names_attr) sprintf (buf, "_OBJC_PROP_NAME_ATTR_%d", property_name_attr_idx++); /* APPLE LOCAL end C* property metadata (Radar 4498373) */ - - /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM - { - /* Darwin linker prefers to use 'L' as a prefix. GCC codegen handles this - later while emitting symbols, but fix it here for llvm. */ - /* All these are in cstring, so none use 'l'. */ - char *tbuf = alloca (strlen (buf) + 2); - tbuf[0] = 'L'; - strcpy (tbuf + 1, buf); - ident = get_identifier (tbuf); - } -#else - ident = get_identifier (buf); -#endif - /* LLVM LOCAL end */ - - decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0)); - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 0; - TREE_USED (decl) = 1; - TREE_CONSTANT (decl) = 1; - DECL_CONTEXT (decl) = 0; - DECL_ARTIFICIAL (decl) = 1; -#ifdef OBJCPLUS - DECL_THIS_STATIC (decl) = 1; /* squash redeclaration errors */ -#endif - - /* LLVM LOCAL begin */ -#ifndef ENABLE_LLVM - make_decl_rtl (decl); -#else - /* This decl's name is special, it uses 'L' as a prefix. Ask llvm to not - add leading underscore by setting it as a user supplied asm name. */ - set_user_assembler_name (decl, IDENTIFIER_POINTER (DECL_NAME (decl))); - - /* Let optimizer know that this decl is not removable. */ - DECL_PRESERVE_P (decl) = 1; - make_decl_llvm (decl); -#endif - /* LLVM LOCAL end */ - pushdecl_top_level (decl); - - return decl; + /* APPLE LOCAL begin do not create an unreferenced decl */ + return get_identifier (buf); + /* APPLE LOCAL end do not create an unreferenced decl */ } From kremenek at apple.com Thu Aug 14 17:11:28 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 14 Aug 2008 22:11:28 -0000 Subject: [llvm-commits] [llvm] r54799 - /llvm/tags/checker/checker-77/ Message-ID: <200808142211.m7EMBS5w014485@zion.cs.uiuc.edu> Author: kremenek Date: Thu Aug 14 17:11:28 2008 New Revision: 54799 URL: http://llvm.org/viewvc/llvm-project?rev=54799&view=rev Log: Tagging checker-77. Added: llvm/tags/checker/checker-77/ - copied from r54798, llvm/trunk/ From gohman at apple.com Thu Aug 14 17:43:27 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 22:43:27 -0000 Subject: [llvm-commits] [llvm] r54801 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200808142243.m7EMhRSp015375@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 17:43:26 2008 New Revision: 54801 URL: http://llvm.org/viewvc/llvm-project?rev=54801&view=rev Log: Don't try to use the insertps instruction for vector element inserts with non-constant indices. This fixes CodeGen/X86/vector-variable-idx.ll on machines that have SSE4.1. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=54801&r1=54800&r2=54801&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Aug 14 17:43:26 2008 @@ -4153,7 +4153,7 @@ if (N2.getValueType() != MVT::i32) N2 = DAG.getIntPtrConstant(cast(N2)->getValue()); return DAG.getNode(Opc, VT, N0, N1, N2); - } else if (EVT == MVT::f32) { + } else if (EVT == MVT::f32 && isa(N2)) { // Bits [7:6] of the constant are the source select. This will always be // zero here. The DAG Combiner may combine an extract_elt index into these // bits. For example (insert (extract, 3), 2) could be matched by putting From resistor at mac.com Thu Aug 14 17:49:33 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 22:49:33 -0000 Subject: [llvm-commits] [llvm] r54802 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200808142249.m7EMnYkV015564@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 17:49:33 2008 New Revision: 54802 URL: http://llvm.org/viewvc/llvm-project?rev=54802&view=rev Log: Convert uses of std::vector in TargetInstrInfo to SmallVector. This change had to be propoagated down into all the targets and up into all clients of this API. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/lib/CodeGen/IfConversion.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp llvm/trunk/lib/Target/IA64/IA64InstrInfo.h llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.h llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.h llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -195,7 +195,7 @@ /// virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const { + SmallVectorImpl &Cond) const { return true; } @@ -215,7 +215,7 @@ /// instructions inserted. virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const { + const SmallVectorImpl &Cond) const { assert(0 && "Target didn't implement TargetInstrInfo::InsertBranch!"); return 0; } @@ -342,7 +342,8 @@ /// ReverseBranchCondition - Reverses the branch condition of the specified /// condition list, returning false on success and true if it cannot be /// reversed. - virtual bool ReverseBranchCondition(std::vector &Cond) const { + virtual + bool ReverseBranchCondition(SmallVectorImpl &Cond) const { return true; } @@ -368,13 +369,13 @@ /// instruction. It returns true if the operation was successful. virtual bool PredicateInstruction(MachineInstr *MI, - const std::vector &Pred) const = 0; + const SmallVectorImpl &Pred) const = 0; /// SubsumesPredicate - Returns true if the first specified predicate /// subsumes the second, e.g. GE subsumes GT. virtual - bool SubsumesPredicate(const std::vector &Pred1, - const std::vector &Pred2) const { + bool SubsumesPredicate(const SmallVectorImpl &Pred1, + const SmallVectorImpl &Pred2) const { return false; } @@ -421,7 +422,7 @@ virtual bool CommuteChangesDestination(MachineInstr *MI, unsigned &OpIdx) const; virtual bool PredicateInstruction(MachineInstr *MI, - const std::vector &Pred) const; + const SmallVectorImpl &Pred) const; virtual void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Thu Aug 14 17:49:33 2008 @@ -95,7 +95,7 @@ bool CanFallThrough(MachineBasicBlock *CurBB); bool CanFallThrough(MachineBasicBlock *CurBB, bool BranchUnAnalyzable, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond); + const SmallVectorImpl &Cond); }; char BranchFolder::ID = 0; } @@ -190,7 +190,7 @@ bool EverMadeChange = false; for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; I++) { MachineBasicBlock *MBB = I, *TBB = 0, *FBB = 0; - std::vector Cond; + SmallVector Cond; if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond)) EverMadeChange |= MBB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty()); EverMadeChange |= OptimizeImpDefsBlock(MBB); @@ -364,7 +364,7 @@ // If OldBB isn't immediately before OldBB, insert a branch to it. if (++MachineFunction::iterator(OldBB) != MachineFunction::iterator(NewDest)) - TII->InsertBranch(*OldBB, NewDest, 0, std::vector()); + TII->InsertBranch(*OldBB, NewDest, 0, SmallVector()); OldBB->addSuccessor(NewDest); ++NumTailMerge; } @@ -432,7 +432,7 @@ MachineFunction *MF = CurMBB->getParent(); MachineFunction::iterator I = next(MachineFunction::iterator(CurMBB)); MachineBasicBlock *TBB = 0, *FBB = 0; - std::vector Cond; + SmallVector Cond; if (I != MF->end() && !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond)) { MachineBasicBlock *NextBB = I; @@ -444,7 +444,7 @@ } } } - TII->InsertBranch(*CurMBB, SuccBB, NULL, std::vector()); + TII->InsertBranch(*CurMBB, SuccBB, NULL, SmallVector()); } static bool MergeCompare(const std::pair &p, @@ -710,11 +710,11 @@ if (PBB==IBB) continue; MachineBasicBlock *TBB = 0, *FBB = 0; - std::vector Cond; + SmallVector Cond; if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond)) { // Failing case: IBB is the target of a cbr, and // we cannot reverse the branch. - std::vector NewCond(Cond); + SmallVector NewCond(Cond); if (!Cond.empty() && TBB==IBB) { if (TII->ReverseBranchCondition(NewCond)) continue; @@ -803,7 +803,7 @@ bool BranchUnAnalyzable, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) { + const SmallVectorImpl &Cond) { MachineFunction::iterator Fallthrough = CurBB; ++Fallthrough; // If FallthroughBlock is off the end of the function, it can't fall through. @@ -844,7 +844,7 @@ /// bool BranchFolder::CanFallThrough(MachineBasicBlock *CurBB) { MachineBasicBlock *TBB = 0, *FBB = 0; - std::vector Cond; + SmallVector Cond; bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond); return CanFallThrough(CurBB, CurUnAnalyzable, TBB, FBB, Cond); } @@ -908,7 +908,7 @@ MachineBasicBlock &PrevBB = *prior(MachineFunction::iterator(MBB)); MachineBasicBlock *PriorTBB = 0, *PriorFBB = 0; - std::vector PriorCond; + SmallVector PriorCond; bool PriorUnAnalyzable = TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond); if (!PriorUnAnalyzable) { @@ -952,7 +952,7 @@ // if the branch condition is reversible, reverse the branch to create a // fall-through. if (PriorTBB == MBB) { - std::vector NewPriorCond(PriorCond); + SmallVector NewPriorCond(PriorCond); if (!TII->ReverseBranchCondition(NewPriorCond)) { TII->RemoveBranch(PrevBB); TII->InsertBranch(PrevBB, PriorFBB, 0, NewPriorCond); @@ -1002,7 +1002,7 @@ if (DoTransform) { // Reverse the branch so we will fall through on the previous true cond. - std::vector NewPriorCond(PriorCond); + SmallVector NewPriorCond(PriorCond); if (!TII->ReverseBranchCondition(NewPriorCond)) { DOUT << "\nMoving MBB: " << *MBB; DOUT << "To make fallthrough to: " << *PriorTBB << "\n"; @@ -1022,7 +1022,7 @@ // Analyze the branch in the current block. MachineBasicBlock *CurTBB = 0, *CurFBB = 0; - std::vector CurCond; + SmallVector CurCond; bool CurUnAnalyzable = TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond); if (!CurUnAnalyzable) { // If the CFG for the prior block has extra edges, remove them. @@ -1034,7 +1034,7 @@ // we want: // Loop: xxx; jncc Loop; jmp Out if (CurTBB && CurFBB && CurFBB == MBB && CurTBB != MBB) { - std::vector NewCond(CurCond); + SmallVector NewCond(CurCond); if (!TII->ReverseBranchCondition(NewCond)) { TII->RemoveBranch(*MBB); TII->InsertBranch(*MBB, CurFBB, CurTBB, NewCond); Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/IfConversion.cpp (original) +++ llvm/trunk/lib/CodeGen/IfConversion.cpp Thu Aug 14 17:49:33 2008 @@ -103,8 +103,8 @@ MachineBasicBlock *BB; MachineBasicBlock *TrueBB; MachineBasicBlock *FalseBB; - std::vector BrCond; - std::vector Predicate; + SmallVector BrCond; + SmallVector Predicate; BBInfo() : IsDone(false), IsBeingAnalyzed(false), IsAnalyzed(false), IsEnqueued(false), IsBrAnalyzable(false), HasFallThrough(false), IsUnpredicable(false), @@ -161,7 +161,7 @@ void ScanInstructions(BBInfo &BBI); BBInfo &AnalyzeBlock(MachineBasicBlock *BB, std::vector &Tokens); - bool FeasibilityAnalysis(BBInfo &BBI, std::vector &Cond, + bool FeasibilityAnalysis(BBInfo &BBI, SmallVectorImpl &Cond, bool isTriangle = false, bool RevBranch = false); bool AnalyzeBlocks(MachineFunction &MF, std::vector &Tokens); @@ -173,9 +173,9 @@ unsigned NumDups1, unsigned NumDups2); void PredicateBlock(BBInfo &BBI, MachineBasicBlock::iterator E, - std::vector &Cond); + SmallVectorImpl &Cond); void CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI, - std::vector &Cond, + SmallVectorImpl &Cond, bool IgnoreBr = false); void MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI); @@ -604,7 +604,7 @@ /// FeasibilityAnalysis - Determine if the block is a suitable candidate to be /// predicated by the specified predicate. bool IfConverter::FeasibilityAnalysis(BBInfo &BBI, - std::vector &Pred, + SmallVectorImpl &Pred, bool isTriangle, bool RevBranch) { // If the block is dead or unpredicable, then it cannot be predicated. if (BBI.IsDone || BBI.IsUnpredicable) @@ -620,8 +620,8 @@ return false; // Test predicate subsumsion. - std::vector RevPred(Pred); - std::vector Cond(BBI.BrCond); + SmallVector RevPred(Pred.begin(), Pred.end()); + SmallVector Cond(BBI.BrCond.begin(), BBI.BrCond.end()); if (RevBranch) { if (TII->ReverseBranchCondition(Cond)) return false; @@ -672,7 +672,7 @@ return BBI; } - std::vector RevCond(BBI.BrCond); + SmallVector RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); bool CanRevCond = !TII->ReverseBranchCondition(RevCond); unsigned Dups = 0; @@ -815,7 +815,7 @@ /// static void InsertUncondBranch(MachineBasicBlock *BB, MachineBasicBlock *ToBB, const TargetInstrInfo *TII) { - std::vector NoCond; + SmallVector NoCond; TII->InsertBranch(*BB, ToBB, NULL, NoCond); } @@ -823,7 +823,7 @@ /// successors. void IfConverter::RemoveExtraEdges(BBInfo &BBI) { MachineBasicBlock *TBB = NULL, *FBB = NULL; - std::vector Cond; + SmallVector Cond; if (!TII->AnalyzeBranch(*BBI.BB, TBB, FBB, Cond)) BBI.BB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty()); } @@ -836,7 +836,7 @@ BBInfo *CvtBBI = &TrueBBI; BBInfo *NextBBI = &FalseBBI; - std::vector Cond(BBI.BrCond); + SmallVector Cond(BBI.BrCond.begin(), BBI.BrCond.end()); if (Kind == ICSimpleFalse) std::swap(CvtBBI, NextBBI); @@ -901,7 +901,7 @@ BBInfo *CvtBBI = &TrueBBI; BBInfo *NextBBI = &FalseBBI; - std::vector Cond(BBI.BrCond); + SmallVector Cond(BBI.BrCond.begin(), BBI.BrCond.end()); if (Kind == ICTriangleFalse || Kind == ICTriangleFRev) std::swap(CvtBBI, NextBBI); @@ -954,7 +954,8 @@ // If 'true' block has a 'false' successor, add an exit branch to it. if (HasEarlyExit) { - std::vector RevCond(CvtBBI->BrCond); + SmallVector RevCond(CvtBBI->BrCond.begin(), + CvtBBI->BrCond.end()); if (TII->ReverseBranchCondition(RevCond)) assert(false && "Unable to reverse branch condition!"); TII->InsertBranch(*BBI.BB, CvtBBI->FalseBB, NULL, RevCond); @@ -1026,10 +1027,10 @@ // block would clobber the predicate, in that case, do the opposite. BBInfo *BBI1 = &TrueBBI; BBInfo *BBI2 = &FalseBBI; - std::vector RevCond(BBI.BrCond); + SmallVector RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); TII->ReverseBranchCondition(RevCond); - std::vector *Cond1 = &BBI.BrCond; - std::vector *Cond2 = &RevCond; + SmallVector *Cond1 = &BBI.BrCond; + SmallVector *Cond2 = &RevCond; // Figure out the more profitable ordering. bool DoSwap = false; @@ -1111,7 +1112,7 @@ /// specified end with the specified condition. void IfConverter::PredicateBlock(BBInfo &BBI, MachineBasicBlock::iterator E, - std::vector &Cond) { + SmallVectorImpl &Cond) { for (MachineBasicBlock::iterator I = BBI.BB->begin(); I != E; ++I) { if (TII->isPredicated(I)) continue; @@ -1132,7 +1133,7 @@ /// CopyAndPredicateBlock - Copy and predicate instructions from source BB to /// the destination block. Skip end of block branches if IgnoreBr is true. void IfConverter::CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI, - std::vector &Cond, + SmallVectorImpl &Cond, bool IgnoreBr) { MachineFunction &MF = *ToBBI.BB->getParent(); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Aug 14 17:49:33 2008 @@ -631,7 +631,7 @@ if (MBB == SuccMBB) return true; MachineBasicBlock *TBB = 0, *FBB = 0; - std::vector Cond; + SmallVector Cond; return !tii_->AnalyzeBranch(*MBB, TBB, FBB, Cond) && !TBB && !FBB && MBB->isSuccessor(SuccMBB); } Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Thu Aug 14 17:49:33 2008 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/TargetInstrInfo.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" using namespace llvm; @@ -77,7 +78,7 @@ bool TargetInstrInfoImpl::PredicateInstruction(MachineInstr *MI, - const std::vector &Pred) const { + const SmallVectorImpl &Pred) const { bool MadeChange = false; const TargetInstrDesc &TID = MI->getDesc(); if (!TID.isPredicable()) Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -333,7 +333,7 @@ // Branch analysis. bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const { + SmallVectorImpl &Cond) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) @@ -432,7 +432,7 @@ unsigned ARMInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const { + const SmallVectorImpl &Cond) const { MachineFunction &MF = *MBB.getParent(); ARMFunctionInfo *AFI = MF.getInfo(); int BOpc = AFI->isThumbFunction() ? ARM::tB : ARM::B; @@ -799,7 +799,7 @@ } bool ARMInstrInfo:: -ReverseBranchCondition(std::vector &Cond) const { +ReverseBranchCondition(SmallVectorImpl &Cond) const { ARMCC::CondCodes CC = (ARMCC::CondCodes)(int)Cond[0].getImm(); Cond[0].setImm(ARMCC::getOppositeCondition(CC)); return false; @@ -811,7 +811,7 @@ } bool ARMInstrInfo::PredicateInstruction(MachineInstr *MI, - const std::vector &Pred) const { + const SmallVectorImpl &Pred) const { unsigned Opc = MI->getOpcode(); if (Opc == ARM::B || Opc == ARM::tB) { MI->setDesc(get(Opc == ARM::B ? ARM::Bcc : ARM::tBcc)); @@ -831,8 +831,8 @@ } bool -ARMInstrInfo::SubsumesPredicate(const std::vector &Pred1, - const std::vector &Pred2) const{ +ARMInstrInfo::SubsumesPredicate(const SmallVectorImpl &Pred1, + const SmallVectorImpl &Pred2) const{ if (Pred1.size() > 2 || Pred2.size() > 2) return false; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -158,11 +158,11 @@ // Branch analysis. virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const; + SmallVectorImpl &Cond) const; virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, unsigned SrcReg, @@ -210,18 +210,19 @@ SmallVectorImpl &Ops) const; virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; - virtual bool ReverseBranchCondition(std::vector &Cond) const; + virtual + bool ReverseBranchCondition(SmallVectorImpl &Cond) const; // Predication support. virtual bool isPredicated(const MachineInstr *MI) const; virtual bool PredicateInstruction(MachineInstr *MI, - const std::vector &Pred) const; + const SmallVectorImpl &Pred) const; virtual - bool SubsumesPredicate(const std::vector &Pred1, - const std::vector &Pred2) const; + bool SubsumesPredicate(const SmallVectorImpl &Pred1, + const SmallVectorImpl &Pred2) const; virtual bool DefinesPredicate(MachineInstr *MI, std::vector &Pred) const; Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -100,9 +100,10 @@ } } -unsigned AlphaInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, - MachineBasicBlock *FBB, - const std::vector &Cond)const{ +unsigned AlphaInstrInfo::InsertBranch(MachineBasicBlock &MBB, + MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const SmallVectorImpl &Cond) const { assert(TBB && "InsertBranch must not be told to insert a fallthrough"); assert((Cond.size() == 2 || Cond.size() == 0) && "Alpha branch conditions have two components!"); @@ -315,7 +316,7 @@ // Branch analysis. bool AlphaInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const { + SmallVectorImpl &Cond) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) @@ -418,7 +419,7 @@ } } bool AlphaInstrInfo:: -ReverseBranchCondition(std::vector &Cond) const { +ReverseBranchCondition(SmallVectorImpl &Cond) const { assert(Cond.size() == 2 && "Invalid Alpha branch opcode!"); Cond[0].setImm(AlphaRevCondCode(Cond[0].getImm())); return false; Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -41,7 +41,7 @@ virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SrcReg, @@ -81,12 +81,12 @@ bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const; + SmallVectorImpl &Cond) const; unsigned RemoveBranch(MachineBasicBlock &MBB) const; void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const; bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; - bool ReverseBranchCondition(std::vector &Cond) const; + bool ReverseBranchCondition(SmallVectorImpl &Cond) const; }; } Modified: llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64InstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -50,7 +50,7 @@ unsigned IA64InstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond)const { + const SmallVectorImpl &Cond)const { // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, get(IA64::BRL_NOTCALL)).addMBB(TBB); Modified: llvm/trunk/lib/Target/IA64/IA64InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64InstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64InstrInfo.h (original) +++ llvm/trunk/lib/Target/IA64/IA64InstrInfo.h Thu Aug 14 17:49:33 2008 @@ -39,7 +39,7 @@ unsigned& destReg) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SrcReg, Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -446,7 +446,7 @@ bool MipsInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const + SmallVectorImpl &Cond) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); @@ -528,9 +528,8 @@ unsigned MipsInstrInfo:: InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, - MachineBasicBlock *FBB, const std::vector &Cond) - const -{ + MachineBasicBlock *FBB, + const SmallVectorImpl &Cond) const { // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); assert((Cond.size() == 3 || Cond.size() == 2 || Cond.size() == 0) && @@ -615,7 +614,7 @@ /// ReverseBranchCondition - Return the inverse opcode of the /// specified Branch instruction. bool MipsInstrInfo:: -ReverseBranchCondition(std::vector &Cond) const +ReverseBranchCondition(SmallVectorImpl &Cond) const { assert( (Cond.size() == 3 || Cond.size() == 2) && "Invalid Mips branch condition!"); Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -164,11 +164,11 @@ /// Branch Analysis virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const; + SmallVectorImpl &Cond) const; virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, unsigned SrcReg, @@ -207,7 +207,8 @@ } virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; - virtual bool ReverseBranchCondition(std::vector &Cond) const; + virtual + bool ReverseBranchCondition(SmallVectorImpl &Cond) const; /// Insert nop instruction when hazard condition is found virtual void insertNoop(MachineBasicBlock &MBB, Modified: llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -121,7 +121,7 @@ unsigned PIC16InstrInfo:: InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const + const SmallVectorImpl &Cond) const { // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); Modified: llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16InstrInfo.h Thu Aug 14 17:49:33 2008 @@ -69,7 +69,7 @@ /// instructions inserted. virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const ; + const SmallVectorImpl &Cond) const ; }; Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -210,7 +210,7 @@ // Branch analysis. bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const { + SmallVectorImpl &Cond) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) @@ -292,7 +292,7 @@ unsigned PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const { + const SmallVectorImpl &Cond) const { // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); assert((Cond.size() == 2 || Cond.size() == 0) && @@ -762,7 +762,7 @@ } bool PPCInstrInfo:: -ReverseBranchCondition(std::vector &Cond) const { +ReverseBranchCondition(SmallVectorImpl &Cond) const { assert(Cond.size() == 2 && "Invalid PPC branch opcode!"); // Leave the CR# the same, but invert the condition. Cond[0].setImm(PPC::InvertPredicate((PPC::Predicate)Cond[0].getImm())); Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -107,11 +107,11 @@ // Branch analysis. virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const; + SmallVectorImpl &Cond) const; virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SrcReg, @@ -156,7 +156,8 @@ SmallVectorImpl &Ops) const; virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; - virtual bool ReverseBranchCondition(std::vector &Cond) const; + virtual + bool ReverseBranchCondition(SmallVectorImpl &Cond) const; /// GetInstSize - Return the number of bytes of code the specified /// instruction may be. This returns the maximum number of bytes. Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -102,7 +102,7 @@ unsigned SparcInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond)const{ + const SmallVectorImpl &Cond)const{ // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, get(SP::BA)).addMBB(TBB); Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.h Thu Aug 14 17:49:33 2008 @@ -66,7 +66,7 @@ virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Thu Aug 14 17:49:33 2008 @@ -1456,7 +1456,7 @@ bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const { + SmallVectorImpl &Cond) const { // If the block has no terminators, it just falls into the block after it. MachineBasicBlock::iterator I = MBB.end(); if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this)) @@ -1567,7 +1567,7 @@ unsigned X86InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const { + const SmallVectorImpl &Cond) const { // Shouldn't be a fall through. assert(TBB && "InsertBranch must not be told to insert a fallthrough"); assert((Cond.size() == 1 || Cond.size() == 0) && @@ -2365,7 +2365,7 @@ } bool X86InstrInfo:: -ReverseBranchCondition(std::vector &Cond) const { +ReverseBranchCondition(SmallVectorImpl &Cond) const { assert(Cond.size() == 1 && "Invalid X86 branch condition!"); Cond[0].setImm(GetOppositeBranchCondition((X86::CondCode)Cond[0].getImm())); return false; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=54802&r1=54801&r2=54802&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Aug 14 17:49:33 2008 @@ -306,11 +306,11 @@ virtual bool isUnpredicatedTerminator(const MachineInstr* MI) const; virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, - std::vector &Cond) const; + SmallVectorImpl &Cond) const; virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, - const std::vector &Cond) const; + const SmallVectorImpl &Cond) const; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SrcReg, @@ -385,7 +385,8 @@ bool UnfoldLoad, bool UnfoldStore) const; virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; - virtual bool ReverseBranchCondition(std::vector &Cond) const; + virtual + bool ReverseBranchCondition(SmallVectorImpl &Cond) const; const TargetRegisterClass *getPointerRegClass() const; From gohman at apple.com Thu Aug 14 17:53:18 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 22:53:18 -0000 Subject: [llvm-commits] [llvm] r54803 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200808142253.m7EMrJ3t015675@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 17:53:18 2008 New Revision: 54803 URL: http://llvm.org/viewvc/llvm-project?rev=54803&view=rev Log: Also avoid pinsrw and pinsrb with a variable insertelement index. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=54803&r1=54802&r2=54803&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Aug 14 17:53:18 2008 @@ -4143,7 +4143,8 @@ SDValue N1 = Op.getOperand(1); SDValue N2 = Op.getOperand(2); - if ((EVT.getSizeInBits() == 8) || (EVT.getSizeInBits() == 16)) { + if ((EVT.getSizeInBits() == 8 || EVT.getSizeInBits() == 16) && + isa(N2)) { unsigned Opc = (EVT.getSizeInBits() == 8) ? X86ISD::PINSRB : X86ISD::PINSRW; // Transform it so it match pinsr{b,w} which expects a GR32 as its second From isanbard at gmail.com Thu Aug 14 18:05:26 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 14 Aug 2008 23:05:26 -0000 Subject: [llvm-commits] [llvm] r54804 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200808142305.m7EN5Qe3016006@zion.cs.uiuc.edu> Author: void Date: Thu Aug 14 18:05:24 2008 New Revision: 54804 URL: http://llvm.org/viewvc/llvm-project?rev=54804&view=rev Log: Temporarily revert r54792. It's causing an ICE during bootstrapping. Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=54804&r1=54803&r2=54804&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Aug 14 18:05:24 2008 @@ -138,7 +138,7 @@ /// class SCCPSolver : public InstVisitor { SmallSet BBExecutable;// The basic blocks that are executable - DenseMap ValueState; // The state each value is in. + std::map ValueState; // The state each value is in. /// GlobalValue - If we are tracking any values for the contents of a global /// variable, we keep a mapping from the constant accessor to the element of @@ -231,7 +231,7 @@ /// getValueMapping - Once we have solved for constants, return the mapping of /// LLVM values to LatticeVals. - DenseMap &getValueMapping() { + std::map &getValueMapping() { return ValueState; } @@ -311,7 +311,7 @@ // Instruction object, then use this accessor to get its value from the map. // inline LatticeVal &getValueState(Value *V) { - DenseMap::iterator I = ValueState.find(V); + std::map::iterator I = ValueState.find(V); if (I != ValueState.end()) return I->second; // Common case, in the map if (Constant *C = dyn_cast(V)) { @@ -1555,7 +1555,7 @@ // SmallSet &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector Insts; - DenseMap &Values = Solver.getValueMapping(); + std::map &Values = Solver.getValueMapping(); for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (!ExecutableBBs.count(BB)) { @@ -1701,7 +1701,7 @@ SmallSet &ExecutableBBs = Solver.getExecutableBlocks(); SmallVector Insts; SmallVector BlocksToErase; - DenseMap &Values = Solver.getValueMapping(); + std::map &Values = Solver.getValueMapping(); for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); From dpatel at apple.com Thu Aug 14 18:07:48 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 14 Aug 2008 23:07:48 -0000 Subject: [llvm-commits] [llvm] r54805 - in /llvm/trunk: lib/VMCore/PassManager.cpp test/Other/2008-08-14-PassManager.ll Message-ID: <200808142307.m7EN7mla016113@zion.cs.uiuc.edu> Author: dpatel Date: Thu Aug 14 18:07:48 2008 New Revision: 54805 URL: http://llvm.org/viewvc/llvm-project?rev=54805&view=rev Log: The pass manager is not able to schedule -loop-deletion -loop-index-split. The loop-deletion pass does not preserve dom frontier, which is required by loop-index-split. When the PM checks dom frontier for loop-index-split, it has already verified that lcssa is availalble. However, new dom frontier forces new loop pass manager, which does not have lcssa yet. The PM should recheck availability of required analysis passes in such cases. Added: llvm/trunk/test/Other/2008-08-14-PassManager.ll Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54805&r1=54804&r2=54805&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Thu Aug 14 18:07:48 2008 @@ -463,20 +463,34 @@ AnalysisUsage *AnUsage = findAnalysisUsage(P); - const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet(); - for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(), - E = RequiredSet.end(); I != E; ++I) { - - Pass *AnalysisPass = findAnalysisPass(*I); - if (!AnalysisPass) { - AnalysisPass = (*I)->createPass(); - // Schedule this analysis run first only if it is not a lower level - // analysis pass. Lower level analsyis passes are run on the fly. - if (P->getPotentialPassManagerType () >= - AnalysisPass->getPotentialPassManagerType()) - schedulePass(AnalysisPass); - else - delete AnalysisPass; + bool checkAnalysis = true; + while (checkAnalysis) { + checkAnalysis = false; + + const AnalysisUsage::VectorType &RequiredSet = AnUsage->getRequiredSet(); + for (AnalysisUsage::VectorType::const_iterator I = RequiredSet.begin(), + E = RequiredSet.end(); I != E; ++I) { + + Pass *AnalysisPass = findAnalysisPass(*I); + if (!AnalysisPass) { + AnalysisPass = (*I)->createPass(); + if (P->getPotentialPassManagerType () == + AnalysisPass->getPotentialPassManagerType()) + // Schedule analysis pass that is managed by the same pass manager. + schedulePass(AnalysisPass); + else if (P->getPotentialPassManagerType () > + AnalysisPass->getPotentialPassManagerType()) { + // Schedule analysis pass that is managed by a new manager. + schedulePass(AnalysisPass); + // Recheck analysis passes to ensure that required analysises that + // are already checked are still available. + checkAnalysis = true; + } + else + // Do not schedule this analysis. Lower level analsyis + // passes are run on the fly. + delete AnalysisPass; + } } } Added: llvm/trunk/test/Other/2008-08-14-PassManager.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2008-08-14-PassManager.ll?rev=54805&view=auto ============================================================================== --- llvm/trunk/test/Other/2008-08-14-PassManager.ll (added) +++ llvm/trunk/test/Other/2008-08-14-PassManager.ll Thu Aug 14 18:07:48 2008 @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | opt -loop-deletion -loop-index-split -disable-output +; PR 2640 +define i32 @test1() { + ret i32 0; +} From gohman at apple.com Thu Aug 14 18:18:11 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 14 Aug 2008 23:18:11 -0000 Subject: [llvm-commits] [llvm] r54806 - /llvm/trunk/lib/Target/X86/Makefile Message-ID: <200808142318.m7ENIBal016486@zion.cs.uiuc.edu> Author: djg Date: Thu Aug 14 18:18:11 2008 New Revision: 54806 URL: http://llvm.org/viewvc/llvm-project?rev=54806&view=rev Log: Build the X86GenFastISel.inc file. Modified: llvm/trunk/lib/Target/X86/Makefile Modified: llvm/trunk/lib/Target/X86/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Makefile?rev=54806&r1=54805&r2=54806&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Makefile (original) +++ llvm/trunk/lib/Target/X86/Makefile Thu Aug 14 18:18:11 2008 @@ -15,6 +15,7 @@ X86GenRegisterInfo.inc X86GenInstrNames.inc \ X86GenInstrInfo.inc X86GenAsmWriter.inc \ X86GenAsmWriter1.inc X86GenDAGISel.inc \ + X86GenFastISel.inc \ X86GenCallingConv.inc X86GenSubtarget.inc include $(LEVEL)/Makefile.common From resistor at mac.com Thu Aug 14 18:25:30 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 23:25:30 -0000 Subject: [llvm-commits] [llvm] r54807 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h lib/CodeGen/MachineInstr.cpp Message-ID: <200808142325.m7ENPUwS016747@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 18:25:30 2008 New Revision: 54807 URL: http://llvm.org/viewvc/llvm-project?rev=54807&view=rev Log: Move MachineInstr::getOpcode inline. Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=54807&r1=54806&r2=54807&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Aug 14 18:25:30 2008 @@ -21,6 +21,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/CodeGen/MachineMemOperand.h" +#include "llvm/Target/TargetInstrDesc.h" #include #include @@ -89,7 +90,7 @@ /// getOpcode - Returns the opcode of this MachineInstr. /// - int getOpcode() const; + int getOpcode() const { return TID->Opcode; } /// Access to explicit operands of the instruction. /// Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=54807&r1=54806&r2=54807&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Aug 14 18:25:30 2008 @@ -345,12 +345,6 @@ #endif } -/// getOpcode - Returns the opcode of this MachineInstr. -/// -int MachineInstr::getOpcode() const { - return TID->Opcode; -} - /// getRegInfo - If this instruction is embedded into a MachineFunction, /// return the MachineRegisterInfo object for the current function, otherwise /// return null. From isanbard at gmail.com Thu Aug 14 18:37:58 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 14 Aug 2008 23:37:58 -0000 Subject: [llvm-commits] [llvm] r54809 - in /llvm/trunk/test/LLVMC: dg.exp llvmc.exp Message-ID: <200808142337.m7ENbxtI017341@zion.cs.uiuc.edu> Author: void Date: Thu Aug 14 18:37:58 2008 New Revision: 54809 URL: http://llvm.org/viewvc/llvm-project?rev=54809&view=rev Log: Renaming LLVMC/dg.exp to LLVM/llvmc.exp Added: llvm/trunk/test/LLVMC/llvmc.exp - copied unchanged from r54803, llvm/trunk/test/LLVMC/dg.exp Removed: llvm/trunk/test/LLVMC/dg.exp Removed: llvm/trunk/test/LLVMC/dg.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/dg.exp?rev=54808&view=auto ============================================================================== --- llvm/trunk/test/LLVMC/dg.exp (original) +++ llvm/trunk/test/LLVMC/dg.exp (removed) @@ -1,10 +0,0 @@ -load_lib llvm.exp - -if [ llvm_gcc_supports c ] then { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{c}]] -} - -if [ llvm_gcc_supports c++ ] then { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{cpp}]] -} - From resistor at mac.com Thu Aug 14 18:41:39 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 14 Aug 2008 23:41:39 -0000 Subject: [llvm-commits] [llvm] r54810 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp Message-ID: <200808142341.m7ENfdL2017534@zion.cs.uiuc.edu> Author: resistor Date: Thu Aug 14 18:41:38 2008 New Revision: 54810 URL: http://llvm.org/viewvc/llvm-project?rev=54810&view=rev Log: Use SmallSet instead of std::set to save allocations. Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=54810&r1=54809&r2=54810&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Thu Aug 14 18:41:38 2008 @@ -221,7 +221,7 @@ LastPartialDef->addOperand(MachineOperand::CreateReg(Reg, true/*IsDef*/, true/*IsImp*/)); PhysRegDef[Reg] = LastPartialDef; - std::set Processed; + SmallSet Processed; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { if (Processed.count(SubReg)) @@ -351,7 +351,7 @@ // AX = AL // = AL // AX = - std::set PartUses; + SmallSet PartUses; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { if (MachineInstr *Use = PhysRegUse[SubReg]) { @@ -437,7 +437,7 @@ if (MI) { // Does this extend the live range of a super-register? - std::set Processed; + SmallSet Processed; for (const unsigned *SuperRegs = TRI->getSuperRegisters(Reg); unsigned SuperReg = *SuperRegs; ++SuperRegs) { if (Processed.count(SuperReg)) From daniel at zuster.org Thu Aug 14 21:07:22 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 14 Aug 2008 19:07:22 -0700 (PDT) Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: <92305.89440.qm@web54604.mail.re2.yahoo.com> I'm seeing a lot of test-suite failures which I isolated to this commit. In particular, in SingleSource/UnitTests/Vector, sse.expandfft, see.stepfft, sumarray, and sumarray-dbl are failing. + /* If shadow use is a int->float cast then insert a second IV + to elminate this cast. + + for (unsigned i = 0; i < n; ++i) + foo((double)i); + + is trnasformed into + + double d = 0.0; + for (unsigned i = 0; i < n; ++i, ++d) + foo(d); + */ If this is really the transformation how can this be legal? 16777216.0f + 1.0f == 16777216.0f and 9007199999999999.0 + 1.0 == 9007199999999999.0 on my machine, for example. - Daniel ----- Original Message ---- From: Devang Patel To: llvm-commits at cs.uiuc.edu Sent: Thursday, August 14, 2008 1:58:31 PM Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Author: dpatel Date: Thu Aug 14 15:58:31 2008 New Revision: 54786 URL: http://llvm.org/viewvc/llvm-project?rev=54786&view=rev Log: If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation. Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54786&r1=54785&r2=54786&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Aug 14 15:58:31 2008 @@ -45,6 +45,7 @@ STATISTIC(NumInserted, "Number of PHIs inserted"); STATISTIC(NumVariable, "Number of PHIs with variable strides"); STATISTIC(NumEliminated , "Number of strides eliminated"); +STATISTIC(NumShadow , "Number of Shdow IVs optimized"); namespace { @@ -177,6 +178,10 @@ IVStrideUse* &CondUse, const SCEVHandle* &CondStride); void OptimizeIndvars(Loop *L); + + /// OptimizeShadowIV - If IV is used in a int-to-float cast + /// inside the loop then try to eliminate the cast opeation. + void OptimizeShadowIV(Loop *L); bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, const SCEVHandle *&CondStride); bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); @@ -1689,12 +1694,108 @@ return Cond; } +/// OptimizeShadowIV - If IV is used in a int-to-float cast +/// inside the loop then try to eliminate the cast opeation. +void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { + + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; + ++Stride) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[Stride]); + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); + + for (std::vector::iterator UI = SI->second.Users.begin(), + E = SI->second.Users.end(); UI != E; /* empty */) { + std::vector::iterator CandidateUI = UI; + UI++; + Instruction *ShadowUse = CandidateUI->User; + const Type *DestTy = NULL; + + /* If shadow use is a int->float cast then insert a second IV + to elminate this cast. + + for (unsigned i = 0; i < n; ++i) + foo((double)i); + + is trnasformed into + + double d = 0.0; + for (unsigned i = 0; i < n; ++i, ++d) + foo(d); + */ + UIToFPInst *UCast = dyn_cast(CandidateUI->User); + if (UCast) + DestTy = UCast->getDestTy(); + else { + SIToFPInst *SCast = dyn_cast(CandidateUI->User); + if (!SCast) continue; + DestTy = SCast->getDestTy(); + } + + PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); + if (!PH) continue; + if (PH->getNumIncomingValues() != 2) continue; + + unsigned Entry, Latch; + if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { + Entry = 0; + Latch = 1; + } else { + Entry = 1; + Latch = 0; + } + + ConstantInt *Init = dyn_cast(PH->getIncomingValue(Entry)); + if (!Init) continue; + ConstantFP *NewInit = ConstantFP::get(DestTy, Init->getZExtValue()); + + BinaryOperator *Incr = + dyn_cast(PH->getIncomingValue(Latch)); + if (!Incr) continue; + if (Incr->getOpcode() != Instruction::Add + && Incr->getOpcode() != Instruction::Sub) + continue; + + /* Initialize new IV, double d = 0.0 in above example. */ + ConstantInt *C = NULL; + if (Incr->getOperand(0) == PH) + C = dyn_cast(Incr->getOperand(1)); + else if (Incr->getOperand(1) == PH) + C = dyn_cast(Incr->getOperand(0)); + else + continue; + + if (!C) continue; + + /* create new icnrement. '++d' in above example. */ + ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); + BinaryOperator *NewIncr = + BinaryOperator::Create(Incr->getOpcode(), + NewInit, CFP, "IV.S.next.", Incr); + + /* Add new PHINode. */ + PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); + NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); + NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); + + /* Remove cast operation */ + ShadowUse->replaceAllUsesWith(NewPH); + ShadowUse->eraseFromParent(); + SI->second.Users.erase(CandidateUI); + NumShadow++; + break; + } + } +} + // OptimizeIndvars - Now that IVUsesByStride is set up with all of the indvar // uses in the loop, look to see if we can eliminate some, in favor of using // common indvars for the different uses. void LoopStrengthReduce::OptimizeIndvars(Loop *L) { // TODO: implement optzns here. + OptimizeShadowIV(L); + // Finally, get the terminating condition for the loop if possible. If we // can, we want to change it to use a post-incremented version of its // induction variable, to allow coalescing the live ranges for the IV into Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54786&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll (added) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Thu Aug 14 15:58:31 2008 @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" + +define void @foobar(i32 %n) nounwind { +entry: + icmp eq i32 %n, 0 ; :0 [#uses=2] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.nph + %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] + tail call void @bar( i32 %i.03 ) nounwind + uitofp i32 %i.03 to double ; :1 [#uses=1] + tail call void @foo( double %1 ) nounwind + %indvar.next = add i32 %i.03, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %umax ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +oreturn: ; preds = %bb, %entry + ret void +} + +declare void @bar(i32) + +declare void @foo(double) _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Thu Aug 14 21:54:39 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 14 Aug 2008 19:54:39 -0700 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll In-Reply-To: <92305.89440.qm@web54604.mail.re2.yahoo.com> References: <92305.89440.qm@web54604.mail.re2.yahoo.com> Message-ID: Yeah, I looked at this for a while, but eventually concluded all the cases where the behavior changes are undefined behavior in the standards. I might have missed something, and there's an argument for not changing the behavior anyway. In your second example, 9907199999999999 is out of range of representable unsigneds, so this patch shouldn't cause a problem. I think it's "safe" provided the FP type has enough mantissa bits to represent all possible values of the int type. Thus for 32-bit ints I think this is OK for double and long double, but could change the behavior for some cases involving float overflow. Maybe put the insufficient-bits case under -ffast-math? This does come up in SPEC IIRC. On Aug 14, 2008, at 7:07 PM, Daniel Dunbar wrote: > I'm seeing a lot of test-suite failures which I isolated to this > commit. > In particular, in SingleSource/UnitTests/Vector, sse.expandfft, > see.stepfft, > sumarray, and sumarray-dbl are failing. > > > > + /* If shadow use is a int->float cast then insert a second IV > + to elminate this cast. > + > + for (unsigned i = 0; i < n; ++i) > + foo((double)i); > + > + is trnasformed into > + > + double d = 0.0; > + for (unsigned i = 0; i < n; ++i, ++d) > + foo(d); > + */ > > If this is really the transformation how can this be legal? > 16777216.0f + 1.0f == 16777216.0f > and > 9007199999999999.0 + 1.0 == 9007199999999999.0 > on my machine, for example. > > - Daniel > > ----- Original Message ---- > From: Devang Patel > To: llvm-commits at cs.uiuc.edu > Sent: Thursday, August 14, 2008 1:58:31 PM > Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/ > Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/ > LoopStrengthReduce/2008-08-14-ShadowIV.ll > > Author: dpatel > Date: Thu Aug 14 15:58:31 2008 > New Revision: 54786 > > URL: http://llvm.org/viewvc/llvm-project?rev=54786&view=rev > Log: > If IV is used in a int-to-float cast inside the loop then try to > eliminate the cast opeation. > > Added: > llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54786&r1=54785&r2=54786&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Aug > 14 15:58:31 2008 > @@ -45,6 +45,7 @@ > STATISTIC(NumInserted, "Number of PHIs inserted"); > STATISTIC(NumVariable, "Number of PHIs with variable strides"); > STATISTIC(NumEliminated , "Number of strides eliminated"); > +STATISTIC(NumShadow , "Number of Shdow IVs optimized"); > > namespace { > > @@ -177,6 +178,10 @@ > IVStrideUse* &CondUse, > const SCEVHandle* &CondStride); > void OptimizeIndvars(Loop *L); > + > + /// OptimizeShadowIV - If IV is used in a int-to-float cast > + /// inside the loop then try to eliminate the cast opeation. > + void OptimizeShadowIV(Loop *L); > bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, > const SCEVHandle *&CondStride); > bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); > @@ -1689,12 +1694,108 @@ > return Cond; > } > > +/// OptimizeShadowIV - If IV is used in a int-to-float cast > +/// inside the loop then try to eliminate the cast opeation. > +void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { > + > + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; > + ++Stride) { > + std::map::iterator SI = > + IVUsesByStride.find(StrideOrder[Stride]); > + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); > + > + for (std::vector::iterator UI = SI- > >second.Users.begin(), > + E = SI->second.Users.end(); UI != E; /* empty */) { > + std::vector::iterator CandidateUI = UI; > + UI++; > + Instruction *ShadowUse = CandidateUI->User; > + const Type *DestTy = NULL; > + > + /* If shadow use is a int->float cast then insert a second IV > + to elminate this cast. > + > + for (unsigned i = 0; i < n; ++i) > + foo((double)i); > + > + is trnasformed into > + > + double d = 0.0; > + for (unsigned i = 0; i < n; ++i, ++d) > + foo(d); > + */ > + UIToFPInst *UCast = dyn_cast(CandidateUI->User); > + if (UCast) > + DestTy = UCast->getDestTy(); > + else { > + SIToFPInst *SCast = dyn_cast(CandidateUI->User); > + if (!SCast) continue; > + DestTy = SCast->getDestTy(); > + } > + > + PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); > + if (!PH) continue; > + if (PH->getNumIncomingValues() != 2) continue; > + > + unsigned Entry, Latch; > + if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { > + Entry = 0; > + Latch = 1; > + } else { > + Entry = 1; > + Latch = 0; > + } > + > + ConstantInt *Init = dyn_cast(PH- > >getIncomingValue(Entry)); > + if (!Init) continue; > + ConstantFP *NewInit = ConstantFP::get(DestTy, Init- > >getZExtValue()); > + > + BinaryOperator *Incr = > + dyn_cast(PH->getIncomingValue(Latch)); > + if (!Incr) continue; > + if (Incr->getOpcode() != Instruction::Add > + && Incr->getOpcode() != Instruction::Sub) > + continue; > + > + /* Initialize new IV, double d = 0.0 in above example. */ > + ConstantInt *C = NULL; > + if (Incr->getOperand(0) == PH) > + C = dyn_cast(Incr->getOperand(1)); > + else if (Incr->getOperand(1) == PH) > + C = dyn_cast(Incr->getOperand(0)); > + else > + continue; > + > + if (!C) continue; > + > + /* create new icnrement. '++d' in above example. */ > + ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); > + BinaryOperator *NewIncr = > + BinaryOperator::Create(Incr->getOpcode(), > + NewInit, CFP, "IV.S.next.", Incr); > + > + /* Add new PHINode. */ > + PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); > + NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); > + NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); > + > + /* Remove cast operation */ > + ShadowUse->replaceAllUsesWith(NewPH); > + ShadowUse->eraseFromParent(); > + SI->second.Users.erase(CandidateUI); > + NumShadow++; > + break; > + } > + } > +} > + > // OptimizeIndvars - Now that IVUsesByStride is set up with all of > the indvar > // uses in the loop, look to see if we can eliminate some, in favor > of using > // common indvars for the different uses. > void LoopStrengthReduce::OptimizeIndvars(Loop *L) { > // TODO: implement optzns here. > > + OptimizeShadowIV(L); > + > // Finally, get the terminating condition for the loop if > possible. If we > // can, we want to change it to use a post-incremented version of > its > // induction variable, to allow coalescing the live ranges for the > IV into > > Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54786&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll (added) > +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll Thu Aug 14 15:58:31 2008 > @@ -0,0 +1,27 @@ > +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" > + > +define void @foobar(i32 %n) nounwind { > +entry: > + icmp eq i32 %n, 0 ; :0 [#uses=2] > + br i1 %0, label %return, label %bb.nph > + > +bb.nph: ; preds = %entry > + %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] > + br label %bb > + > +bb: ; preds = %bb, %bb.nph > + %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; > [#uses=3] > + tail call void @bar( i32 %i.03 ) nounwind > + uitofp i32 %i.03 to double ; :1 [#uses=1] > + tail call void @foo( double %1 ) nounwind > + %indvar.next = add i32 %i.03, 1 ; [#uses=2] > + %exitcond = icmp eq i32 %indvar.next, %umax ; > [#uses=1] > + br i1 %exitcond, label %return, label %bb > + > +oreturn: ; preds = %bb, %entry > + ret void > +} > + > +declare void @bar(i32) > + > +declare void @foo(double) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Aug 14 23:03:02 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Aug 2008 04:03:02 -0000 Subject: [llvm-commits] [llvm] r54811 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200808150403.m7F4326b025452@zion.cs.uiuc.edu> Author: lattner Date: Thu Aug 14 23:03:01 2008 New Revision: 54811 URL: http://llvm.org/viewvc/llvm-project?rev=54811&view=rev Log: use smallvector instead of vector for a couple worklists. This speeds up instcombine by ~10% on some testcases. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=54811&r1=54810&r2=54811&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Aug 14 23:03:01 2008 @@ -74,7 +74,7 @@ : public FunctionPass, public InstVisitor { // Worklist of all of the instructions that need to be simplified. - std::vector Worklist; + SmallVector Worklist; DenseMap WorklistMap; TargetData *TD; bool MustPreserveLCSSA; @@ -11386,7 +11386,7 @@ SmallPtrSet &Visited, InstCombiner &IC, const TargetData *TD) { - std::vector Worklist; + SmallVector Worklist; Worklist.push_back(BB); while (!Worklist.empty()) { From daniel at zuster.org Thu Aug 14 23:09:27 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 14 Aug 2008 21:09:27 -0700 (PDT) Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: <407112.69615.qm@web54603.mail.re2.yahoo.com> I can't really speak to the legality because I'm not familiar with what the standard says w.r.t. floating point transformations. My assumption has always been that the compiler was restricted from doing anything this aggressive. Actually I didn't even think the compiler was allowed to reassociate ((x + 1.) + 1.) for some FP x, within a single statement. I'd love to know kind of flexibility is actually allowed though. > In your second example, 9907199999999999 is out of range of > representable unsigneds, so this patch shouldn't cause a problem. I think it's "safe" Yes, this is true. Although I think it is more complicated than just the bits in the mantissa exceeding the bits of the type, because really the issue is whether the mantissa has enough bits to represent '1', which will vary depending on the exponent. However, it may be that cases where that is not true (for double) would already have roundoff errors. Of course, if this transformation induced -- double d = 9907199999999999; for (unsigned i=0; i To: Commit Messages and Patches for LLVM Sent: Thursday, August 14, 2008 7:54:39 PM Subject: Re: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Yeah, I looked at this for a while, but eventually concluded all the cases where the behavior changes are undefined behavior in the standards. I might have missed something, and there's an argument for not changing the behavior anyway. In your second example, 9907199999999999 is out of range of representable unsigneds, so this patch shouldn't cause a problem. I think it's "safe" provided the FP type has enough mantissa bits to represent all possible values of the int type. Thus for 32-bit ints I think this is OK for double and long double, but could change the behavior for some cases involving float overflow. Maybe put the insufficient-bits case under -ffast-math? This does come up in SPEC IIRC. On Aug 14, 2008, at 7:07 PM, Daniel Dunbar wrote: > I'm seeing a lot of test-suite failures which I isolated to this > commit. > In particular, in SingleSource/UnitTests/Vector, sse.expandfft, > see.stepfft, > sumarray, and sumarray-dbl are failing. > > > > + /* If shadow use is a int->float cast then insert a second IV > + to elminate this cast. > + > + for (unsigned i = 0; i < n; ++i) > + foo((double)i); > + > + is trnasformed into > + > + double d = 0.0; > + for (unsigned i = 0; i < n; ++i, ++d) > + foo(d); > + */ > > If this is really the transformation how can this be legal? > 16777216.0f + 1.0f == 16777216.0f > and > 9007199999999999.0 + 1.0 == 9007199999999999.0 > on my machine, for example. > > - Daniel > > ----- Original Message ---- > From: Devang Patel > To: llvm-commits at cs.uiuc.edu > Sent: Thursday, August 14, 2008 1:58:31 PM > Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/ > Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/ > LoopStrengthReduce/2008-08-14-ShadowIV.ll > > Author: dpatel > Date: Thu Aug 14 15:58:31 2008 > New Revision: 54786 > > URL: http://llvm.org/viewvc/llvm-project?rev=54786&view=rev > Log: > If IV is used in a int-to-float cast inside the loop then try to > eliminate the cast opeation. > > Added: > llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54786&r1=54785&r2=54786&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Aug > 14 15:58:31 2008 > @@ -45,6 +45,7 @@ > STATISTIC(NumInserted, "Number of PHIs inserted"); > STATISTIC(NumVariable, "Number of PHIs with variable strides"); > STATISTIC(NumEliminated , "Number of strides eliminated"); > +STATISTIC(NumShadow , "Number of Shdow IVs optimized"); > > namespace { > > @@ -177,6 +178,10 @@ > IVStrideUse* &CondUse, > const SCEVHandle* &CondStride); > void OptimizeIndvars(Loop *L); > + > + /// OptimizeShadowIV - If IV is used in a int-to-float cast > + /// inside the loop then try to eliminate the cast opeation. > + void OptimizeShadowIV(Loop *L); > bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, > const SCEVHandle *&CondStride); > bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); > @@ -1689,12 +1694,108 @@ > return Cond; > } > > +/// OptimizeShadowIV - If IV is used in a int-to-float cast > +/// inside the loop then try to eliminate the cast opeation. > +void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { > + > + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; > + ++Stride) { > + std::map::iterator SI = > + IVUsesByStride.find(StrideOrder[Stride]); > + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); > + > + for (std::vector::iterator UI = SI- > >second.Users.begin(), > + E = SI->second.Users.end(); UI != E; /* empty */) { > + std::vector::iterator CandidateUI = UI; > + UI++; > + Instruction *ShadowUse = CandidateUI->User; > + const Type *DestTy = NULL; > + > + /* If shadow use is a int->float cast then insert a second IV > + to elminate this cast. > + > + for (unsigned i = 0; i < n; ++i) > + foo((double)i); > + > + is trnasformed into > + > + double d = 0.0; > + for (unsigned i = 0; i < n; ++i, ++d) > + foo(d); > + */ > + UIToFPInst *UCast = dyn_cast(CandidateUI->User); > + if (UCast) > + DestTy = UCast->getDestTy(); > + else { > + SIToFPInst *SCast = dyn_cast(CandidateUI->User); > + if (!SCast) continue; > + DestTy = SCast->getDestTy(); > + } > + > + PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); > + if (!PH) continue; > + if (PH->getNumIncomingValues() != 2) continue; > + > + unsigned Entry, Latch; > + if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { > + Entry = 0; > + Latch = 1; > + } else { > + Entry = 1; > + Latch = 0; > + } > + > + ConstantInt *Init = dyn_cast(PH- > >getIncomingValue(Entry)); > + if (!Init) continue; > + ConstantFP *NewInit = ConstantFP::get(DestTy, Init- > >getZExtValue()); > + > + BinaryOperator *Incr = > + dyn_cast(PH->getIncomingValue(Latch)); > + if (!Incr) continue; > + if (Incr->getOpcode() != Instruction::Add > + && Incr->getOpcode() != Instruction::Sub) > + continue; > + > + /* Initialize new IV, double d = 0.0 in above example. */ > + ConstantInt *C = NULL; > + if (Incr->getOperand(0) == PH) > + C = dyn_cast(Incr->getOperand(1)); > + else if (Incr->getOperand(1) == PH) > + C = dyn_cast(Incr->getOperand(0)); > + else > + continue; > + > + if (!C) continue; > + > + /* create new icnrement. '++d' in above example. */ > + ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); > + BinaryOperator *NewIncr = > + BinaryOperator::Create(Incr->getOpcode(), > + NewInit, CFP, "IV.S.next.", Incr); > + > + /* Add new PHINode. */ > + PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); > + NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); > + NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); > + > + /* Remove cast operation */ > + ShadowUse->replaceAllUsesWith(NewPH); > + ShadowUse->eraseFromParent(); > + SI->second.Users.erase(CandidateUI); > + NumShadow++; > + break; > + } > + } > +} > + > // OptimizeIndvars - Now that IVUsesByStride is set up with all of > the indvar > // uses in the loop, look to see if we can eliminate some, in favor > of using > // common indvars for the different uses. > void LoopStrengthReduce::OptimizeIndvars(Loop *L) { > // TODO: implement optzns here. > > + OptimizeShadowIV(L); > + > // Finally, get the terminating condition for the loop if > possible. If we > // can, we want to change it to use a post-incremented version of > its > // induction variable, to allow coalescing the live ranges for the > IV into > > Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54786&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll (added) > +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14- > ShadowIV.ll Thu Aug 14 15:58:31 2008 > @@ -0,0 +1,27 @@ > +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" > + > +define void @foobar(i32 %n) nounwind { > +entry: > + icmp eq i32 %n, 0 ; :0 [#uses=2] > + br i1 %0, label %return, label %bb.nph > + > +bb.nph: ; preds = %entry > + %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] > + br label %bb > + > +bb: ; preds = %bb, %bb.nph > + %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; > [#uses=3] > + tail call void @bar( i32 %i.03 ) nounwind > + uitofp i32 %i.03 to double ; :1 [#uses=1] > + tail call void @foo( double %1 ) nounwind > + %indvar.next = add i32 %i.03, 1 ; [#uses=2] > + %exitcond = icmp eq i32 %indvar.next, %umax ; > [#uses=1] > + br i1 %exitcond, label %return, label %bb > + > +oreturn: ; preds = %bb, %entry > + ret void > +} > + > +declare void @bar(i32) > + > +declare void @foo(double) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From eli.friedman at gmail.com Thu Aug 14 23:31:17 2008 From: eli.friedman at gmail.com (Eli Friedman) Date: Thu, 14 Aug 2008 21:31:17 -0700 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: This patch doesn't handle overflow correctly. Take the following, where the iteration count is very large (greater than 2^32): unsigned y(double); unsigned z(); unsigned x() { unsigned x = 0; for ( ; z(); x++) y(x); } The transformation is unsafe because x is supposed to overflow. or the following, where a is very large (greater than around 2^23): void y(float); unsigned x(unsigned a) { unsigned i = 0; for ( ; i < a; i++) y(i); } The transformation is unsafe because the float induction variable will eventually stop increasing. It is possible to prove this transformation safe (for example, the transformation is safe for 2008-08-14-ShadowIV.ll because the mantissa of double is greater than 32 bits and the iteration count is %n < 2^32), but as-is, this commit breaks correct code. I'm not sure if this is related to the patch, but one testcase I was trying that I expected to trigger the new code didn't end up triggering it, for reasons I haven't yet figured out: unsigned y(double); unsigned x(unsigned long long a) { unsigned long long i = 0; unsigned x = 0; for ( ; i < a; x++, i++) y(x); } -Eli From evan.cheng at apple.com Fri Aug 15 02:01:25 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Aug 2008 00:01:25 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r54702 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> References: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> Message-ID: <1E711EFB-0848-4587-A63F-6762112FF357@apple.com> Hi Jim, I don't think this is a good idea yet. Most people don't need llvm-gcc ARM support. Perhaps this should be something that's specified on the command line? I'll back this out for now. Thanks. Evan On Aug 12, 2008, at 2:13 PM, Jim Grosbach wrote: > Author: grosbach > Date: Tue Aug 12 16:13:55 2008 > New Revision: 54702 > > URL: http://llvm.org/viewvc/llvm-project?rev=54702&view=rev > Log: > LLVM dylib needs the ARM backend as well. > > Modified: > llvm-gcc-4.2/trunk/gcc/Makefile.in > > Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=54702&r1=54701&r2=54702&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) > +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Tue Aug 12 16:13:55 2008 > @@ -1152,10 +1152,10 @@ > $(error Unsuported LLVM Target $(target)) > endif > > -# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc > backends. > +# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc/ > arm backends. > # See below for more details. > ifdef BUILD_LLVM_INTO_A_DYLIB > -LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc) > +LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc arm) > endif > > # We use llvm-config to determine the libraries that we need to link > in our > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Aug 15 02:10:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Aug 2008 07:10:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54812 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200808150710.m7F7A3QN030732@zion.cs.uiuc.edu> Author: evancheng Date: Fri Aug 15 02:10:01 2008 New Revision: 54812 URL: http://llvm.org/viewvc/llvm-project?rev=54812&view=rev Log: Revert -r54702 for now. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=54812&r1=54811&r2=54812&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Fri Aug 15 02:10:01 2008 @@ -1152,10 +1152,10 @@ $(error Unsuported LLVM Target $(target)) endif -# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc/arm backends. +# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc backends. # See below for more details. ifdef BUILD_LLVM_INTO_A_DYLIB -LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc arm) +LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc) endif # We use llvm-config to determine the libraries that we need to link in our From evan.cheng at apple.com Fri Aug 15 03:12:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Aug 2008 08:12:13 -0000 Subject: [llvm-commits] [llvm] r54813 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: <200808150812.m7F8CDXA014306@zion.cs.uiuc.edu> Author: evancheng Date: Fri Aug 15 03:12:11 2008 New Revision: 54813 URL: http://llvm.org/viewvc/llvm-project?rev=54813&view=rev Log: Revert 54786. It's not checking for overflows, etc. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54813&r1=54812&r2=54813&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Aug 15 03:12:11 2008 @@ -45,7 +45,6 @@ STATISTIC(NumInserted, "Number of PHIs inserted"); STATISTIC(NumVariable, "Number of PHIs with variable strides"); STATISTIC(NumEliminated , "Number of strides eliminated"); -STATISTIC(NumShadow , "Number of Shdow IVs optimized"); namespace { @@ -178,10 +177,6 @@ IVStrideUse* &CondUse, const SCEVHandle* &CondStride); void OptimizeIndvars(Loop *L); - - /// OptimizeShadowIV - If IV is used in a int-to-float cast - /// inside the loop then try to eliminate the cast opeation. - void OptimizeShadowIV(Loop *L); bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, const SCEVHandle *&CondStride); bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); @@ -1694,108 +1689,12 @@ return Cond; } -/// OptimizeShadowIV - If IV is used in a int-to-float cast -/// inside the loop then try to eliminate the cast opeation. -void LoopStrengthReduce::OptimizeShadowIV(Loop *L) { - - for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; - ++Stride) { - std::map::iterator SI = - IVUsesByStride.find(StrideOrder[Stride]); - assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); - - for (std::vector::iterator UI = SI->second.Users.begin(), - E = SI->second.Users.end(); UI != E; /* empty */) { - std::vector::iterator CandidateUI = UI; - UI++; - Instruction *ShadowUse = CandidateUI->User; - const Type *DestTy = NULL; - - /* If shadow use is a int->float cast then insert a second IV - to elminate this cast. - - for (unsigned i = 0; i < n; ++i) - foo((double)i); - - is trnasformed into - - double d = 0.0; - for (unsigned i = 0; i < n; ++i, ++d) - foo(d); - */ - UIToFPInst *UCast = dyn_cast(CandidateUI->User); - if (UCast) - DestTy = UCast->getDestTy(); - else { - SIToFPInst *SCast = dyn_cast(CandidateUI->User); - if (!SCast) continue; - DestTy = SCast->getDestTy(); - } - - PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); - if (!PH) continue; - if (PH->getNumIncomingValues() != 2) continue; - - unsigned Entry, Latch; - if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { - Entry = 0; - Latch = 1; - } else { - Entry = 1; - Latch = 0; - } - - ConstantInt *Init = dyn_cast(PH->getIncomingValue(Entry)); - if (!Init) continue; - ConstantFP *NewInit = ConstantFP::get(DestTy, Init->getZExtValue()); - - BinaryOperator *Incr = - dyn_cast(PH->getIncomingValue(Latch)); - if (!Incr) continue; - if (Incr->getOpcode() != Instruction::Add - && Incr->getOpcode() != Instruction::Sub) - continue; - - /* Initialize new IV, double d = 0.0 in above example. */ - ConstantInt *C = NULL; - if (Incr->getOperand(0) == PH) - C = dyn_cast(Incr->getOperand(1)); - else if (Incr->getOperand(1) == PH) - C = dyn_cast(Incr->getOperand(0)); - else - continue; - - if (!C) continue; - - /* create new icnrement. '++d' in above example. */ - ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); - BinaryOperator *NewIncr = - BinaryOperator::Create(Incr->getOpcode(), - NewInit, CFP, "IV.S.next.", Incr); - - /* Add new PHINode. */ - PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); - NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); - NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); - - /* Remove cast operation */ - ShadowUse->replaceAllUsesWith(NewPH); - ShadowUse->eraseFromParent(); - SI->second.Users.erase(CandidateUI); - NumShadow++; - break; - } - } -} - // OptimizeIndvars - Now that IVUsesByStride is set up with all of the indvar // uses in the loop, look to see if we can eliminate some, in favor of using // common indvars for the different uses. void LoopStrengthReduce::OptimizeIndvars(Loop *L) { // TODO: implement optzns here. - OptimizeShadowIV(L); - // Finally, get the terminating condition for the loop if possible. If we // can, we want to change it to use a post-incremented version of its // induction variable, to allow coalescing the live ranges for the IV into Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54813&r1=54812&r2=54813&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll (original) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Fri Aug 15 03:12:11 2008 @@ -1,27 +0,0 @@ -; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" - -define void @foobar(i32 %n) nounwind { -entry: - icmp eq i32 %n, 0 ; :0 [#uses=2] - br i1 %0, label %return, label %bb.nph - -bb.nph: ; preds = %entry - %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] - br label %bb - -bb: ; preds = %bb, %bb.nph - %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] - tail call void @bar( i32 %i.03 ) nounwind - uitofp i32 %i.03 to double ; :1 [#uses=1] - tail call void @foo( double %1 ) nounwind - %indvar.next = add i32 %i.03, 1 ; [#uses=2] - %exitcond = icmp eq i32 %indvar.next, %umax ; [#uses=1] - br i1 %exitcond, label %return, label %bb - -return: ; preds = %bb, %entry - ret void -} - -declare void @bar(i32) - -declare void @foo(double) From evan.cheng at apple.com Fri Aug 15 03:13:13 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Aug 2008 01:13:13 -0700 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll In-Reply-To: References: Message-ID: <197071E4-4420-4CBE-A9B2-BA5F19F9EBE8@apple.com> Yes, the patch is not checking for overflow and mantissa bits. I've backed it out for now. Evan On Aug 14, 2008, at 9:31 PM, Eli Friedman wrote: > This patch doesn't handle overflow correctly. > > Take the following, where the iteration count is very large (greater > than 2^32): > unsigned y(double); > unsigned z(); > unsigned x() { > unsigned x = 0; > for ( ; z(); x++) y(x); > } > The transformation is unsafe because x is supposed to overflow. > > or the following, where a is very large (greater than around 2^23): > void y(float); > unsigned x(unsigned a) { > unsigned i = 0; > for ( ; i < a; i++) y(i); > } > The transformation is unsafe because the float induction variable will > eventually stop increasing. > > It is possible to prove this transformation safe (for example, the > transformation is safe for 2008-08-14-ShadowIV.ll because the mantissa > of double is greater than 32 bits and the iteration count is %n < > 2^32), but as-is, this commit breaks correct code. > > > I'm not sure if this is related to the patch, but one testcase I was > trying that I expected to trigger the new code didn't end up > triggering it, for reasons I haven't yet figured out: > > unsigned y(double); > unsigned x(unsigned long long a) { > unsigned long long i = 0; > unsigned x = 0; > for ( ; i < a; x++, i++) y(x); > } > > -Eli > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Fri Aug 15 10:16:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Aug 2008 15:16:51 -0000 Subject: [llvm-commits] [llvm] r54814 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp Message-ID: <200808151516.m7FFGqvo027472@zion.cs.uiuc.edu> Author: lattner Date: Fri Aug 15 10:16:50 2008 New Revision: 54814 URL: http://llvm.org/viewvc/llvm-project?rev=54814&view=rev Log: Inline the fastpath of PATypeHolder::get(). This is a small speedup in instcombine among other things. Modified: llvm/trunk/include/llvm/Type.h llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=54814&r1=54813&r2=54814&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Fri Aug 15 10:16:50 2008 @@ -392,6 +392,17 @@ // Define inline methods for PATypeHolder. +/// get - This implements the forwarding part of the union-find algorithm for +/// abstract types. Before every access to the Type*, we check to see if the +/// type we are pointing to is forwarding to a new type. If so, we drop our +/// reference to the type. +/// +inline Type* PATypeHolder::get() const { + const Type *NewTy = Ty->getForwardedType(); + if (!NewTy) return const_cast(Ty); + return *const_cast(this) = NewTy; +} + inline void PATypeHolder::addRef() { assert(Ty && "Type Holder has a null type!"); if (Ty->isAbstract()) Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=54814&r1=54813&r2=54814&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Fri Aug 15 10:16:50 2008 @@ -35,21 +35,6 @@ //===----------------------------------------------------------------------===// -// Type PATypeHolder Implementation -//===----------------------------------------------------------------------===// - -/// get - This implements the forwarding part of the union-find algorithm for -/// abstract types. Before every access to the Type*, we check to see if the -/// type we are pointing to is forwarding to a new type. If so, we drop our -/// reference to the type. -/// -Type* PATypeHolder::get() const { - const Type *NewTy = Ty->getForwardedType(); - if (!NewTy) return const_cast(Ty); - return *const_cast(this) = NewTy; -} - -//===----------------------------------------------------------------------===// // Type Class Implementation //===----------------------------------------------------------------------===// From grosbach at apple.com Fri Aug 15 10:58:20 2008 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 15 Aug 2008 08:58:20 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r54702 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: <1E711EFB-0848-4587-A63F-6762112FF357@apple.com> References: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> <1E711EFB-0848-4587-A63F-6762112FF357@apple.com> Message-ID: <41DDDA2E-3422-4489-9157-AA69BEF5DA95@apple.com> I'm open to suggestions for alternatives; however, without this or equivalent, the build is fundamentally broken on Darwin. The core issue is that on Darwin, we install a single dylib, even when building compilers for more than one architecture. Normally, that dylib will be build only for the target llvm-gcc is configured for (see the bits of Makefile.in above the change for reference). That would be fine, except that the Darwin build scripts (build_gcc) take things a step further; when multiple compilers have been built, only a single dylib is installed, which is then shared by all of the compilers. That is, the build script assumes that the dylib will have support for all targets. So long as the targets are x86 and ppc, this piece of the Makefile is what enforces that assumption. Forcing targets into the dylib like that is ugly to begin with. Adding ARM support is merely an extension of the solution already chosen. There are a couple of alternatives, but they are more invasive and beyond the scope of what I'm looking for at the time being. We can move building the dylib containing the target bits into a separate project with its own build machinery. That seems overkill to me. We can modify the llvmCore build to create a dylib with the necessary bits. llvm-gcc just uses it and doesn't build a new dylib at all. Longer term, I like this option, but there may be caveats of which I'm unaware, so grain of salt and all that. Lastly, we can change the Darwin build script to install a dylib for each target compiler rather than a single dylib with symlinks for the other compilers. Architecturally, this is the most consistent with the rest of the gcc installation; however, it uses up more disk space than strictly necessary. Note that all of this is solely for Darwin. None of it touches the build for anyone else. -Jim On Aug 15, 2008, at 12:01 AM, Evan Cheng wrote: > Hi Jim, > > I don't think this is a good idea yet. Most people don't need llvm-gcc > ARM support. Perhaps this should be something that's specified on the > command line? > > I'll back this out for now. Thanks. > > Evan > > On Aug 12, 2008, at 2:13 PM, Jim Grosbach wrote: > >> Author: grosbach >> Date: Tue Aug 12 16:13:55 2008 >> New Revision: 54702 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=54702&view=rev >> Log: >> LLVM dylib needs the ARM backend as well. >> >> Modified: >> llvm-gcc-4.2/trunk/gcc/Makefile.in >> >> Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=54702&r1=54701&r2=54702&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) >> +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Tue Aug 12 16:13:55 2008 >> @@ -1152,10 +1152,10 @@ >> $(error Unsuported LLVM Target $(target)) >> endif >> >> -# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc >> backends. >> +# If in BUILD_LLVM_INTO_A_DYLIB mode, always link in the x86/ppc/ >> arm backends. >> # See below for more details. >> ifdef BUILD_LLVM_INTO_A_DYLIB >> -LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc) >> +LLVMTARGETOBJ := $(sort $(LLVMTARGETOBJ) x86 powerpc arm) >> endif >> >> # We use llvm-config to determine the libraries that we need to link >> in our >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Aug 15 11:20:26 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Aug 2008 09:20:26 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r54702 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: <41DDDA2E-3422-4489-9157-AA69BEF5DA95@apple.com> References: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> <1E711EFB-0848-4587-A63F-6762112FF357@apple.com> <41DDDA2E-3422-4489-9157-AA69BEF5DA95@apple.com> Message-ID: On Aug 15, 2008, at 8:58 AM, Jim Grosbach wrote: > I'm open to suggestions for alternatives; however, without this or > equivalent, the build is fundamentally broken on Darwin. Can you base this on a flag passed into the build_gcc script like the target arch's? -Chris From clattner at apple.com Fri Aug 15 11:22:11 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Aug 2008 09:22:11 -0700 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll In-Reply-To: <92305.89440.qm@web54604.mail.re2.yahoo.com> References: <92305.89440.qm@web54604.mail.re2.yahoo.com> Message-ID: On Aug 14, 2008, at 7:07 PM, Daniel Dunbar wrote: > I'm seeing a lot of test-suite failures which I isolated to this > commit. > In particular, in SingleSource/UnitTests/Vector, sse.expandfft, > see.stepfft, > sumarray, and sumarray-dbl are failing. It sounds like this transformation is missing a legality check. -Chris From clattner at apple.com Fri Aug 15 11:25:10 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Aug 2008 09:25:10 -0700 Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue (round 2) In-Reply-To: <909666.32410.qm@web54606.mail.re2.yahoo.com> References: <909666.32410.qm@web54606.mail.re2.yahoo.com> Message-ID: On Aug 14, 2008, at 2:59 PM, Daniel Dunbar wrote: > Now with a little more feeling. > > The attached patch adds eraseFromParent,releaseFromParent methods > to GlobalValue while avoiding the overhead of making those methods > virtual > on Function, GlobalAlias, and GlobalVariable. Looks great to me. One minor tweak: do you really need a virtual method for "erase"? It should always be "delete removeFromParent()", so you could just put that in the generic GlobalValue case. -Chris From grosbach at apple.com Fri Aug 15 12:03:58 2008 From: grosbach at apple.com (Jim Grosbach) Date: Fri, 15 Aug 2008 10:03:58 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r54702 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: References: <200808122113.m7CLDujh013664@zion.cs.uiuc.edu> <1E711EFB-0848-4587-A63F-6762112FF357@apple.com> <41DDDA2E-3422-4489-9157-AA69BEF5DA95@apple.com> Message-ID: <3D845A9E-B638-4B73-AFA0-00D950274CE3@apple.com> On Aug 15, 2008, at 9:20 AM, Chris Lattner wrote: > On Aug 15, 2008, at 8:58 AM, Jim Grosbach wrote: > >> I'm open to suggestions for alternatives; however, without this or >> equivalent, the build is fundamentally broken on Darwin. > > Can you base this on a flag passed into the build_gcc script like the > target arch's? That was my first thought, too, once I figured out that I was getting a dylib w/o ARM support even when building an ARM compiler. However, the dylib is built at a much lower level than build_gcc. The information about what other targets are also being built by the meta- script is no longer available. That's appropriate. The information about what other targets are also being built shouldn't be needed when building any individual target. This part of the build requiring that information is indicative that either building the dylib at this step is improper, or that the way we use the dylib in build_gcc is improper. Essentially, either the dylib is tied to a particular target build of llvm-gcc and using it outside of that context is improper, or the dylib is independent of any particular target build and pulling it out of a specific build is improper. Depending on which perspective we choose to adopt, we can modify the infrastructure to deal with it. Both are solvable problems. It's worth noting that it is not unreasonable to envision supporting building for multiple targets in a step-wise manner (i.e., multiple invocations of build_gcc, each creating a compiler installation, and then merging the results to obtain the final image). In that scenario, the full set of target architectures is never available at any stage and could not be passed down from build_gcc. That is, relying on the full set of targets being available when building for any single target is inherently fragile and should be avoided if possible. Note that none of this is unique to ARM. The x86/ppc bits already do this in the exact same manner to solve this same problem. My proposal is that if we want to truly fix these bits to be a cleaner build architecture, that it should be done as a two-step process. First, utilize the existing infrastructure to accomplish the task at hand. Second, refactor the infrastructure into a more elegant form. Whenever possible, I prefer not to co-mingle refactoring work with feature work. From criswell at uiuc.edu Fri Aug 15 12:52:47 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 15 Aug 2008 17:52:47 -0000 Subject: [llvm-commits] [poolalloc] r54815 - in /poolalloc/trunk: include/poolalloc/PoolAllocate.h lib/PoolAllocate/PoolAllocate.cpp lib/PoolAllocate/PoolOptimize.cpp lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200808151752.m7FHqn5S031998@zion.cs.uiuc.edu> Author: criswell Date: Fri Aug 15 12:52:42 2008 New Revision: 54815 URL: http://llvm.org/viewvc/llvm-project?rev=54815&view=rev Log: Made the SAFECode options a run-time option that is configured when the PoolAllocate pass is created. This should make configuration easier. Also removed code that ensures that instructions are added after allocas in the entry basic block. Such care should no longer be necessary. Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/include/poolalloc/PoolAllocate.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/PoolAllocate.h?rev=54815&r1=54814&r2=54815&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/PoolAllocate.h (original) +++ poolalloc/trunk/include/poolalloc/PoolAllocate.h Fri Aug 15 12:52:42 2008 @@ -77,12 +77,10 @@ /// function. std::map PoolDescriptors; -#ifdef SAFECODE - //This is a map from Old to New Value Map reverse of the one above - //Useful in SAFECode for check insertion + /// This is a map from Old to New Values (the reverse of NewToOldValueMap). + /// SAFECode uses this for check insertion. std::map ValueMap; -#endif - + /// NewToOldValueMap - When and if a function needs to be cloned, this map /// contains a mapping from all of the values in the new function back to /// the values they correspond to in the old function. @@ -110,6 +108,8 @@ public: static char ID; Constant *PoolRegister; + bool SAFECodeEnabled; + bool BoundsChecksEnabled; virtual ~PoolAllocateGroup () {return;} virtual PA::FuncInfo *getFuncInfo(Function &F) { return 0;} @@ -169,13 +169,12 @@ public: static char ID; -#ifdef SAFECODE - PoolAllocate(bool passAllArguments = true, intptr_t IDp = (intptr_t) (&ID)) - : ModulePass((intptr_t)IDp), PassAllArguments(passAllArguments) {} -#else - PoolAllocate(bool passAllArguments = false, intptr_t IDp = (intptr_t) (&ID)) - : ModulePass((intptr_t)IDp), PassAllArguments(passAllArguments) {} -#endif + PoolAllocate (bool passAllArguments = false, + bool SAFECode = false, + intptr_t IDp = (intptr_t) (&ID)) + : ModulePass((intptr_t)IDp), + PassAllArguments(passAllArguments) + {SAFECodeEnabled = BoundsChecksEnabled = SAFECode;} virtual bool runOnModule(Module &M); virtual void getAnalysisUsage(AnalysisUsage &AU) const; @@ -230,11 +229,10 @@ /// getPoolType - Return the type of a pool descriptor const Type * getPoolType() { Type * VoidPtrType = PointerType::getUnqual(Type::Int8Ty); -#ifdef SAFECODE - return ArrayType::get(VoidPtrType, 50); -#else - return ArrayType::get(VoidPtrType, 16); -#endif + if (SAFECodeEnabled) + return ArrayType::get(VoidPtrType, 50); + else + return ArrayType::get(VoidPtrType, 16); } virtual DSGraph & getDSGraph (const Function & F) const { @@ -368,7 +366,8 @@ TargetData * TD; public: static char ID; - PoolAllocateSimple() : PoolAllocate(false, (intptr_t)&ID) {} + PoolAllocateSimple(bool passAllArgs=false, bool SAFECode = false) + : PoolAllocate (passAllArgs, SAFECode, (intptr_t)&ID) {} ~PoolAllocateSimple() {return;} void getAnalysisUsage(AnalysisUsage &AU) const; bool runOnModule(Module &M); Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=54815&r1=54814&r2=54815&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Fri Aug 15 12:52:42 2008 @@ -93,14 +93,11 @@ void PoolAllocate::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredTransitive(); AU.addPreserved(); -#ifdef SAFECODE - //Dinakar for preserving the pool information across passes - AU.setPreservesAll(); -#endif -#ifdef BOUNDS_CHECK - //Dinakar hack for preserving the pool information across passes - AU.setPreservesAll(); -#endif + + // Preserve the pool information across passes + if (SAFECodeEnabled) + AU.setPreservesAll(); + AU.addRequired(); if (UseTDResolve) AU.addRequired(); @@ -225,11 +222,9 @@ // Get the poolfree function. PoolFree = M->getOrInsertFunction("poolfree", Type::VoidTy, PoolDescPtrTy, VoidPtrTy, NULL); -#if defined(SAFECODE) || defined(BOUNDS_CHECK) //Get the poolregister function PoolRegister = M->getOrInsertFunction("poolregister", Type::VoidTy, PoolDescPtrTy, VoidPtrTy, Type::Int32Ty, NULL); -#endif } static void getCallsOf(Constant *C, std::vector &Calls) { @@ -413,11 +408,10 @@ // Map the existing arguments of the old function to the corresponding // arguments of the new function, and copy over the names. DenseMap ValueMap; -#ifdef SAFECODE - for (std::map::iterator I = FI.ValueMap.begin(), - E = FI.ValueMap.end(); I != E; ++I) - ValueMap.insert(std::make_pair(I->first, I->second)); -#endif + if (SAFECodeEnabled) + for (std::map::iterator I = FI.ValueMap.begin(), + E = FI.ValueMap.end(); I != E; ++I) + ValueMap.insert(std::make_pair(I->first, I->second)); for (Function::arg_iterator I = F.arg_begin(); NI != New->arg_end(); ++I, ++NI) { ValueMap[I] = NI; @@ -486,12 +480,19 @@ for (hash_set::iterator I = GlobalHeapNodes.begin(), E = GlobalHeapNodes.end(); I != E; ) { hash_set::iterator Last = I++; -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - // if (!(*Last)->isHeapNode()); - // GlobalHeapNodes.erase(Last); -#endif + +#if 0 + // + // FIXME: + // This code was disabled for regular pool allocation, but I don't know + // why. + // + if (!SAFECodeEnabled) { + if (!(*Last)->isHeapNode()); + GlobalHeapNodes.erase(Last); + } #endif + const DSNode *tmp = *Last; // std::cerr << "test \n"; if (!(tmp->isHeapNode() || tmp->isArray())) @@ -516,11 +517,7 @@ CurHeuristic->AssignToPools(NodesToPA, 0, GG, ResultPools); BasicBlock::iterator InsertPt = MainFunc->getEntryBlock().begin(); -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - while (isa(InsertPt)) ++InsertPt; -#endif -#endif + // Perform all global assignments as specified. for (unsigned i = 0, e = ResultPools.size(); i != e; ++i) { Heuristic::OnePool &Pool = ResultPools[i]; @@ -600,11 +597,7 @@ std::set UnallocatedNodes(NodesToPA.begin(), NodesToPA.end()); BasicBlock::iterator InsertPoint = F.front().begin(); -#ifndef SAFECODE -#ifndef BOUNDS_CHECK - while (isa(InsertPoint)) ++InsertPoint; -#endif -#endif + // Is this main? If so, make the pool descriptors globals, not automatic // vars. bool IsMain = F.getName() == "main" && F.hasExternalLinkage(); @@ -675,11 +668,7 @@ for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end(); I != E;++I){ // We only need to make a pool if there is a heap object in it... DSNode *N = I; -#ifdef BOUNDS_CHECK - if ((N->isArray()) || (N->isHeapNode())) -#else - if (N->isHeapNode()) -#endif + if ((N->isHeapNode()) || (BoundsChecksEnabled && (N->isArray()))) if (GlobalsGraphNodeMapping.count(N)) { // If it is a global pool, set up the pool descriptor appropriately. DSNode *GGN = GlobalsGraphNodeMapping[N].getNode(); Modified: poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp?rev=54815&r1=54814&r2=54815&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp Fri Aug 15 12:52:42 2008 @@ -26,7 +26,11 @@ struct PoolOptimize : public ModulePass { static char ID; - PoolOptimize() : ModulePass((intptr_t)&ID) {} + bool SAFECodeEnabled; + + PoolOptimize(bool SAFECode = false) : ModulePass((intptr_t)&ID) { + SAFECodeEnabled = SAFECode; + } bool runOnModule(Module &M); }; @@ -51,12 +55,11 @@ bool PoolOptimize::runOnModule(Module &M) { const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); -#ifdef SAFECODE - const Type *PoolDescPtrTy = PointerType::getUnqual(ArrayType::get(VoidPtrTy, 50)); -#else - const Type *PoolDescPtrTy = PointerType::getUnqual(ArrayType::get(VoidPtrTy, 16)); -#endif - + const Type *PoolDescPtrTy; + if (SAFECodeEnabled) + PoolDescPtrTy = PointerType::getUnqual(ArrayType::get(VoidPtrTy, 50)); + else + PoolDescPtrTy = PointerType::getUnqual(ArrayType::get(VoidPtrTy, 16)); // Get poolinit function. Constant *PoolInit = M.getOrInsertFunction("poolinit", Type::VoidTy, Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=54815&r1=54814&r2=54815&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Aug 15 12:52:42 2008 @@ -208,50 +208,52 @@ if (MI.isArrayAllocation()) AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, MI.getOperand(0), "sizetmp", &MI); -// -// NOTE: -// The code below used to be used by SAFECode. However, it requires -// Pool Allocation to depend upon SAFECode passes, which is messy. -// -// I believe the code below is an unneeded optimization. Basically, when -// SAFECode promotes a stack allocation to the heap, this makes it a stack -// allocation again if the DSNode has no heap allocations. This seems to be -// a performance optimization and unnecessary for the first prototype. -// -#ifdef SAFECODE + // + // NOTE: + // The code below used to be used by SAFECode. However, it requires + // Pool Allocation to depend upon SAFECode passes, which is messy. + // + // I believe the code below is an unneeded optimization. Basically, when + // SAFECode promotes a stack allocation to the heap, this makes it a stack + // allocation again if the DSNode has no heap allocations. This seems to be + // a performance optimization and unnecessary for the first prototype. + // + if (PAInfo.SAFECodeEnabled) { #if 0 - const MallocInst *originalMalloc = &MI; - if (FI.NewToOldValueMap.count(&MI)) { - originalMalloc = cast(FI.NewToOldValueMap[&MI]); - } - //Dinakar to test stack safety & array safety - if (PAInfo.CUAPass->ArrayMallocs.find(originalMalloc) == - PAInfo.CUAPass->ArrayMallocs.end()) { - TransformAllocationInstr(&MI, AllocSize); - } else { - AllocaInst *AI = new AllocaInst(MI.getType()->getElementType(), MI.getArraySize(), MI.getName(), MI.getNext()); - MI.replaceAllUsesWith(AI); - MI.getParent()->getInstList().erase(&MI); - Value *Casted = AI; - Instruction *aiNext = AI->getNext(); - if (AI->getType() != PointerType::getUnqual(Type::Int8Ty)) - Casted = CastInst::createPointerCast(AI, PointerType::getUnqual(Type::Int8Ty), - AI->getName()+".casted",aiNext); - - Instruction *V = CallInst::Create(PAInfo.PoolRegister, - make_vector(PH, AllocSize, Casted, 0), "", aiNext); - AddPoolUse(*V, PH, PoolUses); - } -#else - TransformAllocationInstr(&MI, AllocSize); -#endif + const MallocInst *originalMalloc = &MI; + if (FI.NewToOldValueMap.count(&MI)) { + originalMalloc = cast(FI.NewToOldValueMap[&MI]); + } + //Dinakar to test stack safety & array safety + if (PAInfo.CUAPass->ArrayMallocs.find(originalMalloc) == + PAInfo.CUAPass->ArrayMallocs.end()) { + TransformAllocationInstr(&MI, AllocSize); + } else { + AllocaInst *AI = new AllocaInst(MI.getType()->getElementType(), MI.getArraySize(), MI.getName(), MI.getNext()); + MI.replaceAllUsesWith(AI); + MI.getParent()->getInstList().erase(&MI); + Value *Casted = AI; + Instruction *aiNext = AI->getNext(); + if (AI->getType() != PointerType::getUnqual(Type::Int8Ty)) + Casted = CastInst::createPointerCast(AI, PointerType::getUnqual(Type::Int8Ty), + AI->getName()+".casted",aiNext); + + Instruction *V = CallInst::Create(PAInfo.PoolRegister, + make_vector(PH, AllocSize, Casted, 0), "", aiNext); + AddPoolUse(*V, PH, PoolUses); + } #else - TransformAllocationInstr(&MI, AllocSize); + TransformAllocationInstr(&MI, AllocSize); #endif + } else { + TransformAllocationInstr(&MI, AllocSize); + } } void FuncTransform::visitAllocaInst(AllocaInst &MI) { -#ifdef BOUNDS_CHECK + // Don't do anything if bounds checking will not be done by SAFECode later. + if (!(PAInfo.BoundsChecksEnabled)) return; + // Get the pool handle for the node that this contributes to... DSNode *Node = getDSNodeHFor(&MI).getNode(); if (Node->isArray()) { @@ -278,7 +280,6 @@ args.begin(), args.end(), "", InsertPt); AddPoolUse(*V, PH, PoolUses); } -#endif } @@ -728,28 +729,24 @@ if (FI.PoolDescriptors.count(LocalNode)) ArgVal = FI.PoolDescriptors.find(LocalNode)->second; if (isa(ArgVal) && cast(ArgVal)->isNullValue()) { -#ifdef BOUNDS_CHECK - if (ArgNodes[i]->isArray()) { -#endif - if (!isa(TheCall)) { - // Dinakar: We need pooldescriptors for allocas in the callee if it - // escapes - BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); - Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); - ArgVal = new AllocaInst(PAInfo.getPoolType(), 0, "PD", InsertPt); - Value *ElSize = ConstantInt::get(Type::Int32Ty,0); - Value *Align = ConstantInt::get(Type::Int32Ty,0); - Value* Opts[3] = {ArgVal, ElSize, Align}; - CallInst::Create(PAInfo.PoolInit, Opts, Opts + 3,"", TheCall); - BasicBlock::iterator BBI = TheCall; - CallInst::Create(PAInfo.PoolDestroy, ArgVal, "", ++BBI); - } + if ((!(PAInfo.BoundsChecksEnabled)) || (ArgNodes[i]->isArray())) { + if (!isa(TheCall)) { + // Dinakar: We need pooldescriptors for allocas in the callee if it + // escapes + BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); + Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); + ArgVal = new AllocaInst(PAInfo.getPoolType(), 0, "PD", InsertPt); + Value *ElSize = ConstantInt::get(Type::Int32Ty,0); + Value *Align = ConstantInt::get(Type::Int32Ty,0); + Value* Opts[3] = {ArgVal, ElSize, Align}; + CallInst::Create(PAInfo.PoolInit, Opts, Opts + 3,"", TheCall); + BasicBlock::iterator BBI = TheCall; + CallInst::Create(PAInfo.PoolDestroy, ArgVal, "", ++BBI); + } - //probably need to update DSG - // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; -#ifdef BOUNDS_CHECK + //probably need to update DSG + // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; } -#endif } Args.push_back(ArgVal); } From criswell at uiuc.edu Fri Aug 15 12:58:44 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 15 Aug 2008 17:58:44 -0000 Subject: [llvm-commits] [poolalloc] r54816 - in /poolalloc/trunk: autoconf/configure.ac configure include/poolalloc/Config/config.h.in Message-ID: <200808151758.m7FHwilx032277@zion.cs.uiuc.edu> Author: criswell Date: Fri Aug 15 12:58:44 2008 New Revision: 54816 URL: http://llvm.org/viewvc/llvm-project?rev=54816&view=rev Log: Remove old autoconf options for enabling SAFECode options. These are now always available and can be enabled at run-time. Modified: poolalloc/trunk/autoconf/configure.ac poolalloc/trunk/configure poolalloc/trunk/include/poolalloc/Config/config.h.in Modified: poolalloc/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/autoconf/configure.ac?rev=54816&r1=54815&r2=54816&view=diff ============================================================================== --- poolalloc/trunk/autoconf/configure.ac (original) +++ poolalloc/trunk/autoconf/configure.ac Fri Aug 15 12:58:44 2008 @@ -65,20 +65,6 @@ dnl * Enable various compile-time options dnl ************************************************************************** -dnl --enable-safecode: Enable SAFECode functionality -AC_ARG_ENABLE(safecode, - AS_HELP_STRING(--enable-safecode, - [Enable SAFECode functionality (default is NO)]), - AC_DEFINE(SAFECODE,[[1]]), - ) - -dnl --enable-boundscheck: Enable SAFECode Bounds Check functionality -AC_ARG_ENABLE(boundschecks, - AS_HELP_STRING(--enable-boundschecks, - [Enable SAFECode bounds checking (default is NO)]), - AC_DEFINE(BOUNDS_CHECK,[[1]]), - ) - dnl --enable-llva-kernel: Compile DSA for pool inference AC_ARG_ENABLE(kernel, AS_HELP_STRING(--enable-kernel, Modified: poolalloc/trunk/configure URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/configure?rev=54816&r1=54815&r2=54816&view=diff ============================================================================== --- poolalloc/trunk/configure (original) +++ poolalloc/trunk/configure Fri Aug 15 12:58:44 2008 @@ -844,8 +844,6 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-safecode Enable SAFECode functionality (default is NO) - --enable-boundschecks Enable SAFECode bounds checking (default is NO) --enable-kernel Use SAFECode for use with Linux Kernel (default is NO) @@ -3635,24 +3633,6 @@ fi -# Check whether --enable-safecode or --disable-safecode was given. -if test "${enable_safecode+set}" = set; then - enableval="$enable_safecode" - cat >>confdefs.h <<\_ACEOF -#define SAFECODE 1 -_ACEOF - -fi; - -# Check whether --enable-boundschecks or --disable-boundschecks was given. -if test "${enable_boundschecks+set}" = set; then - enableval="$enable_boundschecks" - cat >>confdefs.h <<\_ACEOF -#define BOUNDS_CHECK 1 -_ACEOF - -fi; - # Check whether --enable-kernel or --disable-kernel was given. if test "${enable_kernel+set}" = set; then enableval="$enable_kernel" Modified: poolalloc/trunk/include/poolalloc/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/poolalloc/Config/config.h.in?rev=54816&r1=54815&r2=54816&view=diff ============================================================================== --- poolalloc/trunk/include/poolalloc/Config/config.h.in (original) +++ poolalloc/trunk/include/poolalloc/Config/config.h.in Fri Aug 15 12:58:44 2008 @@ -466,12 +466,6 @@ /* Define to `unsigned' if does not define. */ #undef size_t -/* Define to 1 if enabling SAFECode */ -#undef SAFECODE - -/* Define to 1 if enabling SAFECode bounds checking */ -#undef BOUNDS_CHECK - /* Define to 1 if compiling for pool inference */ #undef LLVA_KERNEL From baldrick at free.fr Fri Aug 15 13:07:13 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 15 Aug 2008 20:07:13 +0200 Subject: [llvm-commits] legalize types, fneg support In-Reply-To: <275e64e40808111219o3c01d05anbae54ddb7c30126a@mail.gmail.com> References: <275e64e40808111219o3c01d05anbae54ddb7c30126a@mail.gmail.com> Message-ID: <200808152007.13301.baldrick@free.fr> Hi Bruno, > Patch to Soften float fneg results, Mips need this (while in single > float only mode) for f64 fneg results. looks good to me. Thanks for doing this! Duncan. From criswell at uiuc.edu Fri Aug 15 13:07:44 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 15 Aug 2008 18:07:44 -0000 Subject: [llvm-commits] [poolalloc] r54817 - /poolalloc/trunk/LICENSE.TXT Message-ID: <200808151807.m7FI7iEi032687@zion.cs.uiuc.edu> Author: criswell Date: Fri Aug 15 13:07:43 2008 New Revision: 54817 URL: http://llvm.org/viewvc/llvm-project?rev=54817&view=rev Log: Updated copyright years. Modified: poolalloc/trunk/LICENSE.TXT Modified: poolalloc/trunk/LICENSE.TXT URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/LICENSE.TXT?rev=54817&r1=54816&r2=54817&view=diff ============================================================================== --- poolalloc/trunk/LICENSE.TXT (original) +++ poolalloc/trunk/LICENSE.TXT Fri Aug 15 13:07:43 2008 @@ -4,7 +4,7 @@ University of Illinois/NCSA Open Source License -Copyright (c) 2003, 2004, 2005, 2006 University of Illinois at Urbana-Champaign. +Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: From daniel at zuster.org Fri Aug 15 13:17:37 2008 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 15 Aug 2008 11:17:37 -0700 (PDT) Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue (round 2) Message-ID: <701415.2169.qm@web54601.mail.re2.yahoo.com> > Looks great to me. One minor tweak: do you really need a virtual > method for "erase"? It should always be "delete removeFromParent()", > so you could just put that in the generic GlobalValue case. Currently eraseFromParent is not "delete removeFromParent()", it is a call to erase on the iplist. If this distinction is not important then I will drop eraseFromParent from the subclasses. - Daniel From resistor at mac.com Fri Aug 15 13:45:51 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 15 Aug 2008 18:45:51 -0000 Subject: [llvm-commits] [llvm] r54819 - /llvm/trunk/include/llvm/ADT/SmallVector.h Message-ID: <200808151845.m7FIjpFh001375@zion.cs.uiuc.edu> Author: resistor Date: Fri Aug 15 13:45:51 2008 New Revision: 54819 URL: http://llvm.org/viewvc/llvm-project?rev=54819&view=rev Log: Add a value_type typedef to SmallVector, to make it more compatible with STL adapters. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=54819&r1=54818&r2=54819&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Fri Aug 15 13:45:51 2008 @@ -90,6 +90,7 @@ } typedef size_t size_type; + typedef T value_type; typedef T* iterator; typedef const T* const_iterator; From resistor at mac.com Fri Aug 15 13:49:41 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 15 Aug 2008 18:49:41 -0000 Subject: [llvm-commits] [llvm] r54820 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200808151849.m7FInfDr001493@zion.cs.uiuc.edu> Author: resistor Date: Fri Aug 15 13:49:41 2008 New Revision: 54820 URL: http://llvm.org/viewvc/llvm-project?rev=54820&view=rev Log: Convert several std::vectors over to SmallVector, and use reserve() as appropriate for cases where std::vector is still used. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=54820&r1=54819&r2=54820&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Aug 15 13:49:41 2008 @@ -58,7 +58,7 @@ RALinScan() : MachineFunctionPass((intptr_t)&ID) {} typedef std::pair IntervalPtr; - typedef std::vector IntervalPtrs; + typedef SmallVector IntervalPtrs; private: /// RelatedRegClasses - This structure is built the first time a function is /// compiled, and keeps track of which register classes have registers that @@ -94,7 +94,7 @@ IntervalPtrs inactive_; typedef std::priority_queue, + SmallVector, greater_ptr > IntervalHeap; IntervalHeap unhandled_; std::auto_ptr prt_; @@ -322,6 +322,8 @@ active_.empty() && inactive_.empty() && "interval sets should be empty on initialization"); + handled_.reserve(li_->getNumIntervals()); + for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) { reginfo_->setPhysRegUsed(i->second->reg); From dpatel at apple.com Fri Aug 15 14:12:47 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Aug 2008 12:12:47 -0700 Subject: [llvm-commits] [llvm] r54786 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll In-Reply-To: References: Message-ID: <9405E979-9D2A-40D4-BFCC-73CA886E3D3C@apple.com> On Aug 14, 2008, at 9:31 PM, Eli Friedman wrote: > I'm not sure if this is related to the patch, but one testcase I was > trying that I expected to trigger the new code didn't end up > triggering it, for reasons I haven't yet figured out: > > unsigned y(double); > unsigned x(unsigned long long a) { > unsigned long long i = 0; > unsigned x = 0; > for ( ; i < a; x++, i++) y(x); > } In this case, IV is truncated from long long to unsigned before type casted into double, hence it escapes this new code. - Devang From dpatel at apple.com Fri Aug 15 16:21:37 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Aug 2008 21:21:37 -0000 Subject: [llvm-commits] [llvm] r54821 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Message-ID: <200808152121.m7FLLcgE006735@zion.cs.uiuc.edu> Author: dpatel Date: Fri Aug 15 16:21:34 2008 New Revision: 54821 URL: http://llvm.org/viewvc/llvm-project?rev=54821&view=rev Log: Reapply 54786. Add overflow and number of mantissa bits checks. Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=54821&r1=54820&r2=54821&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Aug 15 16:21:34 2008 @@ -45,6 +45,7 @@ STATISTIC(NumInserted, "Number of PHIs inserted"); STATISTIC(NumVariable, "Number of PHIs with variable strides"); STATISTIC(NumEliminated , "Number of strides eliminated"); +STATISTIC(NumShadow , "Number of Shadow IVs optimized"); namespace { @@ -177,8 +178,13 @@ IVStrideUse* &CondUse, const SCEVHandle* &CondStride); void OptimizeIndvars(Loop *L); + + /// OptimizeShadowIV - If IV is used in a int-to-float cast + /// inside the loop then try to eliminate the cast opeation. + void OptimizeShadowIV(Loop *L, ICmpInst *Cond, + const SCEVHandle *&CondStride); bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse, - const SCEVHandle *&CondStride); + const SCEVHandle *&CondStride); bool RequiresTypeConversion(const Type *Ty, const Type *NewTy); unsigned CheckForIVReuse(bool, bool, const SCEVHandle&, IVExpr&, const Type*, @@ -1689,6 +1695,115 @@ return Cond; } +/// OptimizeShadowIV - If IV is used in a int-to-float cast +/// inside the loop then try to eliminate the cast opeation. +void LoopStrengthReduce::OptimizeShadowIV(Loop *L, ICmpInst *Cond, + const SCEVHandle *&CondStride) { + + const SCEVConstant *SC = dyn_cast(*CondStride); + if (!SC) return; + + SCEVHandle IterationCount = SE->getIterationCount(L); + if (isa(IterationCount)) + return; + + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e; + ++Stride) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[Stride]); + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); + + for (std::vector::iterator UI = SI->second.Users.begin(), + E = SI->second.Users.end(); UI != E; /* empty */) { + std::vector::iterator CandidateUI = UI; + UI++; + Instruction *ShadowUse = CandidateUI->User; + const Type *DestTy = NULL; + + /* If shadow use is a int->float cast then insert a second IV + to elminate this cast. + + for (unsigned i = 0; i < n; ++i) + foo((double)i); + + is trnasformed into + + double d = 0.0; + for (unsigned i = 0; i < n; ++i, ++d) + foo(d); + */ + UIToFPInst *UCast = dyn_cast(CandidateUI->User); + if (UCast) + DestTy = UCast->getDestTy(); + else { + SIToFPInst *SCast = dyn_cast(CandidateUI->User); + if (!SCast) continue; + DestTy = SCast->getDestTy(); + } + + PHINode *PH = dyn_cast(ShadowUse->getOperand(0)); + if (!PH) continue; + if (PH->getNumIncomingValues() != 2) continue; + + const Type *SrcTy = PH->getType(); + int Mantissa = DestTy->getFPMantissaWidth(); + if (Mantissa == -1) continue; + if ((int)TD->getTypeSizeInBits(SrcTy) > Mantissa) + continue; + + unsigned Entry, Latch; + if (PH->getIncomingBlock(0) == L->getLoopPreheader()) { + Entry = 0; + Latch = 1; + } else { + Entry = 1; + Latch = 0; + } + + ConstantInt *Init = dyn_cast(PH->getIncomingValue(Entry)); + if (!Init) continue; + ConstantFP *NewInit = ConstantFP::get(DestTy, Init->getZExtValue()); + + BinaryOperator *Incr = + dyn_cast(PH->getIncomingValue(Latch)); + if (!Incr) continue; + if (Incr->getOpcode() != Instruction::Add + && Incr->getOpcode() != Instruction::Sub) + continue; + + /* Initialize new IV, double d = 0.0 in above example. */ + ConstantInt *C = NULL; + if (Incr->getOperand(0) == PH) + C = dyn_cast(Incr->getOperand(1)); + else if (Incr->getOperand(1) == PH) + C = dyn_cast(Incr->getOperand(0)); + else + continue; + + if (!C) continue; + + /* Add new PHINode. */ + PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH); + + /* create new icnrement. '++d' in above example. */ + ConstantFP *CFP = ConstantFP::get(DestTy, C->getZExtValue()); + BinaryOperator *NewIncr = + BinaryOperator::Create(Incr->getOpcode(), + NewPH, CFP, "IV.S.next.", Incr); + + NewPH->addIncoming(NewInit, PH->getIncomingBlock(Entry)); + NewPH->addIncoming(NewIncr, PH->getIncomingBlock(Latch)); + + /* Remove cast operation */ + ShadowUse->replaceAllUsesWith(NewPH); + ShadowUse->eraseFromParent(); + SI->second.Users.erase(CandidateUI); + NumShadow++; + break; + } + } +} + // OptimizeIndvars - Now that IVUsesByStride is set up with all of the indvar // uses in the loop, look to see if we can eliminate some, in favor of using // common indvars for the different uses. @@ -1716,6 +1831,8 @@ if (!FindIVUserForCond(Cond, CondUse, CondStride)) return; // setcc doesn't use the IV. + OptimizeShadowIV(L, Cond, CondStride); + // If possible, change stride and operands of the compare instruction to // eliminate one stride. Cond = ChangeCompareStride(L, Cond, CondUse, CondStride); Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll?rev=54821&r1=54820&r2=54821&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll (original) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll Fri Aug 15 16:21:34 2008 @@ -0,0 +1,99 @@ +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" | count 1 + +define void @foobar(i32 %n) nounwind { +entry: + icmp eq i32 %n, 0 ; :0 [#uses=2] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %umax = select i1 %0, i32 1, i32 %n ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.nph + %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] + tail call void @bar( i32 %i.03 ) nounwind + uitofp i32 %i.03 to double ; :1 [#uses=1] + tail call void @foo( double %1 ) nounwind + %indvar.next = add i32 %i.03, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %umax ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret void +} + +; Unable to eliminate cast because the mantissa bits for double are not enough +; to hold all of i64 IV bits. +define void @foobar2(i64 %n) nounwind { +entry: + icmp eq i64 %n, 0 ; :0 [#uses=2] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %umax = select i1 %0, i64 1, i64 %n ; [#uses=1] + br label %bb + +bb: ; preds = %bb, %bb.nph + %i.03 = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] + trunc i64 %i.03 to i32 ; :1 [#uses=1] + tail call void @bar( i32 %1 ) nounwind + uitofp i64 %i.03 to double ; :2 [#uses=1] + tail call void @foo( double %2 ) nounwind + %indvar.next = add i64 %i.03, 1 ; [#uses=2] + %exitcond = icmp eq i64 %indvar.next, %umax ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret void +} + +; Unable to eliminate cast due to potentional overflow. +define void @foobar3() nounwind { +entry: + tail call i32 (...)* @nn( ) nounwind ; :0 [#uses=1] + icmp eq i32 %0, 0 ; :1 [#uses=1] + br i1 %1, label %return, label %bb + +bb: ; preds = %bb, %entry + %i.03 = phi i32 [ 0, %entry ], [ %3, %bb ] ; [#uses=3] + tail call void @bar( i32 %i.03 ) nounwind + uitofp i32 %i.03 to double ; :2 [#uses=1] + tail call void @foo( double %2 ) nounwind + add i32 %i.03, 1 ; :3 [#uses=2] + tail call i32 (...)* @nn( ) nounwind ; :4 [#uses=1] + icmp ugt i32 %4, %3 ; :5 [#uses=1] + br i1 %5, label %bb, label %return + +return: ; preds = %bb, %entry + ret void +} + +; Unable to eliminate cast due to overflow. +define void @foobar4() nounwind { +entry: + br label %bb.nph + +bb.nph: ; preds = %entry + br label %bb + +bb: ; preds = %bb, %bb.nph + %i.03 = phi i8 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; [#uses=3] + %tmp2 = sext i8 %i.03 to i32 ; :0 [#uses=1] + tail call void @bar( i32 %tmp2 ) nounwind + %tmp3 = uitofp i8 %i.03 to double ; :1 [#uses=1] + tail call void @foo( double %tmp3 ) nounwind + %indvar.next = add i8 %i.03, 1 ; [#uses=2] + %tmp = sext i8 %indvar.next to i32 + %exitcond = icmp eq i32 %tmp, 32767 ; [#uses=1] + br i1 %exitcond, label %return, label %bb + +return: ; preds = %bb, %entry + ret void +} + +declare void @bar(i32) + +declare void @foo(double) + +declare i32 @nn(...) + From resistor at mac.com Fri Aug 15 16:31:04 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 15 Aug 2008 21:31:04 -0000 Subject: [llvm-commits] [llvm] r54822 - in /llvm/trunk: include/llvm/Analysis/LoadValueNumbering.h include/llvm/Analysis/Passes.h include/llvm/Analysis/ValueNumbering.h include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h lib/Analysis/LoadValueNumbering.cpp lib/Analysis/ValueNumbering.cpp lib/Transforms/Scalar/GCSE.cpp tools/llvm-ld/Optimize.cpp tools/lto/LTOCodeGenerator.cpp Message-ID: <200808152131.m7FLV5m7007048@zion.cs.uiuc.edu> Author: resistor Date: Fri Aug 15 16:31:02 2008 New Revision: 54822 URL: http://llvm.org/viewvc/llvm-project?rev=54822&view=rev Log: Remove GCSE, ValueNumbering, and LoadValueNumbering. These have been deprecated for almost a year; it's finally time for them to go away. Removed: llvm/trunk/include/llvm/Analysis/LoadValueNumbering.h llvm/trunk/include/llvm/Analysis/ValueNumbering.h llvm/trunk/lib/Analysis/LoadValueNumbering.cpp llvm/trunk/lib/Analysis/ValueNumbering.cpp llvm/trunk/lib/Transforms/Scalar/GCSE.cpp Modified: llvm/trunk/include/llvm/Analysis/Passes.h llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/Scalar.h llvm/trunk/tools/llvm-ld/Optimize.cpp llvm/trunk/tools/lto/LTOCodeGenerator.cpp Removed: llvm/trunk/include/llvm/Analysis/LoadValueNumbering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoadValueNumbering.h?rev=54821&view=auto ============================================================================== --- llvm/trunk/include/llvm/Analysis/LoadValueNumbering.h (original) +++ llvm/trunk/include/llvm/Analysis/LoadValueNumbering.h (removed) @@ -1,35 +0,0 @@ -//===- llvm/Analysis/LoadValueNumbering.h - Value # Load Insts --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a value numbering pass that value #'s load instructions. -// To do this, it finds lexically identical load instructions, and uses alias -// analysis to determine which loads are guaranteed to produce the same value. -// -// This pass builds off of another value numbering pass to implement value -// numbering for non-load instructions. It uses Alias Analysis so that it can -// disambiguate the load instructions. The more powerful these base analyses -// are, the more powerful the resultant analysis will be. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H -#define LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H - -namespace llvm { - -class FunctionPass; - -/// createLoadValueNumberingPass - Create and return a new pass that implements -/// the ValueNumbering interface. -/// -FunctionPass *createLoadValueNumberingPass(); - -} // End llvm namespace - -#endif Modified: llvm/trunk/include/llvm/Analysis/Passes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Passes.h?rev=54822&r1=54821&r2=54822&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Passes.h (original) +++ llvm/trunk/include/llvm/Analysis/Passes.h Fri Aug 15 16:31:02 2008 @@ -79,13 +79,6 @@ //===--------------------------------------------------------------------===// // - // createBasicVNPass - This pass walks SSA def-use chains to trivially - // identify lexically identical expressions. - // - ImmutablePass *createBasicVNPass(); - - //===--------------------------------------------------------------------===// - // // createProfileLoaderPass - This pass loads information from a profile dump // file. // Removed: llvm/trunk/include/llvm/Analysis/ValueNumbering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueNumbering.h?rev=54821&view=auto ============================================================================== --- llvm/trunk/include/llvm/Analysis/ValueNumbering.h (original) +++ llvm/trunk/include/llvm/Analysis/ValueNumbering.h (removed) @@ -1,75 +0,0 @@ -//===- llvm/Analysis/ValueNumbering.h - Value #'ing Interface ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the abstract ValueNumbering interface, which is used as the -// common interface used by all clients of value numbering information, and -// implemented by all value numbering implementations. -// -// Implementations of this interface must implement the various virtual methods, -// which automatically provides functionality for the entire suite of client -// APIs. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_VALUE_NUMBERING_H -#define LLVM_ANALYSIS_VALUE_NUMBERING_H - -#include -#include "llvm/Pass.h" -#include "llvm/System/IncludeFile.h" - -namespace llvm { - -class Value; -class Instruction; - -struct ValueNumbering { - static char ID; // Class identification, replacement for typeinfo - virtual ~ValueNumbering(); // We want to be subclassed - - /// getEqualNumberNodes - Return nodes with the same value number as the - /// specified Value. This fills in the argument vector with any equal values. - /// - virtual void getEqualNumberNodes(Value *V1, - std::vector &RetVals) const = 0; - - ///===-------------------------------------------------------------------===// - /// Interfaces to update value numbering analysis information as the client - /// changes the program. - /// - - /// deleteValue - This method should be called whenever an LLVM Value is - /// deleted from the program, for example when an instruction is found to be - /// redundant and is eliminated. - /// - virtual void deleteValue(Value *V) {} - - /// copyValue - This method should be used whenever a preexisting value in the - /// program is copied or cloned, introducing a new value. Note that analysis - /// implementations should tolerate clients that use this method to introduce - /// the same value multiple times: if the analysis already knows about a - /// value, it should ignore the request. - /// - virtual void copyValue(Value *From, Value *To) {} - - /// replaceWithNewValue - This method is the obvious combination of the two - /// above, and it provided as a helper to simplify client code. - /// - void replaceWithNewValue(Value *Old, Value *New) { - copyValue(Old, New); - deleteValue(Old); - } -}; - -} // End llvm namespace - -// Force any file including this header to get the implementation as well -FORCE_DEFINING_FILE_TO_BE_LINKED(BasicValueNumbering) - -#endif Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=54822&r1=54821&r2=54822&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Fri Aug 15 16:31:02 2008 @@ -18,7 +18,6 @@ #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/FindUsedTypes.h" #include "llvm/Analysis/IntervalPartition.h" -#include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/Analysis/LoopVR.h" #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/PostDominators.h" @@ -50,7 +49,6 @@ (void) llvm::createStructRetPromotionPass(); (void) llvm::createBasicAliasAnalysisPass(); (void) llvm::createLibCallAliasAnalysisPass(0); - (void) llvm::createBasicVNPass(); (void) llvm::createBlockPlacementPass(); (void) llvm::createBlockProfilerPass(); (void) llvm::createBreakCriticalEdgesPass(); @@ -65,7 +63,6 @@ (void) llvm::createEdgeProfilerPass(); (void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionProfilerPass(); - (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); (void) llvm::createGlobalOptimizerPass(); (void) llvm::createGlobalsModRefPass(); @@ -77,7 +74,6 @@ (void) llvm::createInternalizePass(false); (void) llvm::createLCSSAPass(); (void) llvm::createLICMPass(); - (void) llvm::createLoadValueNumberingPass(); (void) llvm::createLoopExtractorPass(); (void) llvm::createLoopSimplifyPass(); (void) llvm::createLoopStrengthReducePass(); Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=54822&r1=54821&r2=54822&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Fri Aug 15 16:31:02 2008 @@ -78,15 +78,6 @@ //===----------------------------------------------------------------------===// // -// GCSE - This pass is designed to be a very quick global transformation that -// eliminates global common subexpressions from a function. It does this by -// examining the SSA value graph of the function, instead of doing slow -// bit-vector computations. -// -FunctionPass *createGCSEPass(); - -//===----------------------------------------------------------------------===// -// // InductionVariableSimplify - Transform induction variables in a program to all // use a single canonical induction variable per loop. // Removed: llvm/trunk/lib/Analysis/LoadValueNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoadValueNumbering.cpp?rev=54821&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/LoadValueNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/LoadValueNumbering.cpp (removed) @@ -1,530 +0,0 @@ -//===- LoadValueNumbering.cpp - Load Value #'ing Implementation -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements a value numbering pass that value numbers load and call -// instructions. To do this, it finds lexically identical load instructions, -// and uses alias analysis to determine which loads are guaranteed to produce -// the same value. To value number call instructions, it looks for calls to -// functions that do not write to memory which do not have intervening -// instructions that clobber the memory that is read from. -// -// This pass builds off of another value numbering pass to implement value -// numbering for non-load and non-call instructions. It uses Alias Analysis so -// that it can disambiguate the load instructions. The more powerful these base -// analyses are, the more powerful the resultant value numbering will be. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/LoadValueNumbering.h" -#include "llvm/Constants.h" -#include "llvm/Function.h" -#include "llvm/Instructions.h" -#include "llvm/Pass.h" -#include "llvm/Type.h" -#include "llvm/Analysis/ValueNumbering.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/Dominators.h" -#include "llvm/Support/CFG.h" -#include "llvm/Support/Compiler.h" -#include "llvm/Target/TargetData.h" -#include -#include -using namespace llvm; - -namespace { - // FIXME: This should not be a FunctionPass. - struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering { - static char ID; // Class identification, replacement for typeinfo - LoadVN() : FunctionPass((intptr_t)&ID) {} - - /// Pass Implementation stuff. This doesn't do any analysis. - /// - bool runOnFunction(Function &) { return false; } - - /// getAnalysisUsage - Does not modify anything. It uses Value Numbering - /// and Alias Analysis. - /// - virtual void getAnalysisUsage(AnalysisUsage &AU) const; - - /// getEqualNumberNodes - Return nodes with the same value number as the - /// specified Value. This fills in the argument vector with any equal - /// values. - /// - virtual void getEqualNumberNodes(Value *V1, - std::vector &RetVals) const; - - /// deleteValue - This method should be called whenever an LLVM Value is - /// deleted from the program, for example when an instruction is found to be - /// redundant and is eliminated. - /// - virtual void deleteValue(Value *V) { - getAnalysis().deleteValue(V); - } - - /// copyValue - This method should be used whenever a preexisting value in - /// the program is copied or cloned, introducing a new value. Note that - /// analysis implementations should tolerate clients that use this method to - /// introduce the same value multiple times: if the analysis already knows - /// about a value, it should ignore the request. - /// - virtual void copyValue(Value *From, Value *To) { - getAnalysis().copyValue(From, To); - } - - /// getCallEqualNumberNodes - Given a call instruction, find other calls - /// that have the same value number. - void getCallEqualNumberNodes(CallInst *CI, - std::vector &RetVals) const; - }; -} - -char LoadVN::ID = 0; -// Register this pass... -static RegisterPass -X("load-vn", "Load Value Numbering", false, true); - -// Declare that we implement the ValueNumbering interface -static RegisterAnalysisGroup Y(X); - -FunctionPass *llvm::createLoadValueNumberingPass() { return new LoadVN(); } - - -/// getAnalysisUsage - Does not modify anything. It uses Value Numbering and -/// Alias Analysis. -/// -void LoadVN::getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequiredTransitive(); - AU.addRequired(); - AU.addRequiredTransitive(); - AU.addRequiredTransitive(); -} - -static bool isPathTransparentTo(BasicBlock *CurBlock, BasicBlock *Dom, - Value *Ptr, unsigned Size, AliasAnalysis &AA, - std::set &Visited, - std::map &TransparentBlocks){ - // If we have already checked out this path, or if we reached our destination, - // stop searching, returning success. - if (CurBlock == Dom || !Visited.insert(CurBlock).second) - return true; - - // Check whether this block is known transparent or not. - std::map::iterator TBI = - TransparentBlocks.find(CurBlock); - - if (TBI == TransparentBlocks.end()) { - // If this basic block can modify the memory location, then the path is not - // transparent! - if (AA.canBasicBlockModify(*CurBlock, Ptr, Size)) { - TransparentBlocks.insert(TBI, std::make_pair(CurBlock, false)); - return false; - } - TransparentBlocks.insert(TBI, std::make_pair(CurBlock, true)); - } else if (!TBI->second) - // This block is known non-transparent, so that path can't be either. - return false; - - // The current block is known to be transparent. The entire path is - // transparent if all of the predecessors paths to the parent is also - // transparent to the memory location. - for (pred_iterator PI = pred_begin(CurBlock), E = pred_end(CurBlock); - PI != E; ++PI) - if (!isPathTransparentTo(*PI, Dom, Ptr, Size, AA, Visited, - TransparentBlocks)) - return false; - return true; -} - -/// getCallEqualNumberNodes - Given a call instruction, find other calls that -/// have the same value number. -void LoadVN::getCallEqualNumberNodes(CallInst *CI, - std::vector &RetVals) const { - Function *CF = CI->getCalledFunction(); - if (CF == 0) return; // Indirect call. - AliasAnalysis &AA = getAnalysis(); - AliasAnalysis::ModRefBehavior MRB = AA.getModRefBehavior(CI); - if (MRB != AliasAnalysis::DoesNotAccessMemory && - MRB != AliasAnalysis::OnlyReadsMemory) - return; // Nothing we can do for now. - - // Scan all of the arguments of the function, looking for one that is not - // global. In particular, we would prefer to have an argument or instruction - // operand to chase the def-use chains of. - Value *Op = CF; - for (User::op_iterator i = CI->op_begin() + 1, e = CI->op_end(); i != e; ++i) - if (isa(*i) || - isa(*i)) { - Op = *i; - break; - } - - // Identify all lexically identical calls in this function. - std::vector IdenticalCalls; - - Function *CIFunc = CI->getParent()->getParent(); - for (Value::use_iterator UI = Op->use_begin(), E = Op->use_end(); UI != E; - ++UI) - if (CallInst *C = dyn_cast(*UI)) - if (C->getNumOperands() == CI->getNumOperands() && - C->getOperand(0) == CI->getOperand(0) && - C->getParent()->getParent() == CIFunc && C != CI) { - bool AllOperandsEqual = true; - for (User::op_iterator i = CI->op_begin() + 1, j = C->op_begin() + 1, - e = CI->op_end(); i != e; ++i, ++j) - if (*j != *i) { - AllOperandsEqual = false; - break; - } - - if (AllOperandsEqual) - IdenticalCalls.push_back(C); - } - - if (IdenticalCalls.empty()) return; - - // Eliminate duplicates, which could occur if we chose a value that is passed - // into a call site multiple times. - std::sort(IdenticalCalls.begin(), IdenticalCalls.end()); - IdenticalCalls.erase(std::unique(IdenticalCalls.begin(),IdenticalCalls.end()), - IdenticalCalls.end()); - - // If the call reads memory, we must make sure that there are no stores - // between the calls in question. - // - // FIXME: This should use mod/ref information. What we really care about it - // whether an intervening instruction could modify memory that is read, not - // ANY memory. - // - if (MRB == AliasAnalysis::OnlyReadsMemory) { - DominatorTree &DT = getAnalysis(); - BasicBlock *CIBB = CI->getParent(); - for (unsigned i = 0; i != IdenticalCalls.size(); ++i) { - CallInst *C = IdenticalCalls[i]; - bool CantEqual = false; - - if (DT.dominates(CIBB, C->getParent())) { - // FIXME: we currently only handle the case where both calls are in the - // same basic block. - if (CIBB != C->getParent()) { - CantEqual = true; - } else { - Instruction *First = CI, *Second = C; - if (!DT.dominates(CI, C)) - std::swap(First, Second); - - // Scan the instructions between the calls, checking for stores or - // calls to dangerous functions. - BasicBlock::iterator I = First; - for (++First; I != BasicBlock::iterator(Second); ++I) { - if (isa(I)) { - // FIXME: We could use mod/ref information to make this much - // better! - CantEqual = true; - break; - } else if (CallInst *CI = dyn_cast(I)) { - if (!AA.onlyReadsMemory(CI)) { - CantEqual = true; - break; - } - } else if (I->mayWriteToMemory()) { - CantEqual = true; - break; - } - } - } - - } else if (DT.dominates(C->getParent(), CIBB)) { - // FIXME: We could implement this, but we don't for now. - CantEqual = true; - } else { - // FIXME: if one doesn't dominate the other, we can't tell yet. - CantEqual = true; - } - - - if (CantEqual) { - // This call does not produce the same value as the one in the query. - std::swap(IdenticalCalls[i--], IdenticalCalls.back()); - IdenticalCalls.pop_back(); - } - } - } - - // Any calls that are identical and not destroyed will produce equal values! - for (unsigned i = 0, e = IdenticalCalls.size(); i != e; ++i) - RetVals.push_back(IdenticalCalls[i]); -} - -// getEqualNumberNodes - Return nodes with the same value number as the -// specified Value. This fills in the argument vector with any equal values. -// -void LoadVN::getEqualNumberNodes(Value *V, - std::vector &RetVals) const { - // If the alias analysis has any must alias information to share with us, we - // can definitely use it. - if (isa(V->getType())) - getAnalysis().getMustAliases(V, RetVals); - - if (!isa(V)) { - if (CallInst *CI = dyn_cast(V)) - getCallEqualNumberNodes(CI, RetVals); - - // Not a load instruction? Just chain to the base value numbering - // implementation to satisfy the request... - assert(&getAnalysis() != (ValueNumbering*)this && - "getAnalysis() returned this!"); - - return getAnalysis().getEqualNumberNodes(V, RetVals); - } - - // Volatile loads cannot be replaced with the value of other loads. - LoadInst *LI = cast(V); - if (LI->isVolatile()) - return getAnalysis().getEqualNumberNodes(V, RetVals); - - Value *LoadPtr = LI->getOperand(0); - BasicBlock *LoadBB = LI->getParent(); - Function *F = LoadBB->getParent(); - - // Find out how many bytes of memory are loaded by the load instruction... - unsigned LoadSize = getAnalysis().getTypeStoreSize(LI->getType()); - AliasAnalysis &AA = getAnalysis(); - - // Figure out if the load is invalidated from the entry of the block it is in - // until the actual instruction. This scans the block backwards from LI. If - // we see any candidate load or store instructions, then we know that the - // candidates have the same value # as LI. - bool LoadInvalidatedInBBBefore = false; - for (BasicBlock::iterator I = LI; I != LoadBB->begin(); ) { - --I; - if (I == LoadPtr) { - // If we run into an allocation of the value being loaded, then the - // contents are not initialized. - if (isa(I)) - RetVals.push_back(UndefValue::get(LI->getType())); - - // Otherwise, since this is the definition of what we are loading, this - // loaded value cannot occur before this block. - LoadInvalidatedInBBBefore = true; - break; - } else if (LoadInst *LI = dyn_cast(I)) { - // If this instruction is a candidate load before LI, we know there are no - // invalidating instructions between it and LI, so they have the same - // value number. - if (LI->getOperand(0) == LoadPtr && !LI->isVolatile()) - RetVals.push_back(I); - } - - if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) { - // If the invalidating instruction is a store, and its in our candidate - // set, then we can do store-load forwarding: the load has the same value - // # as the stored value. - if (StoreInst *SI = dyn_cast(I)) - if (SI->getOperand(1) == LoadPtr) - RetVals.push_back(I->getOperand(0)); - - LoadInvalidatedInBBBefore = true; - break; - } - } - - // Figure out if the load is invalidated between the load and the exit of the - // block it is defined in. While we are scanning the current basic block, if - // we see any candidate loads, then we know they have the same value # as LI. - // - bool LoadInvalidatedInBBAfter = false; - { - BasicBlock::iterator I = LI; - for (++I; I != LoadBB->end(); ++I) { - // If this instruction is a load, then this instruction returns the same - // value as LI. - if (isa(I) && cast(I)->getOperand(0) == LoadPtr) - RetVals.push_back(I); - - if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) { - LoadInvalidatedInBBAfter = true; - break; - } - } - } - - // If the pointer is clobbered on entry and on exit to the function, there is - // no need to do any global analysis at all. - if (LoadInvalidatedInBBBefore && LoadInvalidatedInBBAfter) - return; - - // Now that we know the value is not neccesarily killed on entry or exit to - // the BB, find out how many load and store instructions (to this location) - // live in each BB in the function. - // - std::map CandidateLoads; - std::set CandidateStores; - - for (Value::use_iterator UI = LoadPtr->use_begin(), UE = LoadPtr->use_end(); - UI != UE; ++UI) - if (LoadInst *Cand = dyn_cast(*UI)) {// Is a load of source? - if (Cand->getParent()->getParent() == F && // In the same function? - // Not in LI's block? - Cand->getParent() != LoadBB && !Cand->isVolatile()) - ++CandidateLoads[Cand->getParent()]; // Got one. - } else if (StoreInst *Cand = dyn_cast(*UI)) { - if (Cand->getParent()->getParent() == F && !Cand->isVolatile() && - Cand->getOperand(1) == LoadPtr) // It's a store THROUGH the ptr. - CandidateStores.insert(Cand->getParent()); - } - - // Get dominators. - DominatorTree &DT = getAnalysis(); - - // TransparentBlocks - For each basic block the load/store is alive across, - // figure out if the pointer is invalidated or not. If it is invalidated, the - // boolean is set to false, if it's not it is set to true. If we don't know - // yet, the entry is not in the map. - std::map TransparentBlocks; - - // Loop over all of the basic blocks that also load the value. If the value - // is live across the CFG from the source to destination blocks, and if the - // value is not invalidated in either the source or destination blocks, add it - // to the equivalence sets. - for (std::map::iterator - I = CandidateLoads.begin(), E = CandidateLoads.end(); I != E; ++I) { - bool CantEqual = false; - - // Right now we only can handle cases where one load dominates the other. - // FIXME: generalize this! - BasicBlock *BB1 = I->first, *BB2 = LoadBB; - if (DT.dominates(BB1, BB2)) { - // The other load dominates LI. If the loaded value is killed entering - // the LoadBB block, we know the load is not live. - if (LoadInvalidatedInBBBefore) - CantEqual = true; - } else if (DT.dominates(BB2, BB1)) { - std::swap(BB1, BB2); // Canonicalize - // LI dominates the other load. If the loaded value is killed exiting - // the LoadBB block, we know the load is not live. - if (LoadInvalidatedInBBAfter) - CantEqual = true; - } else { - // None of these loads can VN the same. - CantEqual = true; - } - - if (!CantEqual) { - // Ok, at this point, we know that BB1 dominates BB2, and that there is - // nothing in the LI block that kills the loaded value. Check to see if - // the value is live across the CFG. - std::set Visited; - for (pred_iterator PI = pred_begin(BB2), E = pred_end(BB2); PI!=E; ++PI) - if (!isPathTransparentTo(*PI, BB1, LoadPtr, LoadSize, AA, - Visited, TransparentBlocks)) { - // None of these loads can VN the same. - CantEqual = true; - break; - } - } - - // If the loads can equal so far, scan the basic block that contains the - // loads under consideration to see if they are invalidated in the block. - // For any loads that are not invalidated, add them to the equivalence - // set! - if (!CantEqual) { - unsigned NumLoads = I->second; - if (BB1 == LoadBB) { - // If LI dominates the block in question, check to see if any of the - // loads in this block are invalidated before they are reached. - for (BasicBlock::iterator BBI = I->first->begin(); ; ++BBI) { - if (LoadInst *LI = dyn_cast(BBI)) { - if (LI->getOperand(0) == LoadPtr && !LI->isVolatile()) { - // The load is in the set! - RetVals.push_back(BBI); - if (--NumLoads == 0) break; // Found last load to check. - } - } else if (AA.getModRefInfo(BBI, LoadPtr, LoadSize) - & AliasAnalysis::Mod) { - // If there is a modifying instruction, nothing below it will value - // # the same. - break; - } - } - } else { - // If the block dominates LI, make sure that the loads in the block are - // not invalidated before the block ends. - BasicBlock::iterator BBI = I->first->end(); - while (1) { - --BBI; - if (LoadInst *LI = dyn_cast(BBI)) { - if (LI->getOperand(0) == LoadPtr && !LI->isVolatile()) { - // The load is the same as this load! - RetVals.push_back(BBI); - if (--NumLoads == 0) break; // Found all of the laods. - } - } else if (AA.getModRefInfo(BBI, LoadPtr, LoadSize) - & AliasAnalysis::Mod) { - // If there is a modifying instruction, nothing above it will value - // # the same. - break; - } - } - } - } - } - - // Handle candidate stores. If the loaded location is clobbered on entrance - // to the LoadBB, no store outside of the LoadBB can value number equal, so - // quick exit. - if (LoadInvalidatedInBBBefore) - return; - - // Stores in the load-bb are handled above. - CandidateStores.erase(LoadBB); - - for (std::set::iterator I = CandidateStores.begin(), - E = CandidateStores.end(); I != E; ++I) - if (DT.dominates(*I, LoadBB)) { - BasicBlock *StoreBB = *I; - - // Check to see if the path from the store to the load is transparent - // w.r.t. the memory location. - bool CantEqual = false; - std::set Visited; - for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB); - PI != E; ++PI) - if (!isPathTransparentTo(*PI, StoreBB, LoadPtr, LoadSize, AA, - Visited, TransparentBlocks)) { - // None of these stores can VN the same. - CantEqual = true; - break; - } - Visited.clear(); - if (!CantEqual) { - // Okay, the path from the store block to the load block is clear, and - // we know that there are no invalidating instructions from the start - // of the load block to the load itself. Now we just scan the store - // block. - - BasicBlock::iterator BBI = StoreBB->end(); - while (1) { - assert(BBI != StoreBB->begin() && - "There is a store in this block of the pointer, but the store" - " doesn't mod the address being stored to?? Must be a bug in" - " the alias analysis implementation!"); - --BBI; - if (AA.getModRefInfo(BBI, LoadPtr, LoadSize) & AliasAnalysis::Mod) { - // If the invalidating instruction is one of the candidates, - // then it provides the value the load loads. - if (StoreInst *SI = dyn_cast(BBI)) - if (SI->getOperand(1) == LoadPtr) - RetVals.push_back(SI->getOperand(0)); - break; - } - } - } - } -} Removed: llvm/trunk/lib/Analysis/ValueNumbering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueNumbering.cpp?rev=54821&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/ValueNumbering.cpp (original) +++ llvm/trunk/lib/Analysis/ValueNumbering.cpp (removed) @@ -1,286 +0,0 @@ -//===- ValueNumbering.cpp - Value #'ing Implementation ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the non-abstract Value Numbering methods as well as a -// default implementation for the analysis group. -// -// The ValueNumbering analysis pass is mostly deprecated. It is only used by the -// Global Common Subexpression Elimination pass, which is deprecated by the -// Global Value Numbering pass (which does its value numbering on its own). -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/ValueNumbering.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/BasicBlock.h" -#include "llvm/Instructions.h" -#include "llvm/Pass.h" -#include "llvm/Type.h" -#include "llvm/Support/Compiler.h" -using namespace llvm; - -char ValueNumbering::ID = 0; -// Register the ValueNumbering interface, providing a nice name to refer to. -static RegisterAnalysisGroup V("Value Numbering"); - -/// ValueNumbering destructor: DO NOT move this to the header file for -/// ValueNumbering or else clients of the ValueNumbering class may not depend on -/// the ValueNumbering.o file in the current .a file, causing alias analysis -/// support to not be included in the tool correctly! -/// -ValueNumbering::~ValueNumbering() {} - -//===----------------------------------------------------------------------===// -// Basic ValueNumbering Pass Implementation -//===----------------------------------------------------------------------===// -// -// Because of the way .a files work, the implementation of the BasicVN class -// MUST be in the ValueNumbering file itself, or else we run the risk of -// ValueNumbering being used, but the default implementation not being linked -// into the tool that uses it. As such, we register and implement the class -// here. -// - -namespace { - /// BasicVN - This class is the default implementation of the ValueNumbering - /// interface. It walks the SSA def-use chains to trivially identify - /// lexically identical expressions. This does not require any ahead of time - /// analysis, so it is a very fast default implementation. - /// - struct VISIBILITY_HIDDEN BasicVN - : public ImmutablePass, public ValueNumbering { - static char ID; // Class identification, replacement for typeinfo - BasicVN() : ImmutablePass((intptr_t)&ID) {} - - /// getEqualNumberNodes - Return nodes with the same value number as the - /// specified Value. This fills in the argument vector with any equal - /// values. - /// - /// This is where our implementation is. - /// - virtual void getEqualNumberNodes(Value *V1, - std::vector &RetVals) const; - }; -} - -char BasicVN::ID = 0; -// Register this pass... -static RegisterPass -X("basicvn", "Basic Value Numbering (default GVN impl)", false, true); - -// Declare that we implement the ValueNumbering interface -static RegisterAnalysisGroup Y(X); - -namespace { - /// BVNImpl - Implement BasicVN in terms of a visitor class that - /// handles the different types of instructions as appropriate. - /// - struct VISIBILITY_HIDDEN BVNImpl : public InstVisitor { - std::vector &RetVals; - explicit BVNImpl(std::vector &RV) : RetVals(RV) {} - - void visitCastInst(CastInst &I); - void visitGetElementPtrInst(GetElementPtrInst &I); - void visitCmpInst(CmpInst &I); - - void handleBinaryInst(Instruction &I); - void visitBinaryOperator(Instruction &I) { handleBinaryInst(I); } - void visitShiftInst(Instruction &I) { handleBinaryInst(I); } - void visitExtractElementInst(Instruction &I) { handleBinaryInst(I); } - - void handleTernaryInst(Instruction &I); - void visitSelectInst(Instruction &I) { handleTernaryInst(I); } - void visitInsertElementInst(Instruction &I) { handleTernaryInst(I); } - void visitShuffleVectorInst(Instruction &I) { handleTernaryInst(I); } - void visitInstruction(Instruction &) { - // Cannot value number calls or terminator instructions. - } - }; -} - -ImmutablePass *llvm::createBasicVNPass() { return new BasicVN(); } - -// getEqualNumberNodes - Return nodes with the same value number as the -// specified Value. This fills in the argument vector with any equal values. -// -void BasicVN::getEqualNumberNodes(Value *V, std::vector &RetVals) const{ - assert(V->getType() != Type::VoidTy && - "Can only value number non-void values!"); - // We can only handle the case where I is an instruction! - if (Instruction *I = dyn_cast(V)) - BVNImpl(RetVals).visit(I); -} - -void BVNImpl::visitCastInst(CastInst &CI) { - Instruction &I = (Instruction&)CI; - Value *Op = I.getOperand(0); - Function *F = I.getParent()->getParent(); - - for (Value::use_iterator UI = Op->use_begin(), UE = Op->use_end(); - UI != UE; ++UI) - if (CastInst *Other = dyn_cast(*UI)) - // Check that the opcode is the same - if (Other->getOpcode() == Instruction::CastOps(I.getOpcode()) && - // Check that the destination types are the same - Other->getType() == I.getType() && - // Is it embedded in the same function? (This could be false if LHS - // is a constant or global!) - Other->getParent()->getParent() == F && - // Check to see if this new cast is not I. - Other != &I) { - // These instructions are identical. Add to list... - RetVals.push_back(Other); - } -} - -void BVNImpl::visitCmpInst(CmpInst &CI1) { - Value *LHS = CI1.getOperand(0); - for (Value::use_iterator UI = LHS->use_begin(), UE = LHS->use_end(); - UI != UE; ++UI) - if (CmpInst *CI2 = dyn_cast(*UI)) - // Check to see if this compare instruction is not CI, but same opcode, - // same predicate, and in the same function. - if (CI2 != &CI1 && CI2->getOpcode() == CI1.getOpcode() && - CI2->getPredicate() == CI1.getPredicate() && - CI2->getParent()->getParent() == CI1.getParent()->getParent()) - // If the operands are the same - if ((CI2->getOperand(0) == CI1.getOperand(0) && - CI2->getOperand(1) == CI1.getOperand(1)) || - // Or the compare is commutative and the operands are reversed - (CI1.isCommutative() && - CI2->getOperand(0) == CI1.getOperand(1) && - CI2->getOperand(1) == CI1.getOperand(0))) - // Then the instructiosn are identical, add to list. - RetVals.push_back(CI2); -} - - - -// isIdenticalBinaryInst - Return true if the two binary instructions are -// identical. -// -static inline bool isIdenticalBinaryInst(const Instruction &I1, - const Instruction *I2) { - // Is it embedded in the same function? (This could be false if LHS - // is a constant or global!) - if (I1.getOpcode() != I2->getOpcode() || - I1.getParent()->getParent() != I2->getParent()->getParent()) - return false; - - // If they are CmpInst instructions, check their predicates - if (CmpInst *CI1 = dyn_cast(&const_cast(I1))) - if (CI1->getPredicate() != cast(I2)->getPredicate()) - return false; - - // They are identical if both operands are the same! - if (I1.getOperand(0) == I2->getOperand(0) && - I1.getOperand(1) == I2->getOperand(1)) - return true; - - // If the instruction is commutative, the instruction can match if the - // operands are swapped! - // - if ((I1.getOperand(0) == I2->getOperand(1) && - I1.getOperand(1) == I2->getOperand(0)) && - I1.isCommutative()) - return true; - - return false; -} - -// isIdenticalTernaryInst - Return true if the two ternary instructions are -// identical. -// -static inline bool isIdenticalTernaryInst(const Instruction &I1, - const Instruction *I2) { - // Is it embedded in the same function? (This could be false if LHS - // is a constant or global!) - if (I1.getParent()->getParent() != I2->getParent()->getParent()) - return false; - - // They are identical if all operands are the same! - return I1.getOperand(0) == I2->getOperand(0) && - I1.getOperand(1) == I2->getOperand(1) && - I1.getOperand(2) == I2->getOperand(2); -} - - - -void BVNImpl::handleBinaryInst(Instruction &I) { - Value *LHS = I.getOperand(0); - - for (Value::use_iterator UI = LHS->use_begin(), UE = LHS->use_end(); - UI != UE; ++UI) - if (Instruction *Other = dyn_cast(*UI)) - // Check to see if this new binary operator is not I, but same operand... - if (Other != &I && isIdenticalBinaryInst(I, Other)) { - // These instructions are identical. Handle the situation. - RetVals.push_back(Other); - } -} - -// IdenticalComplexInst - Return true if the two instructions are the same, by -// using a brute force comparison. This is useful for instructions with an -// arbitrary number of arguments. -// -static inline bool IdenticalComplexInst(const Instruction *I1, - const Instruction *I2) { - assert(I1->getOpcode() == I2->getOpcode()); - // Equal if they are in the same function... - return I1->getParent()->getParent() == I2->getParent()->getParent() && - // And return the same type... - I1->getType() == I2->getType() && - // And have the same number of operands... - I1->getNumOperands() == I2->getNumOperands() && - // And all of the operands are equal. - std::equal(I1->op_begin(), I1->op_end(), I2->op_begin()); -} - -void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) { - Value *Op = I.getOperand(0); - - // Try to pick a local operand if possible instead of a constant or a global - // that might have a lot of uses. - for (User::op_iterator i = I.op_begin() + 1, e = I.op_end(); i != e; ++i) - if (isa(*i) || isa(*i)) { - Op = *i; - break; - } - - for (Value::use_iterator UI = Op->use_begin(), UE = Op->use_end(); - UI != UE; ++UI) - if (GetElementPtrInst *Other = dyn_cast(*UI)) - // Check to see if this new getelementptr is not I, but same operand... - if (Other != &I && IdenticalComplexInst(&I, Other)) { - // These instructions are identical. Handle the situation. - RetVals.push_back(Other); - } -} - -void BVNImpl::handleTernaryInst(Instruction &I) { - Value *Op0 = I.getOperand(0); - Instruction *OtherInst; - - for (Value::use_iterator UI = Op0->use_begin(), UE = Op0->use_end(); - UI != UE; ++UI) - if ((OtherInst = dyn_cast(*UI)) && - OtherInst->getOpcode() == I.getOpcode()) { - // Check to see if this new select is not I, but has the same operands. - if (OtherInst != &I && isIdenticalTernaryInst(I, OtherInst)) { - // These instructions are identical. Handle the situation. - RetVals.push_back(OtherInst); - } - - } -} - - -// Ensure that users of ValueNumbering.h will link with this file -DEFINING_FILE_FOR(BasicValueNumbering) Removed: llvm/trunk/lib/Transforms/Scalar/GCSE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GCSE.cpp?rev=54821&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GCSE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GCSE.cpp (removed) @@ -1,205 +0,0 @@ -//===-- GCSE.cpp - SSA-based Global Common Subexpression Elimination ------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass is designed to be a very quick global transformation that -// eliminates global common subexpressions from a function. It does this by -// using an existing value numbering analysis pass to identify the common -// subexpressions, eliminating them when possible. -// -// This pass is deprecated by the Global Value Numbering pass (which does a -// better job with its own value numbering). -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "gcse" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Instructions.h" -#include "llvm/Function.h" -#include "llvm/Type.h" -#include "llvm/Analysis/ConstantFolding.h" -#include "llvm/Analysis/Dominators.h" -#include "llvm/Analysis/ValueNumbering.h" -#include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Support/Compiler.h" -#include -using namespace llvm; - -STATISTIC(NumInstRemoved, "Number of instructions removed"); -STATISTIC(NumLoadRemoved, "Number of loads removed"); -STATISTIC(NumCallRemoved, "Number of calls removed"); -STATISTIC(NumNonInsts , "Number of instructions removed due " - "to non-instruction values"); -STATISTIC(NumArgsRepl , "Number of function arguments replaced " - "with constant values"); -namespace { - struct VISIBILITY_HIDDEN GCSE : public FunctionPass { - static char ID; // Pass identification, replacement for typeid - GCSE() : FunctionPass((intptr_t)&ID) {} - - virtual bool runOnFunction(Function &F); - - private: - void ReplaceInstructionWith(Instruction *I, Value *V); - - // This transformation requires dominator and immediate dominator info - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); - AU.addRequired(); - AU.addRequired(); - } - }; -} - -char GCSE::ID = 0; -static RegisterPass -X("gcse", "Global Common Subexpression Elimination"); - -// createGCSEPass - The public interface to this file... -FunctionPass *llvm::createGCSEPass() { return new GCSE(); } - -// GCSE::runOnFunction - This is the main transformation entry point for a -// function. -// -bool GCSE::runOnFunction(Function &F) { - bool Changed = false; - - // Get pointers to the analysis results that we will be using... - DominatorTree &DT = getAnalysis(); - ValueNumbering &VN = getAnalysis(); - - std::vector EqualValues; - - // Check for value numbers of arguments. If the value numbering - // implementation can prove that an incoming argument is a constant or global - // value address, substitute it, making the argument dead. - for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E;++AI) - if (!AI->use_empty()) { - VN.getEqualNumberNodes(AI, EqualValues); - if (!EqualValues.empty()) { - for (unsigned i = 0, e = EqualValues.size(); i != e; ++i) - if (isa(EqualValues[i])) { - AI->replaceAllUsesWith(EqualValues[i]); - ++NumArgsRepl; - Changed = true; - break; - } - EqualValues.clear(); - } - } - - // Traverse the CFG of the function in dominator order, so that we see each - // instruction after we see its operands. - for (df_iterator DI = df_begin(DT.getRootNode()), - E = df_end(DT.getRootNode()); DI != E; ++DI) { - BasicBlock *BB = DI->getBlock(); - - // Remember which instructions we've seen in this basic block as we scan. - std::set BlockInsts; - - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { - Instruction *Inst = I++; - - if (Constant *C = ConstantFoldInstruction(Inst)) { - ReplaceInstructionWith(Inst, C); - } else if (Inst->getType() != Type::VoidTy) { - // If this instruction computes a value, try to fold together common - // instructions that compute it. - // - VN.getEqualNumberNodes(Inst, EqualValues); - - // If this instruction computes a value that is already computed - // elsewhere, try to recycle the old value. - if (!EqualValues.empty()) { - if (Inst == &*BB->begin()) - I = BB->end(); - else { - I = Inst; --I; - } - - // First check to see if we were able to value number this instruction - // to a non-instruction value. If so, prefer that value over other - // instructions which may compute the same thing. - for (unsigned i = 0, e = EqualValues.size(); i != e; ++i) - if (!isa(EqualValues[i])) { - ++NumNonInsts; // Keep track of # of insts repl with values - - // Change all users of Inst to use the replacement and remove it - // from the program. - ReplaceInstructionWith(Inst, EqualValues[i]); - Inst = 0; - EqualValues.clear(); // don't enter the next loop - break; - } - - // If there were no non-instruction values that this instruction - // produces, find a dominating instruction that produces the same - // value. If we find one, use it's value instead of ours. - for (unsigned i = 0, e = EqualValues.size(); i != e; ++i) { - Instruction *OtherI = cast(EqualValues[i]); - bool Dominates = false; - if (OtherI->getParent() == BB) - Dominates = BlockInsts.count(OtherI); - else - Dominates = DT.dominates(OtherI->getParent(), BB); - - if (Dominates) { - // Okay, we found an instruction with the same value as this one - // and that dominates this one. Replace this instruction with the - // specified one. - ReplaceInstructionWith(Inst, OtherI); - Inst = 0; - break; - } - } - - EqualValues.clear(); - - if (Inst) { - I = Inst; ++I; // Deleted no instructions - } else if (I == BB->end()) { // Deleted first instruction - I = BB->begin(); - } else { // Deleted inst in middle of block. - ++I; - } - } - - if (Inst) - BlockInsts.insert(Inst); - } - } - } - - // When the worklist is empty, return whether or not we changed anything... - return Changed; -} - - -void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) { - if (isa(I)) - ++NumLoadRemoved; // Keep track of loads eliminated - if (isa(I)) - ++NumCallRemoved; // Keep track of calls eliminated - ++NumInstRemoved; // Keep track of number of insts eliminated - - // Update value numbering - getAnalysis().deleteValue(I); - - I->replaceAllUsesWith(V); - - if (InvokeInst *II = dyn_cast(I)) { - // Removing an invoke instruction requires adding a branch to the normal - // destination and removing PHI node entries in the exception destination. - BranchInst::Create(II->getNormalDest(), II); - II->getUnwindDest()->removePredecessor(II->getParent()); - } - - // Erase the instruction from the program. - I->eraseFromParent(); -} Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=54822&r1=54821&r2=54822&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Fri Aug 15 16:31:02 2008 @@ -13,7 +13,6 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/Verifier.h" Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=54822&r1=54821&r2=54822&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Fri Aug 15 16:31:02 2008 @@ -31,7 +31,6 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/Verifier.h" -#include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/CodeGen/FileWriters.h" #include "llvm/Target/SubtargetFeature.h" #include "llvm/Target/TargetOptions.h" From criswell at uiuc.edu Fri Aug 15 16:33:11 2008 From: criswell at uiuc.edu (John Criswell) Date: Fri, 15 Aug 2008 21:33:11 -0000 Subject: [llvm-commits] [poolalloc] r54823 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <200808152133.m7FLXBvx007114@zion.cs.uiuc.edu> Author: criswell Date: Fri Aug 15 16:33:11 2008 New Revision: 54823 URL: http://llvm.org/viewvc/llvm-project?rev=54823&view=rev Log: Removed unused variable to silence compiler warning. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=54823&r1=54822&r2=54823&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Aug 15 16:33:11 2008 @@ -734,7 +734,6 @@ // Dinakar: We need pooldescriptors for allocas in the callee if it // escapes BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); - Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); ArgVal = new AllocaInst(PAInfo.getPoolType(), 0, "PD", InsertPt); Value *ElSize = ConstantInt::get(Type::Int32Ty,0); Value *Align = ConstantInt::get(Type::Int32Ty,0); From resistor at mac.com Fri Aug 15 18:17:23 2008 From: resistor at mac.com (Owen Anderson) Date: Fri, 15 Aug 2008 23:17:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54825 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-linker-hack.cpp Message-ID: <200808152317.m7FNHOfH010174@zion.cs.uiuc.edu> Author: resistor Date: Fri Aug 15 18:17:23 2008 New Revision: 54825 URL: http://llvm.org/viewvc/llvm-project?rev=54825&view=rev Log: Remove GCSE and LoadVN here as well. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=54825&r1=54824&r2=54825&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Aug 15 18:17:23 2008 @@ -29,7 +29,6 @@ #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" #include "llvm/ValueSymbolTable.h" -#include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Assembly/Writer.h" Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=54825&r1=54824&r2=54825&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Fri Aug 15 18:17:23 2008 @@ -55,7 +55,6 @@ llvm::createLocalRegisterAllocator(); llvm::createGVNPass(); - llvm::createGCSEPass(); llvm::createLoopRotatePass(); llvm::createLICMPass(); llvm::createSCCPPass(); From isanbard at gmail.com Fri Aug 15 18:43:39 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 15 Aug 2008 23:43:39 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54829 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200808152343.m7FNhdvW010922@zion.cs.uiuc.edu> Author: void Date: Fri Aug 15 18:43:38 2008 New Revision: 54829 URL: http://llvm.org/viewvc/llvm-project?rev=54829&view=rev Log: On Darwin platforms, copy over the libstdc++.dylib during compilation of a cross compiler. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=54829&r1=54828&r2=54829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Fri Aug 15 18:43:38 2008 @@ -4051,6 +4051,28 @@ # Install the driver program as $(target_noncanonical)-gcc, # $(target_noncanonical)-gcc-$(version) # and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc. + +# LLVM LOCAL begin copy libstdc++.dylib on Darwin +ifneq (,$(findstring darwin,$(target))) +install-driver: installdirs xgcc$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext) + -cp -p /usr/lib/libstdc++.6.dylib $(DESTDIR)$(libsubdir)/libstdc++.dylib + -( cd $(DESTDIR)$(bindir) && \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ) + -if [ -f gcc-cross$(exeext) ] ; then \ + if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ + rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ + $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ + else true; fi; \ + else \ + rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \ + ( cd $(DESTDIR)$(bindir) && \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \ + mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ + fi +else install-driver: installdirs xgcc$(exeext) -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) @@ -4068,6 +4090,8 @@ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \ mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ fi +endif +# LLVM LOCAL end copy libstdc++.dylib on Darwin # Install the info files. # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir From isanbard at gmail.com Fri Aug 15 18:45:22 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 15 Aug 2008 23:45:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54830 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/ Message-ID: <200808152345.m7FNjMaL010977@zion.cs.uiuc.edu> Author: void Date: Fri Aug 15 18:45:22 2008 New Revision: 54830 URL: http://llvm.org/viewvc/llvm-project?rev=54830&view=rev Log: Copying llvmgcc42-2061-02 from llvmgcc42-2061 Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/ - copied from r54829, llvm-gcc-4.2/tags/Apple/llvmgcc42-2061/ From isanbard at gmail.com Fri Aug 15 18:57:23 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 15 Aug 2008 23:57:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54831 - in /llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc: Makefile.in c-parser.c Message-ID: <200808152357.m7FNvNpx011425@zion.cs.uiuc.edu> Author: void Date: Fri Aug 15 18:57:23 2008 New Revision: 54831 URL: http://llvm.org/viewvc/llvm-project?rev=54831&view=rev Log: - On Darwin platforms, copy over the libstdc++.dylib during compilation of a cross compiler. - Port patch from rdar://6123451 which fixes an x86_64 bug. Modified: llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/Makefile.in llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/c-parser.c Modified: llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/Makefile.in?rev=54831&r1=54830&r2=54831&view=diff ============================================================================== --- llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/Makefile.in (original) +++ llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/Makefile.in Fri Aug 15 18:57:23 2008 @@ -4051,6 +4051,28 @@ # Install the driver program as $(target_noncanonical)-gcc, # $(target_noncanonical)-gcc-$(version) # and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc. + +# LLVM LOCAL begin copy libstdc++.dylib on Darwin +ifneq (,$(findstring darwin,$(target))) +install-driver: installdirs xgcc$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext) + -cp -p /usr/lib/libstdc++.6.dylib $(DESTDIR)$(libsubdir)/libstdc++.dylib + -( cd $(DESTDIR)$(bindir) && \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ) + -if [ -f gcc-cross$(exeext) ] ; then \ + if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ + rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ + $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ + else true; fi; \ + else \ + rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \ + ( cd $(DESTDIR)$(bindir) && \ + $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \ + mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ + fi +else install-driver: installdirs xgcc$(exeext) -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) @@ -4068,6 +4090,8 @@ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \ mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \ fi +endif +# LLVM LOCAL end copy libstdc++.dylib on Darwin # Install the info files. # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir Modified: llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/c-parser.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/c-parser.c?rev=54831&r1=54830&r2=54831&view=diff ============================================================================== --- llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/c-parser.c (original) +++ llvm-gcc-4.2/tags/Apple/llvmgcc42-2061-02/gcc/c-parser.c Fri Aug 15 18:57:23 2008 @@ -2393,6 +2393,7 @@ ret.spec = TREE_TYPE (expr.value); /* APPLE LOCAL begin radar 4204796 (in 4.2 n) */ if (c_dialect_objc() + && ret.spec != error_mark_node && lookup_attribute ("objc_volatilized", TYPE_ATTRIBUTES (ret.spec))) ret.spec = build_qualified_type (ret.spec, (TYPE_QUALS (ret.spec) & ~TYPE_QUAL_VOLATILE)); From resistor at mac.com Fri Aug 15 19:00:54 2008 From: resistor at mac.com (Owen Anderson) Date: Sat, 16 Aug 2008 00:00:54 -0000 Subject: [llvm-commits] [llvm] r54832 - in /llvm/trunk/test: Analysis/Andersens/ Analysis/BasicAA/ Analysis/GlobalsModRef/ Analysis/LoadVN/ Other/ Transforms/GCSE/ Transforms/InstCombine/ Transforms/LICM/ Transforms/Reassociate/ Transforms/SimplifyCFG/ Message-ID: <200808160000.m7G00tL7011564@zion.cs.uiuc.edu> Author: resistor Date: Fri Aug 15 19:00:54 2008 New Revision: 54832 URL: http://llvm.org/viewvc/llvm-project?rev=54832&view=rev Log: Remove GCSE and LoadVN from the testsuite. Removed: llvm/trunk/test/Analysis/Andersens/arg-must-alias.ll llvm/trunk/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll llvm/trunk/test/Analysis/LoadVN/ llvm/trunk/test/Transforms/GCSE/ Modified: llvm/trunk/test/Analysis/Andersens/external.ll llvm/trunk/test/Analysis/Andersens/modreftest.ll llvm/trunk/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll llvm/trunk/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll llvm/trunk/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll llvm/trunk/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll llvm/trunk/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll llvm/trunk/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll llvm/trunk/test/Analysis/BasicAA/featuretest.ll llvm/trunk/test/Analysis/BasicAA/gcsetest.ll llvm/trunk/test/Analysis/BasicAA/global-size.ll llvm/trunk/test/Analysis/BasicAA/tailcall-modref.ll llvm/trunk/test/Analysis/GlobalsModRef/aliastest.ll llvm/trunk/test/Analysis/GlobalsModRef/chaining-analysis.ll llvm/trunk/test/Analysis/GlobalsModRef/indirect-global.ll llvm/trunk/test/Analysis/GlobalsModRef/modreftest.ll llvm/trunk/test/Analysis/GlobalsModRef/purecse.ll llvm/trunk/test/Other/2006-02-05-PassManager.ll llvm/trunk/test/Transforms/InstCombine/GEPIdxCanon.ll llvm/trunk/test/Transforms/InstCombine/getelementptr_const.ll llvm/trunk/test/Transforms/LICM/2003-05-02-LoadHoist.ll llvm/trunk/test/Transforms/Reassociate/basictest3.ll llvm/trunk/test/Transforms/Reassociate/basictest4.ll llvm/trunk/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll Removed: llvm/trunk/test/Analysis/Andersens/arg-must-alias.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Andersens/arg-must-alias.ll?rev=54831&view=auto ============================================================================== --- llvm/trunk/test/Analysis/Andersens/arg-must-alias.ll (original) +++ llvm/trunk/test/Analysis/Andersens/arg-must-alias.ll (removed) @@ -1,15 +0,0 @@ -; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG - - at G = internal constant i32* null - -define internal i32 @internal(i32* %ARG) { - ;; The 'Arg' argument must-aliases the null pointer, so it can be subsituted - ;; directly here, making it dead. - store i32* %ARG, i32** @G - ret i32 0 -} - -define i32 @foo() { - %V = call i32 @internal(i32* null) - ret i32 %V -} Modified: llvm/trunk/test/Analysis/Andersens/external.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Andersens/external.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/Andersens/external.ll (original) +++ llvm/trunk/test/Analysis/Andersens/external.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null +; RUN: llvm-as < %s | opt -anders-aa -gvn -deadargelim | llvm-dis | grep store | not grep null ; Because the 'internal' function is passed to an external function, we don't ; know what the incoming values will alias. As such, we cannot do the Modified: llvm/trunk/test/Analysis/Andersens/modreftest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Andersens/modreftest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/Andersens/modreftest.ll (original) +++ llvm/trunk/test/Analysis/Andersens/modreftest.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -instcombine | llvm-dis \ +; RUN: llvm-as < %s | opt -anders-aa -gvn -instcombine | llvm-dis \ ; RUN: | grep {ret i1 true} @G = internal global i32* null Modified: llvm/trunk/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll Fri Aug 15 19:00:54 2008 @@ -2,7 +2,7 @@ ; is performed. It is not legal to delete the second load instruction because ; the value computed by the first load instruction is changed by the store. -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE +; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep DONOTREMOVE define i32 @test() { %A = alloca i32 Modified: llvm/trunk/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub +; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep sub ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict! Modified: llvm/trunk/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll Fri Aug 15 19:00:54 2008 @@ -1,6 +1,6 @@ ; In this test, a local alloca cannot alias an incoming argument. -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub +; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | not grep sub define i32 @test(i32* %P) { %X = alloca i32 Removed: llvm/trunk/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll?rev=54831&view=auto ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll (removed) @@ -1,13 +0,0 @@ -; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \ -; RUN: llvm-dis | not grep load - - at X = constant [2 x i32] [i32 4, i32 5] - -define i32 @test(i32* %Y, i64 %idx) { - %P = getelementptr [2 x i32]* @X, i64 0, i64 %idx - %A = load i32* %P ; Load from invariant memory - store i32 4, i32* %Y ; Store could not be to @X - %B = load i32* %P - %C = sub i32 %A, %B - ret i32 %C -} Modified: llvm/trunk/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\ ; RUN: llvm-dis | grep {load i32\\* %A} declare double* @useit(i32*) Modified: llvm/trunk/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll Fri Aug 15 19:00:54 2008 @@ -1,7 +1,7 @@ ; PR1109 -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \ ; RUN: grep {sub i32} -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \ ; RUN: not grep {ret i32 0} ; END. Modified: llvm/trunk/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/2007-08-05-GetOverloadedModRef.ll Fri Aug 15 19:00:54 2008 @@ -1,5 +1,5 @@ ; PR1600 -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \ ; RUN: grep {ret i32 0} ; END. Modified: llvm/trunk/test/Analysis/BasicAA/featuretest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/featuretest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/featuretest.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/featuretest.ll Fri Aug 15 19:00:54 2008 @@ -1,7 +1,7 @@ ; This testcase tests for various features the basicaa test should be able to ; determine, as noted in the comments. -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce | llvm-dis | not grep REMOVE @Global = external global { i32 } Modified: llvm/trunk/test/Analysis/BasicAA/gcsetest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/gcsetest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/gcsetest.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/gcsetest.ll Fri Aug 15 19:00:54 2008 @@ -2,7 +2,7 @@ ; disambiguating some obvious cases. All loads should be removable in ; this testcase. -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce \ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce \ ; RUN: | llvm-dis | not grep load @A = global i32 7 Modified: llvm/trunk/test/Analysis/BasicAA/global-size.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/global-size.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/global-size.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/global-size.ll Fri Aug 15 19:00:54 2008 @@ -1,7 +1,7 @@ ; A store or load cannot alias a global if the accessed amount is larger then ; the global. -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | not grep load @B = global i16 8 ; [#uses=2] Modified: llvm/trunk/test/Analysis/BasicAA/tailcall-modref.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BasicAA/tailcall-modref.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/BasicAA/tailcall-modref.ll (original) +++ llvm/trunk/test/Analysis/BasicAA/tailcall-modref.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\ +; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\ ; RUN: llvm-dis | grep {ret i32 0} declare void @foo(i32*) Modified: llvm/trunk/test/Analysis/GlobalsModRef/aliastest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/aliastest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/GlobalsModRef/aliastest.ll (original) +++ llvm/trunk/test/Analysis/GlobalsModRef/aliastest.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load @X = internal global i32 4 ; [#uses=1] define i32 @test(i32* %P) { Modified: llvm/trunk/test/Analysis/GlobalsModRef/chaining-analysis.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/chaining-analysis.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/GlobalsModRef/chaining-analysis.ll (original) +++ llvm/trunk/test/Analysis/GlobalsModRef/chaining-analysis.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load ; This test requires the use of previous analyses to determine that ; doesnotmodX does not modify X (because 'sin' doesn't). Modified: llvm/trunk/test/Analysis/GlobalsModRef/indirect-global.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/indirect-global.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/GlobalsModRef/indirect-global.ll (original) +++ llvm/trunk/test/Analysis/GlobalsModRef/indirect-global.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \ +; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | llvm-dis | \ ; RUN: grep {ret i32 0} @G = internal global i32* null ; [#uses=3] Modified: llvm/trunk/test/Analysis/GlobalsModRef/modreftest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/modreftest.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/GlobalsModRef/modreftest.ll (original) +++ llvm/trunk/test/Analysis/GlobalsModRef/modreftest.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load @X = internal global i32 4 ; [#uses=2] define i32 @test(i32* %P) { Modified: llvm/trunk/test/Analysis/GlobalsModRef/purecse.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/purecse.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Analysis/GlobalsModRef/purecse.ll (original) +++ llvm/trunk/test/Analysis/GlobalsModRef/purecse.ll Fri Aug 15 19:00:54 2008 @@ -1,5 +1,5 @@ ; Test that pure functions are cse'd away -; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | \ +; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | \ ; RUN: llvm-dis | not grep sub define i32 @pure(i32 %X) { Modified: llvm/trunk/test/Other/2006-02-05-PassManager.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2006-02-05-PassManager.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Other/2006-02-05-PassManager.ll (original) +++ llvm/trunk/test/Other/2006-02-05-PassManager.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -domtree -gcse -domtree -constmerge -disable-output +; RUN: llvm-as < %s | opt -domtree -gvn -domtree -constmerge -disable-output define i32 @test1() { unreachable Modified: llvm/trunk/test/Transforms/InstCombine/GEPIdxCanon.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/GEPIdxCanon.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/GEPIdxCanon.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/GEPIdxCanon.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \ +; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \ ; RUN: llvm-dis | not grep getelementptr define i1 @test(i32* %A) { Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr_const.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr_const.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr_const.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr_const.ll Fri Aug 15 19:00:54 2008 @@ -1,5 +1,5 @@ ; Test folding of constantexpr geps into normal geps. -; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \ +; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \ ; RUN: llvm-dis | not grep getelementptr @Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2] Modified: llvm/trunk/test/Transforms/LICM/2003-05-02-LoadHoist.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2003-05-02-LoadHoist.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LICM/2003-05-02-LoadHoist.ll (original) +++ llvm/trunk/test/Transforms/LICM/2003-05-02-LoadHoist.ll Fri Aug 15 19:00:54 2008 @@ -3,7 +3,7 @@ ; loaded from. Basically if the load gets hoisted, the subtract gets turned ; into a constant zero. ; -; RUN: llvm-as < %s | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load +; RUN: llvm-as < %s | opt -licm -gvn -instcombine | llvm-dis | grep load @X = global i32 7 ; [#uses=2] Modified: llvm/trunk/test/Transforms/Reassociate/basictest3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest3.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Reassociate/basictest3.ll (original) +++ llvm/trunk/test/Transforms/Reassociate/basictest3.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -reassociate -gcse | llvm-dis | grep add | count 6 +; RUN: llvm-as < %s | opt -reassociate -gvn | llvm-dis | grep add | count 6 ; Each of these functions should turn into two adds each. @e = external global i32 ; [#uses=3] Modified: llvm/trunk/test/Transforms/Reassociate/basictest4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest4.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Reassociate/basictest4.ll (original) +++ llvm/trunk/test/Transforms/Reassociate/basictest4.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -reassociate -gcse -instcombine | llvm-dis | not grep add +; RUN: llvm-as < %s | opt -reassociate -gvn -instcombine | llvm-dis | not grep add @a = weak global i32 0 ; [#uses=1] @b = weak global i32 0 ; [#uses=1] Modified: llvm/trunk/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll?rev=54832&r1=54831&r2=54832&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll Fri Aug 15 19:00:54 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -load-vn -gcse -simplifycfg \ +; RUN: llvm-as < %s | opt -gvn -simplifycfg \ ; RUN: -disable-output ; PR867 ; END. From clattner at apple.com Sat Aug 16 00:46:54 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Aug 2008 22:46:54 -0700 Subject: [llvm-commits] [llvm] r54822 - in /llvm/trunk: include/llvm/Analysis/LoadValueNumbering.h include/llvm/Analysis/Passes.h include/llvm/Analysis/ValueNumbering.h include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h lib/Analysis/LoadValueNumbering.cpp lib/Analysis/ValueNumbering.cpp lib/Transforms/Scalar/GCSE.cpp tools/llvm-ld/Optimize.cpp tools/lto/LTOCodeGenerator.cpp In-Reply-To: <200808152131.m7FLV5m7007048@zion.cs.uiuc.edu> References: <200808152131.m7FLV5m7007048@zion.cs.uiuc.edu> Message-ID: <10241465-D982-466F-BF25-927CD9A486C8@apple.com> On Aug 15, 2008, at 2:31 PM, Owen Anderson wrote: > Author: resistor > Date: Fri Aug 15 16:31:02 2008 > New Revision: 54822 > > URL: http://llvm.org/viewvc/llvm-project?rev=54822&view=rev > Log: > Remove GCSE, ValueNumbering, and LoadValueNumbering. These have > been deprecated for almost a year; it's finally time for them to go > away. My poor code. RIP. :) Please update docs/AliasAnalysis.html though. -Chris From clattner at apple.com Sat Aug 16 00:47:21 2008 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Aug 2008 22:47:21 -0700 Subject: [llvm-commits] Add eraseFromParent, releaseFromParent to GlobalValue (round 2) In-Reply-To: <701415.2169.qm@web54601.mail.re2.yahoo.com> References: <701415.2169.qm@web54601.mail.re2.yahoo.com> Message-ID: <4559438E-825C-4F26-87FD-DAB40F4F6F4A@apple.com> On Aug 15, 2008, at 11:17 AM, Daniel Dunbar wrote: >> Looks great to me. One minor tweak: do you really need a virtual > >> method for "erase"? It should always be "delete removeFromParent()", >> so you could just put that in the generic GlobalValue case. > > Currently eraseFromParent is not "delete removeFromParent()", it is a > call to erase on the iplist. If this distinction is not important > then I > will drop eraseFromParent from the subclasses. ilist "erase" is always the same as "remove" + delete, this should be safe. -Chris From asl at math.spbu.ru Sat Aug 16 07:57:10 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:57:10 -0000 Subject: [llvm-commits] [llvm] r54842 - in /llvm/trunk: include/llvm/Target/ELFTargetAsmInfo.h include/llvm/Target/TargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp lib/Target/Sparc/SparcTargetAsmInfo.cpp lib/Target/Sparc/SparcTargetAsmInfo.h lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h Message-ID: <200808161257.m7GCvAhv016813@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:57:07 2008 New Revision: 54842 URL: http://llvm.org/viewvc/llvm-project?rev=54842&view=rev Log: Reduce heap trashing due to std::string construction / concatenation via caching of section flags string representations Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Sat Aug 16 07:57:07 2008 @@ -27,7 +27,7 @@ explicit ELFTargetAsmInfo(const TargetMachine &TM); virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; - virtual std::string PrintSectionFlags(unsigned flags) const; + virtual std::string printSectionFlags(unsigned flags) const; const Section* MergeableConstSection(const GlobalVariable *GV) const; inline const Section* MergeableConstSection(const Type *Ty) const; const Section* MergeableStringSection(const GlobalVariable *GV) const; Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Aug 16 07:57:07 2008 @@ -16,6 +16,7 @@ #ifndef LLVM_TARGET_ASM_INFO_H #define LLVM_TARGET_ASM_INFO_H +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/DataTypes.h" #include @@ -83,6 +84,16 @@ static inline unsigned setEntitySize(unsigned Flags, unsigned Size) { return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24)); } + + struct KeyInfo { + static inline unsigned getEmptyKey() { return Invalid; } + static inline unsigned getTombstoneKey() { return Invalid - 1; } + static unsigned getHashValue(const unsigned &Key) { return Key; } + static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; } + static bool isPod() { return true; } + }; + + typedef DenseMap FlagsStringsMapType; } class TargetMachine; @@ -109,6 +120,7 @@ class TargetAsmInfo { private: mutable StringMap
    Sections; + mutable SectionFlags::FlagsStringsMapType FlagsStrings; protected: //===------------------------------------------------------------------===// // Properties to be set by the target writer, used to configure asm printer. @@ -551,7 +563,8 @@ virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, SectionKind::Kind kind) const; - virtual std::string PrintSectionFlags(unsigned flags) const { return ""; } + const std::string& getSectionFlags(unsigned Flags) const; + virtual std::string printSectionFlags(unsigned flags) const { return ""; } virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Sat Aug 16 07:57:07 2008 @@ -148,7 +148,7 @@ return getReadOnlySection_(); } -std::string ELFTargetAsmInfo::PrintSectionFlags(unsigned flags) const { +std::string ELFTargetAsmInfo::printSectionFlags(unsigned flags) const { std::string Flags = ",\""; if (!(flags & SectionFlags::Debug)) Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Sat Aug 16 07:57:07 2008 @@ -27,9 +27,9 @@ CStringSection=".rodata.str"; } -std::string SparcELFTargetAsmInfo::PrintSectionFlags(unsigned flags) const { +std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const { if (flags & SectionFlags::Mergeable) - return ELFTargetAsmInfo::PrintSectionFlags(flags); + return ELFTargetAsmInfo::printSectionFlags(flags); std::string Flags; if (!(flags & SectionFlags::Debug)) Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h Sat Aug 16 07:57:07 2008 @@ -25,7 +25,7 @@ struct SparcELFTargetAsmInfo : public ELFTargetAsmInfo { explicit SparcELFTargetAsmInfo(const TargetMachine &TM); - std::string PrintSectionFlags(unsigned flags) const; + std::string printSectionFlags(unsigned flags) const; }; } // namespace llvm Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Aug 16 07:57:07 2008 @@ -291,7 +291,7 @@ // If section is named we need to switch into it via special '.section' // directive and also append funky flags. Otherwise - section name is just // some magic assembler directive. - return getSwitchToSectionDirective() + S->Name + PrintSectionFlags(S->Flags); + return getSwitchToSectionDirective() + S->Name + getSectionFlags(S->Flags); } // Lame default implementation. Calculate the section name for global. @@ -376,3 +376,16 @@ return &S; } + +const std::string& +TargetAsmInfo::getSectionFlags(unsigned Flags) const { + SectionFlags::FlagsStringsMapType::iterator I = FlagsStrings.find(Flags); + + // We didn't print these flags yet, print and save them to map. This reduces + // amount of heap trashing due to std::string construction / concatenation. + if (I == FlagsStrings.end()) + I = FlagsStrings.insert(std::make_pair(Flags, + printSectionFlags(Flags))).first; + + return I->second; +} Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Sat Aug 16 07:57:07 2008 @@ -404,7 +404,7 @@ } } -std::string X86COFFTargetAsmInfo::PrintSectionFlags(unsigned flags) const { +std::string X86COFFTargetAsmInfo::printSectionFlags(unsigned flags) const { std::string Flags = ",\""; if (flags & SectionFlags::Code) Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=54842&r1=54841&r2=54842&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Sat Aug 16 07:57:07 2008 @@ -52,7 +52,7 @@ bool Global) const; virtual std::string UniqueSectionForGlobal(const GlobalValue* GV, SectionKind::Kind kind) const; - virtual std::string PrintSectionFlags(unsigned flags) const; + virtual std::string printSectionFlags(unsigned flags) const; protected: const X86TargetMachine *X86TM; }; From asl at math.spbu.ru Sat Aug 16 07:57:46 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:57:46 -0000 Subject: [llvm-commits] [llvm] r54843 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/DwarfWriter.cpp lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp lib/Target/TargetAsmInfo.cpp Message-ID: <200808161257.m7GCvkjE016843@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:57:46 2008 New Revision: 54843 URL: http://llvm.org/viewvc/llvm-project?rev=54843&view=rev Log: Move SLEB/ULEB size calculation routines from AsmPrinter to TargetAsmInfo. This makes JIT asmprinter-free. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sat Aug 16 07:57:46 2008 @@ -212,18 +212,10 @@ /// representing an unsigned leb128 value. void PrintULEB128(unsigned Value) const; - /// SizeULEB128 - Compute the number of bytes required for an unsigned - /// leb128 value. - static unsigned SizeULEB128(unsigned Value); - /// PrintSLEB128 - Print a series of hexidecimal values(separated by commas) /// representing a signed leb128 value. void PrintSLEB128(int Value) const; - /// SizeSLEB128 - Compute the number of bytes required for a signed leb128 - /// value. - static unsigned SizeSLEB128(int Value); - //===------------------------------------------------------------------===// // Emission and print routines // Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Aug 16 07:57:46 2008 @@ -570,6 +570,16 @@ virtual const Section* SelectSectionForMachineConst(const Type *Ty) const; + /// getSLEB128Size - Compute the number of bytes required for a signed + /// leb128 value. + + static unsigned getSLEB128Size(int Value); + + /// getULEB128Size - Compute the number of bytes required for an unsigned + /// leb128 value. + + static unsigned getULEB128Size(unsigned Value); + // Accessors. // const char *getTextSection() const { Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Sat Aug 16 07:57:46 2008 @@ -493,23 +493,12 @@ } while (Value); } -/// SizeULEB128 - Compute the number of bytes required for an unsigned leb128 -/// value. -unsigned AsmPrinter::SizeULEB128(unsigned Value) { - unsigned Size = 0; - do { - Value >>= 7; - Size += sizeof(int8_t); - } while (Value); - return Size; -} - /// PrintSLEB128 - Print a series of hexidecimal values (separated by commas) /// representing a signed leb128 value. void AsmPrinter::PrintSLEB128(int Value) const { int Sign = Value >> (8 * sizeof(Value) - 1); bool IsMore; - + do { unsigned Byte = Value & 0x7f; Value >>= 7; @@ -520,22 +509,6 @@ } while (IsMore); } -/// SizeSLEB128 - Compute the number of bytes required for a signed leb128 -/// value. -unsigned AsmPrinter::SizeSLEB128(int Value) { - unsigned Size = 0; - int Sign = Value >> (8 * sizeof(Value) - 1); - bool IsMore; - - do { - unsigned Byte = Value & 0x7f; - Value >>= 7; - IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; - Size += sizeof(int8_t); - } while (IsMore); - return Size; -} - //===--------------------------------------------------------------------===// // Emission and print routines // Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Sat Aug 16 07:57:46 2008 @@ -42,7 +42,7 @@ using namespace llvm::dwarf; namespace llvm { - + //===----------------------------------------------------------------------===// /// Configuration values for initial hash set sizes (log2). @@ -59,26 +59,26 @@ //===----------------------------------------------------------------------===// /// DWLabel - Labels are used to track locations in the assembler file. -/// Labels appear in the form @verbatim @endverbatim, -/// where the tag is a category of label (Ex. location) and number is a value +/// Labels appear in the form @verbatim @endverbatim, +/// where the tag is a category of label (Ex. location) and number is a value /// unique in that category. class DWLabel { public: /// Tag - Label category tag. Should always be a staticly declared C string. /// const char *Tag; - + /// Number - Value to make label unique. /// unsigned Number; DWLabel(const char *T, unsigned N) : Tag(T), Number(N) {} - + void Profile(FoldingSetNodeID &ID) const { ID.AddString(std::string(Tag)); ID.AddInteger(Number); } - + #ifndef NDEBUG void print(std::ostream *O) const { if (O) print(*O); @@ -98,17 +98,17 @@ /// Attribute - Dwarf attribute code. /// unsigned Attribute; - + /// Form - Dwarf form code. - /// - unsigned Form; - + /// + unsigned Form; + public: DIEAbbrevData(unsigned A, unsigned F) : Attribute(A) , Form(F) {} - + // Accessors. unsigned getAttribute() const { return Attribute; } unsigned getForm() const { return Form; } @@ -129,7 +129,7 @@ /// Tag - Dwarf tag code. /// unsigned Tag; - + /// Unique number for node. /// unsigned Number; @@ -150,7 +150,7 @@ , Data() {} ~DIEAbbrev() {} - + // Accessors. unsigned getTag() const { return Tag; } unsigned getNumber() const { return Number; } @@ -159,34 +159,34 @@ void setTag(unsigned T) { Tag = T; } void setChildrenFlag(unsigned CF) { ChildrenFlag = CF; } void setNumber(unsigned N) { Number = N; } - + /// AddAttribute - Adds another set of attribute information to the /// abbreviation. void AddAttribute(unsigned Attribute, unsigned Form) { Data.push_back(DIEAbbrevData(Attribute, Form)); } - + /// AddFirstAttribute - Adds a set of attribute information to the front /// of the abbreviation. void AddFirstAttribute(unsigned Attribute, unsigned Form) { Data.insert(Data.begin(), DIEAbbrevData(Attribute, Form)); } - + /// Profile - Used to gather unique data for the abbreviation folding set. /// void Profile(FoldingSetNodeID &ID) { ID.AddInteger(Tag); ID.AddInteger(ChildrenFlag); - + // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) Data[i].Profile(ID); } - + /// Emit - Print the abbreviation using the specified Dwarf writer. /// - void Emit(const DwarfDebug &DD) const; - + void Emit(const DwarfDebug &DD) const; + #ifndef NDEBUG void print(std::ostream *O) { if (O) print(*O); @@ -204,23 +204,23 @@ /// Abbrev - Buffer for constructing abbreviation. /// DIEAbbrev Abbrev; - + /// Offset - Offset in debug info section. /// unsigned Offset; - + /// Size - Size of instance + children. /// unsigned Size; - + /// Children DIEs. /// std::vector Children; - + /// Attributes values. /// SmallVector Values; - + public: explicit DIE(unsigned Tag) : Abbrev(Tag, DW_CHILDREN_no) @@ -230,7 +230,7 @@ , Values() {} virtual ~DIE(); - + // Accessors. DIEAbbrev &getAbbrev() { return Abbrev; } unsigned getAbbrevNumber() const { @@ -244,18 +244,18 @@ void setTag(unsigned Tag) { Abbrev.setTag(Tag); } void setOffset(unsigned O) { Offset = O; } void setSize(unsigned S) { Size = S; } - + /// AddValue - Add a value and attributes to a DIE. /// void AddValue(unsigned Attribute, unsigned Form, DIEValue *Value) { Abbrev.AddAttribute(Attribute, Form); Values.push_back(Value); } - + /// SiblingOffset - Return the offset of the debug information entry's /// sibling. unsigned SiblingOffset() const { return Offset + Size; } - + /// AddSiblingOffset - Add a sibling offset field to the front of the DIE. /// void AddSiblingOffset(); @@ -266,17 +266,17 @@ Abbrev.setChildrenFlag(DW_CHILDREN_yes); Children.push_back(Child); } - + /// Detach - Detaches objects connected to it after copying. /// void Detach() { Children.clear(); } - + /// Profile - Used to gather unique data for the value folding set. /// void Profile(FoldingSetNodeID &ID) ; - + #ifndef NDEBUG void print(std::ostream *O, unsigned IncIndent = 0) { if (O) print(*O, IncIndent); @@ -301,34 +301,34 @@ isEntry, isBlock }; - + /// Type - Type of data stored in the value. /// unsigned Type; - + explicit DIEValue(unsigned T) : Type(T) {} virtual ~DIEValue() {} - + // Accessors unsigned getType() const { return Type; } - + // Implement isa/cast/dyncast. static bool classof(const DIEValue *) { return true; } - + /// EmitValue - Emit value via the Dwarf writer. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form) = 0; - + /// SizeOf - Return the size of a value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const = 0; - + /// Profile - Used to gather unique data for the value folding set. /// virtual void Profile(FoldingSetNodeID &ID) = 0; - + #ifndef NDEBUG void print(std::ostream *O) { if (O) print(*O); @@ -340,18 +340,18 @@ //===----------------------------------------------------------------------===// /// DWInteger - An integer value DIE. -/// +/// class DIEInteger : public DIEValue { private: uint64_t Integer; - + public: explicit DIEInteger(uint64_t I) : DIEValue(isInteger), Integer(I) {} // Implement isa/cast/dyncast. static bool classof(const DIEInteger *) { return true; } static bool classof(const DIEValue *I) { return I->Type == isInteger; } - + /// BestForm - Choose the best form for integer. /// static unsigned BestForm(bool IsSigned, uint64_t Integer) { @@ -366,15 +366,15 @@ } return DW_FORM_data8; } - + /// EmitValue - Emit integer of appropriate size. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of integer value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, unsigned Integer) { @@ -382,7 +382,7 @@ ID.AddInteger(Integer); } virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Integer); } - + #ifndef NDEBUG virtual void print(std::ostream &O) { O << "Int: " << (int64_t)Integer @@ -393,27 +393,27 @@ //===----------------------------------------------------------------------===// /// DIEString - A string value DIE. -/// +/// class DIEString : public DIEValue { public: const std::string String; - + explicit DIEString(const std::string &S) : DIEValue(isString), String(S) {} // Implement isa/cast/dyncast. static bool classof(const DIEString *) { return true; } static bool classof(const DIEValue *S) { return S->Type == isString; } - + /// EmitValue - Emit string value. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of string value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const { return String.size() + sizeof(char); // sizeof('\0'); } - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, const std::string &String) { @@ -421,7 +421,7 @@ ID.AddString(String); } virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, String); } - + #ifndef NDEBUG virtual void print(std::ostream &O) { O << "Str: \"" << String << "\""; @@ -436,21 +436,21 @@ public: const DWLabel Label; - + explicit DIEDwarfLabel(const DWLabel &L) : DIEValue(isLabel), Label(L) {} // Implement isa/cast/dyncast. static bool classof(const DIEDwarfLabel *) { return true; } static bool classof(const DIEValue *L) { return L->Type == isLabel; } - + /// EmitValue - Emit label value. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of label value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, const DWLabel &Label) { @@ -458,7 +458,7 @@ Label.Profile(ID); } virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label); } - + #ifndef NDEBUG virtual void print(std::ostream &O) { O << "Lbl: "; @@ -474,22 +474,22 @@ class DIEObjectLabel : public DIEValue { public: const std::string Label; - + explicit DIEObjectLabel(const std::string &L) : DIEValue(isAsIsLabel), Label(L) {} // Implement isa/cast/dyncast. static bool classof(const DIEObjectLabel *) { return true; } static bool classof(const DIEValue *L) { return L->Type == isAsIsLabel; } - + /// EmitValue - Emit label value. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of label value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, const std::string &Label) { @@ -514,7 +514,7 @@ const DWLabel Section; bool IsEH : 1; bool UseSet : 1; - + DIESectionOffset(const DWLabel &Lab, const DWLabel &Sec, bool isEH = false, bool useSet = true) : DIEValue(isSectionOffset), Label(Lab), Section(Sec), @@ -523,15 +523,15 @@ // Implement isa/cast/dyncast. static bool classof(const DIESectionOffset *) { return true; } static bool classof(const DIEValue *D) { return D->Type == isSectionOffset; } - + /// EmitValue - Emit section offset. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of section offset value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, const DWLabel &Label, @@ -557,27 +557,27 @@ //===----------------------------------------------------------------------===// /// DIEDelta - A simple label difference DIE. -/// +/// class DIEDelta : public DIEValue { public: const DWLabel LabelHi; const DWLabel LabelLo; - + DIEDelta(const DWLabel &Hi, const DWLabel &Lo) : DIEValue(isDelta), LabelHi(Hi), LabelLo(Lo) {} // Implement isa/cast/dyncast. static bool classof(const DIEDelta *) { return true; } static bool classof(const DIEValue *D) { return D->Type == isDelta; } - + /// EmitValue - Emit delta value. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of delta value in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, const DWLabel &LabelHi, @@ -605,23 +605,23 @@ class DIEntry : public DIEValue { public: DIE *Entry; - + explicit DIEntry(DIE *E) : DIEValue(isEntry), Entry(E) {} - + // Implement isa/cast/dyncast. static bool classof(const DIEntry *) { return true; } static bool classof(const DIEValue *E) { return E->Type == isEntry; } - + /// EmitValue - Emit debug information entry offset. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of debug information entry in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const { return sizeof(int32_t); } - + /// Profile - Used to gather unique data for the value folding set. /// static void Profile(FoldingSetNodeID &ID, DIE *Entry) { @@ -630,14 +630,14 @@ } virtual void Profile(FoldingSetNodeID &ID) { ID.AddInteger(isEntry); - + if (Entry) { ID.AddPointer(Entry); } else { ID.AddPointer(this); } } - + #ifndef NDEBUG virtual void print(std::ostream &O) { O << "Die: 0x" << std::hex << (intptr_t)Entry << std::dec; @@ -651,7 +651,7 @@ class DIEBlock : public DIEValue, public DIE { public: unsigned Size; // Size in bytes excluding size header. - + DIEBlock() : DIEValue(isBlock) , DIE(0) @@ -659,15 +659,15 @@ {} ~DIEBlock() { } - + // Implement isa/cast/dyncast. static bool classof(const DIEBlock *) { return true; } static bool classof(const DIEValue *E) { return E->Type == isBlock; } - + /// ComputeSize - calculate the size of the block. /// unsigned ComputeSize(DwarfDebug &DD); - + /// BestForm - Choose the best form for data. /// unsigned BestForm() const { @@ -680,11 +680,11 @@ /// EmitValue - Emit block data. /// virtual void EmitValue(DwarfDebug &DD, unsigned Form); - + /// SizeOf - Determine size of block data in bytes. /// virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const; - + /// Profile - Used to gather unique data for the value folding set. /// @@ -692,7 +692,7 @@ ID.AddInteger(isBlock); DIE::Profile(ID); } - + #ifndef NDEBUG virtual void print(std::ostream &O) { O << "Blk: "; @@ -709,15 +709,15 @@ /// Desc - Compile unit debug descriptor. /// CompileUnitDesc *Desc; - + /// ID - File identifier for source. /// unsigned ID; - + /// Die - Compile unit debug information entry. /// DIE *Die; - + /// DescToDieMap - Tracks the mapping of unit level debug informaton /// descriptors to debug information entries. std::map DescToDieMap; @@ -733,11 +733,11 @@ /// DiesSet - Used to uniquely define dies within the compile unit. /// FoldingSet DiesSet; - + /// Dies - List of all dies in the compile unit. /// std::vector Dies; - + public: CompileUnit(CompileUnitDesc *CUD, unsigned I, DIE *D) : Desc(CUD) @@ -749,14 +749,14 @@ , DiesSet(InitDiesSetSize) , Dies() {} - + ~CompileUnit() { delete Die; - + for (unsigned i = 0, N = Dies.size(); i < N; ++i) delete Dies[i]; } - + // Accessors. CompileUnitDesc *getDesc() const { return Desc; } unsigned getID() const { return ID; } @@ -774,19 +774,19 @@ void AddGlobal(const std::string &Name, DIE *Die) { Globals[Name] = Die; } - + /// getDieMapSlotFor - Returns the debug information entry map slot for the /// specified debug descriptor. DIE *&getDieMapSlotFor(DebugInfoDesc *DID) { return DescToDieMap[DID]; } - + /// getDIEntrySlotFor - Returns the debug information entry proxy slot for the /// specified debug descriptor. DIEntry *&getDIEntrySlotFor(DebugInfoDesc *DID) { return DescToDIEntryMap[DID]; } - + /// AddDie - Adds or interns the DIE to the compile unit. /// DIE *AddDie(DIE &Buffer) { @@ -794,20 +794,20 @@ Buffer.Profile(ID); void *Where; DIE *Die = DiesSet.FindNodeOrInsertPos(ID, Where); - + if (!Die) { Die = new DIE(Buffer); DiesSet.InsertNode(Die, Where); this->Die->AddChild(Die); Buffer.Detach(); } - + return Die; } }; //===----------------------------------------------------------------------===// -/// Dwarf - Emits general Dwarf directives. +/// Dwarf - Emits general Dwarf directives. /// class Dwarf { @@ -816,7 +816,7 @@ //===--------------------------------------------------------------------===// // Core attributes used by the Dwarf writer. // - + // /// O - Stream to .s file. /// @@ -825,32 +825,32 @@ /// Asm - Target of Dwarf emission. /// AsmPrinter *Asm; - + /// TAI - Target asm information. const TargetAsmInfo *TAI; - + /// TD - Target data. const TargetData *TD; - + /// RI - Register Information. const TargetRegisterInfo *RI; - + /// M - Current module. /// Module *M; - + /// MF - Current machine function. /// MachineFunction *MF; - + /// MMI - Collected machine module information. /// MachineModuleInfo *MMI; - + /// SubprogramCount - The running count of functions being compiled. /// unsigned SubprogramCount; - + /// Flavor - A unique string indicating what dwarf producer this is, used to /// unique labels. const char * const Flavor; @@ -891,7 +891,7 @@ else O << TAI->getData64bitsDirective(); } - + /// PrintLabelName - Print label name in form used by Dwarf writer. /// void PrintLabelName(DWLabel Label) const { @@ -901,14 +901,14 @@ O << TAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } - + void PrintLabelName(const char *Tag, unsigned Number, const char *Suffix) const { O << TAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; O << Suffix; } - + /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(DWLabel Label) const { @@ -918,7 +918,7 @@ PrintLabelName(Tag, Number); O << ":\n"; } - + /// EmitReference - Emit a reference to a label. /// void EmitReference(DWLabel Label, bool IsPCRelative = false, @@ -929,15 +929,15 @@ bool IsPCRelative = false, bool Force32Bit = false) const { PrintRelDirective(Force32Bit); PrintLabelName(Tag, Number); - + if (IsPCRelative) O << "-" << TAI->getPCSymbol(); } void EmitReference(const std::string &Name, bool IsPCRelative = false, bool Force32Bit = false) const { PrintRelDirective(Force32Bit); - + O << Name; - + if (IsPCRelative) O << "-" << TAI->getPCSymbol(); } @@ -967,7 +967,7 @@ ++SetCounter; } else { PrintRelDirective(IsSmall); - + PrintLabelName(TagHi, NumberHi); O << "-"; PrintLabelName(TagLo, NumberLo); @@ -993,25 +993,25 @@ if (!printAbsolute) { O << "-"; PrintLabelName(Section, SectionNumber); - } + } O << "\n"; PrintRelDirective(IsSmall); - + PrintLabelName("set", SetCounter, Flavor); ++SetCounter; } else { PrintRelDirective(IsSmall, true); - + PrintLabelName(Label, LabelNumber); if (!printAbsolute) { O << "-"; PrintLabelName(Section, SectionNumber); } - } + } } - + /// EmitFrameMoves - Emit frame instructions to describe the layout of the /// frame. void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, @@ -1025,29 +1025,29 @@ for (unsigned i = 0, N = Moves.size(); i < N; ++i) { const MachineMove &Move = Moves[i]; unsigned LabelID = Move.getLabelID(); - + if (LabelID) { LabelID = MMI->MappedLabel(LabelID); - + // Throw out move if the label is invalid. if (!LabelID) continue; } - + const MachineLocation &Dst = Move.getDestination(); const MachineLocation &Src = Move.getSource(); - + // Advance row if new location. if (BaseLabel && LabelID && (BaseLabelID != LabelID || !IsLocal)) { Asm->EmitInt8(DW_CFA_advance_loc4); Asm->EOL("DW_CFA_advance_loc4"); EmitDifference("label", LabelID, BaseLabel, BaseLabelID, true); Asm->EOL(); - + BaseLabelID = LabelID; BaseLabel = "label"; IsLocal = true; } - + // If advancing cfa. if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { if (!Src.isRegister()) { @@ -1060,9 +1060,9 @@ Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister(), isEH)); Asm->EOL("Register"); } - + int Offset = -Src.getOffset(); - + Asm->EmitULEB128Bytes(Offset); Asm->EOL("Offset"); } else { @@ -1081,7 +1081,7 @@ } else { unsigned Reg = RI->getDwarfRegNum(Src.getRegister(), isEH); int Offset = Dst.getOffset() / stackGrowth; - + if (Offset < 0) { Asm->EmitInt8(DW_CFA_offset_extended_sf); Asm->EOL("DW_CFA_offset_extended_sf"); @@ -1112,7 +1112,7 @@ }; //===----------------------------------------------------------------------===// -/// DwarfDebug - Emits Dwarf debug directives. +/// DwarfDebug - Emits Dwarf debug directives. /// class DwarfDebug : public Dwarf { @@ -1120,11 +1120,11 @@ //===--------------------------------------------------------------------===// // Attributes used to construct specific Dwarf sections. // - + /// CompileUnits - All the compile units involved in this build. The index /// of each entry in this vector corresponds to the sources in MMI. std::vector CompileUnits; - + /// AbbreviationsSet - Used to uniquely define abbreviations. /// FoldingSet AbbreviationsSet; @@ -1132,15 +1132,15 @@ /// Abbreviations - A list of all the unique abbreviations in use. /// std::vector Abbreviations; - + /// ValuesSet - Used to uniquely define values. /// FoldingSet ValuesSet; - + /// Values - A list of all the unique values in use. /// std::vector Values; - + /// StringPool - A UniqueVector of strings used by indirect references. /// UniqueVector StringPool; @@ -1148,11 +1148,11 @@ /// UnitMap - Map debug information descriptor to compile unit. /// std::map DescToUnitMap; - + /// SectionMap - Provides a unique id per text section. /// UniqueVector SectionMap; - + /// SectionSourceLines - Tracks line numbers per text section. /// std::vector > SectionSourceLines; @@ -1160,7 +1160,7 @@ /// didInitial - Flag to indicate if initial emission has been done. /// bool didInitial; - + /// shouldEmit - Flag to indicate if debug information should be emitted. /// bool shouldEmit; @@ -1174,26 +1174,26 @@ }; std::vector DebugFrames; - + public: - + /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made. /// bool ShouldEmitDwarf() const { return shouldEmit; } /// AssignAbbrevNumber - Define a unique number for the abbreviation. - /// + /// void AssignAbbrevNumber(DIEAbbrev &Abbrev) { // Profile the node so that we can make it unique. FoldingSetNodeID ID; Abbrev.Profile(ID); - + // Check the set for priors. DIEAbbrev *InSet = AbbreviationsSet.GetOrInsertNode(&Abbrev); - + // If it's newly added. if (InSet == &Abbrev) { - // Add to abbreviation list. + // Add to abbreviation list. Abbreviations.push_back(&Abbrev); // Assign the vector position + 1 as its number. Abbrev.setNumber(Abbreviations.size()); @@ -1209,30 +1209,30 @@ unsigned StringID = StringPool.insert(String); return DWLabel("string", StringID); } - + /// NewDIEntry - Creates a new DIEntry to be a proxy for a debug information /// entry. DIEntry *NewDIEntry(DIE *Entry = NULL) { DIEntry *Value; - + if (Entry) { FoldingSetNodeID ID; DIEntry::Profile(ID, Entry); void *Where; Value = static_cast(ValuesSet.FindNodeOrInsertPos(ID, Where)); - + if (Value) return Value; - + Value = new DIEntry(Entry); ValuesSet.InsertNode(Value, Where); } else { Value = new DIEntry(Entry); } - + Values.push_back(Value); return Value; } - + /// SetDIEntry - Set a DIEntry once the debug information entry is defined. /// void SetDIEntry(DIEntry *Value, DIE *Entry) { @@ -1256,10 +1256,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddSInt - Add an signed integer attribute data and value. /// void AddSInt(DIE *Die, unsigned Attribute, unsigned Form, int64_t Integer) { @@ -1274,10 +1274,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddString - Add a std::string attribute data and value. /// void AddString(DIE *Die, unsigned Attribute, unsigned Form, @@ -1291,10 +1291,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddLabel - Add a Dwarf label attribute data and value. /// void AddLabel(DIE *Die, unsigned Attribute, unsigned Form, @@ -1308,10 +1308,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddObjectLabel - Add an non-Dwarf label attribute data and value. /// void AddObjectLabel(DIE *Die, unsigned Attribute, unsigned Form, @@ -1325,10 +1325,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddSectionOffset - Add a section offset label attribute data and value. /// void AddSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, @@ -1343,10 +1343,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddDelta - Add a label delta attribute data and value. /// void AddDelta(DIE *Die, unsigned Attribute, unsigned Form, @@ -1360,10 +1360,10 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } - + Die->AddValue(Attribute, Form, Value); } - + /// AddDIEntry - Add a DIE attribute data and value. /// void AddDIEntry(DIE *Die, unsigned Attribute, unsigned Form, DIE *Entry) { @@ -1387,7 +1387,7 @@ delete Block; Block = cast(Value); } - + Die->AddValue(Attribute, Block->BestForm(), Value); } @@ -1410,7 +1410,7 @@ const MachineLocation &Location) { unsigned Reg = RI->getDwarfRegNum(Location.getRegister(), false); DIEBlock *Block = new DIEBlock(); - + if (Location.isRegister()) { if (Reg < 32) { AddUInt(Block, 0, DW_FORM_data1, DW_OP_reg0 + Reg); @@ -1427,10 +1427,10 @@ } AddUInt(Block, 0, DW_FORM_sdata, Location.getOffset()); } - + AddBlock(Die, Attribute, 0, Block); } - + /// AddBasicType - Add a new basic type attribute to the specified entity. /// void AddBasicType(DIE *Entity, CompileUnit *Unit, @@ -1439,7 +1439,7 @@ DIE *Die = ConstructBasicType(Unit, Name, Encoding, Size); AddDIEntry(Entity, DW_AT_type, DW_FORM_ref4, Die); } - + /// ConstructBasicType - Construct a new basic type. /// DIE *ConstructBasicType(CompileUnit *Unit, @@ -1451,14 +1451,14 @@ if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); return Unit->AddDie(Buffer); } - + /// AddPointerType - Add a new pointer type attribute to the specified entity. /// void AddPointerType(DIE *Entity, CompileUnit *Unit, const std::string &Name) { DIE *Die = ConstructPointerType(Unit, Name); AddDIEntry(Entity, DW_AT_type, DW_FORM_ref4, Die); } - + /// ConstructPointerType - Construct a new pointer type. /// DIE *ConstructPointerType(CompileUnit *Unit, const std::string &Name) { @@ -1467,7 +1467,7 @@ if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name); return Unit->AddDie(Buffer); } - + /// AddType - Add a new type attribute to the specified entity. /// void AddType(DIE *Entity, TypeDesc *TyDesc, CompileUnit *Unit) { @@ -1476,13 +1476,13 @@ } else { // Check for pre-existence. DIEntry *&Slot = Unit->getDIEntrySlotFor(TyDesc); - + // If it exists then use the existing value. if (Slot) { Entity->AddValue(DW_AT_type, DW_FORM_ref4, Slot); return; } - + if (SubprogramDesc *SubprogramTy = dyn_cast(TyDesc)) { // FIXME - Not sure why programs and variables are coming through here. // Short cut for handling subprogram types (not really a TyDesc.) @@ -1492,14 +1492,14 @@ // FIXME - Not sure why programs and variables are coming through here. // Short cut for handling global variable types (not really a TyDesc.) AddPointerType(Entity, Unit, GlobalTy->getName()); - } else { + } else { // Set up proxy. Slot = NewDIEntry(); - + // Construct type. DIE Buffer(DW_TAG_base_type); ConstructType(Buffer, TyDesc, Unit); - + // Add debug information entry to entity and unit. DIE *Die = Unit->AddDie(Buffer); SetDIEntry(Slot, Die); @@ -1507,14 +1507,14 @@ } } } - + /// ConstructType - Adds all the required attributes to the type. /// void ConstructType(DIE &Buffer, TypeDesc *TyDesc, CompileUnit *Unit) { // Get core information. const std::string &Name = TyDesc->getName(); uint64_t Size = TyDesc->getSize() >> 3; - + if (BasicTypeDesc *BasicTy = dyn_cast(TyDesc)) { // Fundamental types like int, float, bool Buffer.setTag(DW_TAG_base_type); @@ -1524,7 +1524,7 @@ unsigned Tag = DerivedTy->getTag(); // FIXME - Workaround for templates. if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type; - // Pointers, typedefs et al. + // Pointers, typedefs et al. Buffer.setTag(Tag); // Map to main type, void will not have a type. if (TypeDesc *FromTy = DerivedTy->getFromType()) @@ -1532,15 +1532,15 @@ } else if (CompositeTypeDesc *CompTy = dyn_cast(TyDesc)){ // Fetch tag. unsigned Tag = CompTy->getTag(); - + // Set tag accordingly. if (Tag == DW_TAG_vector_type) Buffer.setTag(DW_TAG_array_type); - else + else Buffer.setTag(Tag); std::vector &Elements = CompTy->getElements(); - + switch (Tag) { case DW_TAG_vector_type: AddUInt(&Buffer, DW_AT_GNU_vector, DW_FORM_flag, 1); @@ -1549,21 +1549,21 @@ // Add element type. if (TypeDesc *FromTy = CompTy->getFromType()) AddType(&Buffer, FromTy, Unit); - + // Don't emit size attribute. Size = 0; - + // Construct an anonymous type for index type. DIE *IndexTy = ConstructBasicType(Unit, "", DW_ATE_signed, sizeof(int32_t)); - + // Add subranges to array type. for(unsigned i = 0, N = Elements.size(); i < N; ++i) { SubrangeDesc *SRD = cast(Elements[i]); int64_t Lo = SRD->getLo(); int64_t Hi = SRD->getHi(); DIE *Subrange = new DIE(DW_TAG_subrange_type); - + // If a range is available. if (Lo != Hi) { AddDIEntry(Subrange, DW_AT_type, DW_FORM_ref4, IndexTy); @@ -1571,7 +1571,7 @@ if (Lo) AddSInt(Subrange, DW_AT_lower_bound, 0, Lo); AddSInt(Subrange, DW_AT_upper_bound, 0, Hi); } - + Buffer.AddChild(Subrange); } break; @@ -1581,36 +1581,36 @@ // Add elements to structure type. for(unsigned i = 0, N = Elements.size(); i < N; ++i) { DebugInfoDesc *Element = Elements[i]; - + if (DerivedTypeDesc *MemberDesc = dyn_cast(Element)){ // Add field or base class. - + unsigned Tag = MemberDesc->getTag(); - + // Extract the basic information. const std::string &Name = MemberDesc->getName(); uint64_t Size = MemberDesc->getSize(); uint64_t Align = MemberDesc->getAlign(); uint64_t Offset = MemberDesc->getOffset(); - + // Construct member debug information entry. DIE *Member = new DIE(Tag); - + // Add name if not "". if (!Name.empty()) AddString(Member, DW_AT_name, DW_FORM_string, Name); // Add location if available. AddSourceLine(Member, MemberDesc->getFile(), MemberDesc->getLine()); - + // Most of the time the field info is the same as the members. uint64_t FieldSize = Size; uint64_t FieldAlign = Align; uint64_t FieldOffset = Offset; - + // Set the member type. TypeDesc *FromTy = MemberDesc->getFromType(); AddType(Member, FromTy, Unit); - + // Walk up typedefs until a real size is found. while (FromTy) { if (FromTy->getTag() != DW_TAG_typedef) { @@ -1618,10 +1618,10 @@ FieldAlign = FromTy->getSize(); break; } - + FromTy = cast(FromTy)->getFromType(); } - + // Unless we have a bit field. if (Tag == DW_TAG_member && FieldSize != Size) { // Construct the alignment mask. @@ -1632,16 +1632,16 @@ FieldOffset = HiMark - FieldSize; // Now normalize offset to the field. Offset -= FieldOffset; - + // Maybe we need to work from the other end. if (TD->isLittleEndian()) Offset = FieldSize - (Offset + Size); - + // Add size and offset. AddUInt(Member, DW_AT_byte_size, 0, FieldSize >> 3); AddUInt(Member, DW_AT_bit_size, 0, Size); AddUInt(Member, DW_AT_bit_offset, 0, Offset); } - + // Add computation for offset. DIEBlock *Block = new DIEBlock(); AddUInt(Block, 0, DW_FORM_data1, DW_OP_plus_uconst); @@ -1656,15 +1656,15 @@ } else if (Tag == DW_TAG_inheritance) { AddUInt(Member, DW_AT_accessibility, 0, DW_ACCESS_public); } - + Buffer.AddChild(Member); } else if (GlobalVariableDesc *StaticDesc = dyn_cast(Element)) { // Add static member. - + // Construct member debug information entry. DIE *Static = new DIE(DW_TAG_variable); - + // Add name and mangled name. const std::string &Name = StaticDesc->getName(); const std::string &LinkageName = StaticDesc->getLinkageName(); @@ -1673,54 +1673,54 @@ AddString(Static, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); } - + // Add location. AddSourceLine(Static, StaticDesc->getFile(), StaticDesc->getLine()); - + // Add type. if (TypeDesc *StaticTy = StaticDesc->getType()) AddType(Static, StaticTy, Unit); - + // Add flags. if (!StaticDesc->isStatic()) AddUInt(Static, DW_AT_external, DW_FORM_flag, 1); AddUInt(Static, DW_AT_declaration, DW_FORM_flag, 1); - + Buffer.AddChild(Static); } else if (SubprogramDesc *MethodDesc = dyn_cast(Element)) { // Add member function. - + // Construct member debug information entry. DIE *Method = new DIE(DW_TAG_subprogram); - + // Add name and mangled name. const std::string &Name = MethodDesc->getName(); const std::string &LinkageName = MethodDesc->getLinkageName(); - - AddString(Method, DW_AT_name, DW_FORM_string, Name); + + AddString(Method, DW_AT_name, DW_FORM_string, Name); bool IsCTor = TyDesc->getName() == Name; - + if (!LinkageName.empty()) { AddString(Method, DW_AT_MIPS_linkage_name, DW_FORM_string, LinkageName); } - + // Add location. AddSourceLine(Method, MethodDesc->getFile(), MethodDesc->getLine()); - + // Add type. if (CompositeTypeDesc *MethodTy = dyn_cast_or_null(MethodDesc->getType())) { // Get argument information. std::vector &Args = MethodTy->getElements(); - + // If not a ctor. if (!IsCTor) { // Add return type. AddType(Method, dyn_cast(Args[0]), Unit); } - + // Add arguments. for(unsigned i = 1, N = Args.size(); i < N; ++i) { DIE *Arg = new DIE(DW_TAG_formal_parameter); @@ -1734,7 +1734,7 @@ if (!MethodDesc->isStatic()) AddUInt(Method, DW_AT_external, DW_FORM_flag, 1); AddUInt(Method, DW_AT_declaration, DW_FORM_flag, 1); - + Buffer.AddChild(Method); } } @@ -1759,20 +1759,20 @@ AddUInt(&Buffer, DW_AT_prototyped, DW_FORM_flag, 1); // Add return type. AddType(&Buffer, dyn_cast(Elements[0]), Unit); - + // Add arguments. for(unsigned i = 1, N = Elements.size(); i < N; ++i) { DIE *Arg = new DIE(DW_TAG_formal_parameter); AddType(Arg, cast(Elements[i]), Unit); Buffer.AddChild(Arg); } - + break; } default: break; } } - + // Add size if non-zero (derived types don't have a size.) if (Size) AddUInt(&Buffer, DW_AT_byte_size, 0, Size); // Add name if not anonymous or intermediate type. @@ -1792,13 +1792,13 @@ AddUInt (Die, DW_AT_language, DW_FORM_data1, UnitDesc->getLanguage()); AddString(Die, DW_AT_name, DW_FORM_string, UnitDesc->getFileName()); AddString(Die, DW_AT_comp_dir, DW_FORM_string, UnitDesc->getDirectory()); - + // Construct compile unit. CompileUnit *Unit = new CompileUnit(UnitDesc, ID, Die); - + // Add Unit to compile unit map. DescToUnitMap[UnitDesc] = Unit; - + return Unit; } @@ -1829,7 +1829,7 @@ // Check for pre-existence. DIE *&Slot = Unit->getDieMapSlotFor(GVD); if (Slot) return Slot; - + // Get the global variable itself. GlobalVariable *GV = GVD->getGlobalVariable(); @@ -1846,26 +1846,26 @@ AddType(VariableDie, GVD->getType(), Unit); if (!GVD->isStatic()) AddUInt(VariableDie, DW_AT_external, DW_FORM_flag, 1); - + // Add source line info if available. AddSourceLine(VariableDie, UnitDesc, GVD->getLine()); - + // Add address. DIEBlock *Block = new DIEBlock(); AddUInt(Block, 0, DW_FORM_data1, DW_OP_addr); AddObjectLabel(Block, 0, DW_FORM_udata, Asm->getGlobalLinkName(GV)); AddBlock(VariableDie, DW_AT_location, 0, Block); - + // Add to map. Slot = VariableDie; - + // Add to context owner. Unit->getDie()->AddChild(VariableDie); - + // Expose as global. // FIXME - need to check external flag. Unit->AddGlobal(FullName, VariableDie); - + return VariableDie; } @@ -1880,12 +1880,12 @@ // Check for pre-existence. DIE *&Slot = Unit->getDieMapSlotFor(SPD); if (Slot) return Slot; - + // Gather the details (simplify add attribute code.) const std::string &Name = SPD->getName(); const std::string &FullName = SPD->getFullName(); const std::string &LinkageName = SPD->getLinkageName(); - + DIE *SubprogramDie = new DIE(DW_TAG_subprogram); AddString(SubprogramDie, DW_AT_name, DW_FORM_string, Name); if (!LinkageName.empty()) { @@ -1896,19 +1896,19 @@ if (!SPD->isStatic()) AddUInt(SubprogramDie, DW_AT_external, DW_FORM_flag, 1); AddUInt(SubprogramDie, DW_AT_prototyped, DW_FORM_flag, 1); - + // Add source line info if available. AddSourceLine(SubprogramDie, UnitDesc, SPD->getLine()); // Add to map. Slot = SubprogramDie; - + // Add to context owner. Unit->getDie()->AddChild(SubprogramDie); - + // Expose as global. Unit->AddGlobal(FullName, SubprogramDie); - + return SubprogramDie; } @@ -1934,10 +1934,10 @@ // Add source line info if available. AddSourceLine(VariableDie, VD->getFile(), VD->getLine()); - + // Add variable type. - AddType(VariableDie, VD->getType(), Unit); - + AddType(VariableDie, VD->getType(), Unit); + // Add variable address. MachineLocation Location; Location.set(RI->getFrameRegister(*MF), @@ -1958,7 +1958,7 @@ DIE *VariableDie = NewScopeVariable(Variables[i], Unit); if (VariableDie) ParentDie->AddChild(VariableDie); } - + // Add nested scopes. std::vector &Scopes = ParentScope->getScopes(); for (unsigned j = 0, M = Scopes.size(); j < M; ++j) { @@ -1966,20 +1966,20 @@ DebugScope *Scope = Scopes[j]; // FIXME - Ignore inlined functions for the time being. if (!Scope->getParent()) continue; - + unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID()); unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID()); // Ignore empty scopes. if (StartID == EndID && StartID != 0) continue; if (Scope->getScopes().empty() && Scope->getVariables().empty()) continue; - + if (StartID == ParentStartID && EndID == ParentEndID) { // Just add stuff to the parent scope. ConstructScope(Scope, ParentStartID, ParentEndID, ParentDie, Unit); } else { DIE *ScopeDie = new DIE(DW_TAG_lexical_block); - + // Add the scope bounds. if (StartID) { AddLabel(ScopeDie, DW_AT_low_pc, DW_FORM_addr, @@ -1995,7 +1995,7 @@ AddLabel(ScopeDie, DW_AT_high_pc, DW_FORM_addr, DWLabel("func_end", SubprogramCount)); } - + // Add the scope contents. ConstructScope(Scope, StartID, EndID, ScopeDie, Unit); ParentDie->AddChild(ScopeDie); @@ -2008,17 +2008,17 @@ void ConstructRootScope(DebugScope *RootScope) { // Exit if there is no root scope. if (!RootScope) return; - - // Get the subprogram debug information entry. + + // Get the subprogram debug information entry. SubprogramDesc *SPD = cast(RootScope->getDesc()); - + // Get the compile unit context. CompileUnit *Unit = GetBaseCompileUnit(); - + // Get the subprogram die. DIE *SPDie = Unit->getDieMapSlotFor(SPD); assert(SPDie && "Missing subprogram descriptor"); - + // Add the function bounds. AddLabel(SPDie, DW_AT_low_pc, DW_FORM_addr, DWLabel("func_begin", SubprogramCount)); @@ -2036,7 +2036,7 @@ // Check to see if we already emitted intial headers. if (didInitial) return; didInitial = true; - + // Dwarf sections base addresses. if (TAI->doesDwarfRequireFrameSection()) { Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); @@ -2073,7 +2073,7 @@ // Get the abbreviation for this DIE. unsigned AbbrevNumber = Die->getAbbrevNumber(); const DIEAbbrev *Abbrev = Abbreviations[AbbrevNumber - 1]; - + Asm->EOL(); // Emit the code (index) for the abbreviation. @@ -2087,16 +2087,16 @@ TagString(Abbrev->getTag()))); else Asm->EOL(); - + SmallVector &Values = Die->getValues(); const SmallVector &AbbrevData = Abbrev->getData(); - + // Emit the DIE attribute values. for (unsigned i = 0, N = Values.size(); i < N; ++i) { unsigned Attr = AbbrevData[i].getAttribute(); unsigned Form = AbbrevData[i].getForm(); assert(Form && "Too many attributes for DIE (check abbreviation)"); - + switch (Attr) { case DW_AT_sibling: { Asm->EmitInt32(Die->SiblingOffset()); @@ -2108,18 +2108,18 @@ break; } } - + Asm->EOL(AttributeString(Attr)); } - + // Emit the DIE children if any. if (Abbrev->getChildrenFlag() == DW_CHILDREN_yes) { const std::vector &Children = Die->getChildren(); - + for (unsigned j = 0, M = Children.size(); j < M; ++j) { EmitDIE(Children[j]); } - + Asm->EmitInt8(0); Asm->EOL("End Of Children Mark"); } } @@ -2129,23 +2129,23 @@ unsigned SizeAndOffsetDie(DIE *Die, unsigned Offset, bool Last) { // Get the children. const std::vector &Children = Die->getChildren(); - + // If not last sibling and has children then add sibling offset attribute. if (!Last && !Children.empty()) Die->AddSiblingOffset(); // Record the abbreviation. AssignAbbrevNumber(Die->getAbbrev()); - + // Get the abbreviation for this DIE. unsigned AbbrevNumber = Die->getAbbrevNumber(); const DIEAbbrev *Abbrev = Abbreviations[AbbrevNumber - 1]; // Set DIE offset Die->setOffset(Offset); - + // Start the size with the size of abbreviation code. - Offset += Asm->SizeULEB128(AbbrevNumber); - + Offset += TargetAsmInfo::getULEB128Size(AbbrevNumber); + const SmallVector &Values = Die->getValues(); const SmallVector &AbbrevData = Abbrev->getData(); @@ -2154,16 +2154,16 @@ // Size attribute value. Offset += Values[i]->SizeOf(*this, AbbrevData[i].getForm()); } - + // Size the DIE children if any. if (!Children.empty()) { assert(Abbrev->getChildrenFlag() == DW_CHILDREN_yes && "Children flag not set"); - + for (unsigned j = 0, M = Children.size(); j < M; ++j) { Offset = SizeAndOffsetDie(Children[j], Offset, (j + 1) == M); } - + // End of children marker. Offset += sizeof(int8_t); } @@ -2190,7 +2190,7 @@ void EmitDebugInfo() { // Start debug info section. Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); - + CompileUnit *Unit = GetBaseCompileUnit(); DIE *Die = Unit->getDie(); // Emit the compile units header. @@ -2201,13 +2201,13 @@ sizeof(int32_t) + // Offset Into Abbrev. Section sizeof(int8_t) + // Pointer Size (in bytes) sizeof(int32_t); // FIXME - extra pad for gdb bug. - + Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info"); Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number"); EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false); Asm->EOL("Offset Into Abbrev. Section"); Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)"); - + EmitDIE(Die); // FIXME - extra padding for gdb bug. Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); @@ -2215,7 +2215,7 @@ Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB"); EmitLabel("info_end", Unit->getID()); - + Asm->EOL(); } @@ -2226,36 +2226,36 @@ if (!Abbreviations.empty()) { // Start the debug abbrev section. Asm->SwitchToDataSection(TAI->getDwarfAbbrevSection()); - + EmitLabel("abbrev_begin", 0); - + // For each abbrevation. for (unsigned i = 0, N = Abbreviations.size(); i < N; ++i) { // Get abbreviation data const DIEAbbrev *Abbrev = Abbreviations[i]; - + // Emit the abbrevations code (base 1 index.) Asm->EmitULEB128Bytes(Abbrev->getNumber()); Asm->EOL("Abbreviation Code"); - + // Emit the abbreviations data. Abbrev->Emit(*this); - + Asm->EOL(); } - + // Mark end of abbreviations. Asm->EmitULEB128Bytes(0); Asm->EOL("EOM(3)"); EmitLabel("abbrev_end", 0); - + Asm->EOL(); } } /// EmitEndOfLineMatrix - Emit the last address of the section and the end of /// the line matrix. - /// + /// void EmitEndOfLineMatrix(unsigned SectionEnd) { // Define last address of section. Asm->EmitInt8(0); Asm->EOL("Extended Op"); @@ -2284,29 +2284,29 @@ // Start the dwarf line section. Asm->SwitchToDataSection(TAI->getDwarfLineSection()); - + // Construct the section header. - + EmitDifference("line_end", 0, "line_begin", 0, true); Asm->EOL("Length of Source Line Info"); EmitLabel("line_begin", 0); - + Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number"); - + EmitDifference("line_prolog_end", 0, "line_prolog_begin", 0, true); Asm->EOL("Prolog Length"); EmitLabel("line_prolog_begin", 0); - + Asm->EmitInt8(1); Asm->EOL("Minimum Instruction Length"); Asm->EmitInt8(1); Asm->EOL("Default is_stmt_start flag"); Asm->EmitInt8(MinLineDelta); Asm->EOL("Line Base Value (Special Opcodes)"); - + Asm->EmitInt8(MaxLineDelta); Asm->EOL("Line Range Value (Special Opcodes)"); Asm->EmitInt8(-MinLineDelta); Asm->EOL("Special Opcode Base"); - + // Line number standard opcode encodings argument count Asm->EmitInt8(0); Asm->EOL("DW_LNS_copy arg count"); Asm->EmitInt8(1); Asm->EOL("DW_LNS_advance_pc arg count"); @@ -2327,7 +2327,7 @@ Asm->EmitString(Directories[DirectoryID]); Asm->EOL("Directory"); } Asm->EmitInt8(0); Asm->EOL("End of directories"); - + // Emit files. for (unsigned SourceID = 1, NSID = SourceFiles.size(); SourceID <= NSID; ++SourceID) { @@ -2342,9 +2342,9 @@ Asm->EOL("File size"); } Asm->EmitInt8(0); Asm->EOL("End of files"); - + EmitLabel("line_prolog_end", 0); - + // A sequence for each text section. unsigned SecSrcLinesSize = SectionSourceLines.size(); @@ -2360,13 +2360,13 @@ // Dwarf assumes we start with first line of first source file. unsigned Source = 1; unsigned Line = 1; - + // Construct rows of the address, source, line, column matrix. for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) { const SourceLineInfo &LineInfo = LineInfos[i]; unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID()); if (!LabelID) continue; - + unsigned SourceID = LineInfo.getSourceID(); const SourceFileInfo &SourceFile = SourceFiles[SourceID]; unsigned DirectoryID = SourceFile.getDirectoryID(); @@ -2383,23 +2383,23 @@ Asm->EmitInt8(TD->getPointerSize() + 1); Asm->EOL("Op size"); Asm->EmitInt8(DW_LNE_set_address); Asm->EOL("DW_LNE_set_address"); EmitReference("label", LabelID); Asm->EOL("Location label"); - + // If change of source, then switch to the new source. if (Source != LineInfo.getSourceID()) { Source = LineInfo.getSourceID(); Asm->EmitInt8(DW_LNS_set_file); Asm->EOL("DW_LNS_set_file"); Asm->EmitULEB128Bytes(Source); Asm->EOL("New Source"); } - + // If change of line. if (Line != LineInfo.getLine()) { // Determine offset. int Offset = LineInfo.getLine() - Line; int Delta = Offset - MinLineDelta; - + // Update line. Line = LineInfo.getLine(); - + // If delta is small enough and in range... if (Delta >= 0 && Delta < (MaxLineDelta - 1)) { // ... then use fast opcode. @@ -2424,12 +2424,12 @@ // table. The linker and friends expect it to exist. If there's nothing to // put into it, emit an empty table. EmitEndOfLineMatrix(1); - + EmitLabel("line_end", 0); - + Asm->EOL(); } - + /// EmitCommonDebugFrame - Emit common frame info into a debug frame section. /// void EmitCommonDebugFrame() { @@ -2459,10 +2459,10 @@ Asm->EmitULEB128Bytes(1); Asm->EOL("CIE Code Alignment Factor"); Asm->EmitSLEB128Bytes(stackGrowth); - Asm->EOL("CIE Data Alignment Factor"); + Asm->EOL("CIE Data Alignment Factor"); Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), false)); Asm->EOL("CIE RA Column"); - + std::vector Moves; RI->getInitialFrameState(Moves); @@ -2470,7 +2470,7 @@ Asm->EmitAlignment(2, 0, 0, false); EmitLabel("debug_frame_common_end", 0); - + Asm->EOL(); } @@ -2479,14 +2479,14 @@ void EmitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) { if (!TAI->doesDwarfRequireFrameSection()) return; - + // Start the dwarf frame section. Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); - + EmitDifference("debug_frame_end", DebugFrameInfo.Number, "debug_frame_begin", DebugFrameInfo.Number, true); Asm->EOL("Length of Frame Information Entry"); - + EmitLabel("debug_frame_begin", DebugFrameInfo.Number); EmitSectionOffset("debug_frame_common", "section_debug_frame", @@ -2498,9 +2498,9 @@ EmitDifference("func_end", DebugFrameInfo.Number, "func_begin", DebugFrameInfo.Number); Asm->EOL("FDE address range"); - + EmitFrameMoves("func_begin", DebugFrameInfo.Number, DebugFrameInfo.Moves, false); - + Asm->EmitAlignment(2, 0, 0, false); EmitLabel("debug_frame_end", DebugFrameInfo.Number); @@ -2512,15 +2512,15 @@ void EmitDebugPubNames() { // Start the dwarf pubnames section. Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); - - CompileUnit *Unit = GetBaseCompileUnit(); - + + CompileUnit *Unit = GetBaseCompileUnit(); + EmitDifference("pubnames_end", Unit->getID(), "pubnames_begin", Unit->getID(), true); Asm->EOL("Length of Public Names Info"); - + EmitLabel("pubnames_begin", Unit->getID()); - + Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version"); EmitSectionOffset("info_begin", "section_info", @@ -2529,22 +2529,22 @@ EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(),true); Asm->EOL("Compilation Unit Length"); - + std::map &Globals = Unit->getGlobals(); - + for (std::map::iterator GI = Globals.begin(), GE = Globals.end(); GI != GE; ++GI) { const std::string &Name = GI->first; DIE * Entity = GI->second; - + Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset"); Asm->EmitString(Name); Asm->EOL("External Name"); } - + Asm->EmitInt32(0); Asm->EOL("End Mark"); EmitLabel("pubnames_end", Unit->getID()); - + Asm->EOL(); } @@ -2555,7 +2555,7 @@ if (!StringPool.empty()) { // Start the dwarf str section. Asm->SwitchToDataSection(TAI->getDwarfStrSection()); - + // For each of strings in the string pool. for (unsigned StringID = 1, N = StringPool.size(); StringID <= N; ++StringID) { @@ -2565,7 +2565,7 @@ const std::string &String = StringPool[StringID]; Asm->EmitString(String); Asm->EOL(); } - + Asm->EOL(); } } @@ -2575,7 +2575,7 @@ void EmitDebugLoc() { // Start the dwarf loc section. Asm->SwitchToDataSection(TAI->getDwarfLocSection()); - + Asm->EOL(); } @@ -2584,16 +2584,16 @@ void EmitDebugARanges() { // Start the dwarf aranges section. Asm->SwitchToDataSection(TAI->getDwarfARangesSection()); - + // FIXME - Mock up #if 0 - CompileUnit *Unit = GetBaseCompileUnit(); - + CompileUnit *Unit = GetBaseCompileUnit(); + // Don't include size of length Asm->EmitInt32(0x1c); Asm->EOL("Length of Address Ranges Info"); - + Asm->EmitInt16(DWARF_VERSION); Asm->EOL("Dwarf Version"); - + EmitReference("info_begin", Unit->getID()); Asm->EOL("Offset of Compilation Unit Info"); @@ -2611,7 +2611,7 @@ Asm->EmitInt32(0); Asm->EOL("EOM (1)"); Asm->EmitInt32(0); Asm->EOL("EOM (2)"); #endif - + Asm->EOL(); } @@ -2620,7 +2620,7 @@ void EmitDebugRanges() { // Start the dwarf ranges section. Asm->SwitchToDataSection(TAI->getDwarfRangesSection()); - + Asm->EOL(); } @@ -2629,7 +2629,7 @@ void EmitDebugMacInfo() { // Start the dwarf macinfo section. Asm->SwitchToDataSection(TAI->getDwarfMacInfoSection()); - + Asm->EOL(); } @@ -2637,7 +2637,7 @@ /// header file. void ConstructCompileUnitDIEs() { const UniqueVector CUW = MMI->getCompileUnits(); - + for (unsigned i = 1, N = CUW.size(); i <= N; ++i) { unsigned ID = MMI->RecordSource(CUW[i]); CompileUnit *Unit = NewCompileUnit(CUW[i], ID); @@ -2650,7 +2650,7 @@ void ConstructGlobalDIEs() { std::vector GlobalVariables; MMI->getAnchoredDescriptors(*M, GlobalVariables); - + for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) { GlobalVariableDesc *GVD = GlobalVariables[i]; NewGlobalVariable(GVD); @@ -2662,7 +2662,7 @@ void ConstructSubprogramDIEs() { std::vector Subprograms; MMI->getAnchoredDescriptors(*M, Subprograms); - + for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) { SubprogramDesc *SPD = Subprograms[i]; NewSubprogram(SPD); @@ -2702,16 +2702,16 @@ if (!MMI && mmi->hasDebugInfo()) { MMI = mmi; shouldEmit = true; - + // Create all the compile unit DIEs. ConstructCompileUnitDIEs(); - + // Create DIEs for each of the externally visible global variables. ConstructGlobalDIEs(); // Create DIEs for each of the externally visible subprograms. ConstructSubprogramDIEs(); - + // Prime section data. SectionMap.insert(TAI->getTextSection()); @@ -2744,13 +2744,13 @@ /// void EndModule() { if (!ShouldEmitDwarf()) return; - + // Standard sections final addresses. Asm->SwitchToTextSection(TAI->getTextSection()); EmitLabel("text_end", 0); Asm->SwitchToDataSection(TAI->getDataSection()); EmitLabel("data_end", 0); - + // End text sections. for (unsigned i = 1, N = SectionMap.size(); i <= N; ++i) { Asm->SwitchToTextSection(SectionMap[i].c_str()); @@ -2767,45 +2767,45 @@ // Compute DIE offsets and sizes. SizeAndOffsets(); - + // Emit all the DIEs into a debug info section EmitDebugInfo(); - + // Corresponding abbreviations into a abbrev section. EmitAbbreviations(); - + // Emit source line correspondence into a debug line section. EmitDebugLines(); - + // Emit info into a debug pubnames section. EmitDebugPubNames(); - + // Emit info into a debug str section. EmitDebugStr(); - + // Emit info into a debug loc section. EmitDebugLoc(); - + // Emit info into a debug aranges section. EmitDebugARanges(); - + // Emit info into a debug ranges section. EmitDebugRanges(); - + // Emit info into a debug macinfo section. EmitDebugMacInfo(); } - /// BeginFunction - Gather pre-function debug information. Assumes being + /// BeginFunction - Gather pre-function debug information. Assumes being /// emitted immediately after the function entry point. void BeginFunction(MachineFunction *MF) { this->MF = MF; - + if (!ShouldEmitDwarf()) return; // Begin accumulating function debug information. MMI->BeginFunction(MF); - + // Assumes in correct section after the entry point. EmitLabel("func_begin", ++SubprogramCount); @@ -2817,15 +2817,15 @@ Asm->printLabel(LineInfo.getLabelID()); } } - + /// EndFunction - Gather and emit post-function debug information. /// void EndFunction() { if (!ShouldEmitDwarf()) return; - + // Define end label for subprogram. EmitLabel("func_end", SubprogramCount); - + // Get function line info. const std::vector &LineInfos = MMI->getSourceLines(); @@ -2838,7 +2838,7 @@ SectionLineInfos.insert(SectionLineInfos.end(), LineInfos.begin(), LineInfos.end()); } - + // Construct scopes for subprogram. ConstructRootScope(MMI->getRootScope()); @@ -2848,7 +2848,7 @@ }; //===----------------------------------------------------------------------===// -/// DwarfException - Emits Dwarf exception handling directives. +/// DwarfException - Emits Dwarf exception handling directives. /// class DwarfException : public Dwarf { @@ -2884,7 +2884,7 @@ /// should be emitted. bool shouldEmitTableModule; - /// shouldEmitFrameModule - Per-module flag to indicate if frame moves + /// shouldEmitFrameModule - Per-module flag to indicate if frame moves /// should be emitted. bool shouldEmitMovesModule; @@ -2970,7 +2970,7 @@ // On Darwin the linker honors the alignment of eh_frame, which means it // must be 8-byte on 64-bit targets to match what gcc does. Otherwise // you get holes which confuse readers of eh_frame. - Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3, + Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3, 0, 0, false); EmitLabel("eh_frame_common_end", Index); @@ -2993,26 +2993,26 @@ } // If corresponding function is weak definition, this should be too. - if ((linkage == Function::WeakLinkage || + if ((linkage == Function::WeakLinkage || linkage == Function::LinkOnceLinkage) && TAI->getWeakDefDirective()) O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n"; // If there are no calls then you can't unwind. This may mean we can // omit the EH Frame, but some environments do not handle weak absolute - // symbols. + // symbols. // If UnwindTablesMandatory is set we cannot do this optimization; the // unwind info is to be available for non-EH uses. if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory && - ((linkage != Function::WeakLinkage && + ((linkage != Function::WeakLinkage && linkage != Function::LinkOnceLinkage) || !TAI->getWeakDefDirective() || TAI->getSupportsWeakOmittedEHFrame())) - { + { O << EHFrameInfo.FnName << " = 0\n"; - // This name has no connection to the function, so it might get - // dead-stripped when the function is not, erroneously. Prohibit + // This name has no connection to the function, so it might get + // dead-stripped when the function is not, erroneously. Prohibit // dead-stripping unconditionally. if (const char *UsedDirective = TAI->getUsedDirective()) O << UsedDirective << EHFrameInfo.FnName << "\n\n"; @@ -3023,7 +3023,7 @@ EmitDifference("eh_frame_end", EHFrameInfo.Number, "eh_frame_begin", EHFrameInfo.Number, true); Asm->EOL("Length of Frame Information Entry"); - + EmitLabel("eh_frame_begin", EHFrameInfo.Number); EmitSectionOffset("eh_frame_begin", "eh_frame_common", @@ -3056,17 +3056,17 @@ // Indicate locations of function specific callee saved registers in // frame. EmitFrameMoves("eh_func_begin", EHFrameInfo.Number, EHFrameInfo.Moves, true); - + // On Darwin the linker honors the alignment of eh_frame, which means it // must be 8-byte on 64-bit targets to match what gcc does. Otherwise // you get holes which confuse readers of eh_frame. - Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3, + Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3, 0, 0, false); EmitLabel("eh_frame_end", EHFrameInfo.Number); - - // If the function is marked used, this table should be also. We cannot + + // If the function is marked used, this table should be also. We cannot // make the mark unconditional in this case, since retaining the table - // also retains the function in this case, and there is code around + // also retains the function in this case, and there is code around // that depends on unused functions (calling undefined externals) being // dead-stripped to link correctly. Yes, there really is. if (MMI->getUsedFunctions().count(EHFrameInfo.function)) @@ -3188,7 +3188,7 @@ for(std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I != E; ++I) { FilterOffsets.push_back(Offset); - Offset -= Asm->SizeULEB128(*I); + Offset -= TargetAsmInfo::getULEB128Size(*I); } // Compute the actions table and gather the first action index for each @@ -3213,10 +3213,11 @@ const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); assert(Actions.size()); PrevAction = &Actions.back(); - SizeAction = Asm->SizeSLEB128(PrevAction->NextAction) + - Asm->SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + + TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); for (unsigned j = NumShared; j != SizePrevIds; ++j) { - SizeAction -= Asm->SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction -= + TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); SizeAction += -PrevAction->NextAction; PrevAction = PrevAction->Previous; } @@ -3227,10 +3228,10 @@ int TypeID = TypeIds[I]; assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; - unsigned SizeTypeID = Asm->SizeSLEB128(ValueForTypeID); + unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; - SizeAction = SizeTypeID + Asm->SizeSLEB128(NextAction); + SizeAction = SizeTypeID + TargetAsmInfo::getSLEB128Size(NextAction); SizeSiteActions += SizeAction; ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; @@ -3364,19 +3365,19 @@ SiteLengthSize + LandingPadSize); for (unsigned i = 0, e = CallSites.size(); i < e; ++i) - SizeSites += Asm->SizeULEB128(CallSites[i].Action); + SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); // Type infos. const unsigned TypeInfoSize = TD->getPointerSize(); // DW_EH_PE_absptr unsigned SizeTypes = TypeInfos.size() * TypeInfoSize; unsigned TypeOffset = sizeof(int8_t) + // Call site format - Asm->SizeULEB128(SizeSites) + // Call-site table length + TargetAsmInfo::getULEB128Size(SizeSites) + // Call-site table length SizeSites + SizeActions + SizeTypes; unsigned TotalSize = sizeof(int8_t) + // LPStart format sizeof(int8_t) + // TType format - Asm->SizeULEB128(TypeOffset) + // TType base offset + TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset TypeOffset; unsigned SizeAlign = (4 - TotalSize) & 3; @@ -3485,7 +3486,7 @@ , shouldEmitTableModule(false) , shouldEmitMovesModule(false) {} - + virtual ~DwarfException() {} /// SetModuleInfo - Set machine module information when it's known that pass @@ -3514,7 +3515,7 @@ } } - /// BeginFunction - Gather pre-function exception information. Assumes being + /// BeginFunction - Gather pre-function exception information. Assumes being /// emitted immediately after the function entry point. void BeginFunction(MachineFunction *MF) { this->MF = MF; @@ -3569,19 +3570,19 @@ // Emit its Dwarf tag type. DD.getAsm()->EmitULEB128Bytes(Tag); DD.getAsm()->EOL(TagString(Tag)); - + // Emit whether it has children DIEs. DD.getAsm()->EmitULEB128Bytes(ChildrenFlag); DD.getAsm()->EOL(ChildrenString(ChildrenFlag)); - + // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) { const DIEAbbrevData &AttrData = Data[i]; - + // Emit attribute type. DD.getAsm()->EmitULEB128Bytes(AttrData.getAttribute()); DD.getAsm()->EOL(AttributeString(AttrData.getAttribute())); - + // Emit form type. DD.getAsm()->EmitULEB128Bytes(AttrData.getForm()); DD.getAsm()->EOL(FormEncodingString(AttrData.getForm())); @@ -3601,7 +3602,7 @@ << " " << ChildrenString(ChildrenFlag) << "\n"; - + for (unsigned i = 0, N = Data.size(); i < N; ++i) { O << " " << AttributeString(Data[i].getAttribute()) @@ -3655,8 +3656,8 @@ case DW_FORM_data4: return sizeof(int32_t); case DW_FORM_ref8: // Fall thru case DW_FORM_data8: return sizeof(int64_t); - case DW_FORM_udata: return DD.getAsm()->SizeULEB128(Integer); - case DW_FORM_sdata: return DD.getAsm()->SizeSLEB128(Integer); + case DW_FORM_udata: return TargetAsmInfo::getULEB128Size(Integer); + case DW_FORM_sdata: return TargetAsmInfo::getSLEB128Size(Integer); default: assert(0 && "DIE Value form not supported yet"); break; } return 0; @@ -3701,7 +3702,7 @@ if (Form == DW_FORM_data4) return 4; return DD.getTargetData()->getPointerSize(); } - + //===----------------------------------------------------------------------===// /// EmitValue - Emit delta value. @@ -3718,7 +3719,7 @@ if (Form == DW_FORM_data4) return 4; return DD.getTargetData()->getPointerSize(); } - + //===----------------------------------------------------------------------===// /// EmitValue - Emit delta value. @@ -3742,7 +3743,7 @@ void DIEntry::EmitValue(DwarfDebug &DD, unsigned Form) { DD.getAsm()->EmitInt32(Entry->getOffset()); } - + //===----------------------------------------------------------------------===// /// ComputeSize - calculate the size of the block. @@ -3750,7 +3751,7 @@ unsigned DIEBlock::ComputeSize(DwarfDebug &DD) { if (!Size) { const SmallVector &AbbrevData = Abbrev.getData(); - + for (unsigned i = 0, N = Values.size(); i < N; ++i) { Size += Values[i]->SizeOf(DD, AbbrevData[i].getForm()); } @@ -3768,7 +3769,7 @@ case DW_FORM_block: DD.getAsm()->EmitULEB128Bytes(Size); break; default: assert(0 && "Improper form for block"); break; } - + const SmallVector &AbbrevData = Abbrev.getData(); for (unsigned i = 0, N = Values.size(); i < N; ++i) { @@ -3784,7 +3785,7 @@ case DW_FORM_block1: return Size + sizeof(int8_t); case DW_FORM_block2: return Size + sizeof(int16_t); case DW_FORM_block4: return Size + sizeof(int32_t); - case DW_FORM_block: return Size + DD.getAsm()->SizeULEB128(Size); + case DW_FORM_block: return Size + TargetAsmInfo::getULEB128Size(Size); default: assert(0 && "Improper form for block"); break; } return 0; @@ -3797,7 +3798,7 @@ for (unsigned i = 0, N = Children.size(); i < N; ++i) delete Children[i]; } - + /// AddSiblingOffset - Add a sibling offset field to the front of the DIE. /// void DIE::AddSiblingOffset() { @@ -3810,7 +3811,7 @@ /// void DIE::Profile(FoldingSetNodeID &ID) { Abbrev.Profile(ID); - + for (unsigned i = 0, N = Children.size(); i < N; ++i) ID.AddPointer(Children[i]); @@ -3824,15 +3825,15 @@ IndentCount += IncIndent; const std::string Indent(IndentCount, ' '); bool isBlock = Abbrev.getTag() == 0; - + if (!isBlock) { O << Indent << "Die: " << "0x" << std::hex << (intptr_t)this << std::dec << ", Offset: " << Offset << ", Size: " << Size - << "\n"; - + << "\n"; + O << Indent << TagString(Abbrev.getTag()) << " " @@ -3843,7 +3844,7 @@ O << "\n"; const SmallVector &Data = Abbrev.getData(); - + IndentCount += 2; for (unsigned i = 0, N = Data.size(); i < N; ++i) { O << Indent; @@ -3864,7 +3865,7 @@ for (unsigned j = 0, M = Children.size(); j < M; ++j) { Children[j]->print(O, 4); } - + if (!isBlock) O << "\n"; IndentCount -= IncIndent; } @@ -3910,7 +3911,7 @@ DD->EndModule(); } -/// BeginFunction - Gather pre-function debug information. Assumes being +/// BeginFunction - Gather pre-function debug information. Assumes being /// emitted immediately after the function entry point. void DwarfWriter::BeginFunction(MachineFunction *MF) { DE->BeginFunction(MF); @@ -3922,7 +3923,7 @@ void DwarfWriter::EndFunction() { DD->EndFunction(); DE->EndFunction(); - + if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE->getMMI()) // Clear function debug information. MMI->EndFunction(); Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Sat Aug 16 07:57:46 2008 @@ -16,7 +16,6 @@ #include "JITDwarfEmitter.h" #include "llvm/Function.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" @@ -244,7 +243,7 @@ for(std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I != E; ++I) { FilterOffsets.push_back(Offset); - Offset -= AsmPrinter::SizeULEB128(*I); + Offset -= TargetAsmInfo::getULEB128Size(*I); } // Compute the actions table and gather the first action index for each @@ -269,10 +268,10 @@ const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); assert(Actions.size()); PrevAction = &Actions.back(); - SizeAction = AsmPrinter::SizeSLEB128(PrevAction->NextAction) + - AsmPrinter::SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + + TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); for (unsigned j = NumShared; j != SizePrevIds; ++j) { - SizeAction -= AsmPrinter::SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction -= TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); SizeAction += -PrevAction->NextAction; PrevAction = PrevAction->Previous; } @@ -283,10 +282,10 @@ int TypeID = TypeIds[I]; assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; - unsigned SizeTypeID = AsmPrinter::SizeSLEB128(ValueForTypeID); + unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; - SizeAction = SizeTypeID + AsmPrinter::SizeSLEB128(NextAction); + SizeAction = SizeTypeID + TargetAsmInfo::getSLEB128Size(NextAction); SizeSiteActions += SizeAction; ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; @@ -389,18 +388,18 @@ sizeof(int32_t) + // Site length. sizeof(int32_t)); // Landing pad. for (unsigned i = 0, e = CallSites.size(); i < e; ++i) - SizeSites += AsmPrinter::SizeULEB128(CallSites[i].Action); + SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize(); unsigned TypeOffset = sizeof(int8_t) + // Call site format // Call-site table length - AsmPrinter::SizeULEB128(SizeSites) + + TargetAsmInfo::getULEB128Size(SizeSites) + SizeSites + SizeActions + SizeTypes; unsigned TotalSize = sizeof(int8_t) + // LPStart format sizeof(int8_t) + // TType format - AsmPrinter::SizeULEB128(TypeOffset) + // TType base offset + TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset TypeOffset; unsigned SizeAlign = (4 - TotalSize) & 3; @@ -684,10 +683,10 @@ // If there is a personality and landing pads then point to the language // specific data area in the exception table. if (MMI->getPersonalityIndex()) { - FinalSize += AsmPrinter::SizeULEB128(4); + FinalSize += TargetAsmInfo::getULEB128Size(4); FinalSize += PointerSize; } else { - FinalSize += AsmPrinter::SizeULEB128(0); + FinalSize += TargetAsmInfo::getULEB128Size(0); } // Indicate locations of function specific callee saved registers in @@ -715,24 +714,24 @@ FinalSize += 4; FinalSize += 1; FinalSize += Personality ? 5 : 3; // "zPLR" or "zR" - FinalSize += AsmPrinter::SizeULEB128(1); - FinalSize += AsmPrinter::SizeSLEB128(stackGrowth); + FinalSize += TargetAsmInfo::getULEB128Size(1); + FinalSize += TargetAsmInfo::getSLEB128Size(stackGrowth); FinalSize += 1; if (Personality) { - FinalSize += AsmPrinter::SizeULEB128(7); + FinalSize += TargetAsmInfo::getULEB128Size(7); // Encoding FinalSize+= 1; //Personality FinalSize += PointerSize; - FinalSize += AsmPrinter::SizeULEB128(dwarf::DW_EH_PE_pcrel); - FinalSize += AsmPrinter::SizeULEB128(dwarf::DW_EH_PE_pcrel); + FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); + FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); } else { - FinalSize += AsmPrinter::SizeULEB128(1); - FinalSize += AsmPrinter::SizeULEB128(dwarf::DW_EH_PE_pcrel); + FinalSize += TargetAsmInfo::getULEB128Size(1); + FinalSize += TargetAsmInfo::getULEB128Size(dwarf::DW_EH_PE_pcrel); } std::vector Moves; @@ -784,12 +783,12 @@ } else { ++FinalSize; unsigned RegNum = RI->getDwarfRegNum(Src.getRegister(), true); - FinalSize += AsmPrinter::SizeULEB128(RegNum); + FinalSize += TargetAsmInfo::getULEB128Size(RegNum); } int Offset = -Src.getOffset(); - FinalSize += AsmPrinter::SizeULEB128(Offset); + FinalSize += TargetAsmInfo::getULEB128Size(Offset); } else { assert(0 && "Machine move no supported yet."); } @@ -798,7 +797,7 @@ if (Dst.isRegister()) { ++FinalSize; unsigned RegNum = RI->getDwarfRegNum(Dst.getRegister(), true); - FinalSize += AsmPrinter::SizeULEB128(RegNum); + FinalSize += TargetAsmInfo::getULEB128Size(RegNum); } else { assert(0 && "Machine move no supported yet."); } @@ -808,15 +807,15 @@ if (Offset < 0) { ++FinalSize; - FinalSize += AsmPrinter::SizeULEB128(Reg); - FinalSize += AsmPrinter::SizeSLEB128(Offset); + FinalSize += TargetAsmInfo::getULEB128Size(Reg); + FinalSize += TargetAsmInfo::getSLEB128Size(Offset); } else if (Reg < 64) { ++FinalSize; - FinalSize += AsmPrinter::SizeULEB128(Offset); + FinalSize += TargetAsmInfo::getULEB128Size(Offset); } else { ++FinalSize; - FinalSize += AsmPrinter::SizeULEB128(Reg); - FinalSize += AsmPrinter::SizeULEB128(Offset); + FinalSize += TargetAsmInfo::getULEB128Size(Reg); + FinalSize += TargetAsmInfo::getULEB128Size(Offset); } } } @@ -859,7 +858,7 @@ for(std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I != E; ++I) { FilterOffsets.push_back(Offset); - Offset -= AsmPrinter::SizeULEB128(*I); + Offset -= TargetAsmInfo::getULEB128Size(*I); } // Compute the actions table and gather the first action index for each @@ -884,10 +883,10 @@ const unsigned SizePrevIds = LandingPads[i-1]->TypeIds.size(); assert(Actions.size()); PrevAction = &Actions.back(); - SizeAction = AsmPrinter::SizeSLEB128(PrevAction->NextAction) + - AsmPrinter::SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction = TargetAsmInfo::getSLEB128Size(PrevAction->NextAction) + + TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); for (unsigned j = NumShared; j != SizePrevIds; ++j) { - SizeAction -= AsmPrinter::SizeSLEB128(PrevAction->ValueForTypeID); + SizeAction -= TargetAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID); SizeAction += -PrevAction->NextAction; PrevAction = PrevAction->Previous; } @@ -898,10 +897,10 @@ int TypeID = TypeIds[I]; assert(-1-TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; - unsigned SizeTypeID = AsmPrinter::SizeSLEB128(ValueForTypeID); + unsigned SizeTypeID = TargetAsmInfo::getSLEB128Size(ValueForTypeID); int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; - SizeAction = SizeTypeID + AsmPrinter::SizeSLEB128(NextAction); + SizeAction = SizeTypeID + TargetAsmInfo::getSLEB128Size(NextAction); SizeSiteActions += SizeAction; ActionEntry Action = {ValueForTypeID, NextAction, PrevAction}; @@ -1004,18 +1003,18 @@ sizeof(int32_t) + // Site length. sizeof(int32_t)); // Landing pad. for (unsigned i = 0, e = CallSites.size(); i < e; ++i) - SizeSites += AsmPrinter::SizeULEB128(CallSites[i].Action); + SizeSites += TargetAsmInfo::getULEB128Size(CallSites[i].Action); unsigned SizeTypes = TypeInfos.size() * TD->getPointerSize(); unsigned TypeOffset = sizeof(int8_t) + // Call site format // Call-site table length - AsmPrinter::SizeULEB128(SizeSites) + + TargetAsmInfo::getULEB128Size(SizeSites) + SizeSites + SizeActions + SizeTypes; unsigned TotalSize = sizeof(int8_t) + // LPStart format sizeof(int8_t) + // TType format - AsmPrinter::SizeULEB128(TypeOffset) + // TType base offset + TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset TypeOffset; unsigned SizeAlign = (4 - TotalSize) & 3; @@ -1053,7 +1052,7 @@ // Asm->EOL("Landing pad"); FinalSize += PointerSize; - FinalSize += AsmPrinter::SizeULEB128(S.Action); + FinalSize += TargetAsmInfo::getULEB128Size(S.Action); // Asm->EOL("Action"); } @@ -1062,9 +1061,9 @@ ActionEntry &Action = Actions[I]; //Asm->EOL("TypeInfo index"); - FinalSize += AsmPrinter::SizeSLEB128(Action.ValueForTypeID); + FinalSize += TargetAsmInfo::getSLEB128Size(Action.ValueForTypeID); //Asm->EOL("Next action"); - FinalSize += AsmPrinter::SizeSLEB128(Action.NextAction); + FinalSize += TargetAsmInfo::getSLEB128Size(Action.NextAction); } // Emit the type ids. @@ -1076,7 +1075,7 @@ // Emit the filter typeids. for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) { unsigned TypeID = FilterIds[j]; - FinalSize += AsmPrinter::SizeULEB128(TypeID); + FinalSize += TargetAsmInfo::getULEB128Size(TypeID); //Asm->EOL("Filter TypeInfo index"); } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=54843&r1=54842&r2=54843&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Aug 16 07:57:46 2008 @@ -389,3 +389,26 @@ return I->second; } + +unsigned TargetAsmInfo::getULEB128Size(unsigned Value) { + unsigned Size = 0; + do { + Value >>= 7; + Size += sizeof(int8_t); + } while (Value); + return Size; +} + +unsigned TargetAsmInfo::getSLEB128Size(int Value) { + unsigned Size = 0; + int Sign = Value >> (8 * sizeof(Value) - 1); + bool IsMore; + + do { + unsigned Byte = Value & 0x7f; + Value >>= 7; + IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; + Size += sizeof(int8_t); + } while (IsMore); + return Size; +} From asl at math.spbu.ru Sat Aug 16 07:58:12 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:58:12 -0000 Subject: [llvm-commits] [llvm] r54844 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/Sparc/SparcTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp Message-ID: <200808161258.m7GCwCPF016866@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:58:12 2008 New Revision: 54844 URL: http://llvm.org/viewvc/llvm-project?rev=54844&view=rev Log: Add interface for section override. Use this for Sparc, since it should use named BSS section. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=54844&r1=54843&r2=54844&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sat Aug 16 07:58:12 2008 @@ -520,9 +520,11 @@ virtual ~TargetAsmInfo(); const Section* getNamedSection(const char *Name, - unsigned Flags = SectionFlags::None) const; + unsigned Flags = SectionFlags::None, + bool Override = false) const; const Section* getUnnamedSection(const char *Directive, - unsigned Flags = SectionFlags::None) const; + unsigned Flags = SectionFlags::None, + bool Override = false) const; /// Measure the specified inline asm to determine an approximation of its /// length. Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp?rev=54844&r1=54843&r2=54844&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Sat Aug 16 07:58:12 2008 @@ -25,6 +25,11 @@ ConstantPoolSection = "\t.section \".rodata\",#alloc\n"; COMMDirectiveTakesAlignment = true; CStringSection=".rodata.str"; + + // Sparc normally uses named section for BSS. + BSSSection_ = getNamedSection("\t.bss", + SectionFlags::Writeable | SectionFlags::BSS, + /* Override */ true); } std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const { Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=54844&r1=54843&r2=54844&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Aug 16 07:58:12 2008 @@ -352,11 +352,12 @@ } const Section* -TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags) const { +TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags, + bool Override) const { Section& S = Sections[Name]; // This is newly-created section, set it up properly. - if (S.Flags == SectionFlags::Invalid) { + if (S.Flags == SectionFlags::Invalid || Override) { S.Flags = Flags | SectionFlags::Named; S.Name = Name; } @@ -365,11 +366,12 @@ } const Section* -TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const { +TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags, + bool Override) const { Section& S = Sections[Directive]; // This is newly-created section, set it up properly. - if (S.Flags == SectionFlags::Invalid) { + if (S.Flags == SectionFlags::Invalid || Override) { S.Flags = Flags & ~SectionFlags::Named; S.Name = Directive; } From asl at math.spbu.ru Sat Aug 16 07:58:29 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:58:29 -0000 Subject: [llvm-commits] [llvm] r54845 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200808161258.m7GCwUsX016884@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:58:29 2008 New Revision: 54845 URL: http://llvm.org/viewvc/llvm-project?rev=54845&view=rev Log: Use correct name for TLS address resolution routine on x86-64 Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=54845&r1=54844&r2=54845&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Aug 16 07:58:29 2008 @@ -4320,14 +4320,14 @@ Chain = Result.getValue(1); InFlag = Result.getValue(2); - // call ___tls_get_addr. This function receives its argument in + // call __tls_get_addr. This function receives its argument in // the register RDI. Chain = DAG.getCopyToReg(Chain, X86::RDI, Result, InFlag); InFlag = Chain.getValue(1); NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); SDValue Ops1[] = { Chain, - DAG.getTargetExternalSymbol("___tls_get_addr", + DAG.getTargetExternalSymbol("__tls_get_addr", PtrVT), DAG.getRegister(X86::RDI, PtrVT), InFlag }; From asl at math.spbu.ru Sat Aug 16 07:58:46 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:58:46 -0000 Subject: [llvm-commits] [llvm] r54846 - /llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200808161258.m7GCwkrD016905@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:58:46 2008 New Revision: 54846 URL: http://llvm.org/viewvc/llvm-project?rev=54846&view=rev Log: Use proper strings section name for PPC Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=54846&r1=54845&r2=54846&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Sat Aug 16 07:58:46 2008 @@ -111,7 +111,7 @@ PrivateGlobalPrefix = ""; ConstantPoolSection = "\t.section .rodata.cst4\t"; JumpTableDataSection = ".section .rodata.cst4"; - CStringSection = "\t.section\t.rodata"; + CStringSection = ".rodata.str"; StaticCtorsSection = ".section\t.ctors,\"aw\", at progbits"; StaticDtorsSection = ".section\t.dtors,\"aw\", at progbits"; UsedDirective = "\t# .no_dead_strip\t"; From asl at math.spbu.ru Sat Aug 16 07:59:02 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 16 Aug 2008 12:59:02 -0000 Subject: [llvm-commits] [llvm] r54847 - /llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200808161259.m7GCx3Sq016922@zion.cs.uiuc.edu> Author: asl Date: Sat Aug 16 07:59:02 2008 New Revision: 54847 URL: http://llvm.org/viewvc/llvm-project?rev=54847&view=rev Log: PPC/Linux normally uses named section for bss Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=54847&r1=54846&r2=54847&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Sat Aug 16 07:59:02 2008 @@ -118,6 +118,11 @@ WeakRefDirective = "\t.weak\t"; BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits"; + // PPC/Linux normally uses named section for BSS. + BSSSection_ = getNamedSection("\t.bss", + SectionFlags::Writeable | SectionFlags::BSS, + /* Override */ true); + // Debug Information AbsoluteDebugSectionOffsets = true; SupportsDebugInformation = true; From clattner at apple.com Sat Aug 16 19:07:50 2008 From: clattner at apple.com (Chris Lattner) Date: Sat, 16 Aug 2008 17:07:50 -0700 Subject: [llvm-commits] [llvm] r54751 - in /llvm/trunk: Makefile.rules include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/FastISel.cpp utils/TableGen/FastISelEmitter.cpp utils/TableGen/FastISelEmitter.h utils/TableGen/TableGen.cpp In-Reply-To: <200808132019.m7DKJhjA014322@zion.cs.uiuc.edu> References: <200808132019.m7DKJhjA014322@zion.cs.uiuc.edu> Message-ID: On Aug 13, 2008, at 1:19 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=54751&view=rev > Log: > Initial checkin of the new "fast" instruction selection support. See > the comments in FastISelEmitter.cpp for details on what this is. > This is currently experimental and unusable. Nice! > +++ llvm/trunk/utils/TableGen/FastISelEmitter.h Wed Aug 13 15:19:35 > 2008 > @@ -0,0 +1,38 @@ > +#ifndef FASTISEL_EMITTER_H > +#define FASTISEL_EMITTER_H > + > +#include "TableGenBackend.h" > +#include "CodeGenDAGPatterns.h" > +#include No need for ? > = > = > = > = > = > = > = > = > ====================================================================== > +++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Wed Aug 13 > 15:19:35 2008 > +// If compile time is so important, you might wonder why we don't > just > +// skip codegen all-together, emit LLVM bytecode files, and execute > them > +// with an interpreter. The answer is that it would complicate > linking and > +// debugging, and also because that isn't how a compiler is > expected to > +// work in some circles. That also doesn't really help necessarily, because lli has to do selection as well. I guess it wins if you only execute a small percentage of the code being compiled though. > +// If you need better generated code or more lowering than what this > +// instruction selector provides, use the SelectionDAG (DAGISel) > instruction > +// selector instead. If you're looking here because SelectionDAG > isn't fast > +// enough, consider looking into improving the SelectionDAG > infastructure > +// instead. At the time of this writing there remain several major > +// opportunities for improvement. I think a better and more permanent way of putting this is "only consider enhancing the fast isel if you want to make it produce code faster. Changes to make the fast isel produce better code more slowly will be considered to be a step backward. > > + > +struct OperandsSignature { Please give a brief comment about what each of these classes is for. > +void FastISelEmitter::run(std::ostream &OS) { ... > > + typedef std::map TypeMap; > + typedef std::map OpcodeTypeMap; > + typedef std::map > OperandsOpcodeTypeMap; > + OperandsOpcodeTypeMap SimplePatterns; Maybe it would be cleaner to make fastiselemitter be a class with a bunch of methods? That would give you a clean way to share these typedefs and still allow you to split up "run" into multiple different methods. Splitting it up into methods gives the opportunity to pick useful names for each unit. This works well for dagiselemitter at least. > + for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), > + E = CGP.ptm_end(); I != E; ++I) { > + const PatternToMatch &Pattern = *I; > + > + // For now, just look at Instructions, so that we don't have to > worry > + // about emitting multiple instructions for a pattern. > + TreePatternNode *Dst = Pattern.getDstPattern(); > + if (Dst->isLeaf()) continue; > + Record *Op = Dst->getOperator(); > + if (!Op->isSubClassOf("Instruction")) > + continue; > + CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op- > >getName()); > + if (II.OperandList.empty()) > + continue; > + Record *Op0Rec = II.OperandList[0].Rec; > + if (!Op0Rec->isSubClassOf("RegisterClass")) > + continue; > + const CodeGenRegisterClass *DstRC = > &Target.getRegisterClass(Op0Rec); > + if (!DstRC) > + continue; It would be useful to know why your rejecting each of these. I think this will filter out the X86 shift patterns (which use CL), for example. Is this a temporary or permanent approach? > + // For now, filter out instructions which just set a register to > + // an Operand, like MOV32ri. > + if (InstPatOp->isSubClassOf("Operand")) > + continue; This is a great description which makes it easier to follow the code. > + > + // Check all the operands. For now only accept register operands. > + OperandsSignature Operands; > + for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; > ++i) { > + TreePatternNode *Op = InstPatNode->getChild(i); > + if (!Op->isLeaf()) > + goto continue_label; > + DefInit *OpDI = dynamic_cast(Op->getLeafValue()); > + if (!OpDI) > + goto continue_label; > + Record *OpLeafRec = OpDI->getDef(); > + if (!OpLeafRec->isSubClassOf("RegisterClass")) > + goto continue_label; > + const CodeGenRegisterClass *RC = > &Target.getRegisterClass(OpLeafRec); > + if (!RC) > + goto continue_label; > + if (Op->getTypeNum(0) != VT) > + goto continue_label; > + Operands.Operands.push_back("r"); > + } Please split this loop out into a helper function, this will let you get rid of the gotos, by using something like: if (GetFooInfo(InstPatNode, Operands)) continue; > +++ llvm/trunk/include/llvm/CodeGen/FastISel.h Wed Aug 13 15:19:35 > 2008 > @@ -0,0 +1,71 @@ > + > +/// This file defines the FastISel class. This is a fast-path > instruction Plz update/remove the first sentence. > +/// selection class that generates poor code and doesn't support > illegal > +/// types or non-trivial lowering, but runs quickly. > +class FastISel { > + MachineBasicBlock *MBB; > + MachineFunction *MF; > + const TargetInstrInfo *TII; > + > +public: > + FastISel(MachineBasicBlock *mbb, MachineFunction *mf, > + const TargetInstrInfo *tii) > + : MBB(mbb), MF(mf), TII(tii) {} > + > + /// SelectInstructions - Do "fast" instruction selection over the > + /// LLVM IR instructions in the range [Begin, N) where N is either > + /// End or the first unsupported instruction. Return N. > + /// ValueMap is filled in with a mapping of LLVM IR Values to > + /// register numbers. > + BasicBlock::iterator > + SelectInstructions(BasicBlock::iterator Begin, > BasicBlock::iterator End, > + DenseMap &ValueMap); If you change this to take two Instruction*'s as an inclusive range to emit, you can avoid #including BasicBlock.h. I agree this is somewhat ugly though and probably not worth it. > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (added) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Aug 13 > 15:19:35 2008 > @@ -0,0 +1,104 @@ > +BasicBlock::iterator > +FastISel::SelectInstructions(BasicBlock::iterator Begin, > BasicBlock::iterator End, > + DenseMap > &ValueMap) { I like this interface. Is the idea that you only use selectiondag selection on the specific *instructions* that fastisel can't handle, instead of whole blocks? > + BasicBlock::iterator I = Begin; > + > + for (; I != End; ++I) { > + switch (I->getOpcode()) { > + case Instruction::Add: { > + unsigned Op0 = ValueMap[I->getOperand(0)]; > + unsigned Op1 = ValueMap[I->getOperand(1)]; > + MVT VT = MVT::getMVT(I->getType(), /*HandleUnknown=*/true); > + if (VT == MVT::Other || !VT.isSimple()) { > + // Unhandled type. Halt "fast" selection and bail. > + return I; > + } > > + unsigned ResultReg = FastEmit_rr(VT.getSimpleVT(), ISD::ADD, > Op0, Op1); I think this needs to 'return I' if ResultReg is 0. > > +unsigned FastISel::FastEmitInst_(unsigned MachineInstOpcode, > + const TargetRegisterClass* RC) { > + MachineRegisterInfo &MRI = MF->getRegInfo(); > + const TargetInstrDesc &II = TII->get(MachineInstOpcode); > + MachineInstr *MI = BuildMI(*MF, II); > + unsigned ResultReg = MRI.createVirtualRegister(RC); > + > + MI->addOperand(MachineOperand::CreateReg(ResultReg, true)); > + MBB->push_back(MI); Why not just "BuildMI(MBB, II, ResultReg);" > + return ResultReg; > +} > + > +unsigned FastISel::FastEmitInst_r(unsigned MachineInstOpcode, > + const TargetRegisterClass *RC, > + unsigned Op0) { > + MachineRegisterInfo &MRI = MF->getRegInfo(); > + const TargetInstrDesc &II = TII->get(MachineInstOpcode); > + MachineInstr *MI = BuildMI(*MF, II); > + unsigned ResultReg = MRI.createVirtualRegister(RC); > + > + MI->addOperand(MachineOperand::CreateReg(ResultReg, true)); > + MI->addOperand(MachineOperand::CreateReg(Op0, false)); > + > + MBB->push_back(MI); Why not just "BuildMI(MBB, II, ResultReg).addReg(Op0);" Overall, very nice start. Do you have hooks for SDISel to use this? If so, plz commit them as well under a flag. -Chris From gordonhenriksen at me.com Sat Aug 16 19:36:33 2008 From: gordonhenriksen at me.com (Gordon Henriksen) Date: Sat, 16 Aug 2008 20:36:33 -0400 Subject: [llvm-commits] Factoring AsmPrinter foo out of Collector Message-ID: <2DD8A0BF-477F-4F62-A7BA-20E21391A293@me.com> Hi Anton, This patch should allow you to factor the assembly writer out of the JIT without removing the GC infrastructure. I took the approach of separating the assembly printing mechanisms from the Collector class, using a separate registry to look each up by name. CodeGen will access CollectorRegistry; AsmPrinter will access GCMetadataPrinterRegistry. GCMetadataPrinter and its subclass go into your new assembly printer library. Let me know if this looks good. If so, I'll commit and then break the classes out into separate files so that your library factoring can proceed smoothly. ? Gordon -------------- next part -------------- A non-text attachment was scrubbed... Name: gc-factor.patch Type: application/octet-stream Size: 12183 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080816/3c347efc/attachment.obj -------------- next part -------------- From sabre at nondot.org Sat Aug 16 20:35:31 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 01:35:31 -0000 Subject: [llvm-commits] [llvm] r54855 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200808170135.m7H1ZWR5006337@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 20:35:29 2008 New Revision: 54855 URL: http://llvm.org/viewvc/llvm-project?rev=54855&view=rev Log: add a new raw_ostream class which is an extremely high performance ostream that can *only* output data (no seeking, reading, etc). This is adapted from the clang "-E outputter", and is roughly 10% faster than stdio on darwin and 30% (or more) faster than std::ostream. Added: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Added: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=54855&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (added) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Sat Aug 16 20:35:29 2008 @@ -0,0 +1,170 @@ +//===--- raw_ostream.h - Raw output stream ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the raw_ostream class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_RAW_OSTREAM_H +#define LLVM_SUPPORT_RAW_OSTREAM_H + +#include + +namespace llvm { + +/// raw_ostream - This class implements an extremely fast bulk output stream +/// that can *only* output to a stream. It does not support seeking, reopening, +/// rewinding, line buffered disciplines etc. It is a simple buffer that outputs +/// a chunk at a time. +class raw_ostream { +protected: + char *OutBufStart, *OutBufEnd, *OutBufCur; +public: + raw_ostream() { + // Start out ready to flush. + OutBufStart = OutBufEnd = OutBufCur = 0; + } + virtual ~raw_ostream() {} + + //===--------------------------------------------------------------------===// + // Configuration Interface + //===--------------------------------------------------------------------===// + + /// SetBufferSize - Set the internal buffer size to the specified amount + /// instead of the default. + void SetBufferSize(unsigned Size) { + assert(Size >= 64 && + "Buffer size must be somewhat large for invariants to hold"); + flush(); + + delete [] OutBufStart; + OutBufStart = new char[Size]; + OutBufEnd = OutBufStart+Size; + OutBufCur = OutBufStart; + } + + //===--------------------------------------------------------------------===// + // Data Output Interface + //===--------------------------------------------------------------------===// + + void flush() { + if (OutBufCur != OutBufStart) + flush_impl(); + } + + raw_ostream &operator<<(char C) { + if (OutBufCur >= OutBufEnd) + flush_impl(); + *OutBufCur++ = C; + return *this; + } + + raw_ostream &operator<<(const char *Str) { + return OutputData(Str, strlen(Str)); + } + + raw_ostream &OutputData(const char *Ptr, unsigned Size) { + if (OutBufCur+Size > OutBufEnd) + flush_impl(); + + // Handle short strings specially, memcpy isn't very good at very short + // strings. + switch (Size) { +// case 4: OutBufCur[3] = Ptr[3]; // FALL THROUGH + case 3: OutBufCur[2] = Ptr[2]; // FALL THROUGH + case 2: OutBufCur[1] = Ptr[1]; // FALL THROUGH + case 1: OutBufCur[0] = Ptr[0]; // FALL THROUGH + case 0: break; + default: + // Normally the string to emit is shorter than the buffer. + if (Size <= unsigned(OutBufEnd-OutBufStart)) { + memcpy(OutBufCur, Ptr, Size); + break; + } + + // If emitting a string larger than our buffer, emit in chunks. In this + // case we know that we just flushed the buffer. + while (Size) { + unsigned NumToEmit = OutBufEnd-OutBufStart; + if (Size < NumToEmit) NumToEmit = Size; + assert(OutBufCur == OutBufStart); + memcpy(OutBufStart, Ptr, NumToEmit); + Ptr += NumToEmit; + OutBufCur = OutBufStart + NumToEmit; + flush_impl(); + } + break; + } + OutBufCur += Size; + return *this; + } + + //===--------------------------------------------------------------------===// + // Subclass Interface + //===--------------------------------------------------------------------===// + +protected: + + /// flush_impl - The is the piece of the class that is implemented by + /// subclasses. This outputs the currently buffered data and resets the + /// buffer to empty. + virtual void flush_impl() = 0; + + /// HandleFlush - A stream's implementation of flush should call this after + /// emitting the bytes to the data sink. + void HandleFlush() { + if (OutBufStart == 0) + SetBufferSize(4096); + OutBufCur = OutBufStart; + } +private: + // An out of line virtual method to provide a home for the class vtable. + virtual void handle(); +}; + +/// raw_fd_ostream - A raw_ostream that writes to a file descriptor. +/// +class raw_fd_ostream : public raw_ostream { + int FD; + bool ShouldClose; +public: + /// raw_fd_ostream - Open the specified file for writing. If an error occurs, + /// information about the error is put into ErrorInfo, and the stream should + /// be immediately destroyed. + raw_fd_ostream(const char *Filename, std::string &ErrorInfo); + + /// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If + /// ShouldClose is true, this closes the file when + raw_fd_ostream(int fd, bool shouldClose) : FD(fd), ShouldClose(shouldClose) {} + + ~raw_fd_ostream(); + + /// flush_impl - The is the piece of the class that is implemented by + /// subclasses. This outputs the currently buffered data and resets the + /// buffer to empty. + virtual void flush_impl(); +}; + +class raw_stdout_ostream : public raw_fd_ostream { + // An out of line virtual method to provide a home for the class vtable. + virtual void handle(); +public: + raw_stdout_ostream(); +}; + +class raw_stderr_ostream : public raw_fd_ostream { + // An out of line virtual method to provide a home for the class vtable. + virtual void handle(); +public: + raw_stderr_ostream(); +}; + +} // end llvm namespace + +#endif Added: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=54855&view=auto ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (added) +++ llvm/trunk/lib/Support/raw_ostream.cpp Sat Aug 16 20:35:29 2008 @@ -0,0 +1,64 @@ +//===--- raw_ostream.cpp - Implement the raw_ostream classes --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This implements support for bulk buffered stream output. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/raw_ostream.h" +using namespace llvm; + +#if !defined(_MSC_VER) +#include +#else +#include +#define open(x,y,z) _open(x,y) +#define write(fd, start, size) _write(fd, start, size) +#define close(fd) _close(fd) +#endif + +// An out of line virtual method to provide a home for the class vtable. +void raw_ostream::handle() {} + +//===----------------------------------------------------------------------===// +// raw_fd_ostream +//===----------------------------------------------------------------------===// + +/// raw_fd_ostream - Open the specified file for writing. If an error occurs, +/// information about the error is put into ErrorInfo, and the stream should +/// be immediately destroyed. +raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo) { + FD = open(Filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (FD < 0) { + ErrorInfo = "Error opening output file '" + std::string(Filename) + "'"; + ShouldClose = false; + } else { + ShouldClose = true; + } +} + +raw_fd_ostream::~raw_fd_ostream() { + flush(); + if (ShouldClose) + close(FD); +} + +void raw_fd_ostream::flush_impl() { + if (OutBufCur-OutBufStart) + write(FD, OutBufStart, OutBufCur-OutBufStart); + HandleFlush(); +} + + +raw_stdout_ostream::raw_stdout_ostream():raw_fd_ostream(STDOUT_FILENO, false) {} +raw_stderr_ostream::raw_stderr_ostream():raw_fd_ostream(STDERR_FILENO, false) {} + +// An out of line virtual method to provide a home for the class vtable. +void raw_stdout_ostream::handle() {} +void raw_stderr_ostream::handle() {} From sabre at nondot.org Sat Aug 16 20:35:54 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 01:35:54 -0000 Subject: [llvm-commits] [llvm] r54856 - /llvm/trunk/include/llvm/Support/raw_ostream.h Message-ID: <200808170135.m7H1ZsPh006359@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 20:35:54 2008 New Revision: 54856 URL: http://llvm.org/viewvc/llvm-project?rev=54856&view=rev Log: remove accidental comment. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=54856&r1=54855&r2=54856&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Sat Aug 16 20:35:54 2008 @@ -76,7 +76,7 @@ // Handle short strings specially, memcpy isn't very good at very short // strings. switch (Size) { -// case 4: OutBufCur[3] = Ptr[3]; // FALL THROUGH + case 4: OutBufCur[3] = Ptr[3]; // FALL THROUGH case 3: OutBufCur[2] = Ptr[2]; // FALL THROUGH case 2: OutBufCur[1] = Ptr[1]; // FALL THROUGH case 1: OutBufCur[0] = Ptr[0]; // FALL THROUGH From clattner at apple.com Sat Aug 16 20:43:31 2008 From: clattner at apple.com (Chris Lattner) Date: Sat, 16 Aug 2008 18:43:31 -0700 Subject: [llvm-commits] [llvm] r54855 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp In-Reply-To: <200808170135.m7H1ZWR5006337@zion.cs.uiuc.edu> References: <200808170135.m7H1ZWR5006337@zion.cs.uiuc.edu> Message-ID: On Aug 16, 2008, at 6:35 PM, Chris Lattner wrote: > Author: lattner > Date: Sat Aug 16 20:35:29 2008 > New Revision: 54855 > > URL: http://llvm.org/viewvc/llvm-project?rev=54855&view=rev > Log: > add a new raw_ostream class which is an extremely high performance > ostream that > can *only* output data (no seeking, reading, etc). This is adapted > from the > clang "-E outputter", and is roughly 10% faster than stdio on darwin > and 30% > (or more) faster than std::ostream. Sorry, my timings were wrong. This is 18% faster than stdio, and 70% faster than std::ostream for Clang's -E command (which has to lex the file in addition to just printing stuff, so the difference is even higher). -Chris From sabre at nondot.org Sat Aug 16 20:46:05 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 01:46:05 -0000 Subject: [llvm-commits] [llvm] r54857 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200808170146.m7H1k5Xe006640@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 20:46:05 2008 New Revision: 54857 URL: http://llvm.org/viewvc/llvm-project?rev=54857&view=rev Log: rename OutputData to 'write' to match ostream. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=54857&r1=54856&r2=54857&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Sat Aug 16 20:46:05 2008 @@ -66,10 +66,10 @@ } raw_ostream &operator<<(const char *Str) { - return OutputData(Str, strlen(Str)); + return write(Str, strlen(Str)); } - raw_ostream &OutputData(const char *Ptr, unsigned Size) { + raw_ostream &write(const char *Ptr, unsigned Size) { if (OutBufCur+Size > OutBufEnd) flush_impl(); Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=54857&r1=54856&r2=54857&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Sat Aug 16 20:46:05 2008 @@ -51,7 +51,7 @@ void raw_fd_ostream::flush_impl() { if (OutBufCur-OutBufStart) - write(FD, OutBufStart, OutBufCur-OutBufStart); + ::write(FD, OutBufStart, OutBufCur-OutBufStart); HandleFlush(); } From sabre at nondot.org Sat Aug 16 22:53:23 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 03:53:23 -0000 Subject: [llvm-commits] [llvm] r54863 - /llvm/trunk/lib/Support/raw_ostream.cpp Message-ID: <200808170353.m7H3rO53009899@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 22:53:23 2008 New Revision: 54863 URL: http://llvm.org/viewvc/llvm-project?rev=54863&view=rev Log: opening "-" automatically yields stdout. Modified: llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=54863&r1=54862&r2=54863&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Sat Aug 16 22:53:23 2008 @@ -34,6 +34,13 @@ /// information about the error is put into ErrorInfo, and the stream should /// be immediately destroyed. raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo) { + // Handle "-" as stdout. + if (Filename[0] == '-' && Filename[1] == 0) { + FD = STDOUT_FILENO; + ShouldClose = false; + return; + } + FD = open(Filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); if (FD < 0) { ErrorInfo = "Error opening output file '" + std::string(Filename) + "'"; From sabre at nondot.org Sat Aug 16 23:13:37 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 04:13:37 -0000 Subject: [llvm-commits] [llvm] r54865 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp Message-ID: <200808170413.m7H4Db58010521@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 23:13:37 2008 New Revision: 54865 URL: http://llvm.org/viewvc/llvm-project?rev=54865&view=rev Log: add support for a cout/cerr analog (outs()/errs()) as well as a simple adaptor class to give raw output capabilities to something that wants to write to an ostream. Modified: llvm/trunk/include/llvm/Support/raw_ostream.h llvm/trunk/lib/Support/raw_ostream.cpp Modified: llvm/trunk/include/llvm/Support/raw_ostream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=54865&r1=54864&r2=54865&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/raw_ostream.h (original) +++ llvm/trunk/include/llvm/Support/raw_ostream.h Sat Aug 16 23:13:37 2008 @@ -1,4 +1,4 @@ -//===--- raw_ostream.h - Raw output stream ---------------------------------===// +//===--- raw_ostream.h - Raw output stream --------------------------------===// // // The LLVM Compiler Infrastructure // @@ -15,6 +15,7 @@ #define LLVM_SUPPORT_RAW_OSTREAM_H #include +#include namespace llvm { @@ -151,6 +152,8 @@ virtual void flush_impl(); }; +/// raw_stdout_ostream - This is a stream that always prints to stdout. +/// class raw_stdout_ostream : public raw_fd_ostream { // An out of line virtual method to provide a home for the class vtable. virtual void handle(); @@ -158,6 +161,8 @@ raw_stdout_ostream(); }; +/// raw_stderr_ostream - This is a stream that always prints to stderr. +/// class raw_stderr_ostream : public raw_fd_ostream { // An out of line virtual method to provide a home for the class vtable. virtual void handle(); @@ -165,6 +170,28 @@ raw_stderr_ostream(); }; +/// outs() - This returns a reference to a raw_ostream for standard output. +/// Use it like: outs() << "foo" << "bar"; +raw_ostream &outs(); + +/// errs() - This returns a reference to a raw_ostream for standard error. +/// Use it like: errs() << "foo" << "bar"; +raw_ostream &errs(); + + +/// raw_os_ostream - A raw_ostream that writes to an std::ostream. This is a +/// simple adaptor class. +class raw_os_ostream : public raw_ostream { + std::ostream &OS; +public: + raw_os_ostream(std::ostream &O) : OS(O) {} + + /// flush_impl - The is the piece of the class that is implemented by + /// subclasses. This outputs the currently buffered data and resets the + /// buffer to empty. + virtual void flush_impl(); +}; + } // end llvm namespace #endif Modified: llvm/trunk/lib/Support/raw_ostream.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=54865&r1=54864&r2=54865&view=diff ============================================================================== --- llvm/trunk/lib/Support/raw_ostream.cpp (original) +++ llvm/trunk/lib/Support/raw_ostream.cpp Sat Aug 16 23:13:37 2008 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/raw_ostream.h" +#include using namespace llvm; #if !defined(_MSC_VER) @@ -62,6 +63,9 @@ HandleFlush(); } +//===----------------------------------------------------------------------===// +// raw_stdout/err_ostream +//===----------------------------------------------------------------------===// raw_stdout_ostream::raw_stdout_ostream():raw_fd_ostream(STDOUT_FILENO, false) {} raw_stderr_ostream::raw_stderr_ostream():raw_fd_ostream(STDERR_FILENO, false) {} @@ -69,3 +73,30 @@ // An out of line virtual method to provide a home for the class vtable. void raw_stdout_ostream::handle() {} void raw_stderr_ostream::handle() {} + +/// outs() - This returns a reference to a raw_ostream for standard output. +/// Use it like: outs() << "foo" << "bar"; +raw_ostream &outs() { + static raw_stdout_ostream S; + return S; +} + +/// errs() - This returns a reference to a raw_ostream for standard error. +/// Use it like: errs() << "foo" << "bar"; +raw_ostream &errs() { + static raw_stderr_ostream S; + return S; +} + +//===----------------------------------------------------------------------===// +// raw_os_ostream +//===----------------------------------------------------------------------===// + +/// flush_impl - The is the piece of the class that is implemented by +/// subclasses. This outputs the currently buffered data and resets the +/// buffer to empty. +void raw_os_ostream::flush_impl() { + if (OutBufCur-OutBufStart) + OS.write(OutBufStart, OutBufCur-OutBufStart); + HandleFlush(); +} From sabre at nondot.org Sat Aug 16 23:17:45 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 04:17:45 -0000 Subject: [llvm-commits] [llvm] r54866 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200808170417.m7H4HjRM010660@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 23:17:45 2008 New Revision: 54866 URL: http://llvm.org/viewvc/llvm-project?rev=54866&view=rev Log: random cleanups. Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=54866&r1=54865&r2=54866&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Aug 16 23:17:45 2008 @@ -31,6 +31,7 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" +#include "llvm/Support/raw_ostream.h" #include #include using namespace llvm; @@ -41,39 +42,39 @@ AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {} /// This class provides computation of slot numbers for LLVM Assembly writing. -/// @brief LLVM Assembly Writing Slot Computation. +/// class SlotMachine { - -/// @name Types -/// @{ public: - - /// @brief A mapping of Values to slot numbers - typedef std::map ValueMap; - -/// @} -/// @name Constructors -/// @{ + /// ValueMap - A mapping of Values to slot numbers + typedef std::map ValueMap; + +private: + /// TheModule - The module for which we are holding slot numbers + const Module* TheModule; + + /// TheFunction - The function for which we are holding slot numbers + const Function* TheFunction; + bool FunctionProcessed; + + /// mMap - The TypePlanes map for the module level data + ValueMap mMap; + unsigned mNext; + + /// fMap - The TypePlanes map for the function level data + ValueMap fMap; + unsigned fNext; + public: - /// @brief Construct from a module + /// Construct from a module explicit SlotMachine(const Module *M); - - /// @brief Construct from a function, starting out in incorp state. + /// Construct from a function, starting out in incorp state. explicit SlotMachine(const Function *F); -/// @} -/// @name Accessors -/// @{ -public: /// Return the slot number of the specified value in it's type /// plane. If something is not in the SlotMachine, return -1. int getLocalSlot(const Value *V); int getGlobalSlot(const GlobalValue *V); -/// @} -/// @name Mutators -/// @{ -public: /// If you'd like to deal with a function instead of just a module, use /// this method to get its data into the SlotMachine. void incorporateFunction(const Function *F) { @@ -86,9 +87,7 @@ /// will reset the state of the machine back to just the module contents. void purgeFunction(); -/// @} -/// @name Implementation Details -/// @{ + // Implementation Details private: /// This function does the actual initialization. inline void initialize(); @@ -108,29 +107,6 @@ SlotMachine(const SlotMachine &); // DO NOT IMPLEMENT void operator=(const SlotMachine &); // DO NOT IMPLEMENT - -/// @} -/// @name Data -/// @{ -public: - - /// @brief The module for which we are holding slot numbers - const Module* TheModule; - - /// @brief The function for which we are holding slot numbers - const Function* TheFunction; - bool FunctionProcessed; - - /// @brief The TypePlanes map for the module level data - ValueMap mMap; - unsigned mNext; - - /// @brief The TypePlanes map for the function level data - ValueMap fMap; - unsigned fNext; - -/// @} - }; } // end namespace llvm @@ -461,7 +437,6 @@ return pred; } -/// @brief Internal constant writer. static void WriteConstantInt(std::ostream &Out, const Constant *CV, std::map &TypeTable, SlotMachine *Machine) { @@ -1549,7 +1524,7 @@ : TheModule(M) ///< Saved for lazy initialization. , TheFunction(0) , FunctionProcessed(false) - , mMap(), mNext(0), fMap(), fNext(0) + , mNext(0), fMap(), fNext(0) { } @@ -1559,7 +1534,7 @@ : TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization , TheFunction(F) ///< Saved for lazy initialization , FunctionProcessed(false) - , mMap(), mNext(0), fMap(), fNext(0) + , mNext(0), fMap(), fNext(0) { } @@ -1672,8 +1647,8 @@ DestSlot << " ["); // G = Global, F = Function, A = Alias, o = other SC_DEBUG((isa(V) ? 'G' : - (isa ? 'F' : - (isa ? 'A' : 'o'))) << "]\n"); + (isa(V) ? 'F' : + (isa(V) ? 'A' : 'o'))) << "]\n"); } From dalej at apple.com Sat Aug 16 23:25:08 2008 From: dalej at apple.com (Dale Johannesen) Date: Sun, 17 Aug 2008 04:25:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r54867 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200808170425.m7H4P8YZ010891@zion.cs.uiuc.edu> Author: johannes Date: Sat Aug 16 23:25:08 2008 New Revision: 54867 URL: http://llvm.org/viewvc/llvm-project?rev=54867&view=rev Log: Copy unions with FP elements by bitwise copy. PR 2680. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=54867&r1=54866&r2=54867&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Aug 16 23:25:08 2008 @@ -1336,6 +1336,32 @@ } } +/// containsFPField - indicates whether the given LLVM type +/// contains any floating point elements. + +static bool containsFPField(const Type *LLVMTy) { + if (LLVMTy->isFloatingPoint()) + return true; + const StructType* STy = dyn_cast(LLVMTy); + if (STy) { + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; I++) { + const Type *Ty = *I; + if (Ty->isFloatingPoint()) + return true; + if (isa(Ty) && containsFPField(Ty)) + return true; + const ArrayType *ATy = dyn_cast(Ty); + if (ATy && containsFPField(ATy->getElementType())) + return true; + const VectorType *VTy = dyn_cast(Ty); + if (VTy && containsFPField(VTy->getElementType())) + return true; + } + } + return false; +} + #ifndef TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY #define TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY 64 #endif @@ -1352,9 +1378,15 @@ TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY) { const Type *LLVMTy = ConvertType(type); + // Some targets (x87) cannot pass non-floating-point values using FP + // instructions. The LLVM type for a union may include FP elements, + // even if some of the union fields do not; it is unsafe to pass such + // converted types element by element. PR 2680. + // If the GCC type is not fully covered by the LLVM type, use memcpy. This // can occur with unions etc. - if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) && + if ((TREE_CODE(type) != UNION_TYPE || !containsFPField(LLVMTy)) && + !TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) && // Don't copy tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::getUnqual(LLVMTy)); From sabre at nondot.org Sat Aug 16 23:40:13 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Aug 2008 04:40:13 -0000 Subject: [llvm-commits] [llvm] r54868 - /llvm/trunk/lib/VMCore/AsmWriter.cpp Message-ID: <200808170440.m7H4eD1k011327@zion.cs.uiuc.edu> Author: lattner Date: Sat Aug 16 23:40:13 2008 New Revision: 54868 URL: http://llvm.org/viewvc/llvm-project?rev=54868&view=rev Log: avoid string thrashing when formatting names in output. This speeds up release-asserts llvm-dis on kc++ from 1.86s to 1.04s (~79%) Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=54868&r1=54867&r2=54868&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Aug 16 23:40:13 2008 @@ -211,6 +211,72 @@ } } +/// PrintLLVMName - Turn the specified name into an 'LLVM name', which is either +/// prefixed with % (if the string only contains simple characters) or is +/// surrounded with ""'s (if it has special chars in it). Print it out. +static void PrintLLVMName(std::ostream &OS, const ValueName *Name, + PrefixType Prefix) { + assert(Name && "Cannot get empty name!"); + switch (Prefix) { + default: assert(0 && "Bad prefix!"); + case GlobalPrefix: OS << '@'; break; + case LabelPrefix: break; + case LocalPrefix: OS << '%'; break; + } + + // Scan the name to see if it needs quotes first. + const char *NameStr = Name->getKeyData(); + unsigned NameLen = Name->getKeyLength(); + + bool NeedsQuotes = NameStr[0] >= '0' && NameStr[0] <= '9'; + if (!NeedsQuotes) { + for (unsigned i = 0; i != NameLen; ++i) { + char C = NameStr[i]; + if (!isalnum(C) && C != '-' && C != '.' && C != '_') { + NeedsQuotes = true; + break; + } + } + } + + // If we didn't need any quotes, just write out the name in one blast. + if (!NeedsQuotes) { + OS.write(NameStr, NameLen); + return; + } + + // Okay, we need quotes. Output the quotes and escape any scary characters as + // needed. + OS << '"'; + for (unsigned i = 0; i != NameLen; ++i) { + char C = NameStr[i]; + assert(C != '"' && "Illegal character in LLVM value name!"); + if (C == '\\') { + OS << "\\\\"; + } else if (isprint(C)) { + OS << C; + } else { + OS << "\\"; + char hex1 = (C >> 4) & 0x0F; + if (hex1 < 10) + OS << (hex1 + '0'); + else + OS << (hex1 - 10 + 'A'); + char hex2 = C & 0x0F; + if (hex2 < 10) + OS << (hex2 + '0'); + else + OS << (hex2 - 10 + 'A'); + } + } + OS << '"'; +} + +static void PrintLLVMName(std::ostream &OS, const Value *V) { + PrintLLVMName(OS, V->getValueName(), + isa(V) ? GlobalPrefix : LocalPrefix); +} + /// fillTypeNameTable - If the module has a symbol table, take all global types /// and stuff their names into the TypeNames map. @@ -626,25 +692,35 @@ std::map &TypeTable, SlotMachine *Machine) { Out << ' '; - if (V->hasName()) - Out << getLLVMName(V->getName(), - isa(V) ? GlobalPrefix : LocalPrefix); - else { - const Constant *CV = dyn_cast(V); - if (CV && !isa(CV)) { - WriteConstantInt(Out, CV, TypeTable, Machine); - } else if (const InlineAsm *IA = dyn_cast(V)) { - Out << "asm "; - if (IA->hasSideEffects()) - Out << "sideeffect "; - Out << '"'; - PrintEscapedString(IA->getAsmString(), Out); - Out << "\", \""; - PrintEscapedString(IA->getConstraintString(), Out); - Out << '"'; + if (V->hasName()) { + PrintLLVMName(Out, V); + return; + } + + const Constant *CV = dyn_cast(V); + if (CV && !isa(CV)) { + WriteConstantInt(Out, CV, TypeTable, Machine); + } else if (const InlineAsm *IA = dyn_cast(V)) { + Out << "asm "; + if (IA->hasSideEffects()) + Out << "sideeffect "; + Out << '"'; + PrintEscapedString(IA->getAsmString(), Out); + Out << "\", \""; + PrintEscapedString(IA->getConstraintString(), Out); + Out << '"'; + } else { + char Prefix = '%'; + int Slot; + if (Machine) { + if (const GlobalValue *GV = dyn_cast(V)) { + Slot = Machine->getGlobalSlot(GV); + Prefix = '@'; + } else { + Slot = Machine->getLocalSlot(V); + } } else { - char Prefix = '%'; - int Slot; + Machine = createSlotMachine(V); if (Machine) { if (const GlobalValue *GV = dyn_cast(V)) { Slot = Machine->getGlobalSlot(GV); @@ -653,24 +729,14 @@ Slot = Machine->getLocalSlot(V); } } else { - Machine = createSlotMachine(V); - if (Machine) { - if (const GlobalValue *GV = dyn_cast(V)) { - Slot = Machine->getGlobalSlot(GV); - Prefix = '@'; - } else { - Slot = Machine->getLocalSlot(V); - } - } else { - Slot = -1; - } - delete Machine; + Slot = -1; } - if (Slot != -1) - Out << Prefix << Slot; - else - Out << ""; + delete Machine; } + if (Slot != -1) + Out << Prefix << Slot; + else + Out << ""; } } @@ -900,7 +966,10 @@ } void AssemblyWriter::printGlobal(const GlobalVariable *GV) { - if (GV->hasName()) Out << getLLVMName(GV->getName(), GlobalPrefix) << " = "; + if (GV->hasName()) { + PrintLLVMName(Out, GV); + Out << " = "; + } if (!GV->hasInitializer()) { switch (GV->getLinkage()) { @@ -935,11 +1004,8 @@ Out << (GV->isConstant() ? "constant " : "global "); printType(GV->getType()->getElementType()); - if (GV->hasInitializer()) { - Constant* C = cast(GV->getInitializer()); - assert(C && "GlobalVar initializer isn't constant?"); + if (GV->hasInitializer()) writeOperand(GV->getInitializer(), false); - } if (unsigned AddressSpace = GV->getType()->getAddressSpace()) Out << " addrspace(" << AddressSpace << ") "; @@ -957,8 +1023,10 @@ // Don't crash when dumping partially built GA if (!GA->hasName()) Out << "<> = "; - else - Out << getLLVMName(GA->getName(), GlobalPrefix) << " = "; + else { + PrintLLVMName(Out, GA); + Out << " = "; + } switch (GA->getVisibility()) { default: assert(0 && "Invalid visibility style!"); case GlobalValue::DefaultVisibility: break; @@ -980,18 +1048,20 @@ if (const GlobalVariable *GV = dyn_cast(Aliasee)) { printType(GV->getType()); - Out << " " << getLLVMName(GV->getName(), GlobalPrefix); + Out << ' '; + PrintLLVMName(Out, GV); } else if (const Function *F = dyn_cast(Aliasee)) { printType(F->getFunctionType()); Out << "* "; - if (!F->getName().empty()) - Out << getLLVMName(F->getName(), GlobalPrefix); + if (!F->hasName()) + PrintLLVMName(Out, F); else Out << "@\"\""; } else if (const GlobalAlias *GA = dyn_cast(Aliasee)) { printType(GA->getType()); - Out << " " << getLLVMName(GA->getName(), GlobalPrefix); + Out << " "; + PrintLLVMName(Out, GA); } else { const ConstantExpr *CE = 0; if ((CE = dyn_cast(Aliasee)) && @@ -1067,7 +1137,7 @@ const PAListPtr &Attrs = F->getParamAttrs(); printType(F->getReturnType()) << ' '; if (!F->getName().empty()) - Out << getLLVMName(F->getName(), GlobalPrefix); + PrintLLVMName(Out, F); else Out << "@\"\""; Out << '('; @@ -1144,15 +1214,19 @@ Out << ' ' << ParamAttr::getAsString(Attrs); // Output name, if available... - if (Arg->hasName()) - Out << ' ' << getLLVMName(Arg->getName(), LocalPrefix); + if (Arg->hasName()) { + Out << ' '; + PrintLLVMName(Out, Arg); + } } /// printBasicBlock - This member is called for each basic block in a method. /// void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { if (BB->hasName()) { // Print out the label if it exists... - Out << "\n" << getLLVMName(BB->getName(), LabelPrefix) << ':'; + Out << "\n"; + PrintLLVMName(Out, BB->getValueName(), LabelPrefix); + Out << ':'; } else if (!BB->use_empty()) { // Don't print block # of no uses... Out << "\n;