X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FStacker.html;h=225a27bbf77556707220239e905f8a3d89dff404;hb=b627eab0402edabb19c702fd1f04c6c59ee2b339;hp=5fb5fe39d71ba7b44f6a9246d296497631aa1984;hpb=88eed81802c777552b5e77a2331d3ae0cadaaf72;p=oota-llvm.git diff --git a/docs/Stacker.html b/docs/Stacker.html index 5fb5fe39d71..225a27bbf77 100644 --- a/docs/Stacker.html +++ b/docs/Stacker.html @@ -4,10 +4,6 @@
using namespace llvm; BasicBlock* -MyCompiler::handle_if( BasicBlock* bb, SetCondInst* condition ) +MyCompiler::handle_if( BasicBlock* bb, ICmpInst* condition ) { // Create the blocks to contain code in the structure of if/then/else BasicBlock* then_bb = new BasicBlock(); @@ -312,7 +308,7 @@ things, this leads to the idiom:std::vector<Value*> index_vector; -index_vector.push_back( ConstantSInt::get( Type::LongTy, 0 ); +index_vector.push_back( ConstantInt::get( Type::LongTy, 0 ); // ... push other indices ... GetElementPtrInst* gep = new GetElementPtrInst( ptr, index_vector );@@ -371,9 +367,9 @@ functions in the LLVM IR that make things easier. Here's what I learned:
Definition Of Operation Of Built In Words | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LOGICAL OPERATIONS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Definition Of Operation Of Built In Words | ||||
---|---|---|---|---|
LOGICAL OPERATIONS | ||||
Word | Name | Operation | Description | |
< | LT | w1 w2 -- b | @@ -581,7 +577,7 @@ using the following construction:-- b | The boolean value TRUE (-1) is pushed on to the stack. |
BITWISE OPERATORS | ||||
BITWISE OPERATORS | ||||
Word | Name | @@ -623,7 +619,7 @@ using the following construction: are bitwise exclusive OR'd together and pushed back on the stack. For example, The sequence 1 3 XOR yields 2.|||
ARITHMETIC OPERATORS | ||||
ARITHMETIC OPERATORS | ||||
Word | Name | @@ -704,7 +700,7 @@ using the following construction:Two values are popped off the stack. The larger value is pushed back on to the stack. | ||
STACK MANIPULATION OPERATORS | ||||
STACK MANIPULATION OPERATORS | ||||
Word | Name | @@ -791,7 +787,7 @@ using the following construction:|||
RROT | RROT | -w1 w2 w3 -- w2 w3 w1 | +w1 w2 w3 -- w3 w1 w2 | Reverse 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. | @@ -849,7 +845,7 @@ using the following construction: 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 | ||||
MEMORY OPERATORS | ||||
Word | Name | @@ -902,7 +898,7 @@ using the following construction: pushed back on the stack so this doesn't count as a "use ptr" in the FREE idiom.|||
CONTROL FLOW OPERATORS | ||||
CONTROL FLOW OPERATORS | ||||
Word | Name | @@ -950,26 +946,30 @@ using the following construction: executed. In either case, after the (words....) have executed, execution continues immediately following the ENDIF.|||
WHILE (words...) END | -WHILE (words...) END | +|||
WHILE word END | +WHILE word END | b -- b | -The boolean value on the top of the stack is examined. If it is non-zero then the
- "words..." between WHILE and END are executed. Execution then begins again at the WHILE where another
- boolean is popped off the stack. To prevent this operation from eating up the entire
- stack, you should push on to the stack (just before the END) a boolean value that indicates
- whether to terminate. Note that since booleans and integers can be coerced you can
- use the following "for loop" idiom: - (push count) WHILE (words...) -- END + | 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 DUP >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 duplicated and then - 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 the WHILE test fails and control is - transfered to the word after the END. |
-
INPUT & OUTPUT OPERATORS | ||||
INPUT & OUTPUT OPERATORS | ||||
Word | Name | @@ -1298,11 +1298,16 @@ remainder of the story.