IRGen: Make outlined enum copy/destroy lazier and better mangled.

Emit enum copy/destroy methods only when codegen demands them; they previously got emitted immediately when TypeInfo is instantiated, which led to many functions getting emitted that were never used. Also, make it so that the symbol name includes the full type of the enum instance the outlined functions operate on, so it's more obvious what they'e being used for and they can be ODRed across translation units.
This commit is contained in:
Joe Groff
2018-03-11 11:02:54 -07:00
parent 37e3534b42
commit 53792aa64e
8 changed files with 91 additions and 38 deletions

View File

@@ -892,10 +892,14 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
case Node::Kind::OutlinedCopy:
Printer << "outlined copy of ";
print(Node->getChild(0));
if (Node->getNumChildren() > 1)
print(Node->getChild(1));
return nullptr;
case Node::Kind::OutlinedConsume:
Printer << "outlined consume of ";
print(Node->getChild(0));
if (Node->getNumChildren() > 1)
print(Node->getChild(1));
return nullptr;
case Node::Kind::OutlinedRetain:
Printer << "outlined retain of ";