Skip to content

Commit

Permalink
[AVR] Cherry-pick (D68524) Rewrite the function calling convention.
Browse files Browse the repository at this point in the history
This fixes avr-rust/rust-legacy-fork#92.

At the time of cherry-picking, this patch has not yet been upstreamed.
  • Loading branch information
dylanmckay committed Nov 27, 2019
1 parent 4350776 commit 38a608b
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 213 deletions.
18 changes: 1 addition & 17 deletions llvm/lib/Target/AVR/AVRCallingConv.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@
//
//===----------------------------------------------------------------------===//
// This describes the calling conventions for AVR architecture.
// Normal functions use a special calling convention, solved in code.
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// AVR Return Value Calling Convention
//===----------------------------------------------------------------------===//

def RetCC_AVR : CallingConv
<[
// i8 is returned in R24.
CCIfType<[i8], CCAssignToReg<[R24]>>,

// i16 are returned in R25:R24, R23:R22, R21:R20 and R19:R18.
CCIfType<[i16], CCAssignToReg<[R25R24, R23R22, R21R20, R19R18]>>
]>;

// Special return value calling convention for runtime functions.
def RetCC_AVR_BUILTIN : CallingConv
<[
Expand All @@ -41,14 +33,6 @@ def ArgCC_AVR_Vararg : CallingConv
CCAssignToStack<2, 1>
]>;

// Special argument calling convention for
// division runtime functions.
def ArgCC_AVR_BUILTIN_DIV : CallingConv
<[
CCIfType<[i8], CCAssignToReg<[R24,R22]>>,
CCIfType<[i16], CCAssignToReg<[R25R24, R23R22]>>
]>;

//===----------------------------------------------------------------------===//
// Callee-saved register lists.
//===----------------------------------------------------------------------===//
Expand Down
Loading

0 comments on commit 38a608b

Please sign in to comment.