comparison gen/toir.cpp @ 125:c42d245468ea trunk

[svn r129] Started AA literals. Fixed #15, passing -O will now invoke the optimizer before writing bitcode.
author lindquist
date Wed, 28 Nov 2007 04:52:35 +0100
parents a939ec89fc72
children facc562f5674
comparison
equal deleted inserted replaced
124:a939ec89fc72 125:c42d245468ea
2568 2568
2569 DValue* key = e1->toElem(p); 2569 DValue* key = e1->toElem(p);
2570 DValue* aa = e2->toElem(p); 2570 DValue* aa = e2->toElem(p);
2571 2571
2572 return DtoAAIn(type, aa, key); 2572 return DtoAAIn(type, aa, key);
2573 }
2574
2575 //////////////////////////////////////////////////////////////////////////////////////////
2576
2577 DValue* AssocArrayLiteralExp::toElem(IRState* p)
2578 {
2579 Logger::print("AssocArrayLiteralExp::toElem: %s | %s\n", toChars(), type->toChars());
2580 LOG_SCOPE;
2581
2582 assert(keys);
2583 assert(values);
2584 assert(keys->dim == values->dim);
2585
2586 const size_t n = keys->dim;
2587 for (size_t i=0; i<n; ++i)
2588 {
2589 Expression* ekey = (Expression*)keys->data[i];
2590 Expression* eval = (Expression*)values->data[i];
2591
2592 Logger::println("(%u) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
2593 }
2594
2595 assert(0);
2573 } 2596 }
2574 2597
2575 ////////////////////////////////////////////////////////////////////////////////////////// 2598 //////////////////////////////////////////////////////////////////////////////////////////
2576 2599
2577 #define STUB(x) DValue *x::toElem(IRState * p) {error("Exp type "#x" not implemented: %s", toChars()); fatal(); return 0; } 2600 #define STUB(x) DValue *x::toElem(IRState * p) {error("Exp type "#x" not implemented: %s", toChars()); fatal(); return 0; }
2643 //STUB(CommaExp); 2666 //STUB(CommaExp);
2644 //STUB(ArrayLengthExp); 2667 //STUB(ArrayLengthExp);
2645 //STUB(HaltExp); 2668 //STUB(HaltExp);
2646 STUB(RemoveExp); 2669 STUB(RemoveExp);
2647 //STUB(ArrayLiteralExp); 2670 //STUB(ArrayLiteralExp);
2648 STUB(AssocArrayLiteralExp); 2671 //STUB(AssocArrayLiteralExp);
2649 //STUB(StructLiteralExp); 2672 //STUB(StructLiteralExp);
2650 STUB(TupleExp); 2673 STUB(TupleExp);
2651 2674
2652 #define CONSTSTUB(x) llvm::Constant* x::toConstElem(IRState * p) {error("const Exp type "#x" not implemented: '%s' type: '%s'", toChars(), type->toChars()); fatal(); return NULL; } 2675 #define CONSTSTUB(x) llvm::Constant* x::toConstElem(IRState * p) {error("const Exp type "#x" not implemented: '%s' type: '%s'", toChars(), type->toChars()); fatal(); return NULL; }
2653 CONSTSTUB(Expression); 2676 CONSTSTUB(Expression);