[llvm] 61bd33e - [BPF] explicit warning of not supporting dynamic stack allocation

Yonghong Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 20:44:05 PST 2020


Author: Yonghong Song
Date: 2020-02-12T20:43:06-08:00
New Revision: 61bd33e37b1d4f3feda50162ec196e5e14759686

URL: https://github.com/llvm/llvm-project/commit/61bd33e37b1d4f3feda50162ec196e5e14759686
DIFF: https://github.com/llvm/llvm-project/commit/61bd33e37b1d4f3feda50162ec196e5e14759686.diff

LOG: [BPF] explicit warning of not supporting dynamic stack allocation

Currently, BPF does not support dynamic static allocation.
For a program like below:
  extern void bar(int *);
  void foo(int n) {
    int a[n];
    bar(a);
  }

The current error message looks like:
  unimplemented operand
  UNREACHABLE executed at /.../llvm/lib/Target/BPF/BPFISelLowering.cpp:199!

Let us make error message explicit so it will be clear to the user
what is the problem. With this patch, the error message looks like:
  fatal error: error in backend: Unsupported dynamic stack allocation
  ...

Differential Revision: https://reviews.llvm.org/D74521

Added: 
    

Modified: 
    llvm/lib/Target/BPF/BPFISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp
index 799a60c6cc92..cc8a48677538 100644
--- a/llvm/lib/Target/BPF/BPFISelLowering.cpp
+++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp
@@ -227,6 +227,8 @@ SDValue BPFTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
     return LowerGlobalAddress(Op, DAG);
   case ISD::SELECT_CC:
     return LowerSELECT_CC(Op, DAG);
+  case ISD::DYNAMIC_STACKALLOC:
+    report_fatal_error("Unsupported dynamic stack allocation");
   default:
     llvm_unreachable("unimplemented operand");
   }


        


More information about the llvm-commits mailing list