[PATCH] D67313: [MSP430] Allow msp430_intrcc functions to not have interrupt attribute.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 11:58:21 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372910: [MSP430] Allow msp430_intrcc functions to not have interrupt attribute. (authored by dambrouski, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67313?vs=221776&id=221816#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67313/new/

https://reviews.llvm.org/D67313

Files:
  llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
  llvm/trunk/test/CodeGen/MSP430/interrupt.ll


Index: llvm/trunk/test/CodeGen/MSP430/interrupt.ll
===================================================================
--- llvm/trunk/test/CodeGen/MSP430/interrupt.ll
+++ llvm/trunk/test/CodeGen/MSP430/interrupt.ll
@@ -50,4 +50,13 @@
   ret void
 }
 
+; Functions without 'interrupt' attribute don't get a vector section.
+; CHECK-NOT: __interrupt_vector
+; CHECK-LABEL: NMI:
+; CHECK: reti
+define msp430_intrcc void @NMI() #1 {
+  ret void
+}
+
 attributes #0 = { noinline nounwind optnone "interrupt"="2" }
+attributes #1 = { noinline nounwind optnone }
Index: llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
+++ llvm/trunk/lib/Target/MSP430/MSP430AsmPrinter.cpp
@@ -159,8 +159,9 @@
 void MSP430AsmPrinter::EmitInterruptVectorSection(MachineFunction &ISR) {
   MCSection *Cur = OutStreamer->getCurrentSectionOnly();
   const auto *F = &ISR.getFunction();
-  assert(F->hasFnAttribute("interrupt") &&
-         "Functions with MSP430_INTR CC should have 'interrupt' attribute");
+  if (F->getCallingConv() != CallingConv::MSP430_INTR) {
+    report_fatal_error("Functions with 'interrupt' attribute must have msp430_intrcc CC");
+  }
   StringRef IVIdx = F->getFnAttribute("interrupt").getValueAsString();
   MCSection *IV = OutStreamer->getContext().getELFSection(
     "__interrupt_vector_" + IVIdx,
@@ -174,8 +175,9 @@
 
 bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   // Emit separate section for an interrupt vector if ISR
-  if (MF.getFunction().getCallingConv() == CallingConv::MSP430_INTR)
+  if (MF.getFunction().hasFnAttribute("interrupt")) {
     EmitInterruptVectorSection(MF);
+  }
 
   SetupMachineFunction(MF);
   EmitFunctionBody();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67313.221816.patch
Type: text/x-patch
Size: 1797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190925/bae7f8da/attachment.bin>


More information about the llvm-commits mailing list