summaryrefslogtreecommitdiffstats
path: root/vm/compiler/codegen/arm/ArchUtility.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@android.com>2011-01-24 10:14:29 -0800
committerBen Cheng <bccheng@android.com>2011-01-24 10:14:29 -0800
commit18c990ebab4475335a5b94ac6077d3482b6875b9 (patch)
tree4d3b43c801f3e106b39b12ea2fa017616e52a7ce /vm/compiler/codegen/arm/ArchUtility.c
parentd0900d13fb7bb1706aff5205af7e2d6517335bee (diff)
downloadandroid_dalvik-18c990ebab4475335a5b94ac6077d3482b6875b9.tar.gz
android_dalvik-18c990ebab4475335a5b94ac6077d3482b6875b9.tar.bz2
android_dalvik-18c990ebab4475335a5b94ac6077d3482b6875b9.zip
Fix push/pop instruction selection and encoding.
1) Thumb 'push' can handle lr and 'pop' can handle pc, so make use of them. 2) Thumb2 push was incorrectly encoded as stmia, which should be stmdb instead. None of the above affect the code that we currently ship. Change-Id: I89ab46b032a3d562355c2cc3bc05fe308ba40957
Diffstat (limited to 'vm/compiler/codegen/arm/ArchUtility.c')
-rw-r--r--vm/compiler/codegen/arm/ArchUtility.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/vm/compiler/codegen/arm/ArchUtility.c b/vm/compiler/codegen/arm/ArchUtility.c
index 95b96c496..7a4d307b5 100644
--- a/vm/compiler/codegen/arm/ArchUtility.c
+++ b/vm/compiler/codegen/arm/ArchUtility.c
@@ -25,18 +25,24 @@ static char *shiftNames[4] = {
"ror"};
/* Decode and print a ARM register name */
-static char * decodeRegList(int vector, char *buf)
+static char * decodeRegList(ArmOpcode opcode, int vector, char *buf)
{
int i;
bool printed = false;
buf[0] = 0;
- for (i = 0; i < 8; i++, vector >>= 1) {
+ for (i = 0; i < 16; i++, vector >>= 1) {
if (vector & 0x1) {
+ int regId = i;
+ if (opcode == kThumbPush && i == 8) {
+ regId = rlr;
+ } else if (opcode == kThumbPop && i == 8) {
+ regId = rpc;
+ }
if (printed) {
- sprintf(buf + strlen(buf), ", r%d", i);
+ sprintf(buf + strlen(buf), ", r%d", regId);
} else {
printed = true;
- sprintf(buf, "r%d", i);
+ sprintf(buf, "r%d", regId);
}
}
}
@@ -209,7 +215,7 @@ static void buildInsnString(char *fmt, ArmLIR *lir, char* buf,
strcpy(tbuf, "see above");
break;
case 'R':
- decodeRegList(operand, tbuf);
+ decodeRegList(lir->opcode, operand, tbuf);
break;
default:
strcpy(tbuf,"DecodeError");