diff options
| author | Mike Pall <mike> | 2010-08-31 23:55:18 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-08-31 23:55:18 +0200 |
| commit | 00d10711ae59117922fc916ed8e574226474da3d (patch) | |
| tree | 0170034bdc56ce3c1620e4c194401c8566d26e0e /src | |
| parent | fc1866fb6ff84327cea91977f83f2a038d2999ca (diff) | |
| download | luajit-00d10711ae59117922fc916ed8e574226474da3d.tar.gz luajit-00d10711ae59117922fc916ed8e574226474da3d.tar.bz2 luajit-00d10711ae59117922fc916ed8e574226474da3d.zip | |
PPC: Add return instructions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buildvm_ppc.dasc | 89 |
1 files changed, 85 insertions, 4 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 5d3fc198..1a74c51f 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
| @@ -1060,17 +1060,98 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
| 1060 | /* -- Returns ----------------------------------------------------------- */ | 1060 | /* -- Returns ----------------------------------------------------------- */ |
| 1061 | 1061 | ||
| 1062 | case BC_RETM: | 1062 | case BC_RETM: |
| 1063 | | NYI | 1063 | | // RA = results*8, RD = extra_nresults*8 |
| 1064 | | lwz TMP0, SAVE_MULTRES | ||
| 1065 | | add RD, RD, TMP0 // SAVE_MULTRES >= 8, so RD >= 8. | ||
| 1066 | | // Fall through. Assumes BC_RET follows. | ||
| 1064 | break; | 1067 | break; |
| 1065 | 1068 | ||
| 1066 | case BC_RET: | 1069 | case BC_RET: |
| 1067 | | NYI | 1070 | | // RA = results*8, RD = (nresults+1)*8 |
| 1071 | | lwz PC, FRAME_PC(BASE) | ||
| 1072 | | add RA, BASE, RA | ||
| 1073 | | stw RD, SAVE_MULTRES | ||
| 1074 | |1: | ||
| 1075 | | andi. TMP0, PC, FRAME_TYPE | ||
| 1076 | | xori TMP1, PC, FRAME_VARG | ||
| 1077 | | bne ->BC_RETV_Z | ||
| 1078 | | | ||
| 1068 | |->BC_RET_Z: | 1079 | |->BC_RET_Z: |
| 1069 | | NYI | 1080 | | // BASE = base, RA = resultptr, RD = (nresults+1)*8, PC = return |
| 1081 | | lwz INS, -4(PC) | ||
| 1082 | | cmpwi RD, 8 | ||
| 1083 | | subi TMP2, BASE, 8 | ||
| 1084 | | decode_RB8 RB, INS | ||
| 1085 | | beq >3 | ||
| 1086 | | li TMP1, 0 | ||
| 1087 | |2: | ||
| 1088 | | addi TMP3, TMP1, 8 | ||
| 1089 | | evlddx TMP0, RA, TMP1 | ||
| 1090 | | cmpw TMP3, RD | ||
| 1091 | | evstddx TMP0, TMP2, TMP1 | ||
| 1092 | | beq >3 | ||
| 1093 | | addi TMP1, TMP3, 8 | ||
| 1094 | | evlddx TMP0, RA, TMP3 | ||
| 1095 | | cmpw TMP1, RD | ||
| 1096 | | evstddx TMP0, TMP2, TMP3 | ||
| 1097 | | bne <2 | ||
| 1098 | |3: | ||
| 1099 | |5: | ||
| 1100 | | cmplw RB, RD | ||
| 1101 | | decode_RA8 RA, INS | ||
| 1102 | | bgt >6 | ||
| 1103 | | sub BASE, TMP2, RA | ||
| 1104 | | lwz LFUNC:TMP1, FRAME_FUNC(BASE) | ||
| 1105 | | lwz TMP1, LFUNC:TMP1->pc | ||
| 1106 | | lwz KBASE, PC2PROTO(k)(TMP1) | ||
| 1107 | | ins_next | ||
| 1108 | | | ||
| 1109 | |6: // Fill up results with nil. | ||
| 1110 | | subi TMP1, RD, 8 | ||
| 1111 | | addi RD, RD, 8 | ||
| 1112 | | evstddx TISNIL, TMP2, TMP1 | ||
| 1113 | | b <5 | ||
| 1114 | | | ||
| 1115 | |->BC_RETV_Z: // Non-standard return case. | ||
| 1116 | | andi. TMP2, TMP1, FRAME_TYPEP | ||
| 1117 | | bne ->vm_return | ||
| 1118 | | // Return from vararg function: relocate BASE down. | ||
| 1119 | | sub BASE, BASE, TMP1 | ||
| 1120 | | lwz PC, FRAME_PC(BASE) | ||
| 1121 | | b <1 | ||
| 1070 | break; | 1122 | break; |
| 1071 | 1123 | ||
| 1072 | case BC_RET0: case BC_RET1: | 1124 | case BC_RET0: case BC_RET1: |
| 1073 | | NYI | 1125 | | // RA = results*8, RD = (nresults+1)*8 |
| 1126 | | lwz PC, FRAME_PC(BASE) | ||
| 1127 | | add RA, BASE, RA | ||
| 1128 | | stw RD, SAVE_MULTRES | ||
| 1129 | | andi. TMP0, PC, FRAME_TYPE | ||
| 1130 | | xori TMP1, PC, FRAME_VARG | ||
| 1131 | | bne ->BC_RETV_Z | ||
| 1132 | | | ||
| 1133 | | lwz INS, -4(PC) | ||
| 1134 | | subi TMP2, BASE, 8 | ||
| 1135 | | decode_RB8 RB, INS | ||
| 1136 | if (op == BC_RET1) { | ||
| 1137 | | evldd TMP0, 0(RA) | ||
| 1138 | | evstdd TMP0, 0(TMP2) | ||
| 1139 | } | ||
| 1140 | |5: | ||
| 1141 | | cmplw RB, RD | ||
| 1142 | | decode_RA8 RA, INS | ||
| 1143 | | bgt >6 | ||
| 1144 | | sub BASE, TMP2, RA | ||
| 1145 | | lwz LFUNC:TMP1, FRAME_FUNC(BASE) | ||
| 1146 | | lwz TMP1, LFUNC:TMP1->pc | ||
| 1147 | | lwz KBASE, PC2PROTO(k)(TMP1) | ||
| 1148 | | ins_next | ||
| 1149 | | | ||
| 1150 | |6: // Fill up results with nil. | ||
| 1151 | | subi TMP1, RD, 8 | ||
| 1152 | | addi RD, RD, 8 | ||
| 1153 | | evstddx TISNIL, TMP2, TMP1 | ||
| 1154 | | b <5 | ||
| 1074 | break; | 1155 | break; |
| 1075 | 1156 | ||
| 1076 | /* -- Loops and branches ------------------------------------------------ */ | 1157 | /* -- Loops and branches ------------------------------------------------ */ |
