// Skip the LLVM metadata
if (GV->getSection() == "llvm.metadata")
return;
+ if (!GV->hasSection())
+ return;
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
MCSection *TheSection = getObjFileLowering().SectionForGlobal(GV, GVKind, TM);
OutStreamer->switchSection(TheSection);
}
FunctionPass *createTargetRegisterAllocator(bool) override { return nullptr; }
+ void addCodeGenPrepare() override {
+ addPass(createDXILOpLoweringLegacyPass());
+ addPass(createDXILPrepareModulePass());
+ addPass(createDXILTranslateMetadataPass());
+ }
};
DirectXTargetMachine::DirectXTargetMachine(const Target &T, const Triple &TT,
PassManagerBase &PM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut,
CodeGenFileType FileType, bool DisableVerify,
MachineModuleInfoWrapperPass *MMIWP) {
- PM.add(createDXILOpLoweringLegacyPass());
- PM.add(createDXILPrepareModulePass());
- PM.add(createDXILTranslateMetadataPass());
+ TargetPassConfig *PassConfig = createPassConfig(PM);
+ PassConfig->addCodeGenPrepare();
+
if (TargetPassConfig::willCompleteCodeGenPipeline()) {
PM.add(createDXILEmbedderPass());
}