[PATCH] D51363: Add support for getRegisterByName.
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 06:37:27 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341658: Add support for getRegisterByName. (authored by sidneym, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51363?vs=163842&id=164407#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51363
Files:
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
llvm/trunk/test/CodeGen/Hexagon/namedreg.ll
Index: llvm/trunk/test/CodeGen/Hexagon/namedreg.ll
===================================================================
--- llvm/trunk/test/CodeGen/Hexagon/namedreg.ll
+++ llvm/trunk/test/CodeGen/Hexagon/namedreg.ll
@@ -0,0 +1,13 @@
+; RUN: llc -mattr=+reserved-r19 -march=hexagon < %s | FileCheck %s
+define dso_local i32 @r19f() #0 {
+entry:
+ %0 = call i32 @llvm.read_register.i32(metadata !0)
+ ret i32 %0
+}
+
+declare i32 @llvm.read_register.i32(metadata) #1
+
+!llvm.named.register.r19 = !{!0}
+
+!0 = !{!"r19"}
+; CHECK: r0 = r19
Index: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
===================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
@@ -223,6 +223,9 @@
bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
+ unsigned getRegisterByName(const char* RegName, EVT VT,
+ SelectionDAG &DAG) const override;
+
/// If a physical register, this returns the register that receives the
/// exception address on entry to an EH pad.
unsigned
Index: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -22,6 +22,7 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -240,6 +241,18 @@
return true;
}
+unsigned HexagonTargetLowering::getRegisterByName(const char* RegName, EVT VT,
+ SelectionDAG &DAG) const {
+ // Just support r19, the linux kernel uses it.
+ unsigned Reg = StringSwitch<unsigned>(RegName)
+ .Case("r19", Hexagon::R19)
+ .Default(0);
+ if (Reg)
+ return Reg;
+
+ report_fatal_error("Invalid register name global variable");
+}
+
/// LowerCallResult - Lower the result values of an ISD::CALL into the
/// appropriate copies out of appropriate physical registers. This assumes that
/// Chain/Glue are the input chain/glue to use, and that TheCall is the call
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51363.164407.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/cbdde1a9/attachment.bin>
More information about the llvm-commits
mailing list