diff options
| author | Yonghong Song <yhs@fb.com> | 2018-02-23 23:49:22 +0000 |
|---|---|---|
| committer | Yonghong Song <yhs@fb.com> | 2018-02-23 23:49:22 +0000 |
| commit | 42389377d86c80d1879588fab459672c7ada3375 (patch) | |
| tree | 574e965474a6f9ff4df6f91e0dc837ef756766fb /llvm/lib | |
| parent | 0252f35362f34b2fd7a56c8f55fce5b49b4bf36e (diff) | |
| download | bcm5719-llvm-42389377d86c80d1879588fab459672c7ada3375.tar.gz bcm5719-llvm-42389377d86c80d1879588fab459672c7ada3375.zip | |
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@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 325982
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/BPF/BPF.td | 3 | ||||
| -rw-r--r-- | llvm/lib/Target/BPF/BPFSubtarget.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/BPF/BPFSubtarget.h | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/BPF/BPF.td b/llvm/lib/Target/BPF/BPF.td index 2d0c22a3a51..b8c2298584c 100644 --- a/llvm/lib/Target/BPF/BPF.td +++ b/llvm/lib/Target/BPF/BPF.td @@ -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; diff --git a/llvm/lib/Target/BPF/BPFSubtarget.cpp b/llvm/lib/Target/BPF/BPFSubtarget.cpp index 42ca87f9ef6..2bb07032304 100644 --- a/llvm/lib/Target/BPF/BPFSubtarget.cpp +++ b/llvm/lib/Target/BPF/BPFSubtarget.cpp @@ -30,11 +30,13 @@ BPFSubtarget &BPFSubtarget::initializeSubtargetDependencies(StringRef CPU, 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) { diff --git a/llvm/lib/Target/BPF/BPFSubtarget.h b/llvm/lib/Target/BPF/BPFSubtarget.h index fa1f24443bc..4fbd4b00181 100644 --- a/llvm/lib/Target/BPF/BPFSubtarget.h +++ b/llvm/lib/Target/BPF/BPFSubtarget.h @@ -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 { |

