Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 527:cecfee2d01a8
Added support for overloaded intrinsics.
Added atomic intrinsics in the intrinsics.di header.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 20 Aug 2008 01:02:22 +0200 |
parents | 841589c97f20 |
children | 3197ffdc2811 |
comparison
equal
deleted
inserted
replaced
526:642f6fa854e5 | 527:cecfee2d01a8 |
---|---|
1551 // unknown | 1551 // unknown |
1552 std::cout << "unsupported -> bool : " << dtype->toChars() << '\n'; | 1552 std::cout << "unsupported -> bool : " << dtype->toChars() << '\n'; |
1553 assert(0); | 1553 assert(0); |
1554 return 0; | 1554 return 0; |
1555 } | 1555 } |
1556 | |
1557 ////////////////////////////////////////////////////////////////////////////////////////// | |
1558 | |
1559 void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, std::string& name) | |
1560 { | |
1561 Logger::println("DtoOverloadedIntrinsicName"); | |
1562 LOG_SCOPE; | |
1563 | |
1564 Logger::println("template instance: %s", ti->toChars()); | |
1565 Logger::println("template declaration: %s", td->toChars()); | |
1566 Logger::println("intrinsic name: %s", td->intrinsicName.c_str()); | |
1567 | |
1568 // for now use the size in bits of the first template param in the instance | |
1569 assert(ti->tdtypes.dim == 1); | |
1570 Type* T = (Type*)ti->tdtypes.data[0]; | |
1571 | |
1572 char tmp[10]; | |
1573 sprintf(tmp, "%d", T->size()*8); | |
1574 | |
1575 // replace # in name with bitsize | |
1576 name = td->intrinsicName; | |
1577 | |
1578 std::string needle("#"); | |
1579 size_t pos; | |
1580 while(std::string::npos != (pos = name.find(needle))) | |
1581 name.replace(pos, 1, tmp); | |
1582 | |
1583 Logger::println("final intrinsic name: %s", name.c_str()); | |
1584 } |