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

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 20:16:48 PST 2020


yonghong-song created this revision.
yonghong-song added a reviewer: ast.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

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
  ...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74521

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


Index: llvm/lib/Target/BPF/BPFISelLowering.cpp
===================================================================
--- llvm/lib/Target/BPF/BPFISelLowering.cpp
+++ llvm/lib/Target/BPF/BPFISelLowering.cpp
@@ -227,6 +227,8 @@
     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");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74521.244324.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/a24af2a2/attachment.bin>


More information about the llvm-commits mailing list