[llvm] r202860 - [XCore] Fix call of absolute address.
Richard Osborne
richard at xmos.com
Tue Mar 4 08:50:31 PST 2014
Author: friedgold
Date: Tue Mar 4 10:50:30 2014
New Revision: 202860
URL: http://llvm.org/viewvc/llvm-project?rev=202860&view=rev
Log:
[XCore] Fix call of absolute address.
Previously for:
tail call void inttoptr (i64 65536 to void ()*)() nounwind
We would emit:
bl 65536
The immediate operand of the bl instruction is a relative offset so it is
wrong to use the absolute address here.
Added:
llvm/trunk/test/CodeGen/XCore/call.ll
Modified:
llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td
Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=202860&r1=202859&r2=202860&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original)
+++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Tue Mar 4 10:50:30 2014
@@ -718,10 +718,10 @@ def BLACP_u10 : _FU10<0b111000, (outs),
def BLACP_lu10 : _FLU10<0b111000, (outs), (ins i32imm:$a), "bla cp[$a]", []>;
def BLRF_u10 : _FU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
- [(XCoreBranchLink immU10:$a)]>;
+ []>;
def BLRF_lu10 : _FLU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
- [(XCoreBranchLink immU20:$a)]>;
+ [(XCoreBranchLink tglobaladdr:$a)]>;
def BLRB_u10 : _FU10<0b110101, (outs), (ins pcrel_imm_neg:$a), "bl $a", []>;
@@ -1113,7 +1113,6 @@ def WAITEU_0R : _F0R<0b0000001100, (outs
// Non-Instruction Patterns
//===----------------------------------------------------------------------===//
-def : Pat<(XCoreBranchLink tglobaladdr:$addr), (BLRF_lu10 tglobaladdr:$addr)>;
def : Pat<(XCoreBranchLink texternalsym:$addr), (BLRF_lu10 texternalsym:$addr)>;
/// sext_inreg
Added: llvm/trunk/test/CodeGen/XCore/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/call.ll?rev=202860&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/call.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/call.ll Tue Mar 4 10:50:30 2014
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=xcore | FileCheck %s
+
+; CHECK-LABEL: bl_imm:
+; CHECK: ldw [[R0:r[0-9]+]], cp
+; CHECK: bla [[R0]]
+define void @bl_imm() nounwind {
+entry:
+ tail call void inttoptr (i64 65536 to void ()*)() nounwind
+ ret void
+}
More information about the llvm-commits
mailing list