Skip to content

Commit 40afb88

Browse files
committed
CogVM source as per Name: VMMaker.oscog-eem.3624
Improve CogARMv8Compiler>>usesOutOfLineLiteral further given that the assembly tokenizer has made it easy to find .inst occurrences. This eliminates them all in generating all code up to the reader's prompt for input. In particular PushCq uses MoveCq to load the pushed register. Fix disassembly of nop on arm32 (the original code printed unwanted extra tabs after nop).
1 parent c58f120 commit 40afb88

3 files changed

Lines changed: 52 additions & 22 deletions

File tree

processors/ARM/gdb-8.3.1/opcodes/arm-dis.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,11 @@ static const struct opcode32 arm_opcodes[] =
17621762
{
17631763
/* ARM instructions. */
17641764
{ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
1765+
#if COG
1766+
0xe1a00000, 0xffffffff, "nop\t; (mov r0, r0)"},
1767+
#else
17651768
0xe1a00000, 0xffffffff, "nop\t\t\t; (mov r0, r0)"},
1769+
#endif
17661770
{ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
17671771
0xe7f000f0, 0xfff000f0, "udf\t#%e"},
17681772

src/spur64.cog/cogitARMv8.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001
2+
CCodeGenerator VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655
33
(* Compiler-ct.519)
44
from
5-
StackToRegisterMappingCogit VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001
5+
StackToRegisterMappingCogit VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655
66
*/
7-
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001 " __DATE__ ;
7+
static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655 " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

@@ -7424,7 +7424,7 @@ rewriteImm19JumpBeforetarget(AbstractInstruction *self_in_CogARMv8Compiler, sqIn
74247424
static NoDbgRegParms sqInt
74257425
rewriteImm26JumpBeforetarget(AbstractInstruction *self_in_CogARMv8Compiler, sqInt followingAddress, sqInt targetAddress)
74267426
{
7427-
sqInt instrOpcode;
7427+
unsigned int instrOpcode;
74287428
sqInt mcpc;
74297429
sqInt offset;
74307430

@@ -7759,7 +7759,11 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
77597759
return 0;
77607760

77617761
case MoveCqR:
7762-
immediate = ((self_in_CogARMv8Compiler->operands))[0];
7762+
case PushCq:
7763+
if ((((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) >= (-65536)) && ((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) <= (0xFFFF)))) {
7764+
return 0;
7765+
}
7766+
immediate = ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]));
77637767

77647768
/* begin isPossiblyShiftableImm12:ifTrue:ifFalse: */
77657769
if (((immediate >= 0) && (immediate <= (0xFFF)))) {
@@ -7771,7 +7775,19 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
77717775
}
77727776
/* end isPossiblyShiftableImm12:ifTrue:ifFalse: */
77737777
l1:
7774-
constant = ((self_in_CogARMv8Compiler->operands))[0];
7778+
immediate = -(((sqLong) (((self_in_CogARMv8Compiler->operands))[0])));
7779+
7780+
/* begin isPossiblyShiftableImm12:ifTrue:ifFalse: */
7781+
if (((immediate >= 0) && (immediate <= (0xFFF)))) {
7782+
return 0;
7783+
}
7784+
if (((!(immediate & (0xFFF))))
7785+
&& (((((immediate) >> 12) >= 0) && (((immediate) >> 12) <= (0xFFF))))) {
7786+
return 0;
7787+
}
7788+
/* end isPossiblyShiftableImm12:ifTrue:ifFalse: */
7789+
l2:
7790+
constant = ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]));
77757791

77767792
/* begin isImmNImmSImmREncodableBitmask:ifTrue:ifFalse: */
77777793
if (((constant >= -1) && (constant <= 0))) {
@@ -7846,12 +7862,12 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
78467862
case MoveMwrR:
78477863
case MoveMbrR:
78487864
case MoveM16rR:
7849-
return !(isImm12orImm9offset(self_in_CogARMv8Compiler, ((self_in_CogARMv8Compiler->operands))[0]));
7865+
return !(isImm12orImm9offset(self_in_CogARMv8Compiler, ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))));
78507866

78517867
case MoveRMwr:
78527868
case MoveRMbr:
78537869
case MoveRM16r:
7854-
immediate = ((self_in_CogARMv8Compiler->operands))[1];
7870+
immediate = ((sqLong) (((self_in_CogARMv8Compiler->operands))[1]));
78557871

78567872
/* begin isPossiblyShiftableNegatableImm12:ifTrue:ifFalse: */
78577873
if (((immediate >= (-4096)) && (immediate <= (0xFFF)))) {
@@ -7869,9 +7885,6 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
78697885
case MoveM64rRd:
78707886
return !(isUnsigned12BitMultipleOf8(self_in_CogARMv8Compiler, ((self_in_CogARMv8Compiler->operands))[0]));
78717887

7872-
case PushCq:
7873-
return !((((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) >= -256) && ((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) <= 0xFF)));
7874-
78757888
default:
78767889
assert(0);
78777890
}

src/spur64.sista/cogitARMv8.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001
2+
CCodeGenerator VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655
33
(* Compiler-ct.519)
44
from
5-
SistaCogit VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001
5+
SistaCogit VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655
66
*/
7-
static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3623 uuid: c9a77704-a949-4a44-a1e8-1b40ae8c6001 " __DATE__ ;
7+
static char __buildInfo[] = "SistaCogit VMMaker.oscog-eem.3624 uuid: 8576861a-f0a3-4391-ba97-4dbcda24a655 " __DATE__ ;
88
char *__cogitBuildInfo = __buildInfo;
99

1010

@@ -7541,7 +7541,7 @@ rewriteImm19JumpBeforetarget(AbstractInstruction *self_in_CogARMv8Compiler, sqIn
75417541
static NoDbgRegParms sqInt
75427542
rewriteImm26JumpBeforetarget(AbstractInstruction *self_in_CogARMv8Compiler, sqInt followingAddress, sqInt targetAddress)
75437543
{
7544-
sqInt instrOpcode;
7544+
unsigned int instrOpcode;
75457545
sqInt mcpc;
75467546
sqInt offset;
75477547

@@ -7876,7 +7876,11 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
78767876
return 0;
78777877

78787878
case MoveCqR:
7879-
immediate = ((self_in_CogARMv8Compiler->operands))[0];
7879+
case PushCq:
7880+
if ((((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) >= (-65536)) && ((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) <= (0xFFFF)))) {
7881+
return 0;
7882+
}
7883+
immediate = ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]));
78807884

78817885
/* begin isPossiblyShiftableImm12:ifTrue:ifFalse: */
78827886
if (((immediate >= 0) && (immediate <= (0xFFF)))) {
@@ -7888,7 +7892,19 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
78887892
}
78897893
/* end isPossiblyShiftableImm12:ifTrue:ifFalse: */
78907894
l1:
7891-
constant = ((self_in_CogARMv8Compiler->operands))[0];
7895+
immediate = -(((sqLong) (((self_in_CogARMv8Compiler->operands))[0])));
7896+
7897+
/* begin isPossiblyShiftableImm12:ifTrue:ifFalse: */
7898+
if (((immediate >= 0) && (immediate <= (0xFFF)))) {
7899+
return 0;
7900+
}
7901+
if (((!(immediate & (0xFFF))))
7902+
&& (((((immediate) >> 12) >= 0) && (((immediate) >> 12) <= (0xFFF))))) {
7903+
return 0;
7904+
}
7905+
/* end isPossiblyShiftableImm12:ifTrue:ifFalse: */
7906+
l2:
7907+
constant = ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]));
78927908

78937909
/* begin isImmNImmSImmREncodableBitmask:ifTrue:ifFalse: */
78947910
if (((constant >= -1) && (constant <= 0))) {
@@ -7963,12 +7979,12 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
79637979
case MoveMwrR:
79647980
case MoveMbrR:
79657981
case MoveM16rR:
7966-
return !(isImm12orImm9offset(self_in_CogARMv8Compiler, ((self_in_CogARMv8Compiler->operands))[0]));
7982+
return !(isImm12orImm9offset(self_in_CogARMv8Compiler, ((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))));
79677983

79687984
case MoveRMwr:
79697985
case MoveRMbr:
79707986
case MoveRM16r:
7971-
immediate = ((self_in_CogARMv8Compiler->operands))[1];
7987+
immediate = ((sqLong) (((self_in_CogARMv8Compiler->operands))[1]));
79727988

79737989
/* begin isPossiblyShiftableNegatableImm12:ifTrue:ifFalse: */
79747990
if (((immediate >= (-4096)) && (immediate <= (0xFFF)))) {
@@ -7986,9 +8002,6 @@ usesOutOfLineLiteral(AbstractInstruction *self_in_CogARMv8Compiler)
79868002
case MoveM64rRd:
79878003
return !(isUnsigned12BitMultipleOf8(self_in_CogARMv8Compiler, ((self_in_CogARMv8Compiler->operands))[0]));
79888004

7989-
case PushCq:
7990-
return !((((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) >= -256) && ((((sqLong) (((self_in_CogARMv8Compiler->operands))[0]))) <= 0xFF)));
7991-
79928005
default:
79938006
assert(0);
79948007
}

0 commit comments

Comments
 (0)