[llvm-uc] 答复: [llvm-uc] [PATCH 1/4] Add UniCore calling convention

  • From: "Guan Xuetao" <gxt@xxxxxxxxxxxxxxx>
  • To: <llvm-uc@xxxxxxxxxxxxx>
  • Date: Mon, 3 Dec 2012 10:35:55 +0800


-----邮件原件-----
发件人: llvm-uc-bounce@xxxxxxxxxxxxx [mailto:llvm-uc-bounce@xxxxxxxxxxxxx]
代表 Chen Wei-Ren
发送时间: Friday, November 30, 2012 15:40
收件人: llvm-uc@xxxxxxxxxxxxx
主题: [llvm-uc] [PATCH 1/4] Add UniCore calling convention

  Add UniCore calling convention according to UniCore32-ABI-1.1.0-UC4.pdf
[1].

[1] http://mprc.pku.edu.cn/~guanxuetao/linux/manual/UniCore32-ABI-1.1.0-UC4.
pdf

Signed-off-by: Chen Wei-Ren <chenwj@xxxxxxxxxxxxxxxxx>
---
 lib/Target/UniCore/UniCoreCallingConv.td |   42
++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)  create mode 100644
lib/Target/UniCore/UniCoreCallingConv.td

diff --git a/lib/Target/UniCore/UniCoreCallingConv.td
b/lib/Target/UniCore/UniCoreCallingConv.td
new file mode 100644
index 0000000..659fc59
--- /dev/null
+++ b/lib/Target/UniCore/UniCoreCallingConv.td
@@ -0,0 +1,42 @@
+//==- UniCoreCallingConv.td - Calling Conv. for UniCore -*- tablegen 
+-*---==// //
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open 
+Source // License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------
+----===// // This describes the calling conventions for UniCore 
+architecture.
+//===------------------------------------------------------------------
+----===//
+
+//===------------------------------------------------------------------
+----===// // UniCore Return Value Calling Convention 
+//===------------------------------------------------------------------
+----===//
+def RetCC_UniCore : CallingConv<[
+  // i32 are returned in registers A1, A2
+  CCIfType<[i32], CCAssignToReg<[A1, A1]>> ]>;

Typo, it should be A1, A2

+
+//===------------------------------------------------------------------
+----===// // UniCore Argument Calling Conventions 
+//===------------------------------------------------------------------
+----===//
+def CC_UniCore : CallingConv<[
+  // Promote i8 arguments to i32.
+  CCIfType<[i8], CCPromoteToType<i32>>,
+  // Promote i8 arguments to i32.
+  CCIfType<[i16], CCPromoteToType<i32>>,
+
+  // The first 4 integer arguments of non-varargs functions are passed 
+ in  // integer registers.
+  CCIfNotVarArg<CCIfType<[i32], CCAssignToReg<[A1, A2, A3, A4]>>>,
+
+  // Integer values get stored in stack slots that are 4 bytes in
+  // size and 4-byte aligned.
+  CCIfType<[i32], CCAssignToStack<4, 4>> ]>;
+
+//===------------------------------------------------------------------
+----===//
+// Callee-saved register lists.
+//===------------------------------------------------------------------
+----===//
+
+def CSR: CalleeSavedRegs<(add R17, R18, R19, R20, R21, R22, R23, R24, 
+SB, SL, FP, IP, SP, LR)>;

Please see my last post

--
1.7.3.4



Other related posts:

  • » [llvm-uc] 答复: [llvm-uc] [PATCH 1/4] Add UniCore calling convention - Guan Xuetao