[llvm] [RISCV] Collect function features in AsmPrinter before emission (#76231) (PR #76437)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 27 09:24:05 PST 2023
================
@@ -363,13 +370,23 @@ bool RISCVAsmPrinter::emitDirectiveOptionArch() {
return false;
}
+bool RISCVAsmPrinter::doInitialization(Module &M) {
+
+ CommonSTI->setFeatureBits(TM.getMCSubtargetInfo()->getFeatureBits());
+ return AsmPrinter::doInitialization(M);
+}
+
bool RISCVAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
STI = &MF.getSubtarget<RISCVSubtarget>();
RISCVTargetStreamer &RTS =
static_cast<RISCVTargetStreamer &>(*OutStreamer->getTargetStreamer());
bool EmittedOptionArch = emitDirectiveOptionArch();
+ // Collect flags from this function.
+ CommonSTI->setFeatureBits(CommonSTI->getFeatureBits() |
----------------
topperc wrote:
I don't think we can just union the features. Some features are incompatible, like F and
Zfinx.
https://github.com/llvm/llvm-project/pull/76437
More information about the llvm-commits
mailing list