[llvm] r325982 - bpf: New target attribute "alu32" for 32-bit subregister support

Yonghong Song via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 15:49:22 PST 2018


Author: yhs
Date: Fri Feb 23 15:49:22 2018
New Revision: 325982

URL: http://llvm.org/viewvc/llvm-project?rev=325982&view=rev
Log:
bpf: New target attribute "alu32" for 32-bit subregister support

This new attribute aims to control the enablement of 32-bit subregister
support on eBPF backend.

Name the interface as "alu32" is because we in particular want to enable
the generation of BPF_ALU32 instructions by enable subregister support.

This attribute could be used in the following format with llc:

  llc -mtriple=bpf -mattr=[+|-]alu32

It is disabled at default.

Signed-off-by: Jiong Wang <jiong.wang at netronome.com>
Reviewed-by: Yonghong Song <yhs at fb.com>

Modified:
    llvm/trunk/lib/Target/BPF/BPF.td
    llvm/trunk/lib/Target/BPF/BPFSubtarget.cpp
    llvm/trunk/lib/Target/BPF/BPFSubtarget.h

Modified: llvm/trunk/lib/Target/BPF/BPF.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPF.td?rev=325982&r1=325981&r2=325982&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/BPF.td (original)
+++ llvm/trunk/lib/Target/BPF/BPF.td Fri Feb 23 15:49:22 2018
@@ -26,6 +26,9 @@ def : Proc<"probe", []>;
 def DummyFeature : SubtargetFeature<"dummy", "isDummyMode",
                                     "true", "unused feature">;
 
+def ALU32 : SubtargetFeature<"alu32", "HasAlu32", "true",
+                             "Enable ALU32 instructions">;
+
 def BPFInstPrinter : AsmWriter {
   string AsmWriterClassName  = "InstPrinter";
   bit isMCAsmWriter = 1;

Modified: llvm/trunk/lib/Target/BPF/BPFSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFSubtarget.cpp?rev=325982&r1=325981&r2=325982&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/BPFSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/BPF/BPFSubtarget.cpp Fri Feb 23 15:49:22 2018
@@ -30,11 +30,13 @@ BPFSubtarget &BPFSubtarget::initializeSu
                                                             StringRef FS) {
   initializeEnvironment();
   initSubtargetFeatures(CPU, FS);
+  ParseSubtargetFeatures(CPU, FS);
   return *this;
 }
 
 void BPFSubtarget::initializeEnvironment() {
   HasJmpExt = false;
+  HasAlu32 = false;
 }
 
 void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {

Modified: llvm/trunk/lib/Target/BPF/BPFSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFSubtarget.h?rev=325982&r1=325981&r2=325982&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/BPFSubtarget.h (original)
+++ llvm/trunk/lib/Target/BPF/BPFSubtarget.h Fri Feb 23 15:49:22 2018
@@ -47,6 +47,9 @@ protected:
   // whether the cpu supports jmp ext
   bool HasJmpExt;
 
+  // whether the cpu supports alu32 instructions.
+  bool HasAlu32;
+
 public:
   // This constructor initializes the data members to match that
   // of the specified triple.
@@ -59,6 +62,7 @@ public:
   // subtarget options.  Definition of function is auto generated by tblgen.
   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
   bool getHasJmpExt() const { return HasJmpExt; }
+  bool getHasAlu32() const { return HasAlu32; }
 
   const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
   const BPFFrameLowering *getFrameLowering() const override {




More information about the llvm-commits mailing list