<div dir="ltr">It doesn't look like anyone actually approved this? (I know, it was in my list of things to look at :)<br><br><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 4, 2015 at 12:23 PM Alexei Starovoitov <<a href="mailto:alexei.starovoitov@gmail.com">alexei.starovoitov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ast<br>
Date: Thu Jun 4 14:15:05 2015<br>
New Revision: 239071<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239071-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=D2X4QqGAaeEjczUq4ogfhKvcTHyPqIysfTCRPPmfT94&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239071&view=rev</a><br>
Log:<br>
[bpf] add big- and host- endian support<br>
<br>
Summary:<br>
-march=bpf -> host endian<br>
-march=bpf_le -> little endian<br>
-match=bpf_be -> big endian<br>
<br>
Test Plan:<br>
v1 was tested by IBM s390 guys and appears to be working there.<br>
It bit rots too fast here.<br>
<br>
Reviewers: chandlerc, tstellarAMD<br>
<br>
Subscribers: llvm-commits<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10177&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=MX6j00fxR6zuGvg25qwS9F4X12KIfXKr-Mv8XgEYb2E&e=" target="_blank">http://reviews.llvm.org/D10177</a><br>
<br>
Added:<br>
llvm/trunk/test/CodeGen/BPF/cc_args_be.ll<br>
- copied, changed from r239069, llvm/trunk/test/CodeGen/BPF/cc_args.ll<br>
Modified:<br>
llvm/trunk/include/llvm/ADT/Triple.h<br>
llvm/trunk/lib/Support/Triple.cpp<br>
llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp<br>
llvm/trunk/lib/Target/BPF/BPFTargetMachine.cpp<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp<br>
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h<br>
llvm/trunk/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp<br>
llvm/trunk/test/CodeGen/BPF/alu8.ll<br>
llvm/trunk/test/CodeGen/BPF/atomics.ll<br>
llvm/trunk/test/CodeGen/BPF/basictest.ll<br>
llvm/trunk/test/CodeGen/BPF/cc_args.ll<br>
llvm/trunk/test/CodeGen/BPF/cc_ret.ll<br>
llvm/trunk/test/CodeGen/BPF/ex1.ll<br>
llvm/trunk/test/CodeGen/BPF/intrinsics.ll<br>
llvm/trunk/test/CodeGen/BPF/load.ll<br>
llvm/trunk/test/CodeGen/BPF/loops.ll<br>
llvm/trunk/test/CodeGen/BPF/sanity.ll<br>
llvm/trunk/test/CodeGen/BPF/setcc.ll<br>
llvm/trunk/test/CodeGen/BPF/shifts.ll<br>
llvm/trunk/test/CodeGen/BPF/sockex2.ll<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/Triple.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_ADT_Triple.h-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=j7uyDvRNVY_1OCFgf_PAuUCylp44rXSIfA-XEKAqoNA&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/Triple.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/Triple.h Thu Jun 4 14:15:05 2015<br>
@@ -50,7 +50,8 @@ public:<br>
armeb, // ARM (big endian): armeb<br>
aarch64, // AArch64 (little endian): aarch64<br>
aarch64_be, // AArch64 (big endian): aarch64_be<br>
- bpf, // eBPF or extended BPF or 64-bit BPF (little endian)<br>
+ bpf_le, // eBPF or extended BPF or 64-bit BPF (little endian)<br>
+ bpf_be, // eBPF or extended BPF or 64-bit BPF (big endian)<br>
hexagon, // Hexagon: hexagon<br>
mips, // MIPS: mips, mipsallegrex<br>
mipsel, // MIPSEL: mipsel, mipsallegrexel<br>
<br>
Modified: llvm/trunk/lib/Support/Triple.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Support_Triple.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=56yxMQFeafx7g6za461B4TQD2k2ebRlkYHW8qYWUCok&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Triple.cpp (original)<br>
+++ llvm/trunk/lib/Support/Triple.cpp Thu Jun 4 14:15:05 2015<br>
@@ -13,6 +13,7 @@<br>
#include "llvm/ADT/StringSwitch.h"<br>
#include "llvm/Support/ErrorHandling.h"<br>
#include "llvm/Support/TargetParser.h"<br>
+#include "llvm/Support/Host.h"<br>
#include <cstring><br>
using namespace llvm;<br>
<br>
@@ -24,7 +25,8 @@ const char *Triple::getArchTypeName(Arch<br>
case aarch64_be: return "aarch64_be";<br>
case arm: return "arm";<br>
case armeb: return "armeb";<br>
- case bpf: return "bpf";<br>
+ case bpf_le: return "bpf_le";<br>
+ case bpf_be: return "bpf_be";<br>
case hexagon: return "hexagon";<br>
case mips: return "mips";<br>
case mipsel: return "mipsel";<br>
@@ -89,7 +91,8 @@ const char *Triple::getArchTypePrefix(Ar<br>
case amdgcn:<br>
case r600: return "amdgpu";<br>
<br>
- case bpf: return "bpf";<br>
+ case bpf_le:<br>
+ case bpf_be: return "bpf";<br>
<br>
case sparcv9:<br>
case sparcel:<br>
@@ -192,14 +195,30 @@ const char *Triple::getEnvironmentTypeNa<br>
llvm_unreachable("Invalid EnvironmentType!");<br>
}<br>
<br>
+static Triple::ArchType parseBPFArch(StringRef ArchName) {<br>
+ if (ArchName.equals("bpf")) {<br>
+ if (sys::IsLittleEndianHost)<br>
+ return Triple::bpf_le;<br>
+ else<br>
+ return Triple::bpf_be;<br>
+ } else if (ArchName.equals("bpf_be")) {<br>
+ return Triple::bpf_be;<br>
+ } else if (ArchName.equals("bpf_le")) {<br>
+ return Triple::bpf_le;<br>
+ } else {<br>
+ return Triple::UnknownArch;<br>
+ }<br>
+}<br>
+<br>
Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {<br>
+ Triple::ArchType BPFArch(parseBPFArch(Name));<br>
return StringSwitch<Triple::ArchType>(Name)<br>
.Case("aarch64", aarch64)<br>
.Case("aarch64_be", aarch64_be)<br>
.Case("arm64", aarch64) // "arm64" is an alias for "aarch64"<br>
.Case("arm", arm)<br>
.Case("armeb", armeb)<br>
- .Case("bpf", bpf)<br>
+ .StartsWith("bpf", BPFArch)<br>
.Case("mips", mips)<br>
.Case("mipsel", mipsel)<br>
.Case("mips64", mips64)<br>
@@ -296,6 +315,7 @@ static Triple::ArchType parseARMArch(Str<br>
<br>
static Triple::ArchType parseArch(StringRef ArchName) {<br>
Triple::ArchType ARMArch(parseARMArch(ArchName));<br>
+ Triple::ArchType BPFArch(parseBPFArch(ArchName));<br>
<br>
return StringSwitch<Triple::ArchType>(ArchName)<br>
.Cases("i386", "i486", "i586", "i686", Triple::x86)<br>
@@ -317,7 +337,7 @@ static Triple::ArchType parseArch(String<br>
.Case("mips64el", Triple::mips64el)<br>
.Case("r600", Triple::r600)<br>
.Case("amdgcn", Triple::amdgcn)<br>
- .Case("bpf", Triple::bpf)<br>
+ .StartsWith("bpf", BPFArch)<br>
.Case("hexagon", Triple::hexagon)<br>
.Case("s390x", Triple::systemz)<br>
.Case("sparc", Triple::sparc)<br>
@@ -989,7 +1009,8 @@ static unsigned getArchPointerBitWidth(l<br>
case llvm::Triple::aarch64:<br>
case llvm::Triple::aarch64_be:<br>
case llvm::Triple::amdgcn:<br>
- case llvm::Triple::bpf:<br>
+ case llvm::Triple::bpf_le:<br>
+ case llvm::Triple::bpf_be:<br>
case llvm::Triple::le64:<br>
case llvm::Triple::mips64:<br>
case llvm::Triple::mips64el:<br>
@@ -1026,7 +1047,8 @@ Triple Triple::get32BitArchVariant() con<br>
case Triple::aarch64:<br>
case Triple::aarch64_be:<br>
case Triple::amdgcn:<br>
- case Triple::bpf:<br>
+ case Triple::bpf_le:<br>
+ case Triple::bpf_be:<br>
case Triple::msp430:<br>
case Triple::systemz:<br>
case Triple::ppc64le:<br>
@@ -1090,7 +1112,8 @@ Triple Triple::get64BitArchVariant() con<br>
<br>
case Triple::aarch64:<br>
case Triple::aarch64_be:<br>
- case Triple::bpf:<br>
+ case Triple::bpf_le:<br>
+ case Triple::bpf_be:<br>
case Triple::le64:<br>
case Triple::amdil64:<br>
case Triple::amdgcn:<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_BPFAsmPrinter.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=f1ijx0YCWldAcH0lUyvonrydK2NZEKf4qw_AzjW82Qw&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp Thu Jun 4 14:15:05 2015<br>
@@ -83,5 +83,7 @@ void BPFAsmPrinter::EmitInstruction(cons<br>
<br>
// Force static initialization.<br>
extern "C" void LLVMInitializeBPFAsmPrinter() {<br>
- RegisterAsmPrinter<BPFAsmPrinter> X(TheBPFTarget);<br>
+ RegisterAsmPrinter<BPFAsmPrinter> X(TheBPFleTarget);<br>
+ RegisterAsmPrinter<BPFAsmPrinter> Y(TheBPFbeTarget);<br>
+ RegisterAsmPrinter<BPFAsmPrinter> Z(TheBPFTarget);<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/BPFTargetMachine.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_BPFTargetMachine.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=5yyIUigJ6eIpIcBjDZBwATRfW1JuVYfpxD54wN4txkE&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFTargetMachine.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/BPFTargetMachine.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/BPFTargetMachine.cpp Thu Jun 4 14:15:05 2015<br>
@@ -23,19 +23,24 @@ using namespace llvm;<br>
<br>
extern "C" void LLVMInitializeBPFTarget() {<br>
// Register the target.<br>
- RegisterTargetMachine<BPFTargetMachine> X(TheBPFTarget);<br>
+ RegisterTargetMachine<BPFTargetMachine> X(TheBPFleTarget);<br>
+ RegisterTargetMachine<BPFTargetMachine> Y(TheBPFbeTarget);<br>
+ RegisterTargetMachine<BPFTargetMachine> Z(TheBPFTarget);<br>
+}<br>
+<br>
+// DataLayout: little or big endian<br>
+static std::string computeDataLayout(StringRef TT) {<br>
+ if (Triple(TT).getArch() == Triple::bpf_be)<br>
+ return "E-m:e-p:64:64-i64:64-n32:64-S128";<br>
+ else<br>
+ return "e-m:e-p:64:64-i64:64-n32:64-S128";<br>
}<br>
<br>
-// DataLayout --> Little-endian, 64-bit pointer/ABI/alignment<br>
-// The stack is always 8 byte aligned<br>
-// On function prologue, the stack is created by decrementing<br>
-// its pointer. Once decremented, all references are done with positive<br>
-// offset from the stack/frame pointer.<br>
BPFTargetMachine::BPFTargetMachine(const Target &T, StringRef TT, StringRef CPU,<br>
StringRef FS, const TargetOptions &Options,<br>
Reloc::Model RM, CodeModel::Model CM,<br>
CodeGenOpt::Level OL)<br>
- : LLVMTargetMachine(T, "e-m:e-p:64:64-i64:64-n32:64-S128", TT, CPU, FS,<br>
+ : LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS,<br>
Options, RM, CM, OL),<br>
TLOF(make_unique<TargetLoweringObjectFileELF>()),<br>
Subtarget(TT, CPU, FS, *this) {<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFAsmBackend.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=JV3IUBQqAqcYlQvDPVr6UGKd5T84jKX-iF5HQTdSF3I&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp Thu Jun 4 14:15:05 2015<br>
@@ -25,7 +25,10 @@ using namespace llvm;<br>
namespace {<br>
class BPFAsmBackend : public MCAsmBackend {<br>
public:<br>
- BPFAsmBackend() : MCAsmBackend() {}<br>
+ bool IsLittleEndian;<br>
+<br>
+ BPFAsmBackend(bool IsLittleEndian)<br>
+ : MCAsmBackend(), IsLittleEndian(IsLittleEndian) {}<br>
~BPFAsmBackend() override {}<br>
<br>
void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,<br>
@@ -69,17 +72,28 @@ void BPFAsmBackend::applyFixup(const MCF<br>
}<br>
assert(Fixup.getKind() == FK_PCRel_2);<br>
Value = (uint16_t)((Value - 8) / 8);<br>
- Data[Fixup.getOffset() + 2] = Value & 0xFF;<br>
- Data[Fixup.getOffset() + 3] = Value >> 8;<br>
+ if (IsLittleEndian) {<br>
+ Data[Fixup.getOffset() + 2] = Value & 0xFF;<br>
+ Data[Fixup.getOffset() + 3] = Value >> 8;<br>
+ } else {<br>
+ Data[Fixup.getOffset() + 2] = Value >> 8;<br>
+ Data[Fixup.getOffset() + 3] = Value & 0xFF;<br>
+ }<br>
}<br>
<br>
MCObjectWriter *BPFAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {<br>
- return createBPFELFObjectWriter(OS, 0);<br>
+ return createBPFELFObjectWriter(OS, 0, IsLittleEndian);<br>
}<br>
}<br>
<br>
MCAsmBackend *llvm::createBPFAsmBackend(const Target &T,<br>
const MCRegisterInfo &MRI, StringRef TT,<br>
StringRef CPU) {<br>
- return new BPFAsmBackend();<br>
+ return new BPFAsmBackend(/*IsLittleEndian=*/true);<br>
+}<br>
+<br>
+MCAsmBackend *llvm::createBPFbeAsmBackend(const Target &T,<br>
+ const MCRegisterInfo &MRI, StringRef TT,<br>
+ StringRef CPU) {<br>
+ return new BPFAsmBackend(/*IsLittleEndian=*/false);<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFELFObjectWriter.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=BIUtVU_p9ab3dAyydBeXjh1HmSpICphWrs6qJdrs-oM&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp Thu Jun 4 14:15:05 2015<br>
@@ -47,7 +47,8 @@ unsigned BPFELFObjectWriter::GetRelocTyp<br>
}<br>
}<br>
<br>
-MCObjectWriter *llvm::createBPFELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) {<br>
+MCObjectWriter *llvm::createBPFELFObjectWriter(raw_pwrite_stream &OS,<br>
+ uint8_t OSABI, bool IsLittleEndian) {<br>
MCELFObjectTargetWriter *MOTW = new BPFELFObjectWriter(OSABI);<br>
- return createELFObjectWriter(MOTW, OS, /*IsLittleEndian=*/true);<br>
+ return createELFObjectWriter(MOTW, OS, IsLittleEndian);<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFMCAsmInfo.h-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=M8D_-gQI9HwvKFxDF2YLoVg4SweTkWP2sq0lJVefPi8&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h Thu Jun 4 14:15:05 2015<br>
@@ -16,6 +16,7 @@<br>
<br>
#include "llvm/ADT/StringRef.h"<br>
#include "llvm/MC/MCAsmInfo.h"<br>
+#include "llvm/ADT/Triple.h"<br>
<br>
namespace llvm {<br>
class Target;<br>
@@ -24,6 +25,9 @@ class Triple;<br>
class BPFMCAsmInfo : public MCAsmInfo {<br>
public:<br>
explicit BPFMCAsmInfo(const Triple &TT) {<br>
+ if (TT.getArch() == Triple::bpf_be)<br>
+ IsLittleEndian = false;<br>
+<br>
PrivateGlobalPrefix = ".L";<br>
WeakRefDirective = "\t.weak\t";<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFMCCodeEmitter.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=K5TdYRGEURRKpfwrZJ-I1VeYm39zgChxcGbMvEzmGa0&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp Thu Jun 4 14:15:05 2015<br>
@@ -30,9 +30,11 @@ class BPFMCCodeEmitter : public MCCodeEm<br>
BPFMCCodeEmitter(const BPFMCCodeEmitter &) = delete;<br>
void operator=(const BPFMCCodeEmitter &) = delete;<br>
const MCRegisterInfo &MRI;<br>
+ bool IsLittleEndian;<br>
<br>
public:<br>
- BPFMCCodeEmitter(const MCRegisterInfo &mri) : MRI(mri) {}<br>
+ BPFMCCodeEmitter(const MCRegisterInfo &mri, bool IsLittleEndian)<br>
+ : MRI(mri), IsLittleEndian(IsLittleEndian) {}<br>
<br>
~BPFMCCodeEmitter() {}<br>
<br>
@@ -61,7 +63,13 @@ public:<br>
MCCodeEmitter *llvm::createBPFMCCodeEmitter(const MCInstrInfo &MCII,<br>
const MCRegisterInfo &MRI,<br>
MCContext &Ctx) {<br>
- return new BPFMCCodeEmitter(MRI);<br>
+ return new BPFMCCodeEmitter(MRI, true);<br>
+}<br>
+<br>
+MCCodeEmitter *llvm::createBPFbeMCCodeEmitter(const MCInstrInfo &MCII,<br>
+ const MCRegisterInfo &MRI,<br>
+ MCContext &Ctx) {<br>
+ return new BPFMCCodeEmitter(MRI, false);<br>
}<br>
<br>
unsigned BPFMCCodeEmitter::getMachineOpValue(const MCInst &MI,<br>
@@ -91,32 +99,53 @@ unsigned BPFMCCodeEmitter::getMachineOpV<br>
return 0;<br>
}<br>
<br>
+static uint8_t SwapBits(uint8_t Val)<br>
+{<br>
+ return (Val & 0x0F) << 4 | (Val & 0xF0) >> 4;<br>
+}<br>
+<br>
void BPFMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,<br>
SmallVectorImpl<MCFixup> &Fixups,<br>
const MCSubtargetInfo &STI) const {<br>
unsigned Opcode = MI.getOpcode();<br>
support::endian::Writer<support::little> LE(OS);<br>
+ support::endian::Writer<support::big> BE(OS);<br>
<br>
if (Opcode == BPF::LD_imm64 || Opcode == BPF::LD_pseudo) {<br>
uint64_t Value = getBinaryCodeForInstr(MI, Fixups, STI);<br>
LE.write<uint8_t>(Value >> 56);<br>
- LE.write<uint8_t>(((Value >> 48) & 0xff));<br>
+ if (IsLittleEndian)<br>
+ LE.write<uint8_t>((Value >> 48) & 0xff);<br>
+ else<br>
+ LE.write<uint8_t>(SwapBits((Value >> 48) & 0xff));<br>
LE.write<uint16_t>(0);<br>
- LE.write<uint32_t>(Value & 0xffffFFFF);<br>
+ if (IsLittleEndian)<br>
+ LE.write<uint32_t>(Value & 0xffffFFFF);<br>
+ else<br>
+ BE.write<uint32_t>(Value & 0xffffFFFF);<br>
<br>
const MCOperand &MO = MI.getOperand(1);<br>
uint64_t Imm = MO.isImm() ? MO.getImm() : 0;<br>
LE.write<uint8_t>(0);<br>
LE.write<uint8_t>(0);<br>
LE.write<uint16_t>(0);<br>
- LE.write<uint32_t>(Imm >> 32);<br>
+ if (IsLittleEndian)<br>
+ LE.write<uint32_t>(Imm >> 32);<br>
+ else<br>
+ BE.write<uint32_t>(Imm >> 32);<br>
} else {<br>
// Get instruction encoding and emit it<br>
uint64_t Value = getBinaryCodeForInstr(MI, Fixups, STI);<br>
LE.write<uint8_t>(Value >> 56);<br>
- LE.write<uint8_t>((Value >> 48) & 0xff);<br>
- LE.write<uint16_t>((Value >> 32) & 0xffff);<br>
- LE.write<uint32_t>(Value & 0xffffFFFF);<br>
+ if (IsLittleEndian) {<br>
+ LE.write<uint8_t>((Value >> 48) & 0xff);<br>
+ LE.write<uint16_t>((Value >> 32) & 0xffff);<br>
+ LE.write<uint32_t>(Value & 0xffffFFFF);<br>
+ } else {<br>
+ LE.write<uint8_t>(SwapBits((Value >> 48) & 0xff));<br>
+ BE.write<uint16_t>((Value >> 32) & 0xffff);<br>
+ BE.write<uint32_t>(Value & 0xffffFFFF);<br>
+ }<br>
}<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFMCTargetDesc.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=j9Wd7wMaY-9p5VwUoKrkktjLLULa970E_FE5ioEBYIY&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp Thu Jun 4 14:15:05 2015<br>
@@ -79,32 +79,43 @@ static MCInstPrinter *createBPFMCInstPri<br>
}<br>
<br>
extern "C" void LLVMInitializeBPFTargetMC() {<br>
- // Register the MC asm info.<br>
- RegisterMCAsmInfo<BPFMCAsmInfo> X(TheBPFTarget);<br>
+ for (Target *T : {&TheBPFleTarget, &TheBPFbeTarget, &TheBPFTarget}) {<br>
+ // Register the MC asm info.<br>
+ RegisterMCAsmInfo<BPFMCAsmInfo> X(*T);<br>
<br>
- // Register the MC codegen info.<br>
- TargetRegistry::RegisterMCCodeGenInfo(TheBPFTarget, createBPFMCCodeGenInfo);<br>
+ // Register the MC codegen info.<br>
+ TargetRegistry::RegisterMCCodeGenInfo(*T, createBPFMCCodeGenInfo);<br>
<br>
- // Register the MC instruction info.<br>
- TargetRegistry::RegisterMCInstrInfo(TheBPFTarget, createBPFMCInstrInfo);<br>
+ // Register the MC instruction info.<br>
+ TargetRegistry::RegisterMCInstrInfo(*T, createBPFMCInstrInfo);<br>
<br>
- // Register the MC register info.<br>
- TargetRegistry::RegisterMCRegInfo(TheBPFTarget, createBPFMCRegisterInfo);<br>
+ // Register the MC register info.<br>
+ TargetRegistry::RegisterMCRegInfo(*T, createBPFMCRegisterInfo);<br>
<br>
- // Register the MC subtarget info.<br>
- TargetRegistry::RegisterMCSubtargetInfo(TheBPFTarget,<br>
- createBPFMCSubtargetInfo);<br>
+ // Register the MC subtarget info.<br>
+ TargetRegistry::RegisterMCSubtargetInfo(*T,<br>
+ createBPFMCSubtargetInfo);<br>
+<br>
+ // Register the object streamer<br>
+ TargetRegistry::RegisterELFStreamer(*T, createBPFMCStreamer);<br>
+<br>
+ // Register the MCInstPrinter.<br>
+ TargetRegistry::RegisterMCInstPrinter(*T, createBPFMCInstPrinter);<br>
+ }<br>
<br>
// Register the MC code emitter<br>
- TargetRegistry::RegisterMCCodeEmitter(TheBPFTarget,<br>
- llvm::createBPFMCCodeEmitter);<br>
+ TargetRegistry::RegisterMCCodeEmitter(TheBPFleTarget, createBPFMCCodeEmitter);<br>
+ TargetRegistry::RegisterMCCodeEmitter(TheBPFbeTarget, createBPFbeMCCodeEmitter);<br>
<br>
// Register the ASM Backend<br>
- TargetRegistry::RegisterMCAsmBackend(TheBPFTarget, createBPFAsmBackend);<br>
-<br>
- // Register the object streamer<br>
- TargetRegistry::RegisterELFStreamer(TheBPFTarget, createBPFMCStreamer);<br>
+ TargetRegistry::RegisterMCAsmBackend(TheBPFleTarget, createBPFAsmBackend);<br>
+ TargetRegistry::RegisterMCAsmBackend(TheBPFbeTarget, createBPFbeAsmBackend);<br>
<br>
- // Register the MCInstPrinter.<br>
- TargetRegistry::RegisterMCInstPrinter(TheBPFTarget, createBPFMCInstPrinter);<br>
+ if (sys::IsLittleEndianHost) {<br>
+ TargetRegistry::RegisterMCCodeEmitter(TheBPFTarget, createBPFMCCodeEmitter);<br>
+ TargetRegistry::RegisterMCAsmBackend(TheBPFTarget, createBPFAsmBackend);<br>
+ } else {<br>
+ TargetRegistry::RegisterMCCodeEmitter(TheBPFTarget, createBPFbeMCCodeEmitter);<br>
+ TargetRegistry::RegisterMCAsmBackend(TheBPFTarget, createBPFbeAsmBackend);<br>
+ }<br>
}<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_MCTargetDesc_BPFMCTargetDesc.h-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=kQ-XK2fIJbJ6eHA4XGtHSWpYjigwrxlRQ4ZQg86Xgb4&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h (original)<br>
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h Thu Jun 4 14:15:05 2015<br>
@@ -30,16 +30,24 @@ class StringRef;<br>
class raw_ostream;<br>
class raw_pwrite_stream;<br>
<br>
+extern Target TheBPFleTarget;<br>
+extern Target TheBPFbeTarget;<br>
extern Target TheBPFTarget;<br>
<br>
MCCodeEmitter *createBPFMCCodeEmitter(const MCInstrInfo &MCII,<br>
const MCRegisterInfo &MRI,<br>
MCContext &Ctx);<br>
+MCCodeEmitter *createBPFbeMCCodeEmitter(const MCInstrInfo &MCII,<br>
+ const MCRegisterInfo &MRI,<br>
+ MCContext &Ctx);<br>
<br>
MCAsmBackend *createBPFAsmBackend(const Target &T, const MCRegisterInfo &MRI,<br>
StringRef TT, StringRef CPU);<br>
+MCAsmBackend *createBPFbeAsmBackend(const Target &T, const MCRegisterInfo &MRI,<br>
+ StringRef TT, StringRef CPU);<br>
<br>
-MCObjectWriter *createBPFELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI);<br>
+MCObjectWriter *createBPFELFObjectWriter(raw_pwrite_stream &OS,<br>
+ uint8_t OSABI, bool IsLittleEndian);<br>
}<br>
<br>
// Defines symbolic names for BPF registers. This defines a mapping from<br>
<br>
Modified: llvm/trunk/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_BPF_TargetInfo_BPFTargetInfo.cpp-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=Gdex-czj7IIFeGm-oOn05SZ4rfmJB-xLJAxHdnDVarE&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp (original)<br>
+++ llvm/trunk/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp Thu Jun 4 14:15:05 2015<br>
@@ -11,8 +11,18 @@<br>
#include "llvm/Support/TargetRegistry.h"<br>
using namespace llvm;<br>
<br>
-Target llvm::TheBPFTarget;<br>
+namespace llvm {<br>
+Target TheBPFleTarget;<br>
+Target TheBPFbeTarget;<br>
+Target TheBPFTarget;<br>
+}<br>
<br>
extern "C" void LLVMInitializeBPFTargetInfo() {<br>
- RegisterTarget<Triple::bpf, /*HasJIT=*/true> X(TheBPFTarget, "bpf", "BPF");<br>
+ TargetRegistry::RegisterTarget(TheBPFTarget, "bpf",<br>
+ "BPF (host endian)",<br>
+ [](Triple::ArchType) { return false; }, true);<br>
+ RegisterTarget<Triple::bpf_le, /*HasJIT=*/true> X(<br>
+ TheBPFleTarget, "bpf_le", "BPF (little endian)");<br>
+ RegisterTarget<Triple::bpf_be, /*HasJIT=*/true> Y(<br>
+ TheBPFbeTarget, "bpf_be", "BPF (big endian)");<br>
}<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/alu8.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_alu8.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=igxjCIQFaU1O1FnpWJMHtoIq4gKhB7WM8-lwmzz6jYM&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/alu8.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/alu8.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/alu8.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,5 +1,4 @@<br>
-; RUN: llc -march=bpf -show-mc-encoding < %s | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc -march=bpf_le -show-mc-encoding < %s | FileCheck %s<br>
<br>
define i8 @mov(i8 %a, i8 %b) nounwind {<br>
; CHECK-LABEL: mov:<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/atomics.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_atomics.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=FxgBd3kH6DMeIXZfhdNRdQKPxKOgSiBQVTma01EfP7M&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/atomics.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/atomics.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/atomics.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,5 +1,4 @@<br>
-; RUN: llc < %s -march=bpf -verify-machineinstrs -show-mc-encoding | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc < %s -march=bpf_le -verify-machineinstrs -show-mc-encoding | FileCheck %s<br>
<br>
; CHECK-LABEL: test_load_add_32<br>
; CHECK: xadd32<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/basictest.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_basictest.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=kducjiDz0ojAAzBwYypRATxrxR4xwQxCuhHf8N0A_d8&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/basictest.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/basictest.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/basictest.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
define i32 @test0(i32 %X) {<br>
%tmp.1 = add i32 %X, 1<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/cc_args.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_cc-5Fargs.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=weHU3rin7JseZO2dpA-eG7-qWMVDKr68VWufOow1VzM&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/cc_args.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/cc_args.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/cc_args.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,5 +1,4 @@<br>
-; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc < %s -march=bpf_le -show-mc-encoding | FileCheck %s<br>
<br>
define void @test() #0 {<br>
entry:<br>
<br>
Copied: llvm/trunk/test/CodeGen/BPF/cc_args_be.ll (from r239069, llvm/trunk/test/CodeGen/BPF/cc_args.ll)<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_cc-5Fargs-5Fbe.ll-3Fp2-3Dllvm_trunk_test_CodeGen_BPF_cc-5Fargs-5Fbe.ll-26p1-3Dllvm_trunk_test_CodeGen_BPF_cc-5Fargs.ll-26r1-3D239069-26r2-3D239071-26rev-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=Sc5g9i6eBDYyNsr4QgmbdgPQBsN1KbDheMAddvRG0sE&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/cc_args_be.ll?p2=llvm/trunk/test/CodeGen/BPF/cc_args_be.ll&p1=llvm/trunk/test/CodeGen/BPF/cc_args.ll&r1=239069&r2=239071&rev=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/cc_args.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/cc_args_be.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,19 +1,19 @@<br>
-; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc < %s -march=bpf_be -show-mc-encoding | FileCheck %s<br>
+; test big endian<br>
<br>
define void @test() #0 {<br>
entry:<br>
; CHECK: test:<br>
<br>
-; CHECK: mov r1, 123 # encoding: [0xb7,0x01,0x00,0x00,0x7b,0x00,0x00,0x00]<br>
+; CHECK: mov r1, 123 # encoding: [0xb7,0x10,0x00,0x00,0x00,0x00,0x00,0x7b]<br>
; CHECK: call f_i16<br>
call void @f_i16(i16 123)<br>
<br>
-; CHECK: mov r1, 12345678 # encoding: [0xb7,0x01,0x00,0x00,0x4e,0x61,0xbc,0x00]<br>
+; CHECK: mov r1, 12345678 # encoding: [0xb7,0x10,0x00,0x00,0x00,0xbc,0x61,0x4e]<br>
; CHECK: call f_i32<br>
call void @f_i32(i32 12345678)<br>
<br>
-; CHECK: ld_64 r1, 72623859790382856 # encoding: [0x18,0x01,0x00,0x00,0x08,0x07,0x06,0x05,0x00,0x00,0x00,0x00,0x04,0x03,0x02,0x01]<br>
+; CHECK: ld_64 r1, 72623859790382856 # encoding: [0x18,0x10,0x00,0x00,0x05,0x06,0x07,0x08,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04]<br>
; CHECK: call f_i64<br>
call void @f_i64(i64 72623859790382856)<br>
<br>
@@ -43,23 +43,23 @@ entry:<br>
<br>
define void @f_i16(i16 %a) #0 {<br>
; CHECK: f_i16:<br>
-; CHECK: sth 0(r2), r1 # encoding: [0x6b,0x12,0x00,0x00,0x00,0x00,0x00,0x00]<br>
+; CHECK: sth 0(r2), r1 # encoding: [0x6b,0x21,0x00,0x00,0x00,0x00,0x00,0x00]<br>
store volatile i16 %a, i16* @g_i16, align 2<br>
ret void<br>
}<br>
<br>
define void @f_i32(i32 %a) #0 {<br>
; CHECK: f_i32:<br>
-; CHECK: sth 0(r2), r1 # encoding: [0x6b,0x12,0x00,0x00,0x00,0x00,0x00,0x00]<br>
-; CHECK: sth 2(r2), r1 # encoding: [0x6b,0x12,0x02,0x00,0x00,0x00,0x00,0x00]<br>
+; CHECK: sth 2(r2), r1 # encoding: [0x6b,0x21,0x00,0x02,0x00,0x00,0x00,0x00]<br>
+; CHECK: sth 0(r2), r1 # encoding: [0x6b,0x21,0x00,0x00,0x00,0x00,0x00,0x00]<br>
store volatile i32 %a, i32* @g_i32, align 2<br>
ret void<br>
}<br>
<br>
define void @f_i64(i64 %a) #0 {<br>
; CHECK: f_i64:<br>
+; CHECK: stw 4(r2), r1 # encoding: [0x63,0x21,0x00,0x04,0x00,0x00,0x00,0x00]<br>
; CHECK: stw 0(r2), r1<br>
-; CHECK: stw 4(r2), r1 # encoding: [0x63,0x12,0x04,0x00,0x00,0x00,0x00,0x00]<br>
store volatile i64 %a, i64* @g_i64, align 2<br>
ret void<br>
}<br>
@@ -88,7 +88,7 @@ define void @f_i16_i64_i16(i16 %a, i64 %<br>
; CHECK: f_i16_i64_i16:<br>
; CHECK: sth 0(r4), r1<br>
store volatile i16 %a, i16* @g_i16, align 2<br>
-; CHECK: std 0(r1), r2 # encoding: [0x7b,0x21,0x00,0x00,0x00,0x00,0x00,0x00]<br>
+; CHECK: std 0(r1), r2 # encoding: [0x7b,0x12,0x00,0x00,0x00,0x00,0x00,0x00]<br>
store volatile i64 %b, i64* @g_i64, align 8<br>
; CHECK: sth 0(r4), r3<br>
store volatile i16 %c, i16* @g_i16, align 2<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/cc_ret.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_cc-5Fret.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=YqRHj5tWEysOF1XfTVc89kFW4scLHyIKvVBNDZdyL5M&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/cc_ret.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/cc_ret.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/cc_ret.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
define void @test() #0 {<br>
entry:<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/ex1.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_ex1.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=q5Fa5L3AjKD3N9epjxwiV_58HyHIarynZKLjxBRzsGc&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/ex1.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/ex1.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/ex1.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
%struct.bpf_context = type { i64, i64, i64, i64, i64, i64, i64 }<br>
%struct.sk_buff = type { i64, i64, i64, i64, i64, i64, i64 }<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/intrinsics.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_intrinsics.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=EnV8yTEfv-MAXqX9NotNE8TvlupGlrl7-TSKsOgX7Uo&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/intrinsics.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/intrinsics.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/intrinsics.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le -show-mc-encoding | FileCheck %s<br>
<br>
; Function Attrs: nounwind uwtable<br>
define i32 @ld_b(i64 %foo, i64* nocapture %bar, i8* %ctx, i8* %ctx2) #0 {<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/load.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_load.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=UA6WDzzkqV_n17ALEF-e0L4wlbfLI1AWk9dx4Lc79S8&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/load.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/load.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/load.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
define i16 @am1(i16* %a) nounwind {<br>
%1 = load i16, i16* %a<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/loops.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_loops.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=-8Oon8yLAuQwW9jBQmYdCouZEdFis0fAghYfEGRwngg&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/loops.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/loops.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/loops.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
define zeroext i16 @add(i16* nocapture %a, i16 zeroext %n) nounwind readonly {<br>
entry:<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/sanity.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_sanity.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=BdQpQLa13jPh3gI_jGCIo0eIQXIR_ndjQbwyMFdKD-U&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/sanity.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/sanity.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/sanity.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc < %s -march=bpf | FileCheck %s<br>
+; RUN: llc < %s -march=bpf_le | FileCheck %s<br>
<br>
@foo_printf.fmt = private unnamed_addr constant [9 x i8] c"hello \0A\00", align 1<br>
<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/setcc.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_setcc.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=ackv8Q3hRNDX8JVw-1JaI35dOGI6qxqREB6Riemm0DY&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/setcc.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/setcc.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/setcc.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc -march=bpf < %s | FileCheck %s<br>
+; RUN: llc -march=bpf_le < %s | FileCheck %s<br>
<br>
define i16 @sccweqand(i16 %a, i16 %b) nounwind {<br>
%t1 = and i16 %a, %b<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/shifts.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_shifts.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=Mm6jGP46qUGiEG3NeYPucof9W-vztHhoLorIdOHHXtw&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/shifts.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/shifts.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/shifts.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,5 +1,4 @@<br>
-; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc < %s -march=bpf_le -show-mc-encoding | FileCheck %s<br>
<br>
define zeroext i8 @lshr8(i8 zeroext %a, i8 zeroext %cnt) nounwind readnone {<br>
entry:<br>
<br>
Modified: llvm/trunk/test/CodeGen/BPF/sockex2.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_BPF_sockex2.ll-3Frev-3D239071-26r1-3D239070-26r2-3D239071-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=i2DbI0-ec2aTj3hU__xWqdbdttgMQl4TX4iVaHnW8Aw&s=ebQC04vIzDHdWPulSnbX-5BUBN-3KPgx535dFYw_hhQ&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/sockex2.ll?rev=239071&r1=239070&r2=239071&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/BPF/sockex2.ll (original)<br>
+++ llvm/trunk/test/CodeGen/BPF/sockex2.ll Thu Jun 4 14:15:05 2015<br>
@@ -1,5 +1,4 @@<br>
-; RUN: llc < %s -march=bpf -show-mc-encoding | FileCheck %s<br>
-; test little endian only for now<br>
+; RUN: llc < %s -march=bpf_le -show-mc-encoding | FileCheck %s<br>
<br>
%struct.bpf_map_def = type { i32, i32, i32, i32 }<br>
%struct.sk_buff = type opaque<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>