File tree Expand file tree Collapse file tree 3 files changed +32
-10
lines changed Expand file tree Collapse file tree 3 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -397,7 +397,7 @@ class OpGen : public ValueVisitor<OpGen, mlir::Value> {
397397 mlir::Value VisitBinding (Binding* B);
398398
399399 mlir::Value VisitPair (Pair* P);
400- // TODO mlir::Value VisitVector(Vector* V);
400+ mlir::Value VisitVector (Vector* V);
401401
402402 mlir::Value Lookup (heavy::Value V) {
403403 return BindingTable.lookup (V);
Original file line number Diff line number Diff line change @@ -1141,18 +1141,21 @@ mlir::Value OpGen::VisitPair(Pair* P) {
11411141 return HandleCall (P);
11421142}
11431143
1144- #if 0 // TODO VectorOp??
11451144mlir::Value OpGen::VisitVector (Vector* V) {
1146- llvm::ArrayRef< Value> Xs = V->getElements() ;
1147- Vector* New = Context.CreateVector(Xs.size());
1148- llvm::MutableArrayRef< Value> Ys = New->getElements( );
1149- for (unsigned i = 0; i < Xs.size(); ++i) {
1150- Visit(Xs[i] );
1151- Ys[i] = Visit(Xs[i] );
1145+ llvm::SmallVector<mlir:: Value, 8 > Vals ;
1146+ for ( auto X : V-> getElements ()) {
1147+ mlir:: Value Val = GetSingleResult (X );
1148+ if ( CheckError ())
1149+ return mlir::Value ( );
1150+ Vals. push_back (Val );
11521151 }
1153- return New;
1152+
1153+ // Localize the values in the current context.
1154+ for (mlir::Value& Val : Vals)
1155+ Val = LocalizeValue (Val);
1156+
1157+ return create<heavy::VectorOp>(Context.getLoc (), Vals);
11541158}
1155- #endif
11561159
11571160// LocalizeValue - If a value belongs to a parent region from
11581161// which the current region should be isolated
Original file line number Diff line number Diff line change 1+ ; RUN: heavy-scheme %s | FileCheck %s
2+ (import (heavy base))
3+
4+ (define (id x ) x)
5+
6+ ; CHECK: #()
7+ (write #())(newline)
8+
9+ ; CHECK: #(5)
10+ (write #(5 ))(newline)
11+
12+ ; CHECK: #(42)
13+ (write #((id 42 )))(newline)
14+
15+ ; CHECK: #(1 2 "yo" "moo")
16+ (write #(1 2 " yo" (id " moo" )))(newline)
17+
18+ ; CHECK: #(#(1 2 "yo" "moo"))
19+ (write #(#(1 2 " yo" (id " moo" ))))(newline)
You can’t perform that action at this time.
0 commit comments