IRGen: a small refactoring in GenConstant

Just moving a few functions around and make emitConstantValue the main entry point for creating constants.

NFC
This commit is contained in:
Erik Eckstein
2021-02-05 11:56:23 +01:00
parent 65b03f9815
commit 44f07aea2b
3 changed files with 64 additions and 83 deletions

View File

@@ -6414,17 +6414,8 @@ void IRGenModule::emitSILStaticInitializers() {
continue;
}
// Set the IR global's initializer to the constant for this SIL
// struct.
if (auto *SI = dyn_cast<StructInst>(InitValue)) {
IRGlobal->setInitializer(emitConstantStruct(*this, SI));
continue;
}
// Set the IR global's initializer to the constant for this SIL
// tuple.
auto *TI = cast<TupleInst>(InitValue);
IRGlobal->setInitializer(emitConstantTuple(*this, TI));
IRGlobal->setInitializer(
emitConstantValue(*this, cast<SingleValueInstruction>(InitValue)));
}
}