Browse Source

fix many things kk

eugeniucarvalho 5 years ago
parent
commit
2e808da44d
34 changed files with 1484 additions and 3327 deletions
  1. BIN
      build/classes/API/Api.class
  2. BIN
      build/classes/compiler/IVANNOSYS.class
  3. 25 187
      build/classes/samples/program_mult.go
  4. BIN
      build/classes/tools/mips/MipsProcessor.class
  5. 27 10
      build/classes/tools/mips/memory/md.memory
  6. 212 76
      build/classes/tools/mips/memory/mi.memory
  7. 3 3
      src/API/Api.java
  8. 7 0
      src/API/Middleware.java
  9. 4 2
      src/API/Variables.java
  10. 65 38
      src/IntermediaryCode/IRGenerator.java
  11. 2 2
      src/IntermediaryCode/IRTemplate.java
  12. 269 22
      src/compiler/IVANNOSYS.java
  13. 26 92
      src/compiler/Simulator.java
  14. 13 5
      src/frontend/Ivannosys/IvannosysListener.java
  15. 15 4
      src/middlewares/BasicBlockMiddleware.java
  16. 4 2
      src/middlewares/BlockBaseGroup.java
  17. 19 2
      src/middlewares/BlockBaseOcorrences.java
  18. 55 1
      src/middlewares/CodeOtimizadorMiddleware.java
  19. 2 0
      src/middlewares/Interval.java
  20. 115 50
      src/middlewares/LoadStoreMiddleware.java
  21. 0 377
      src/samples/program_jun_bit_count_1.go
  22. 0 234
      src/samples/program_jun_bytes.go
  23. 5 144
      src/samples/program_jun_laplaciano.go
  24. 65 398
      src/samples/program_jun_lu.go
  25. 98 404
      src/samples/program_jun_quick.go
  26. 25 187
      src/samples/program_mult.go
  27. 5 0
      src/targets/mips/Descriprion.java
  28. 46 23
      src/targets/mips/MipsRegisterAllocMiddleware.java
  29. 3 0
      src/targets/mips/Registers.java
  30. 81 53
      src/targets/mips/Translate.java
  31. 27 919
      src/targets/mips/TranslateJun.java
  32. 27 6
      src/tools/mips/MipsProcessor.java
  33. 27 10
      src/tools/mips/memory/md.memory
  34. 212 76
      src/tools/mips/memory/mi.memory

BIN
build/classes/API/Api.class


BIN
build/classes/compiler/IVANNOSYS.class


+ 25 - 187
build/classes/samples/program_mult.go

@@ -45,194 +45,32 @@ func main() {
     preenche()
     multiplica()
 }
-
-
 /**
-			alloc (int32), 4 _G13		  T< alloc >		
-			alloc (int32), 4 _G18		  T< alloc >		
-			alloc (int32), 4 _G54		  T< alloc >		
-		<main>:
- 0:	 0:		call <preenche>		  T< call >		
- 1:	 1:		call <multiplica>		  T< call >		
-		<main-end>:
-		<preenche>:
-			alloc (int32), 1 _VJ5		  T< alloc >		
-			alloc (int32), 1 _VI3		  T< alloc >		
-			alloc (int32), 1 _VK1		  T< alloc >		
- 2:	 0:		store (int32) _VK1, 1		  T< store >		
- 3:	 1:		store (int32) _VI3, 0		  T< store >		
- 4:	 2:		goto <preenche+_i3>		  T< jump >		
-		<preenche+_i0>:
- 5:	 3:		store (int32) _VJ5, 0		  T< store >		
- 6:	 4:		goto <preenche+_i7>		  T< jump >		
-		<preenche+_i4>:
- 7:	 5:		load (int32) _VI3, _S8 --Copy value of index		  T< load >		
- 8:	 6:		_T9 := _S8 << 1		  T< assign >		
- 9:	 7:		load (int32) _VJ5, _S10 --Copy value of index		  T< load >		
-10:	 8:		_T9 := _T9 + _S10 --colls shift		  T< assign >		
-11:	 9:		_T12 := _T9 << 2		  T< assign >		
-12:	10:		load (int32) _VK1, _S7 --Load param (_S7)		  T< load >		
-13:	11:		store (int32) _G13[_T12], _S7		  T< store >		
-14:	12:		_S8 := _S8 --Copy value of index		  T< copy >		
-15:	13:		store (int32) _VI3, _S8		  T< store >		
-16:	14:		_T15 := _S8 << 1		  T< assign >		
-17:	15:		_S10 := _S10 --Copy value of index		  T< copy >		
-18:	16:		store (int32) _VJ5, _S10		  T< store >		
-19:	17:		_T15 := _T15 + _S10 --colls shift		  T< assign >		
-20:	18:		_T17 := _T15 << 2		  T< assign >		
-21:	19:		store (int32) _G18[_T17], _S7		  T< store >		
-22:	20:		_S7 := _S7 + 1		  T< assign >		
-23:	21:		store (int32) _VK1, _S7		  T< store >		
-24:	22:		_S10 := _S10 + 1		  T< assign >		
-25:	23:		store (int32) _VJ5, _S10		  T< store >		
-		<preenche+_i7>:
-26:	24:		load (int32) _VJ5, _S20 --Load param (_S20)		  T< load >		
-27:	25:		if _S20 < 2 goto <preenche+_i4>		  T< branch >		
-28:	26:		load (int32) _VI3, _S21 --Load param (_S21)		  T< load >		
-29:	27:		_S21 := _S21 + 1		  T< assign >		
-30:	28:		store (int32) _VI3, _S21		  T< store >		
-		<preenche+_i3>:
-31:	29:		load (int32) _VI3, _S22 --Load param (_S22)		  T< load >		
-32:	30:		if _S22 < 2 goto <preenche+_i0>		  T< branch >		
-		<preenche-end>:
-		<multiplica>:
-			alloc (int32), 1 _VK29		  T< alloc >		
-			alloc (int32), 1 _VJ27		  T< alloc >		
-			alloc (int32), 1 _VI25		  T< alloc >		
-			alloc (int32), 1 _VAUX23		  T< alloc >		
-33:	 0:		store (int32) _VAUX23, 0		  T< store >		
-34:	 1:		store (int32) _VI25, 0		  T< store >		
-35:	 2:		goto <multiplica+_i11>		  T< jump >		
-		<multiplica+_i8>:
-36:	 3:		store (int32) _VJ27, 0		  T< store >		
-37:	 4:		goto <multiplica+_i15>		  T< jump >		
-		<multiplica+_i12>:
-38:	 5:		store (int32) _VK29, 0		  T< store >		
-39:	 6:		goto <multiplica+_i19>		  T< jump >		
-		<multiplica+_i16>:
-40:	 7:		load (int32) _VI25, _S32 --Copy value of index		  T< load >		
-41:	 8:		_T33 := _S32 << 1		  T< assign >		
-42:	 9:		load (int32) _VK29, _S34 --Copy value of index		  T< load >		
-43:	10:		_T33 := _T33 + _S34 --colls shift		  T< assign >		
-44:	11:		_T36 := _T33 << 2		  T< assign >		
-45:	12:		load (int32) _G13[_T36], _T38		  T< load >		
-
-46:	13:		_S34 := _S34 --Copy value of index		  T< copy >		
-47:	14:		store (int32) _VK29, _S34		  T< store >		
+leadersList:[
+0,2
+ 2,2
+ 4,3
+ 7,12
+ 19,6
+ 25,13
+ 38, 3
+ 41,3
+ 44,2
+ 46,3
+ 49,4
+ 53,29
+ 82,3
+ 85,2
+ 87,4
+ 91,7
+ 98,4
+ 102,15
+ 117,41
+ 158,2
+ 160,3
+ 163,2
+ 165,3
+ 168,3
 
-48:	15:		_T39 := _S34 << 1		  T< assign >		
-49:	16:		load (int32) _VJ27, _S40 --Copy value of index		  T< load >		
-50:	17:		_T39 := _T39 + _S40 --colls shift		  T< assign >		
-51:	18:		_T42 := _T39 << 2		  T< assign >		
-52:	19:		load (int32) _G18[_T42], _T44		  T< load >		
-53:	20:		_T45 := _T38 * _T44		  T< assign >		
-54:	21:		load (int32) _VAUX23, _S31 --Load param (_S31)		  T< load >		
-55:	22:		_T46 := _S31 + _T45		  T< assign >		
-56:	23:		store (int32) _VAUX23, _T46		  T< store >		
-57:	24:		_S34 := _S34 + 1		  T< assign >		
-58:	25:		store (int32) _VK29, _S34		  T< store >		
-		<multiplica+_i19>:
-59:	26:		load (int32) _VK29, _S47 --Load param (_S47)		  T< load >		
-60:	27:		if _S47 < 2 goto <multiplica+_i16>		  T< branch >		
-61:	28:		load (int32) _VI25, _S49 --Copy value of index		  T< load >		
-62:	29:		_T50 := _S49 << 1		  T< assign >		
-63:	30:		load (int32) _VJ27, _S51 --Copy value of index		  T< load >		
-64:	31:		_T50 := _T50 + _S51 --colls shift		  T< assign >		
-65:	32:		_T53 := _T50 << 2		  T< assign >		
-66:	33:		load (int32) _VAUX23, _S48 --Load param (_S48)		  T< load >		
-67:	34:		store (int32) _G54[_T53], _S48		  T< store >		
-68:	35:		store (int32) _VAUX23, 0		  T< store >		
-69:	36:		_S51 := _S51 + 1		  T< assign >		
-70:	37:		store (int32) _VJ27, _S51		  T< store >		
-		<multiplica+_i15>:
-71:	38:		load (int32) _VJ27, _S56 --Load param (_S56)		  T< load >		
-72:	39:		if _S56 < 2 goto <multiplica+_i12>		  T< branch >		
-73:	40:		load (int32) _VI25, _S57 --Load param (_S57)		  T< load >		
-74:	41:		_S57 := _S57 + 1		  T< assign >		
-75:	42:		store (int32) _VI25, _S57		  T< store >		
-		<multiplica+_i11>:
-76:	43:		load (int32) _VI25, _S58 --Load param (_S58)		  T< load >		
-77:	44:		if _S58 < 2 goto <multiplica+_i8>		  T< branch >		
-		<multiplica-end>:
 
- ec:  0666763248	addiu sp,sp,-16		 -- prolog| push stack frame
- f0:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- f4:  2948595712	sw zero,0(fp)		.0 -- store content of zero in _VAUX23
- f8:  2948595716	sw zero,4(fp)		.1 -- store content of zero in _VI25
- fc:  0134217855	j 1fc <multiplica+0x110>		.2 -- jump to multiplica+_i11
-100:  0000000000	sll zero,zero,0		.2 -- Nop
-104:  2948595720	sw zero,8(fp)		.3 -- store content of zero in _VJ27
-108:  0134217844	j 1d0 <multiplica+0xe4>		.4 -- jump to multiplica+_i15
-10c:  0000000000	sll zero,zero,0		.4 -- Nop
-110:  2948595724	sw zero,12(fp)		.5 -- store content of zero in _VK29
-114:  0134217824	j 180 <multiplica+0x94>		.6 -- jump to multiplica+_i19
-118:  0000000000	sll zero,zero,0		.6 -- Nop
-11c:  2413101060	lw s5,4(fp)		.7 -- load content from _VI25 in s5
-120:  0000000000	sll zero,zero,0		.7 -- Nop
-124:  0001400896	sll t4,s5,1		.8 -- _T33 = _S32 << 1
-128:  2413232140	lw s7,12(fp)		.9 -- load content from _VK29 in s7
-12c:  0000000000	sll zero,zero,0		.9 -- Nop
-130:  0026697761	addu t4,t4,s7		.10 -- _T33 = _T33 + _S34
-134:  0000813184	sll t5,t4,2		.11 -- _T36 = _T33 << 2
-138:  2377580544	lw s7,0(t5)		.12 -- load content from _G13[_T36] in t6
-13c:  2950103052	sw s7,12(fp)		.14 -- store content of s7 in _VK29
-140:  0001538112	sll t7,s7,1		.15 -- _T39 = _S34 << 1
-144:  2412904456	lw s2,8(fp)		.16 -- load content from _VJ27 in s2
-148:  0000000000	sll zero,zero,0		.16 -- Nop
-14c:  0032667681	addu t7,t7,s2		.17 -- _T39 = _T39 + _S40
-150:  0001032320	sll t8,t7,2		.18 -- _T42 = _T39 << 2
-154:  2399666192	lw t0,16(t8)		.19 -- load content from _G18[_T42] in t0
-158:  0000000000	sll zero,zero,0		.19 -- Nop
-15c:  0029902872	mult t6,t0		.20 -- _T45 = _T38 * _T44
-160:  0000018450	mflo t1		.20
-164:  2413101056	lw s5,0(fp)		.21 -- load content from _VAUX23 in s5
-168:  0000000000	sll zero,zero,0		.21 -- Nop
-16c:  0044650529	addu t2,s5,t1		.22 -- _T46 = _S31 + _T45
-170:  2949251072	sw t2,0(fp)		.23 -- store content of t2 in _VAUX23
-174:  0604700673	addiu t3,zero,1		.24 -- load param (p2)
-178:  0653721601	addiu s7,s7,1		.24 -- _S34 = _S34 + 1
-17c:  2950103052	sw s7,12(fp)		.25 -- store content of s7 in _VK29
-180:  2412838924	lw s1,12(fp)		.26 -- load content from _VK29 in s1
-184:  0000000000	sll zero,zero,0		.26 -- Nop
-188:  0604766210	addiu t4,zero,2		.27 -- load param (p2)
-18c:  0036442147	subu v0,s1,t4		.27
-190:  0071368674	bltz v0,11c <multiplica+0x30>		.27 -- branch if register < 0
-194:  0000000000	sll zero,zero,0		.27 -- Nop
-198:  2412969988	lw s3,4(fp)		.28 -- load content from _VI25 in s3
-19c:  0000000000	sll zero,zero,0		.28 -- Nop
-1a0:  0001271872	sll t5,s3,1		.29 -- _T50 = _S49 << 1
-1a4:  2413035528	lw s4,8(fp)		.30 -- load content from _VJ27 in s4
-1a8:  0000000000	sll zero,zero,0		.30 -- Nop
-1ac:  0028600353	addu t5,t5,s4		.31 -- _T50 = _T50 + _S51
-1b0:  0000882816	sll t7,t5,2		.32 -- _T53 = _T50 << 2
-1b4:  2413166592	lw s6,0(fp)		.33 -- load content from _VAUX23 in s6
-1b8:  0000000000	sll zero,zero,0		.33 -- Nop
-1bc:  2918580256	sw s6,32(t7)		.34 -- store content of s6 in _G54[_T53]
-1c0:  2948595712	sw zero,0(fp)		.35 -- store content of zero in _VAUX23
-1c4:  0604897281	addiu t6,zero,1		.36 -- load param (p2)
-1c8:  0647233537	addiu s4,s4,1		.36 -- _S51 = _S51 + 1
-1cc:  2949906440	sw s4,8(fp)		.37 -- store content of s4 in _VJ27
-1d0:  2412904456	lw s2,8(fp)		.38 -- load content from _VJ27 in s2
-1d4:  0000000000	sll zero,zero,0		.38 -- Nop
-1d8:  0604504066	addiu t0,zero,2		.39 -- load param (p2)
-1dc:  0038277155	subu v0,s2,t0		.39
-1e0:  0071368651	bltz v0,110 <multiplica+0x24>		.39 -- branch if register < 0
-1e4:  0000000000	sll zero,zero,0		.39 -- Nop
-1e8:  2413166596	lw s6,4(fp)		.40 -- load content from _VI25 in s6
-1ec:  0000000000	sll zero,zero,0		.40 -- Nop
-1f0:  0604569601	addiu t1,zero,1		.41 -- load param (p2)
-1f4:  0651558913	addiu s6,s6,1		.41 -- _S57 = _S57 + 1
-1f8:  2950037508	sw s6,4(fp)		.42 -- store content of s6 in _VI25
-1fc:  2413232132	lw s7,4(fp)		.43 -- load content from _VI25 in s7
-200:  0000000000	sll zero,zero,0		.43 -- Nop
-204:  0604635138	addiu t2,zero,2		.44 -- load param (p2)
-208:  0048893987	subu v0,s7,t2		.44
-20c:  0071368637	bltz v0,104 <multiplica+0x18>		.44 -- branch if register < 0
-210:  0000000000	sll zero,zero,0		.44 -- Nop
-214:  0666697744	addiu sp,sp,16		 -- epilog| pop stack frame
-218:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-21c:  0065011720	jr ra		 -- epilog| return
 */
-
-
-

BIN
build/classes/tools/mips/MipsProcessor.class


+ 27 - 10
build/classes/tools/mips/memory/md.memory

@@ -23,15 +23,32 @@ DATA_RADIX = BIN;
 
 CONTENT
 BEGIN
-[4..124]:	00000000000000000000000000000000;
-00128:	00000000000000001001110110101111;	% dec 40367 %
-[132..16348]:	00000000000000000000000000000000;
-16352:	00000000000000000100100100111110;	% dec 18750 %
-16356:	00000000000000000000000000000001;	% dec 1 %
-16360:	00000000000000001001110110101111;	% dec 40367 %
-16364:	00000000000000000000000000000000;	% dec 0 %
-16368:	00000000000000101001101111111000;	% dec 171000 %
-16372:	00000000000000000101101011010010;	% dec 23250 %
-16376:	00000000000000000000000000001100;	% dec 12 %
+00000:	00000000000000000000000000000000;	% dec 0 %
+00004:	00000000000000000000000000000001;	% dec 1 %
+00008:	00000000000000000000000000000010;	% dec 2 %
+00012:	00000000000000000000000000000011;	% dec 3 %
+00016:	00000000000000000000000000000100;	% dec 4 %
+00020:	00000000000000000000000000000101;	% dec 5 %
+00024:	00000000000000000000000000000110;	% dec 6 %
+00028:	00000000000000000000000000000111;	% dec 7 %
+[32..16284]:	00000000000000000000000000000000;
+16288:	00000000000000000000000000000011;	% dec 3 %
+16292:	00000000000000000000000000000100;	% dec 4 %
+16296:	00000000000000000000000000000011;	% dec 3 %
+16300:	00000000000000000000000000000010;	% dec 2 %
+16304:	00000000000000000000000000000100;	% dec 4 %
+16308:	00000000000000000000000000000100;	% dec 4 %
+16312:	00000000000000000000000000000011;	% dec 3 %
+16316:	00000000000000000000000000000011;	% dec 3 %
+16320:	00000000000000000000000000000100;	% dec 4 %
+16324:	11111111111111111111111111111111;	% dec -1 %
+16328:	00000000000000000000000000000011;	% dec 3 %
+16332:	00000000000000000000000000000100;	% dec 4 %
+[16336..16356]:	00000000000000000000000000000000;
+16360:	00000000000000000000000000000011;	% dec 3 %
+16364:	11111111111111111111111111110100;	% dec -12 %
+16368:	00000000000000000000000001101100;	% dec 108 %
+16372:	00000000000000000000000000000111;	% dec 7 %
+16376:	00000000000000000000000000000111;	% dec 7 %
 16380:	00000000000000000000000000000000;	% dec 0 %
 END;

+ 212 - 76
build/classes/tools/mips/memory/mi.memory

@@ -23,85 +23,221 @@ DATA_RADIX = BIN;
 
 CONTENT
 BEGIN
-000:	00100100000001000100100100111110;	% dec 604260670 %
-004:	00100100000001010000000000000001;	% dec 604307457 %
-008:	00001100000000000000000000000101;	% dec 201326597 %
-012:	00000000000000000000000000000000;	% dec 0 %
-016:	11111111111111111111111111111111;	% dec -1 %
-020:	00100111101111011111111111100000;	% dec 666763232 %
-024:	00000000000111011111000000100001;	% dec 1962017 %
-028:	10101111110001000000000000000000;	% dec -1346109440 %
-032:	10101111110001010000000000000100;	% dec -1346043900 %
-036:	10101111110000000000000000001000;	% dec -1346371576 %
-040:	10101111110000000000000000001100;	% dec -1346371572 %
-044:	00111100000010100000000000000001;	% dec 1007288321 %
-048:	00110101010010101011011101110100;	% dec 894089076 %
-052:	10101111110010100000000000010000;	% dec -1345716208 %
-056:	10001111110101010000000000000000;	% dec -1881866240 %
-060:	00000000000000000000000000000000;	% dec 0 %
-064:	10101111110101010000000000010100;	% dec -1344995308 %
-068:	00001000000000000000000000111100;	% dec 134217788 %
-072:	00000000000000000000000000000000;	% dec 0 %
-076:	10101111110000000000000000011000;	% dec -1346371560 %
-080:	10001111110100100000000000010000;	% dec -1882062832 %
+000:	00100111101111011111111111110100;	% dec 666763252 %
+004:	00000000000111011111000000100001;	% dec 1962017 %
+008:	00100100000010010000000000000111;	% dec 604569607 %
+012:	10101111110010010000000000000000;	% dec -1345781760 %
+016:	10101111110000000000000000000100;	% dec -1346371580 %
+020:	10001111110100100000000000000000;	% dec -1882062848 %
+024:	00000000000000000000000000000000;	% dec 0 %
+028:	10101111110100100000000000001000;	% dec -1345191928 %
+032:	00001000000000000000000000010100;	% dec 134217748 %
+036:	00000000000000000000000000000000;	% dec 0 %
+040:	10001111110101010000000000000100;	% dec -1881866236 %
+044:	00000000000000000000000000000000;	% dec 0 %
+048:	00000000000101010101100010000000;	% dec 1398912 %
+052:	10001111110101110000000000001000;	% dec -1881735160 %
+056:	00000000000000000000000000000000;	% dec 0 %
+060:	10101101011101110000000000000000;	% dec -1384710144 %
+064:	00100110101101010000000000000001;	% dec 649396225 %
+068:	10101111110101010000000000000100;	% dec -1344995324 %
+072:	00100110111101111111111111111111;	% dec 653787135 %
+076:	10101111110101110000000000001000;	% dec -1344864248 %
+080:	10001111110100100000000000001000;	% dec -1882062840 %
 084:	00000000000000000000000000000000;	% dec 0 %
-088:	10101111110100100000000000011100;	% dec -1345191908 %
-092:	10001111110101000000000000011100;	% dec -1881931748 %
+088:	00000010010000000001000000100011;	% dec 37752867 %
+092:	00011100010000001111111111110010;	% dec 474021874 %
 096:	00000000000000000000000000000000;	% dec 0 %
-100:	00000010100000000001000000100011;	% dec 41947171 %
-104:	00011000010000000000000000011001;	% dec 406847513 %
-108:	00000000000000000000000000000000;	% dec 0 %
-112:	00001000000000000000000000101101;	% dec 134217773 %
-116:	00000000000000000000000000000000;	% dec 0 %
-120:	10001111110101010000000000011000;	% dec -1881866216 %
-124:	00000000000000000000000000000000;	% dec 0 %
-128:	00100110101101010000000000000001;	% dec 649396225 %
-132:	10101111110101010000000000011000;	% dec -1344995304 %
-136:	10001111110101110000000000011100;	% dec -1881735140 %
-140:	00000000000000000000000000000000;	% dec 0 %
-144:	00100110111011111111111111111111;	% dec 653262847 %
-148:	00000010111011111100000000100100;	% dec 49266724 %
-152:	10101111110110000000000000011100;	% dec -1344798692 %
-156:	10001111110101110000000000011100;	% dec -1881735140 %
+100:	00100100000001000000000000000000;	% dec 604241920 %
+104:	00100100000001010000000000000111;	% dec 604307463 %
+108:	00001100000000000000000000011110;	% dec 201326622 %
+112:	00000000000000000000000000000000;	% dec 0 %
+116:	11111111111111111111111111111111;	% dec -1 %
+120:	00100111101111011111111111001000;	% dec 666763208 %
+124:	10101111101111100000000000110000;	% dec -1346502608 %
+128:	10101111101111110000000000110100;	% dec -1346437068 %
+132:	00000000000111011111000000100001;	% dec 1962017 %
+136:	10101111110001000000000000000000;	% dec -1346109440 %
+140:	10101111110001010000000000000100;	% dec -1346043900 %
+144:	10001111110100110000000000001000;	% dec -1881997304 %
+148:	00000000000000000000000000000000;	% dec 0 %
+152:	00000000000100110100000010000000;	% dec 1261696 %
+156:	10001111110101000000000000000000;	% dec -1881931776 %
 160:	00000000000000000000000000000000;	% dec 0 %
-164:	00010110111000000000000000000011;	% dec 383778819 %
-168:	00000000000000000000000000000000;	% dec 0 %
-172:	00001000000000000000000000101111;	% dec 134217775 %
-176:	00000000000000000000000000000000;	% dec 0 %
-180:	00001000000000000000000000011110;	% dec 134217758 %
-184:	00000000000000000000000000000000;	% dec 0 %
-188:	10001111110100100000000000001000;	% dec -1882062840 %
-192:	10001111110101000000000000011000;	% dec -1881931752 %
-196:	00000000000000000000000000000000;	% dec 0 %
-200:	00000010010101001001000000100001;	% dec 39096353 %
-204:	10101111110100100000000000001000;	% dec -1345191928 %
-208:	10001111110100000000000000010000;	% dec -1882193904 %
+164:	00000001000111100100000000100001;	% dec 18759713 %
+168:	10101101000101000000000000001100;	% dec -1391198196 %
+172:	00100110011100110000000000000001;	% dec 645070849 %
+176:	10101111110100110000000000001000;	% dec -1345126392 %
+180:	00000000000100110101000010000000;	% dec 1265792 %
+184:	10001111110101100000000000000100;	% dec -1881800700 %
+188:	00000000000000000000000000000000;	% dec 0 %
+192:	00000001010111100101000000100001;	% dec 22958113 %
+196:	10101101010101100000000000001100;	% dec -1386872820 %
+200:	00001000000000000000000001111110;	% dec 134217854 %
+204:	00000000000000000000000000000000;	% dec 0 %
+208:	10001111110101000000000000001000;	% dec -1881931768 %
 212:	00000000000000000000000000000000;	% dec 0 %
-216:	00100110000100000000000000001101;	% dec 638582797 %
-220:	10101111110100000000000000010000;	% dec -1345322992 %
-224:	10001111110101110000000000010100;	% dec -1881735148 %
+216:	00000000000101000101100010000000;	% dec 1333376 %
+220:	00000001011111100101100000100001;	% dec 25057313 %
+224:	10001101011011000000000000001100;	% dec -1922301940 %
 228:	00000000000000000000000000000000;	% dec 0 %
-232:	00100110111101110000000000000001;	% dec 653721601 %
-236:	10101111110101110000000000010100;	% dec -1344864236 %
-240:	10001111110101000000000000000000;	% dec -1881931776 %
-244:	00000000000000000000000000000000;	% dec 0 %
-248:	00100110100011000001000110010100;	% dec 646713748 %
-252:	10001111110100010000000000010100;	% dec -1882128364 %
-256:	00000000000000000000000000000000;	% dec 0 %
-260:	00000010001011000001000000100011;	% dec 36442147 %
-264:	00000100010000001111111111010000;	% dec 71368656 %
-268:	00000000000000000000000000000000;	% dec 0 %
-272:	10001111110101010000000000000100;	% dec -1881866236 %
-276:	00000000000000000000000000000000;	% dec 0 %
-280:	00000000000101010110100101000000;	% dec 1403200 %
-284:	10001111110101100000000000001100;	% dec -1881800692 %
-288:	00000000000000000000000000000000;	% dec 0 %
-292:	00000001101101100110100000100001;	% dec 28731425 %
-296:	00000000000011010111000010000000;	% dec 880768 %
-300:	10001111110101000000000000001000;	% dec -1881931768 %
-304:	00000000000000000000000000000000;	% dec 0 %
-308:	10101101110101000000000000000000;	% dec -1378615296 %
-312:	00100111101111010000000000100000;	% dec 666697760 %
-316:	00000000000111011111000000100001;	% dec 1962017 %
-320:	00000011111000000000000000001000;	% dec 65011720 %
+232:	10101111110011000000000000000100;	% dec -1345585148 %
+236:	00100110100101001111111111111111;	% dec 647299071 %
+240:	00000000000101000111000010000000;	% dec 1339520 %
+244:	00000001110111100111000000100001;	% dec 31354913 %
+248:	10001101110011110000000000001100;	% dec -1915813876 %
+252:	00000000000000000000000000000000;	% dec 0 %
+256:	10101111110011110000000000000000;	% dec -1345388544 %
+260:	00100110100101001111111111111111;	% dec 647299071 %
+264:	10101111110101000000000000001000;	% dec -1345060856 %
+268:	10001111110101100000000000000000;	% dec -1881800704 %
+272:	00000000000000000000000000000000;	% dec 0 %
+276:	10001111110101110000000000000100;	% dec -1881735164 %
+280:	00000000000000000000000000000000;	% dec 0 %
+284:	00000000000101100010000000100001;	% dec 1450017 %
+288:	00000000000101110010100000100001;	% dec 1517601 %
+292:	00001100000000000000000010001010;	% dec 201326730 %
+296:	00000000000000000000000000000000;	% dec 0 %
+300:	00000000000000100100000000100001;	% dec 147489 %
+304:	10101111110010000000000000101100;	% dec -1345847252 %
+308:	10001111110100110000000000101100;	% dec -1881997268 %
+312:	00000000000000000000000000000000;	% dec 0 %
+316:	00100110011010101111111111111111;	% dec 644546559 %
+320:	10001111110100000000000000000000;	% dec -1882193920 %
+324:	00000000000000000000000000000000;	% dec 0 %
+328:	00000001010100000001000000101010;	% dec 22024234 %
+332:	00010100010000000000000000010001;	% dec 339738641 %
+336:	00000000000000000000000000000000;	% dec 0 %
+340:	10001111110101100000000000001000;	% dec -1881800696 %
+344:	00000000000000000000000000000000;	% dec 0 %
+348:	00100110110101100000000000000001;	% dec 651558913 %
+352:	00000000000101100110000010000000;	% dec 1466496 %
+356:	10001111110101110000000000000000;	% dec -1881735168 %
+360:	00000000000000000000000000000000;	% dec 0 %
+364:	00000001100111100110000000100001;	% dec 27156513 %
+368:	10101101100101110000000000001100;	% dec -1382612980 %
+372:	00100110110101100000000000000001;	% dec 651558913 %
+376:	10101111110101100000000000001000;	% dec -1344929784 %
+380:	10001111110101000000000000101100;	% dec -1881931732 %
+384:	00000000000000000000000000000000;	% dec 0 %
+388:	00100110100011111111111111111111;	% dec 646971391 %
+392:	00000000000101101100000010000000;	% dec 1491072 %
+396:	00000011000111101100000000100001;	% dec 52346913 %
+400:	10101111000011110000000000001100;	% dec -1357971444 %
+404:	10001111110101110000000000101100;	% dec -1881735124 %
+408:	00000000000000000000000000000000;	% dec 0 %
+412:	00100110111010010000000000000001;	% dec 652804097 %
+416:	10001111110100010000000000000100;	% dec -1882128380 %
+420:	00000000000000000000000000000000;	% dec 0 %
+424:	00000001001100010001000000100011;	% dec 19992611 %
+428:	00000100010000010000000000010010;	% dec 71368722 %
+432:	00000000000000000000000000000000;	% dec 0 %
+436:	10001111110101000000000000001000;	% dec -1881931768 %
+440:	00000000000000000000000000000000;	% dec 0 %
+444:	00100110100101000000000000000001;	% dec 647233537 %
+448:	10101111110101000000000000001000;	% dec -1345060856 %
+452:	10001111110100000000000000101100;	% dec -1882193876 %
+456:	00000000000000000000000000000000;	% dec 0 %
+460:	00100110000011000000000000000001;	% dec 638320641 %
+464:	00000000000101000110100010000000;	% dec 1337472 %
+468:	00000001101111100110100000100001;	% dec 29255713 %
+472:	10101101101011000000000000001100;	% dec -1381236724 %
+476:	00100110100101000000000000000001;	% dec 647233537 %
+480:	10101111110101000000000000001000;	% dec -1345060856 %
+484:	00000000000101000111100010000000;	% dec 1341568 %
+488:	10001111110101010000000000000100;	% dec -1881866236 %
+492:	00000000000000000000000000000000;	% dec 0 %
+496:	00000001111111100111100000100001;	% dec 33454113 %
+500:	10101101111101010000000000001100;	% dec -1376452596 %
+504:	10001111110100000000000000001000;	% dec -1882193912 %
+508:	00000000000000000000000000000000;	% dec 0 %
+512:	00000010000000000001000000100011;	% dec 33558563 %
+516:	00000100010000011111111110110010;	% dec 71434162 %
+520:	00000000000000000000000000000000;	% dec 0 %
+524:	10001111101111100000000000110000;	% dec -1883373520 %
+528:	00000000000000000000000000000000;	% dec 0 %
+532:	10001111101111110000000000110100;	% dec -1883307980 %
+536:	00000000000000000000000000000000;	% dec 0 %
+540:	00100111101111010000000000111000;	% dec 666697784 %
+544:	00000000000111011111000000100001;	% dec 1962017 %
+548:	00000011111000000000000000001000;	% dec 65011720 %
+552:	00100111101111011111111111100100;	% dec 666763236 %
+556:	00000000000111011111000000100001;	% dec 1962017 %
+560:	10101111110001000000000000000000;	% dec -1346109440 %
+564:	10101111110001010000000000000100;	% dec -1346043900 %
+568:	10001111110100100000000000000100;	% dec -1882062844 %
+572:	00000000000000000000000000000000;	% dec 0 %
+576:	00000000000100100100000010000000;	% dec 1196160 %
+580:	10001101000010010000000000000000;	% dec -1928790016 %
+584:	00000000000000000000000000000000;	% dec 0 %
+588:	10101111110010010000000000001000;	% dec -1345781752 %
+592:	10001111110101010000000000000000;	% dec -1881866240 %
+596:	00000000000000000000000000000000;	% dec 0 %
+600:	00100110101010111111111111111111;	% dec 648806399 %
+604:	10101111110010110000000000001100;	% dec -1345650676 %
+608:	10101111110101010000000000010000;	% dec -1344995312 %
+612:	00001000000000000000000010111010;	% dec 134217914 %
+616:	00000000000000000000000000000000;	% dec 0 %
+620:	10001111110100100000000000010000;	% dec -1882062832 %
+624:	00000000000000000000000000000000;	% dec 0 %
+628:	00000000000100100110000010000000;	% dec 1204352 %
+632:	10001101100011010000000000000000;	% dec -1920139264 %
+636:	10001111110100000000000000001000;	% dec -1882193912 %
+640:	00000000000000000000000000000000;	% dec 0 %
+644:	00000001101100000001000000100011;	% dec 28315683 %
+648:	00011100010000000000000000010011;	% dec 473956371 %
+652:	00000000000000000000000000000000;	% dec 0 %
+656:	10001111110101010000000000001100;	% dec -1881866228 %
+660:	00000000000000000000000000000000;	% dec 0 %
+664:	00100110101101010000000000000001;	% dec 649396225 %
+668:	10101111110101010000000000001100;	% dec -1344995316 %
+672:	00000000000101010111100010000000;	% dec 1407104 %
+676:	10001101111110000000000000000000;	% dec -1913126912 %
+680:	00000000000000000000000000000000;	% dec 0 %
+684:	10101111110110000000000000010100;	% dec -1344798700 %
+688:	10001111110100110000000000010000;	% dec -1881997296 %
+692:	00000000000000000000000000000000;	% dec 0 %
+696:	00000000000100110100000010000000;	% dec 1261696 %
+700:	10001101000010010000000000000000;	% dec -1928790016 %
+704:	00000000000101010101000010000000;	% dec 1396864 %
+708:	10101101010010010000000000000000;	% dec -1387724800 %
+712:	00000000000100110101100010000000;	% dec 1267840 %
+716:	10001111110101100000000000010100;	% dec -1881800684 %
+720:	00000000000000000000000000000000;	% dec 0 %
+724:	10101101011101100000000000000000;	% dec -1384775680 %
+728:	10001111110101000000000000010000;	% dec -1881931760 %
+732:	00000000000000000000000000000000;	% dec 0 %
+736:	00100110100101000000000000000001;	% dec 647233537 %
+740:	10101111110101000000000000010000;	% dec -1345060848 %
+744:	10001111110100000000000000010000;	% dec -1882193904 %
+748:	10001111110100010000000000000100;	% dec -1882128380 %
+752:	00000000000000000000000000000000;	% dec 0 %
+756:	00000010000100010001000000100011;	% dec 34672675 %
+760:	00000100010000001111111111011100;	% dec 71368668 %
+764:	00000000000000000000000000000000;	% dec 0 %
+768:	10001111110101110000000000001100;	% dec -1881735156 %
+772:	00000000000000000000000000000000;	% dec 0 %
+776:	00100110111011100000000000000001;	% dec 653131777 %
+780:	10101111110011100000000000011000;	% dec -1345454056 %
+784:	10001111110100100000000000011000;	% dec -1882062824 %
+788:	00000000000000000000000000000000;	% dec 0 %
+792:	00000000000100100111100010000000;	% dec 1210496 %
+796:	10001101111110000000000000000000;	% dec -1913126912 %
+800:	00000000000000000000000000000000;	% dec 0 %
+804:	10101111110110000000000000010100;	% dec -1344798700 %
+808:	10001111110100010000000000000100;	% dec -1882128380 %
+812:	00000000000000000000000000000000;	% dec 0 %
+816:	00000000000100010100000010000000;	% dec 1130624 %
+820:	10001101000010010000000000000000;	% dec -1928790016 %
+824:	00000000000100100101000010000000;	% dec 1200256 %
+828:	10101101010010010000000000000000;	% dec -1387724800 %
+832:	00000000000100010101100010000000;	% dec 1136768 %
+836:	10001111110101010000000000010100;	% dec -1881866220 %
+840:	00000000000000000000000000000000;	% dec 0 %
+844:	10101101011101010000000000000000;	% dec -1384841216 %
+848:	00100110111011010000000000000001;	% dec 653066241 %
+852:	00000000000011010001000000100001;	% dec 856097 %
+856:	00100111101111010000000000011100;	% dec 666697756 %
+860:	00000000000111011111000000100001;	% dec 1962017 %
+864:	00000011111000000000000000001000;	% dec 65011720 %
 END;

+ 3 - 3
src/API/Api.java

@@ -58,7 +58,7 @@ public class Api {
 //        Middleware.On("IR", "close.block", "print.data");
         String middlelist = Utils.Join(new String[]{
             // Remove labels não referenciadas
-            //            "ir.clear.labels",
+//            "ir.clear.labels",
             // Remove copias
             "ir.o.copies",
             // Propagacao de constantes
@@ -66,8 +66,8 @@ public class Api {
             // Remove instruções que não tem impacto algum na execusao
             //                + "ir.o.DeadInstructions,"
             "ir.basic.blocks", // Extrai os blocos basicos de uma subrotina
-        //            "ir.o.load_store", // Remove loads e stores desnecessarios
-        //            "ir.basic.blocks", // Extrai os blsocos basicos de uma subrotina
+            "ir.o.load_store", // Remove loads e stores desnecessarios
+//            "ir.basic.blocks", // Extrai os blsocos basicos de uma subrotina
         }, ",");
 
         // Define os processadores padrão da IR

+ 7 - 0
src/API/Middleware.java

@@ -8,6 +8,7 @@ package API;
 import common.Instruction;
 import common.Log;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 
@@ -25,6 +26,12 @@ public class Middleware {
 
     }
 
+    public static void On(String selectors, String event, API.MiddlewareInterface p) throws Exception {
+        String id = selectors + "." + event + "." + new Date().getTime();
+        Add(id, p);
+        On(selectors, event, id);
+    }
+
     public static void On(String selectors, String event, String processors) {
         HashMap<String, ArrayList<String>> s;
         ArrayList<String> processorsList = ProcToList(processors);

+ 4 - 2
src/API/Variables.java

@@ -69,10 +69,12 @@ public class Variables {
     }
 
     public static String TypeOf(String varname) throws Exception {
-
+//        System.out.println("Type of " + varname);
         Node var = Get(varname);
         Node tmp, t;
         String type = "undefined";
+
+//        System.out.println("Type:" + varname + " var: " + var);
         if (var != null) {
 //            System.out.println("TypeOf:\n" + varname + "\n" + var + "\n" + var.contem("scope", "."));
 
@@ -135,7 +137,7 @@ public class Variables {
 
 //        System.out.println("Get:" + id + "=" + x);
         if (Defined(id, false)) {
-//            System.out.println("Var defined:" + id);
+//            System.out.println("##################### Var defined:" + id);
             return vars.get(id);
         }
         List<String> items = Arrays.asList(id.split("\\."));

+ 65 - 38
src/IntermediaryCode/IRGenerator.java

@@ -375,11 +375,12 @@ public final class IRGenerator implements IRGenInterface {
         // Cria a chave para a ocorrencia de um acesso ao array, evitando recalcular o endereco
         String key = n.getText();
         for (Node node : n.childrens()) {
+//            System.out.println("ArrayShift:" + node);
             key += "_" + node.getText();
         }
 
-        if (!ArrayShiftMap.containsKey(key)) {
-
+//        System.out.println("@@@@@@@@@@ARRAY_SHIFT :" + key);
+//        if (!ArrayShiftMap.containsKey(key)) {
 //            String shift;
             Node var = Variables.Get(n.getText());
 //            System.out.println("INDEX shift:" + n + var);
@@ -397,10 +398,11 @@ public final class IRGenerator implements IRGenInterface {
 ////                __exp("+", ret, CreateAlias(n), ret);
 //                shift = ret;
 //            }
-            ArrayShiftMap.put(key, ret);
-        }
-
-        return ArrayShiftMap.get(key);
+//            ArrayShiftMap.put(key, ret);
+//        }
+////
+//        return ArrayShiftMap.get(key);
+        return ret;
     }
 
     protected String GenShiftLeftLogical(String var, int size, boolean mps, boolean last) throws Exception {
@@ -437,9 +439,9 @@ public final class IRGenerator implements IRGenInterface {
         switch (path.size()) {
             case 1:
                 if (!mps) {
-                    Copy(T1, var, false)
-                            .Set("comment", "Copy value of index")
-                            .Set("copy", "true");
+//                    Copy(T1, var, false)
+//                            .Set("comment", "Copy value of index M1")
+//                            .Set("copy", "true");
                 } else {
                     T1 = var;
                 }
@@ -457,7 +459,7 @@ public final class IRGenerator implements IRGenInterface {
 //                String T4 = CreateTmpVar();
                 if (!mps) {
                     Copy(T1, var, false)
-                            .Set("comment", "Copy value of index")
+                            .Set("comment", "Copy value of index M3")
                             .Set("copy", "true");
                 }
 
@@ -1135,7 +1137,7 @@ public final class IRGenerator implements IRGenInterface {
                 .Set("p1", src));
 
         if (!addr.equals(src)) {
-            System.out.println("Store:" + addr + ":" + src);
+//            System.out.println("Store:" + addr + ":" + src);
             blockVarAliasCtx.peek().SetLoaded(addr, false);
         }
         return add;
@@ -2179,7 +2181,9 @@ public final class IRGenerator implements IRGenInterface {
             g = SetNewVar(id, n);
             alias = g[0];
 //            System.out.println("id:" + id + "|g:" + alias);
-
+//            if (alias.equals("_G5")) {
+//                System.out.println("@@@@@@@@@@@@@@@ :" + id + " >>>  " + alias + "::" + n.Get("id"));
+//            }
             varGenMap.put(id, alias);
 
             if (varGenMap.containsKey(alias)) {
@@ -2189,6 +2193,7 @@ public final class IRGenerator implements IRGenInterface {
             } else {
                 varGenMap.put(alias, id);
             }
+            // Se for uma constante
             if (g[1].equals("t")) {
                 return alias;
             }
@@ -2200,7 +2205,7 @@ public final class IRGenerator implements IRGenInterface {
 
         if (!block.Defined(id)) {
             block.Put(id, CreateSavedVar());
-            System.out.println("SET VAR (" + id + ")" + block.Get(id));
+//            System.out.println("SET VAR (" + id + ")" + block.Get(id));
         }
 
         return block.Get(id);
@@ -2220,7 +2225,9 @@ public final class IRGenerator implements IRGenInterface {
         if (var.eq("constant", "true")) {
             return new String[]{var.Get("default.value"), "t"};
         }
-        uniqPath = var.Get("scope") + "." + var.Get("name");
+//        uniqPath = var.Get("scope") + "." + var.Get("name");
+        uniqPath = var.Get("name");
+//        System.out.println("UNIQUEPATH:" + uniqPath);
 //        uniqPath = id;
 
 //        System.out.println("$$$$$$$$$$$$4 VarName:" + uniqPath + "\n\n" + var);
@@ -2364,6 +2371,7 @@ public final class IRGenerator implements IRGenInterface {
         }
 
         System.out.println("Var Map:\n" + s.toString());
+
         return varGenMap.toString();
     }
 
@@ -2409,31 +2417,34 @@ public final class IRGenerator implements IRGenInterface {
         return r;
     }
 
-    protected void basicBlockSet(Instruction inst) throws Exception {
-        String type = inst.Get("type");
-
-        if (type.equals("label") || resetOnNextAdd) {
-            System.out.println("Reset por (" + resetOnNextAdd + ") or era label");
-            blockVarAliasCtx.peek().Reset();
-            resetOnNextAdd = false;
-            return;
-        }
-        switch (inst.Get("type")) {
-            case "jump":
-            case "call":
-            case "goto":
-            case "branch":
-                resetOnNextAdd = true;
-        }
-    }
-
+//    protected void basicBlockSet(Instruction inst) throws Exception {
+////        String type = inst.Get("type");
+//
+//        if (resetOnNextAdd || inst.eq("type", "label")) {
+//            System.out.println("Reset por (" + resetOnNextAdd + ") or era label");
+//            blockVarAliasCtx.peek().Reset();
+//            resetOnNextAdd = false;
+//            return;
+//        }
+////        switch (inst.Get("type")) {
+////            case "jump":
+////            case "call":
+////            case "goto":
+////            case "branch":
+////                resetOnNextAdd = true;
+////        }
+//    }
     protected Instruction Add(Instruction inst) throws Exception {
         Instruction load = null;
         String value;
         String[] parts;
         String type, paramValue;
 
-        basicBlockSet(inst);
+//        basicBlockSet(inst);
+        if (inst.eq("type", "label")) {
+            blockVarAliasCtx.peek().Reset();
+            ArrayShiftMap = new HashMap<>();
+        }
 
         boolean temporary,
                 ignore = !inst.in("type", new String[]{"jump", "goto", "label"});
@@ -2449,9 +2460,14 @@ public final class IRGenerator implements IRGenInterface {
 
                 type = "int32";
                 paramValue = inst.Get(param);
+
                 if (varGenMap.containsKey(paramValue)) {
+
                     type = Variables.TypeOf(varGenMap.get(paramValue));
+//                    System.out.println("Check type for " + paramValue + "|" + varGenMap.get(paramValue) + "|" + type);
+
                 }
+
                 inst.Set(param + ".type", type);
 
                 if (!inst.Has(param + "value")) {
@@ -2483,6 +2499,7 @@ public final class IRGenerator implements IRGenInterface {
                 }
             }
         }
+
         // Se a instrução adicionada for uma copia e o parametro foi carregado
         // Atualiza o destino para o destino da copia e não adiciona a copia
         if (inst.eq("type", "copy") && load != null) {
@@ -2497,7 +2514,7 @@ public final class IRGenerator implements IRGenInterface {
             );
         }
 
-        // 
+// 
 //        if (inst.eq("type", "store")) {
 //            System.out.println("Add store" + inst);
 //            blockVarAliasCtx.peek().SetLoaded(inst.Get("p1"), false);
@@ -2544,6 +2561,16 @@ public final class IRGenerator implements IRGenInterface {
 
         }
 
+        switch (inst.Get("type")) {
+            case "jump":
+            case "call":
+            case "goto":
+            case "branch":
+//                resetOnNextAdd = true;
+                blockVarAliasCtx.peek().Reset();
+                ArrayShiftMap = new HashMap<>();
+        }
+
         return inst;
     }
 
@@ -2582,12 +2609,12 @@ public final class IRGenerator implements IRGenInterface {
         }
 
         public String Reverse(String alias) {
-            System.out.println("$$$$$$$$$$$$$$$$ Get Reverse of " + (prefix + Utils.clearName(alias)) + " | " + map);
+//            System.out.println("$$$$$$$$$$$$$$$$ Get Reverse of " + (prefix + Utils.clearName(alias)) + " | " + map);
             return map.get(prefix + Utils.clearName(alias)) + FixIndex(alias);
         }
 
         public void Reset() {
-            System.out.println("$$$$$$$$$$$$$$$$ RESET ");
+//            System.out.println("$$$$$$$$$$$$$$$$ RESET ");
             map = new HashMap<>();
             loaded = new HashMap<>();
         }
@@ -2598,7 +2625,7 @@ public final class IRGenerator implements IRGenInterface {
         }
 
         protected boolean Loaded(String alias) {
-            System.out.println("$$$$$$$$$$$$$$$$ LOADED " + alias + " : " + (loaded.containsKey(alias) && loaded.get(alias)));
+//            System.out.println("$$$$$$$$$$$$$$$$ LOADED " + alias + " : " + (loaded.containsKey(alias) && loaded.get(alias)));
             return loaded.containsKey(alias) && loaded.get(alias);
         }
 
@@ -2607,7 +2634,7 @@ public final class IRGenerator implements IRGenInterface {
         }
 
         private void SetLoaded(String alias, boolean b) {
-            System.out.println("$$$$$$$$$$$$$$$$ SetLoaded:" + alias + ":" + b);
+//            System.out.println("$$$$$$$$$$$$$$$$ SetLoaded:" + alias + ":" + b);
             loaded.put(alias, b);
         }
 

+ 2 - 2
src/IntermediaryCode/IRTemplate.java

@@ -23,9 +23,9 @@ public class IRTemplate implements templates.TemplateDescription {
                         + "{[PAD(block.position,G.addressLen,' ')]':'}"
                         + "{[T(2)]}";
 
-                String end = " {' --'[comment]}"
-                        + "{[T(2)]}"
+                String end = "{[T(3)]}"
                         + "{'  T< '[type]' >'} "
+                        + "{' --'[comment]}"
                         + "{[T(2)]}"
                         + "{[basicBlock]}";
 

+ 269 - 22
src/compiler/IVANNOSYS.java

@@ -62,43 +62,50 @@ public class IVANNOSYS {
                     BuildParams.Add("display.AST", "true");
                     BuildParams.Add("mode", "developement");
 
-                    // Especifica a classe de geração de código alvo mips
-                    Translate Mips = new targets.mips.Translate();
-                    // Adiciona dois metodos de exportação ao alvo mips 
-                    // Metodo de simualcao
-                    Mips.AddExportOption("simulation", new Simulation(new tools.mips.MipsSettings() {
+                    Simulation simulator = new Simulation(new tools.mips.MipsSettings() {
                         {
                             // Não executar passo a passo
 //                            Set("step.by.step", "true");
-                            Set("step.by.step", "false");
                             // Necessario para poder usar os breakpoints
 //                            Set("mode", "debug");
-                            // Determina os pontos de para no codigo alvo
-//                            Set("breakpoints", "c4");
-//                            Set("breakpoints", "f4");
-//                            Set("breakpoints", "94-9c");
-//                            Set("breakpoints", "1d8,214,2e0,28c,2f0,250,330");
-//                            Set("breakpoints", "1d8,214,250,28c,2dc,2e0,2d8,2f0,300,314,324,350,35c");
-//                            Set("breakpoints", "2e8-350,35c");
-//                            Set("breakpoints", "314,35c");
-//                            Set("breakpoints", "350,35c");
-                            // Caminho do arquivo de memoria de instrucoes
+// Determina os pontos de para no codigo alvo
+//                            Set("breakpoints", "104,10c,30c,300,22c");
+//                            Set("breakpoints", "104,110");
+//                            Set("breakpoints", "108,110,114,37c,280,294");
+//                            Set("breakpoints", "5c,cc,154,1c0");
+
+// Caminho do arquivo de memoria de instrucoes
                             Set("memory.instruction", "\\src\\tools\\mips\\memory\\mi.memory");
-                            // Tamanho da memorua de instrucoes 16 kb
+// Tamanho da memorua de instrucoes 16 kb
                             Set("memory.instruction.size", 16 * 1024);
-                            // Caminho do arquivo de memoria de dados
+// Caminho do arquivo de memoria de dados
                             Set("memory.data", "\\src\\tools\\mips\\memory\\md.memory");
-                            // Tamanho da memorua de dados 16 kb
+// Tamanho da memorua de dados 16 kb
                             Set("memory.data.size", 16 * 1024);
                             Set("memory.data.reset", "true");
                         }
-                    }));
+                    });
 
+                    MultCoreJun JunExport = new MultCoreJun();
+                    // Especifica a classe de geração de código alvo mips
+                    Translate Mips = new targets.mips.Translate();
+                    // Adiciona dois metodos de exportação ao alvo mips 
+                    // Metodo de simualcao
+                    Mips.AddExportOption("simulation", simulator);
                     // Metodo exporta profile para arquitetura de juninho
-                    Mips.AddExportOption("MultCoreJun", new MultCoreJun());
+                    Mips.AddExportOption("MultCoreJun", JunExport);
 
                     Target.Add("mips", Mips);
 
+                    Mips = new targets.mips.TranslateJun();
+                    // Adiciona dois metodos de exportação ao alvo mips 
+                    // Metodo de simualcao
+                    Mips.AddExportOption("simulation", simulator);
+                    // Metodo exporta profile para arquitetura de juninho
+                    Mips.AddExportOption("MultCoreJun", JunExport);
+
+                    Target.Add("mipsjun", Mips);
+
                     // Registra os processadores para o alvo mips
                     // Executa alocacao de registradores antes de traduzir cada bloco
                     Middleware.On("mips", "before.translate.block", "mips.register.alloc");
@@ -114,7 +121,9 @@ public class IVANNOSYS {
                     // cmd = "src\\samples\\program_mult_jon.go";
 //                    cmd = "src\\samples\\program_mult.go";
 //                    cmd = "src\\samples\\program_jun_bit_count.go";
-                    cmd = "src\\samples\\program_jun_bit_count_1.go";
+//                    cmd = "src\\samples\\program_jun_bit_count_1.go";
+//                    cmd = "src\\samples\\program_jun_lu.go";
+                    cmd = "src\\samples\\program_jun_quick.go";
 //                    cmd = "src\\samples\\program_jun_laplaciano.go";
 //                    cmd = "src\\samples\\program_jun_bytes.go";
 //                    cmd = "src\\samples\\program_jun_mult_manycore.go";
@@ -127,3 +136,241 @@ public class IVANNOSYS {
         }
     }
 }
+
+
+/*
+		<main>:
+  0:  0604504068	addiu t0,zero,4		.0 -- load param (p1)
+  4:  2886205440	sw t0,0(zero)		.0 -- store content of t0 in _G1[0]
+  8:  0604569603	addiu t1,zero,3		.1 -- load param (p1)
+  c:  2886270980	sw t1,4(zero)		.1 -- store content of t1 in _G1[4]
+ 10:  0604635141	addiu t2,zero,5		.2 -- load param (p1)
+ 14:  2886336520	sw t2,8(zero)		.2 -- store content of t2 in _G1[8]
+ 18:  0604700674	addiu t3,zero,2		.3 -- load param (p1)
+ 1c:  2886402060	sw t3,12(zero)		.3 -- store content of t3 in _G1[12]
+ 20:  0604766209	addiu t4,zero,1		.4 -- load param (p1)
+ 24:  2886467600	sw t4,16(zero)		.4 -- store content of t4 in _G1[16]
+ 28:  0604831747	addiu t5,zero,3		.5 -- load param (p1)
+ 2c:  2886533140	sw t5,20(zero)		.5 -- store content of t5 in _G1[20]
+ 30:  0604897282	addiu t6,zero,2		.6 -- load param (p1)
+ 34:  2886598680	sw t6,24(zero)		.6 -- store content of t6 in _G1[24]
+ 38:  0604962819	addiu t7,zero,3		.7 -- load param (p1)
+ 3c:  2886664220	sw t7,28(zero)		.7 -- store content of t7 in _G1[28]
+ 40:  0604241920	addiu a0,zero,0		.10 -- push param
+ 44:  0604307463	addiu a1,zero,7		.10 -- push param
+ 48:  0201326613	jal 54 <quickSortIterative+0x0>		.10 -- jump to <quickSortIterative>
+ 4c:  0000000000	sll zero,zero,0		.10 -- Nop
+ 50:  4294967295	stop 		 -- End of programa
+		<quickSortIterative>:
+ 54:  0666763208	addiu sp,sp,-56		 -- prolog| push stack frame
+ 58:  2948464688	sw fp,48(sp)		 -- prolog| backup fp
+ 5c:  2948530228	sw ra,52(sp)		 -- prolog| backup ra
+ 60:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
+ 64:  2948857856	sw a0,0(fp)		.0 -- pop param
+ 68:  2948923396	sw a1,4(fp)		.1 -- pop param
+ 6c:  2412969992	lw s3,8(fp)		.2 -- load content from _VTOP7 in s3
+ 70:  0000000000	sll zero,zero,0		.2 -- Nop
+ 74:  0001261696	sll t0,s3,2		.3 -- _T10 = _S8 << 2
+ 78:  2413035520	lw s4,0(fp)		.4 -- load content from _VL3 in s4
+ 7c:  0000000000	sll zero,zero,0		.4 -- Nop
+ 80:  0018759713	addu t0,t0,fp		.5
+ 84:  2903769100	sw s4,12(t0)		.5 -- store content of s4 in _VSTACK11[_T10]
+ 88:  0645070849	addiu s3,s3,1		.6 -- _S8 = _S8 + 1
+ 8c:  2949840904	sw s3,8(fp)		.7 -- store content of s3 in _VTOP7
+ 90:  0001284129	addu s3,zero,s3		.8 -- copy _S8 ← _S8
+ 94:  2949840904	sw s3,8(fp)		.9 -- store content of s3 in _VTOP7
+ 98:  0001265792	sll t2,s3,2		.10 -- _T14 = _S8 << 2
+ 9c:  2413166596	lw s6,4(fp)		.11 -- load content from _VH5 in s6
+ a0:  0000000000	sll zero,zero,0		.11 -- Nop
+ a4:  0022958113	addu t2,t2,fp		.12
+ a8:  2908094476	sw s6,12(t2)		.12 -- store content of s6 in _VSTACK11[_T14]
+ ac:  0134217857	j 204 <quickSortIterative+0x1b0>		.13 -- jump to quickSortIterative+_i3
+ b0:  0000000000	sll zero,zero,0		.13 -- Nop
+ b4:  2413035528	lw s4,8(fp)		.14 -- load content from _VTOP7 in s4
+ b8:  0000000000	sll zero,zero,0		.14 -- Nop
+ bc:  0001333376	sll t3,s4,2		.15 -- _T17 = _S15 << 2
+ c0:  2372665356	lw t4,12(t3)		.16 -- load content from _VSTACK11[_T17] in t4
+ c4:  0000000000	sll zero,zero,0		.16 -- Nop
+ c8:  2949382148	sw t4,4(fp)		.17 -- store content of t4 in _VH5
+ cc:  0647299071	addiu s4,s4,-1		.18 -- _S15 = _S15 - 1
+ d0:  2949906440	sw s4,8(fp)		.19 -- store content of s4 in _VTOP7
+ d4:  0001351713	addu s4,zero,s4		.20 -- copy _S15 ← _S15
+ d8:  2949906440	sw s4,8(fp)		.21 -- store content of s4 in _VTOP7
+ dc:  0001339520	sll t6,s4,2		.22 -- _T22 = _S15 << 2
+ e0:  2379153420	lw t7,12(t6)		.23 -- load content from _VSTACK11[_T22] in t7
+ e4:  0000000000	sll zero,zero,0		.23 -- Nop
+ e8:  2949578752	sw t7,0(fp)		.24 -- store content of t7 in _VL3
+ ec:  0647299071	addiu s4,s4,-1		.25 -- _S15 = _S15 - 1
+ f0:  2949906440	sw s4,8(fp)		.26 -- store content of s4 in _VTOP7
+ f4:  2413166592	lw s6,0(fp)		.27 -- load content from _VL3 in s6
+ f8:  0000000000	sll zero,zero,0		.27 -- Nop
+ fc:  2413232132	lw s7,4(fp)		.29 -- load content from _VH5 in s7
+100:  0000000000	sll zero,zero,0		.29 -- Nop
+104:  0001450017	addu a0,zero,s6		.31 -- push param
+108:  0001517601	addu a1,zero,s7		.31 -- push param
+10c:  0201326733	jal 234 <partition+0x0>		.31 -- jump to <partition>
+110:  0000000000	sll zero,zero,0		.31 -- Nop
+114:  0000147489	addu t0,zero,v0		.32 -- copy t0 ← v0
+118:  2949120044	sw t0,44(fp)		.33 -- store content of t0 in _VP83
+11c:  2412970028	lw s3,44(fp)		.34 -- load content from _VP83 in s3
+120:  0000000000	sll zero,zero,0		.34 -- Nop
+124:  0644546559	addiu t2,s3,-1		.35 -- _T85 = _S84 - 1
+128:  2412773376	lw s0,0(fp)		.36 -- load content from _VL3 in s0
+12c:  0000000000	sll zero,zero,0		.36 -- Nop
+130:  0022024234	slt v0,t2,s0		.37
+134:  0339738646	bne zero,v0,190 <quickSortIterative+0x13c>		.37 -- branch if not equals
+138:  0000000000	sll zero,zero,0		.37 -- Nop
+13c:  2413166600	lw s6,8(fp)		.38 -- load content from _VTOP7 in s6
+140:  0000000000	sll zero,zero,0		.38 -- Nop
+144:  0651558913	addiu s6,s6,1		.39 -- _S87 = _S87 + 1
+148:  2950037512	sw s6,8(fp)		.40 -- store content of s6 in _VTOP7
+14c:  0001486881	addu s6,zero,s6		.41 -- copy _S87 ← _S87
+150:  2950037512	sw s6,8(fp)		.42 -- store content of s6 in _VTOP7
+154:  0001466496	sll t4,s6,2		.43 -- _T90 = _S87 << 2
+158:  2413232128	lw s7,0(fp)		.44 -- load content from _VL3 in s7
+15c:  0000000000	sll zero,zero,0		.44 -- Nop
+160:  0027156513	addu t4,t4,fp		.45
+164:  2912354316	sw s7,12(t4)		.45 -- store content of s7 in _VSTACK11[_T90]
+168:  0651558913	addiu s6,s6,1		.46 -- _S87 = _S87 + 1
+16c:  2950037512	sw s6,8(fp)		.47 -- store content of s6 in _VTOP7
+170:  2413035564	lw s4,44(fp)		.48 -- load content from _VP83 in s4
+174:  0000000000	sll zero,zero,0		.48 -- Nop
+178:  0646971391	addiu t7,s4,-1		.49 -- _T93 = _S92 - 1
+17c:  0001486881	addu s6,zero,s6		.50 -- copy _S87 ← _S87
+180:  2950037512	sw s6,8(fp)		.51 -- store content of s6 in _VTOP7
+184:  0001491072	sll t8,s6,2		.52 -- _T95 = _S87 << 2
+188:  0052346913	addu t8,t8,fp		.53
+18c:  2936995852	sw t7,12(t8)		.53 -- store content of t7 in _VSTACK11[_T95]
+190:  2413232172	lw s7,44(fp)		.54 -- load content from _VP83 in s7
+194:  0000000000	sll zero,zero,0		.54 -- Nop
+198:  0652804097	addiu t1,s7,1		.55 -- _T97 = _S96 + 1
+19c:  2412969988	lw s3,4(fp)		.56 -- load content from _VH5 in s3
+1a0:  0000000000	sll zero,zero,0		.56 -- Nop
+1a4:  0020123683	subu v0,t1,s3		.57
+1a8:  0071368726	bgez v0,204 <quickSortIterative+0x1b0>		.57 -- branch if register >= 0
+1ac:  0000000000	sll zero,zero,0		.57 -- Nop
+1b0:  2412838920	lw s1,8(fp)		.58 -- load content from _VTOP7 in s1
+1b4:  0000000000	sll zero,zero,0		.58 -- Nop
+1b8:  0640745473	addiu s1,s1,1		.59 -- _S99 = _S99 + 1
+1bc:  2949709832	sw s1,8(fp)		.60 -- store content of s1 in _VTOP7
+1c0:  2412773420	lw s0,44(fp)		.61 -- load content from _VP83 in s0
+1c4:  0000000000	sll zero,zero,0		.61 -- Nop
+1c8:  0638320641	addiu t4,s0,1		.62 -- _T101 = _S100 + 1
+1cc:  0001148961	addu s1,zero,s1		.63 -- copy _S99 ← _S99
+1d0:  2949709832	sw s1,8(fp)		.64 -- store content of s1 in _VTOP7
+1d4:  0001140864	sll t5,s1,2		.65 -- _T103 = _S99 << 2
+1d8:  0029255713	addu t5,t5,fp		.66
+1dc:  2913730572	sw t4,12(t5)		.66 -- store content of t4 in _VSTACK11[_T103]
+1e0:  0640745473	addiu s1,s1,1		.67 -- _S99 = _S99 + 1
+1e4:  2949709832	sw s1,8(fp)		.68 -- store content of s1 in _VTOP7
+1e8:  0001148961	addu s1,zero,s1		.69 -- copy _S99 ← _S99
+1ec:  2949709832	sw s1,8(fp)		.70 -- store content of s1 in _VTOP7
+1f0:  0001144960	sll t7,s1,2		.71 -- _T107 = _S99 << 2
+1f4:  2413101060	lw s5,4(fp)		.72 -- load content from _VH5 in s5
+1f8:  0000000000	sll zero,zero,0		.72 -- Nop
+1fc:  0033454113	addu t7,t7,fp		.73
+200:  2918514700	sw s5,12(t7)		.73 -- store content of s5 in _VSTACK11[_T107]
+204:  2412773384	lw s0,8(fp)		.74 -- load content from _VTOP7 in s0
+208:  0000000000	sll zero,zero,0		.74 -- Nop
+20c:  0033558563	subu v0,s0,zero		.75
+210:  0071434152	bgez v0,b4 <quickSortIterative+0x60>		.75 -- branch if register >= 0
+214:  0000000000	sll zero,zero,0		.75 -- Nop
+218:  2411593776	lw fp,48(sp)		 -- epilog| restore 
+21c:  0000000000	sll zero,zero,0		 -- Nop
+220:  2411659316	lw ra,52(sp)		 -- epilog| restore 
+224:  0000000000	sll zero,zero,0		 -- Nop
+228:  0666697784	addiu sp,sp,56		 -- epilog| pop stack frame
+22c:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
+230:  0065011720	jr ra		 -- epilog| return
+		<partition>:
+234:  0666763236	addiu sp,sp,-28		 -- prolog| push stack frame
+238:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
+23c:  2948857856	sw a0,0(fp)		.0 -- pop param
+240:  2948923396	sw a1,4(fp)		.1 -- pop param
+244:  2412904452	lw s2,4(fp)		.2 -- load content from _VH27 in s2
+248:  0000000000	sll zero,zero,0		.2 -- Nop
+24c:  0001196160	sll t0,s2,2		.3 -- _T30 = _S28 << 2
+250:  2366177280	lw t1,0(t0)		.4 -- load content from _G1[_T30] in t1
+254:  0000000000	sll zero,zero,0		.4 -- Nop
+258:  2949185544	sw t1,8(fp)		.5 -- store content of t1 in _VX33
+25c:  2413101056	lw s5,0(fp)		.6 -- load content from _VL25 in s5
+260:  0000000000	sll zero,zero,0		.6 -- Nop
+264:  0648806399	addiu t3,s5,-1		.7 -- _T35 = _S26 - 1
+268:  2949316620	sw t3,12(fp)		.8 -- store content of t3 in _VI36
+26c:  2949971984	sw s5,16(fp)		.9 -- store content of s5 in _VJ38
+270:  0134217923	j 30c <partition+0xd8>		.10 -- jump to partition+_i7
+274:  0000000000	sll zero,zero,0		.10 -- Nop
+278:  2412904464	lw s2,16(fp)		.11 -- load content from _VJ38 in s2
+27c:  0000000000	sll zero,zero,0		.11 -- Nop
+280:  0001204352	sll t4,s2,2		.12 -- _T42 = _S40 << 2
+284:  2374828032	lw t5,0(t4)		.13 -- load content from _G1[_T42] in t5
+288:  2412773384	lw s0,8(fp)		.14 -- load content from _VX33 in s0
+28c:  0000000000	sll zero,zero,0		.14 -- Nop
+290:  0028315683	subu v0,t5,s0		.15
+294:  0473956377	bgtz v0,2fc <partition+0xc8>		.15 -- branch if register > 0
+298:  0000000000	sll zero,zero,0		.15 -- Nop
+29c:  2413101068	lw s5,12(fp)		.16 -- load content from _VI36 in s5
+2a0:  0000000000	sll zero,zero,0		.16 -- Nop
+2a4:  0649396225	addiu s5,s5,1		.17 -- _S46 = _S46 + 1
+2a8:  2949971980	sw s5,12(fp)		.18 -- store content of s5 in _VI36
+2ac:  0001419297	addu s5,zero,s5		.19 -- copy _S46 ← _S46
+2b0:  2949971980	sw s5,12(fp)		.20 -- store content of s5 in _VI36
+2b4:  0001407104	sll t7,s5,2		.21 -- _T48 = _S46 << 2
+2b8:  2381840384	lw t8,0(t7)		.22 -- load content from _G1[_T48] in t8
+2bc:  0000000000	sll zero,zero,0		.22 -- Nop
+2c0:  2950168596	sw t8,20(fp)		.23 -- store content of t8 in _VTMP51
+2c4:  2412970000	lw s3,16(fp)		.24 -- load content from _VJ38 in s3
+2c8:  0000000000	sll zero,zero,0		.24 -- Nop
+2cc:  0001261696	sll t0,s3,2		.25 -- _T55 = _S53 << 2
+2d0:  2366177280	lw t1,0(t0)		.26 -- load content from _G1[_T55] in t1
+2d4:  0001419297	addu s5,zero,s5		.27 -- copy _S46 ← _S46
+2d8:  2949971980	sw s5,12(fp)		.28 -- store content of s5 in _VI36
+2dc:  0001396864	sll t2,s5,2		.29 -- _T58 = _S46 << 2
+2e0:  2907242496	sw t1,0(t2)		.30 -- store content of t1 in _G1[_T58]
+2e4:  0001284129	addu s3,zero,s3		.31 -- copy _S53 ← _S53
+2e8:  2949840912	sw s3,16(fp)		.32 -- store content of s3 in _VJ38
+2ec:  0001267840	sll t3,s3,2		.33 -- _T60 = _S53 << 2
+2f0:  2413232148	lw s7,20(fp)		.34 -- load content from _VTMP51 in s7
+2f4:  0000000000	sll zero,zero,0		.34 -- Nop
+2f8:  2910257152	sw s7,0(t3)		.35 -- store content of s7 in _G1[_T60]
+2fc:  2413101072	lw s5,16(fp)		.36 -- load content from _VJ38 in s5
+300:  0000000000	sll zero,zero,0		.36 -- Nop
+304:  0649396225	addiu s5,s5,1		.37 -- _S61 = _S61 + 1
+308:  2949971984	sw s5,16(fp)		.38 -- store content of s5 in _VJ38
+30c:  2412904464	lw s2,16(fp)		.39 -- load content from _VJ38 in s2
+310:  2412838916	lw s1,4(fp)		.40 -- load content from _VH27 in s1
+314:  0000000000	sll zero,zero,0		.40 -- Nop
+318:  0038866979	subu v0,s2,s1		.41
+31c:  0071368662	bltz v0,278 <partition+0x44>		.41 -- branch if register < 0
+320:  0000000000	sll zero,zero,0		.41 -- Nop
+324:  2413035532	lw s4,12(fp)		.42 -- load content from _VI36 in s4
+328:  0000000000	sll zero,zero,0		.42 -- Nop
+32c:  0646840321	addiu t6,s4,1		.43 -- _T65 = _S64 + 1
+330:  2949513240	sw t6,24(fp)		.44 -- store content of t6 in _VINDEX66
+334:  2413166616	lw s6,24(fp)		.45 -- load content from _VINDEX66 in s6
+338:  0000000000	sll zero,zero,0		.45 -- Nop
+33c:  0001472640	sll t7,s6,2		.46 -- _T69 = _S67 << 2
+340:  2381840384	lw t8,0(t7)		.47 -- load content from _G1[_T69] in t8
+344:  0000000000	sll zero,zero,0		.47 -- Nop
+348:  2950168596	sw t8,20(fp)		.48 -- store content of t8 in _VTMP51
+34c:  2412838916	lw s1,4(fp)		.49 -- load content from _VH27 in s1
+350:  0000000000	sll zero,zero,0		.49 -- Nop
+354:  0001130624	sll t0,s1,2		.50 -- _T75 = _S73 << 2
+358:  2366177280	lw t1,0(t0)		.51 -- load content from _G1[_T75] in t1
+35c:  0001486881	addu s6,zero,s6		.52 -- copy _S67 ← _S67
+360:  2950037528	sw s6,24(fp)		.53 -- store content of s6 in _VINDEX66
+364:  0001462400	sll t2,s6,2		.54 -- _T78 = _S67 << 2
+368:  2907242496	sw t1,0(t2)		.55 -- store content of t1 in _G1[_T78]
+36c:  0001148961	addu s1,zero,s1		.56 -- copy _S73 ← _S73
+370:  2949709828	sw s1,4(fp)		.57 -- store content of s1 in _VH27
+374:  0001136768	sll t3,s1,2		.58 -- _T80 = _S73 << 2
+378:  2413232148	lw s7,20(fp)		.59 -- load content from _VTMP51 in s7
+37c:  0000000000	sll zero,zero,0		.59 -- Nop
+380:  2910257152	sw s7,0(t3)		.60 -- store content of s7 in _G1[_T80]
+384:  0646774785	addiu t5,s4,1		.61 -- _T81 = _S64 + 1
+388:  0000856097	addu v0,zero,t5		.63 -- push return 
+38c:  0666697756	addiu sp,sp,28		 -- epilog| pop stack frame
+390:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
+394:  0065011720	jr ra		 -- epilog| return
+
+ */

+ 26 - 92
src/compiler/Simulator.java

@@ -6,24 +6,15 @@ package compiler;
  * To change this template file, choose Tools | Templates
  * and open the template in the editor.
  */
-import API.Api;
-import API.BuildParams;
-import API.Middleware;
-import API.Target;
-import Export.MultCoreJun;
-import Export.Simulation;
-import IntermediaryCode.IRGenerator;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import targets.mips.Translate;
+import tools.mips.MipsSettings;
 
 /**
  *
  * @author Eugenio
  */
-public class IVANNOSYS {
-
-    protected static IvannosysCompiler COM;
+public class Simulator {
 
     /**
      * @param args the command line arguments
@@ -31,50 +22,16 @@ public class IVANNOSYS {
     public static void main(String[] args) throws Exception {
 
         try {
-            String cmd = "", file = "";
-
-            if (args.length > 0) {
-                cmd = args[0];
-            }
-            switch (cmd) {
-                case "create":
-                    break;
-                default:
-//                    Middleware.Add("mips.analise", new analise.AnaliseDependenciaMiddleware());
-//                    Middleware.Add("mips.module.scheduling", new analise.ModuleSchedulingMiddleware());
-
-                    COM = new IvannosysCompiler(
-                            "UTF-8",
-                            IvannosysCompiler.INPUT_FILE)
-                            .include(".\\src\\samples")
-                            .include(".\\src\\libs")
-                            // Especifica a classe de geração de codigo de tres enderecos
-                            .IRGenerator(new IRGenerator());
-                    // Extensao dos arquivos 
-//                            .setExtensionLibrary(".go");
-
-                    // Inicializa a api do compilador
-                    Api.Init(COM);
-
-                    // Parametros de compilação
-                    BuildParams.Add("display.ERROS", "true");
-                    BuildParams.Add("display.IR", "true");
-                    BuildParams.Add("display.AST", "true");
-                    BuildParams.Add("mode", "developement");
 
-                    // Especifica a classe de geração de código alvo mips
-                    Translate Mips = new targets.mips.Translate();
-                    // Adiciona dois metodos de exportação ao alvo mips 
-                    // Metodo de simualcao
-                    Mips.AddExportOption("simulation", new Simulation(new tools.mips.MipsSettings() {
-                        {
-                            // Não executar passo a passo
+            MipsSettings settings = new tools.mips.MipsSettings() {
+                {
+                    // Não executar passo a passo
 //                            Set("step.by.step", "true");
-                            Set("step.by.step", "false");
-                            // Necessario para poder usar os breakpoints
+                    Set("step.by.step", "false");
+                    // Necessario para poder usar os breakpoints
 //                            Set("mode", "debug");
-                            // Determina os pontos de para no codigo alvo
-//                            Set("breakpoints", "c4");
+// Determina os pontos de para no codigo alvo
+                    Set("breakpoints", "25c,260");
 //                            Set("breakpoints", "f4");
 //                            Set("breakpoints", "94-9c");
 //                            Set("breakpoints", "1d8,214,2e0,28c,2f0,250,330");
@@ -82,48 +39,25 @@ public class IVANNOSYS {
 //                            Set("breakpoints", "2e8-350,35c");
 //                            Set("breakpoints", "314,35c");
 //                            Set("breakpoints", "350,35c");
-                            // Caminho do arquivo de memoria de instrucoes
-                            Set("memory.instruction", "\\src\\tools\\mips\\memory\\mi.memory");
-                            // Tamanho da memorua de instrucoes 16 kb
-                            Set("memory.instruction.size", 16 * 1024);
-                            // Caminho do arquivo de memoria de dados
-                            Set("memory.data", "\\src\\tools\\mips\\memory\\md.memory");
-                            // Tamanho da memorua de dados 16 kb
-                            Set("memory.data.size", 16 * 1024);
-                            Set("memory.data.reset", "true");
-                        }
-                    }));
-
-                    // Metodo exporta profile para arquitetura de juninho
-                    Mips.AddExportOption("MultCoreJun", new MultCoreJun());
-
-                    Target.Add("mips", Mips);
-
-                    // Registra os processadores para o alvo mips
-                    // Executa alocacao de registradores antes de traduzir cada bloco
-                    Middleware.On("mips", "before.translate.block", "mips.register.alloc");
-//                    Middleware.On("mips", "after.translate.block", "mips.o.L1,mips.copy.dep");
-                    Middleware.On("mips", "after.translate.block", "mips.copy.dep");
-                    // Atualiza os enderecos de saltos e set no campo offset
-//                    Middleware.On("mips", "after.translate", "mips.update.address,mips.analise,mips.module.scheduling");
-//                    Middleware.On("mips", "after.translate", "mips.update.address,mips.module.scheduling");
-                    Middleware.On("mips", "after.translate", "mips.update.address");
-
-                    // cmd = "src\\samples\\program.go";
-                    // cmd = "src\\samples\\program.go";
-                    // cmd = "src\\samples\\program_mult_jon.go";
-//                    cmd = "src\\samples\\program_mult.go";
-//                    cmd = "src\\samples\\program_jun_bit_count.go";
-                    cmd = "src\\samples\\program_jun_bit_count_1.go";
-//                    cmd = "src\\samples\\program_jun_laplaciano.go";
-//                    cmd = "src\\samples\\program_jun_bytes.go";
-//                    cmd = "src\\samples\\program_jun_mult_manycore.go";
-                    // Compila o arquivo de entrada
-                    COM.Compile(cmd);
-            }
+// Caminho do arquivo de memoria de instrucoes
+                    Set("memory.instruction", "\\src\\tools\\mips\\memory\\mi.memory");
+// Tamanho da memorua de instrucoes 16 kb
+                    Set("memory.instruction.size", 16 * 1024);
+// Caminho do arquivo de memoria de dados
+                    Set("memory.data", "\\src\\tools\\mips\\memory\\md.memory");
+// Tamanho da memorua de dados 16 kb
+                    Set("memory.data.size", 16 * 1024);
+                    Set("memory.data.reset", "true");
+                }
+            };
+            // Instancia um simulador, executa e salva a memoria
+            new tools.mips.MipsProcessor(settings)
+                    .Run()
+                    .Persist()
+                    .Report();
 
         } catch (Exception ex) {
-            Logger.getLogger(IVANNOSYS.class.getName()).log(Level.SEVERE, null, ex);
+            Logger.getLogger(Simulator.class.getName()).log(Level.SEVERE, null, ex);
         }
     }
 }

+ 13 - 5
src/frontend/Ivannosys/IvannosysListener.java

@@ -307,8 +307,9 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
 
 //        System.out.println("types:" + types);
         for (Node var : node.find("ids").childrens()) {
-            varname = scopeStack.peek() + "." + var.getText();
+            varname = scopeStack.peek() + "." + var.getText(); // nmm
 
+//            System.out.println("DecVariavel:" + varname);
             t = types.get(i);
 
             var.Set("type", t)
@@ -402,7 +403,8 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
         String id = childrens.get(0).getText();
         Node value = childrens.get(1);
 
-        String varID = scopeStack.peek() + "." + id;
+        String varID = scopeStack.peek() + "." + id; //nmm
+//        System.out.println("DECCONST:" + varID);
         Node var = new Node(varID)
                 .Set("fullname", varID)
                 .Set("name", id)
@@ -592,7 +594,7 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
         if (ctx.index() != null) {
             String val = ctx.index().expression().getText();
             if (!Utils.IsNumber(val)) {
-                Node ref = Variables.Get(scopeStack.peek() + "." + val);
+                Node ref = Variables.Get(scopeStack.peek() + "." + val); //nmmd
                 if (ref != null && ref.eq("constant", "true")) {
 //                    System.out.println("INDEXEDTYPE" + constante);
                     val = ref.Get("default.value");
@@ -929,7 +931,9 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
     public void exitReceive_type(IvannosysGrammarParser.Receive_typeContext ctx) {
         ArrayList<Node> parts = astCurrent().childrens();
         String varname = parts.get(0).getText();
-        String fullname = scopeStack.peek() + "." + varname;
+        String fullname = scopeStack.peek() + "." + varname; //nmmd
+
+//        System.out.println("Received");
 //        astBaseSet(ctx);
         parts.get(0).Set("value", fullname);
 
@@ -1307,7 +1311,8 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
                 type = getTypeOfPrimitive(ctx.operand().primitive_value());
             } else {
                 try {
-                    base = scopeStack.peek() + "." + base;
+                    base = scopeStack.peek() + "." + base;//NMM
+
                     type = Variables.TypeOf(base);
 
                     pointer = Variables.Get(base).Get("pointer");
@@ -1320,6 +1325,7 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
         } else if (ctx.expression_seletor() != null) {
             try {
                 base = scopeStack.peek() + "." + ctx.primary_expr().getText() + "." + ctx.expression_seletor().ID().getText();
+
                 subclasse = "selector";
                 type = Variables.TypeOf(base);
             } catch (Exception ex) {
@@ -1330,6 +1336,8 @@ public class IvannosysListener extends IvannosysGrammarBaseListener {
             try {
                 subclasse = "index";
                 base = scopeStack.peek() + "." + ctx.id;
+
+
                 type = Variables.TypeOf(base);
             } catch (Exception ex) {
 //                Logger.getLogger(IvannosysListener.class.getName()).Log(Level.SEVERE, null, ex);

+ 15 - 4
src/middlewares/BasicBlockMiddleware.java

@@ -15,6 +15,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
+import java.util.Objects;
 import java.util.regex.Pattern;
 
 /**
@@ -80,7 +81,7 @@ public class BasicBlockMiddleware implements MiddlewareInterface {
         instructions = block.Instructions();
 
         // Remove da quantidade o label inicial e final
-        Integer limit = instructions.size() - 2;
+        Integer limit = instructions.size() - 1;
 
         for (int i = 0; i < limit; i++) {
             instruction = instructions.get(i);
@@ -107,6 +108,7 @@ public class BasicBlockMiddleware implements MiddlewareInterface {
         leaders.put(lastLeader, instructionPosition);
 
         VerifyOcorrences();
+
         System.out.println(group);
     }
 
@@ -114,7 +116,7 @@ public class BasicBlockMiddleware implements MiddlewareInterface {
 //        System.out.println("leaders:" + leaders);
 //        System.out.println("RegBasicBlock:(" + nextLeader + ")(" + ((leaders.Get(nextLeader) - nextLeader) + 1) + ")");
 
-        group.RegisterBlock(nextLeader, (leaders.get(nextLeader) - nextLeader) + 1);
+        group.RegisterBlock(nextLeader, (leaders.get(nextLeader) - nextLeader));
 
         if (!leadersList.isEmpty()) {
             nextLeader = leadersList.remove(0);
@@ -160,23 +162,32 @@ public class BasicBlockMiddleware implements MiddlewareInterface {
         // Atribui o segundo leder como 
 //        block.LastPosition = nextLeader - 1;
 
+//        System.out.println("$$$$$$$$$$$$$$$$$$$$$$$ Quantidade de instrucoes:" + instructions.size());
+//        Integer global = 0;
         for (Iterator<Instruction> it = instructions.iterator(); it.hasNext();) {
+
             instruction = it.next();
+
             if (!instruction.in("type", ignore)) {
 
-//                System.out.println("Ins:(" + instructionPosition + ")(" + nextLeader + ")");
                 // Registra 
-                if (instructionPosition == nextLeader) {
+//                System.out.println("Ins:(" + instructionPosition + ")(" + nextLeader + ")");
+
+                if (Objects.equals(instructionPosition, nextLeader)) {
+//                    System.out.println("#####################Registrei um novo bloco###############");
 //                        block.CloseAllIntervals();
 //                        nextLeader = leadersList.remove(0);
 //                        block.LastPosition = nextLeader - 1;
                     RegBasicBlock();
                 }
+
                 // Registra os acessos de leitura e escrita dos enderecos da instrucao
                 group.ParseInstruction(instruction, "dst,p1,p2");
 
+//                System.out.println("Instruction >>>>>>>> :" + instructionPosition + " real:" + (global));
                 instructionPosition++;
             }
+//            global++;
         }
         // Finaliza o grupo de blocos
         group.Close();

+ 4 - 2
src/middlewares/BlockBaseGroup.java

@@ -43,9 +43,11 @@ public class BlockBaseGroup {
         if (current != null) {
             current.CloseAllIntervals();
         }
-//        System.out.println("Register block:" + name + "." + bbs.size() + "/" + (size - 1));
+
+//        System.out.println("Register block:" + name + "." + bbs.size() + "/" + size);
         BlockBaseOcorrences c = new BlockBaseOcorrences(name + "." + bbs.size(), leader);
-        c.LastPosition = (size - 1);
+//        c.LastPosition = (size - 1);
+        c.LastPosition = size;
         current = c;
         bbs.add(c);
     }

+ 19 - 2
src/middlewares/BlockBaseOcorrences.java

@@ -127,9 +127,12 @@ public class BlockBaseOcorrences {
                 ocorrences.put(a, new LinkedList<>());
             }
             ocorrences.get(a).add(Position);
+
             if (!Alive(a)) {
                 OpenInterval(a);
             }
+
+//            System.out.println("Register:a, Position," + a + ":" + Position);
             Get(a, Position).setLastOcorrence(Position);
         }
     }
@@ -144,13 +147,19 @@ public class BlockBaseOcorrences {
 
     public Interval Get(String var, int i) throws Exception {
         LinkedList<Interval> intervls = Get(var);
+
         if (intervls != null) {
+//            System.out.println("Encontrei o intervalo de " + var);
             for (Interval inter : intervls) {
+//                System.out.println("Interval:" + inter + ":" + i);
                 if (inter.Inside(i)) {
                     return inter;
                 }
             }
         }
+//        else {
+//            System.out.println("Encontrei o intervalo de " + var);
+//        }
         return null;
 //        throw new CompileException("Intervalo não definido para a variável %s na posição %d", var, i);
     }
@@ -173,7 +182,7 @@ public class BlockBaseOcorrences {
             }
         }
         inter = null;
-        System.out.println("Spill disp: " + is.size());
+//        System.out.println("Spill disp: (position:" + position + ") " + is.size());
         // is Contem todos os intervalos que podem ser divididos;
         // o intervalo escolhido é o que possui a ocorrencia mais longe
         int pos = 0, pos1, interpos;
@@ -186,7 +195,7 @@ public class BlockBaseOcorrences {
                 inter = x.getValue();
             }
         }
-        System.out.println("Spill inter: " + var + "|" + inter);
+//        System.out.println("Spill inter: " + var + "|" + inter);
         // Se encontrou um intervalo para ser dividido executa a divisao
         if (inter != null) {
             LinkedList<Interval> lintervals = intervals.get(var);
@@ -270,6 +279,14 @@ public class BlockBaseOcorrences {
         return buffer.toString();
     }
 
+    public int getLastPosition() {
+        return getLeader() + Position;
+    }
+
+    public int getSize() {
+        return Position;
+    }
+
 }
 
 //    protected void Register(Instruction x, String attr) {

+ 55 - 1
src/middlewares/CodeOtimizadorMiddleware.java

@@ -1,13 +1,14 @@
 package middlewares;
 
+import API.MiddlewareInterface;
 import common.Block;
 import common.Code;
 import common.Instruction;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
-import API.MiddlewareInterface;
 
 /**
  *
@@ -16,6 +17,7 @@ import API.MiddlewareInterface;
 public class CodeOtimizadorMiddleware implements MiddlewareInterface {
 
     protected Code code;
+    protected HashMap<String, Ocorrences> ConstantePropagation = new HashMap<>();
 //    protected ArrayList<Filtros> filtros = new ArrayList<Filtros>();
     protected boolean enable = true;
 
@@ -35,6 +37,7 @@ public class CodeOtimizadorMiddleware implements MiddlewareInterface {
             return;
         }
         int index = 0;
+        String dst;
         Block block = c.Block();
         Instruction last = null;
         LinkedList<Instruction> instructions = block.Instructions();
@@ -70,10 +73,14 @@ public class CodeOtimizadorMiddleware implements MiddlewareInterface {
 
 //            System.out.println("CodeOtimizadorProcessor2:" + inst.Get("type"));
             switch (inst.Get("type")) {
+
                 case "copy":
+//                    System.out.println("Copy:" + inst);
+
                     if (last != null && last.eq("dst", inst.Get("p1"))) {
                         last.copy("dst", inst);
                         remove.add(inst);
+                    } else if (inst.eq("p1value", "true")) {
                     }
 //                    if (!inst.eq("copy", "true")) {
 //                        if (!inst.isNumber("p1") && ReplaceVarAndRemoveInstruction(instructions, inst, index, block)) {
@@ -104,9 +111,35 @@ public class CodeOtimizadorMiddleware implements MiddlewareInterface {
 //                    }
                     break;
             }
+
+//            if (inst.Has("dst")) {
+//                dst = inst.Get("dst");
+//                if (!ConstantePropagation.containsKey(dst)) {
+//                    ConstantePropagation.put(dst, new Ocorrences());
+//                }
+//                ConstantePropagation.get(dst).Add(inst);
+//            }
+
             last = inst;
             index++;
         }
+
+//        Instruction inst;
+//        // Process constant propagation
+//        for (Map.Entry<String, Ocorrences> entry : ConstantePropagation.entrySet()) {
+//            LinkedList<Instruction> deps = entry.getValue().getDeps();
+//
+//            if (deps.size() > 2) {
+//                inst = deps.pollFirst();
+//                // Marca a instrucao pra remover
+//                remove.add(inst);
+//                inst.Get("p1");
+//                for (Instruction dep : deps) {
+//                    dep.Set("",);
+//                }
+//            }
+//        }
+
         if (!remove.isEmpty()) {
             for (Instruction instruction : remove) {
                 instructions.remove(instruction);
@@ -154,4 +187,25 @@ public class CodeOtimizadorMiddleware implements MiddlewareInterface {
 //        System.out.println("}");
         return true;
     }
+
+    private static class Ocorrences {
+
+        protected LinkedList<Instruction> deps = new LinkedList<>();
+
+        public Ocorrences() {
+        }
+
+        private void Add(Instruction inst) {
+            deps.add(inst);
+        }
+
+        public LinkedList<Instruction> getDeps() {
+            return deps;
+        }
+
+        public void setDeps(LinkedList<Instruction> deps) {
+            this.deps = deps;
+        }
+
+    }
 }

+ 2 - 0
src/middlewares/Interval.java

@@ -73,6 +73,8 @@ public class Interval {
     }
 
     public boolean Inside(int i) {
+
+//        return Start <= i && i <= ((End < this.LastOcorrence) ? this.LastOcorrence : End);
         return Start <= i && i <= End;
     }
 

+ 115 - 50
src/middlewares/LoadStoreMiddleware.java

@@ -40,12 +40,23 @@ public class LoadStoreMiddleware implements MiddlewareInterface {
         Instruction IL, IS;
         // Group contem a lista de blocos basicos do bloco atual
         group = basicBlocks.getGroups().get(blockname);
+        Instruction inst;
         HashMap<String, Boolean> loaded, stored;
         String varL, varS;
         Integer fix = 0;
+        int i, j, fixAllocCount = 0;
         group.Init();
 
-        System.out.println("Inicianado load store processor....");
+        System.out.println("Inicianado load store processor...." + blockname);
+
+        String[] ignore = "alloc,label".split(",");
+
+        for (int ctrl = 1; ctrl < instructions.size(); ctrl++) {
+            if (!instructions.get(ctrl).eq("type", "alloc")) {
+                break;
+            }
+            fixAllocCount++;
+        }
 
         while (true) {
             g = group.getCurrent();
@@ -53,69 +64,123 @@ public class LoadStoreMiddleware implements MiddlewareInterface {
             if (g == null) {
                 break;
             }
-            System.out.println("------------------------------>:");
-
-            // Corrige o endereco inicial do leader caso alguma instrucao tenha sido removida
-            leader = g.getLeader() - fix;
-
-            limit = leader + g.Position;
 
-            System.out.println("LoadStoreProcessor:[" + leader + "][" + limit + "]");
-
-            loaded = new HashMap<>();
+            // check stores
+            // Verifica a possibilidade de remover a instrucao atual considerando:
+            // * A instrucao é um store
+            // * O endereco carregado é uma variavel da pilha
+            // Variaveis globais sempre são gravadas
             stored = new HashMap<>();
+            leader = g.getLeader() + fixAllocCount;
+            i = j = (g.getLastPosition() + fixAllocCount);
 
-            for (int i = leader, j = limit - 1; i < limit; i++, j--) {
-                IL = instructions.get(i);
+//            System.out.println("------------------------------>(" + leader + "|" + i + "|F" + fixAllocCount + "):");
+            for (; i > leader; j--) {
                 IS = instructions.get(j);
-
-                varL = IL.Get("p1");
-                varS = IS.Get("p1");
-                // Verifica a possibilidade de remover a instrucao atual considerando:
-                // * A instrucao é um load
-                // * O endereco carregado é uma variavel da pilha
-                // Variaveis globais sempre são lidas
-
-                if (IL.eq("type", "load") && varL.contains("_V")) {
-//                    System.out.println("Looad:" + instruction);
-                    if (loaded.containsKey(varL)) {
-                        remove.add(IL);
-                        fix++;
-                    } else {
-                        loaded.put(varL, Boolean.TRUE);
-                    }
+                if (IS.in("type", ignore)) {
+                    continue;
+                }
+//                System.out.println("type :" + IS.Get("type"));
+                switch (IS.Get("type")) {
+                    case "store":
+                        varS = IS.Get("dst");
+//                        System.out.println("[" + i + "]Era store de " + varS);
+
+                        // Se não for uma variavel global
+                        if (!varS.contains("_G")) {
+//
+//                            System.out.println("[" + i + "]Verificando ocorrencia de  " + varS + " " + stored.containsKey(varS));
+
+                            if (stored.containsKey(varS)) {
+//                                System.out.println("[" + i + "]Marcada para ser removida");
+                                remove.add(IS);
+                            } else {
+//                                System.out.println("[" + i + "]Adicionando primeira ocorrencia");
+                                stored.put(varS, Boolean.TRUE);
+                            }
+                        }
+                        break;
+                    case "load":
+                        varS = IS.Get("p1");
+                        if (stored.containsKey(varS)) {
+//                            System.out.println("Remove " + varS + " dos stores");
+                            stored.remove(varS);
+                        }
+                        break;
+                    default:
+//                        System.out.println("Instruction " + IS);
+//                        for (String param : "dst,dst.indice".split(",")) {
+//                            if (IS.Has(param)) {
+//                                varS = IS.Get(param);
+//                                if (stored.containsKey(varS)) {
+//                                    stored.remove(varS);
+//                                }
+//                            }
+//                        }
+//                        System.out.println("[" + i + "]Nao Era store de " + IS.Get("type"));
                 }
 
-                // Verifica a possibilidade de remover a instrucao atual considerando:
-                // * A instrucao é um store
-                // * O endereco carregado é uma variavel da pilha
-                // Variaveis globais sempre são gravadas
-//                if (IS.eq("type", "store") && varS.contains("_V")) {
-//                    if (varS.equals("_V8")) {
-//                        System.out.println("Looad:" + IS + " > " + stored.containsKey(varS));
-//                    }
-//                    if (stored.containsKey(varS)) {
-//                        remove.add(IS);
-//                        fix++;
-//                    } else {
-//                        stored.put(varS, Boolean.TRUE);
-//                    }
-//                }
+                i--;
             }
-            // Corrige o endereco final do bloco caso alguma instrucao tenha sido removida
-            g.setLeader(leader);
-            g.Position -= fix;
-
-            System.out.println("------------------------------<:" + g);
+//            System.out.println("------------------------------<:");
 
             if (!group.NextBlock()) {
                 break;
             }
         }
+        boolean changed = !remove.isEmpty();
+        // Remove as instruções sinalizadas para remorcao
+        System.out.println("Foram removidas " + remove.size() + " instruções de store.");
 
-        for (Instruction i : remove) {
-            instructions.remove(i);
+        while (!remove.isEmpty()) {
+            instructions.remove(remove.remove(0));
+        }
+
+        // Atualiza os blocos basicos e ocorrencias de variaveis
+        if (changed) {
+            cp.get("ir.basic.blocks").Exec(c, cp);
         }
     }
 
+    private void UpdateBasicBlocksReference() {
+
+    }
+
 }
+
+//            // Corrige o endereco inicial do leader caso alguma instrucao tenha sido removida
+//            leader = g.getLeader() - fix;
+//            limit = leader + g.Position;
+//
+//            System.out.println("LoadStoreProcessor:[" + leader + "][" + limit + "]");
+//
+//            loaded = new HashMap<>();
+//            stored = new HashMap<>();
+//
+//            for (int i = limit - 1; i > leader; i++, j--) {
+//
+//            }
+//            for (int i = leader, j = limit - 1; i < limit; i++, j--) {
+//                IL = instructions.get(i);
+//                IS = instructions.get(j);
+//
+//                varL = IL.Get("p1");
+//                varS = IS.Get("p1");
+//                // Verifica a possibilidade de remover a instrucao atual considerando:
+//                // * A instrucao é um load
+//                // * O endereco carregado é uma variavel da pilha
+//                // Variaveis globais sempre são lidas
+//
+//                if (IL.eq("type", "load") && varL.contains("_V")) {
+////                    System.out.println("Looad:" + instruction);
+//                    if (loaded.containsKey(varL)) {
+//                        remove.add(IL);
+//                        fix++;
+//                    } else {
+//                        loaded.put(varL, Boolean.TRUE);
+//                    }
+//                }
+//            }
+// Corrige o endereco final do bloco caso alguma instrucao tenha sido removida
+//            g.setLeader(leader);
+//            g.Position -= fix;

+ 0 - 377
src/samples/program_jun_bit_count_1.go

@@ -81,380 +81,3 @@ func bitCount(init int32, core int32){
 func main(){
     bitCount(18750,1)
 }
-
-/*
-
-$$$$$$$$$$$$$$$$ SetLoaded:_S6:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S8:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S10:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S12:false
-$$$$$$$$$$$$$$$$ LOADED _S2 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S2:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S14:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:false
-$$$$$$$$$$$$$$$$ LOADED _S15 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S15:true
-$$$$$$$$$$$$$$$$ LOADED _S17 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:true
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:false
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:false
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S22 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S22:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:false
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:false
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:false
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ LOADED _S27 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S27:true
-$$$$$$$$$$$$$$$$ LOADED _S26 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S26:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S30:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : true
-$$$$$$$$$$$$$$$$ LOADED _S32 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S32:true
-$$$$$$$$$$$$$$$$ LOADED _S32 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S36[_T34]:false
-$$$$$$$$$$$$$$$$ LOADED _S29 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S29:true
-
-package main
-
-import (
-	"fmt"
-)
-
-var (
-    result [4][32]int
-)
-
-func bitCount(init int, core int){
-    var (
-        n int
-        x int
-        tmp  = 0
-        seed = 112500
-    )
-
-    for i:= init; i < init + 4500; i++ {
-        n = 0
-	x = seed
-	fmt.Println("X: ", x)
-        if x > 0 {
-            for true {
-                n++
-                if x = x & (x-1); x == 0 {
-                   break
-                }
-            }
-            tmp += n
-        }
-	seed +=13
-    }
-    fmt.Println(tmp)
-}
-*/
-
-/**	
-		<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217795	j 10c <bitCount+0xf8>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847517	blez v0,dc <bitCount+0xc8>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217774	j b8 <bitCount+0xa4>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2413101080	lw s5,24(fp)		.16 -- load content from _VN13 in s5
- 84:  0000000000	sll zero,zero,0		.16 -- Nop
- 88:  2949971992	sw s5,24(fp)		.17 -- store content of s5 in _VN13
- 8c:  2413232156	lw s7,28(fp)		.18 -- load content from _VX16 in s7
- 90:  0000000000	sll zero,zero,0		.18 -- Nop
- 94:  0653262847	addiu t7,s7,-1		.19 -- _T20 = _S19 - 1
- 98:  0049266724	and t8,s7,t7		.20 -- _T21 = _S19 & _T20
- 9c:  2950168604	sw t8,28(fp)		.21 -- store content of t8 in _VX16
- a0:  2413232156	lw s7,28(fp)		.22 -- load content from _VX16 in s7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0383778819	bne zero,s7,b8 <bitCount+0xa4>		.23 -- branch if not equals
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  0134217776	j c0 <bitCount+0xac>		.24 -- jump to bitCount+_i7
- b4:  0000000000	sll zero,zero,0		.24 -- Nop
- b8:  0134217757	j 74 <bitCount+0x60>		.25 -- jump to bitCount+_i6
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  2412904456	lw s2,8(fp)		.26 -- load content from _VTMP5 in s2
- c4:  2413035544	lw s4,24(fp)		.27 -- load content from _VN13 in s4
- c8:  0000000000	sll zero,zero,0		.27 -- Nop
- cc:  0039096353	addu s2,s2,s4		.28 -- _S23 = _S23 + _S22
- d0:  2412904456	lw s2,8(fp)		.29 -- load content from _VTMP5 in s2
- d4:  0000000000	sll zero,zero,0		.29 -- Nop
- d8:  2949775368	sw s2,8(fp)		.30 -- store content of s2 in _VTMP5
- dc:  2412773392	lw s0,16(fp)		.31 -- load content from _VSEED9 in s0
- e0:  0000000000	sll zero,zero,0		.31 -- Nop
- e4:  0638582797	addiu s0,s0,13		.32 -- _S24 = _S24 + 13
- e8:  2412773392	lw s0,16(fp)		.33 -- load content from _VSEED9 in s0
- ec:  0000000000	sll zero,zero,0		.33 -- Nop
- f0:  2949644304	sw s0,16(fp)		.34 -- store content of s0 in _VSEED9
- f4:  2413232148	lw s7,20(fp)		.35 -- load content from _VI11 in s7
- f8:  0000000000	sll zero,zero,0		.35 -- Nop
- fc:  0653721601	addiu s7,s7,1		.36 -- _S25 = _S25 + 1
-100:  2413232148	lw s7,20(fp)		.37 -- load content from _VI11 in s7
-104:  0000000000	sll zero,zero,0		.37 -- Nop
-108:  2950103060	sw s7,20(fp)		.38 -- store content of s7 in _VI11
-10c:  2413035520	lw s4,0(fp)		.39 -- load content from _VINIT1 in s4
-110:  0000000000	sll zero,zero,0		.39 -- Nop
-114:  0646713748	addiu t4,s4,4500		.40 -- _T28 = _S27 + 4500
-118:  2412838932	lw s1,20(fp)		.41 -- load content from _VI11 in s1
-11c:  0000000000	sll zero,zero,0		.41 -- Nop
-120:  0036442147	subu v0,s1,t4		.42
-124:  0071368648	bltz v0,48 <bitCount+0x34>		.42 -- branch if register < 0
-128:  0000000000	sll zero,zero,0		.42 -- Nop
-12c:  2413101060	lw s5,4(fp)		.43 -- load content from _VCORE3 in s5
-130:  0000000000	sll zero,zero,0		.43 -- Nop
-134:  0001403200	sll t5,s5,5		.44 -- _T31 = _S30 << 5
-138:  2413166604	lw s6,12(fp)		.45 -- load content from _VZERO7 in s6
-13c:  0000000000	sll zero,zero,0		.45 -- Nop
-140:  0028731425	addu t5,t5,s6		.46 -- _T31 = _T31 + _S32
-144:  0000880768	sll t6,t5,2		.47 -- _T34 = _T31 << 2
-148:  2413035528	lw s4,8(fp)		.48 -- load content from _VTMP5 in s4
-14c:  0000000000	sll zero,zero,0		.48 -- Nop
-150:  2916352000	sw s4,0(t6)		.49 -- store content of s4 in _G35[_T34]
-154:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-158:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-15c:  0065011720	jr ra		 -- epilog| return
-
-
-Target[mips]:
-	<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217785	j e4 <bitCount+0xd0>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847511	blez v0,c4 <bitCount+0xb0>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217770	j a8 <bitCount+0x94>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
- 
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2949971992	sw s5,24(fp)		.16 -- store content of s5 in _VN13
- 84:  2413232156	lw s7,28(fp)		.17 -- load content from _VX16 in s7
- 88:  0000000000	sll zero,zero,0		.17 -- Nop
- 8c:  0653262847	addiu t7,s7,-1		.18 -- _T20 = _S19 - 1
- 90:  0049266724	and t8,s7,t7		.19 -- _T21 = _S19 & _T20
- 94:  2950168604	sw t8,28(fp)		.20 -- store content of t8 in _VX16
- 98:  0383778819	bne zero,s7,a8 <bitCount+0x94>		.21 -- branch if not equals
- 
- 9c:  0000000000	sll zero,zero,0		.21 -- Nop
- a0:  0134217772	j b0 <bitCount+0x9c>		.22 -- jump to bitCount+_i7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0134217757	j 74 <bitCount+0x60>		.23 -- jump to bitCount+_i6
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  2412904456	lw s2,8(fp)		.24 -- load content from _VTMP5 in s2
- b4:  2413035544	lw s4,24(fp)		.25 -- load content from _VN13 in s4
- b8:  0000000000	sll zero,zero,0		.25 -- Nop
- bc:  0039096353	addu s2,s2,s4		.26 -- _S23 = _S23 + _S22
- c0:  2949775368	sw s2,8(fp)		.27 -- store content of s2 in _VTMP5
- 
- c4:  2412773392	lw s0,16(fp)		.28 -- load content from _VSEED9 in s0
- c8:  0000000000	sll zero,zero,0		.28 -- Nop
- cc:  0638582797	addiu s0,s0,13		.29 -- _S24 = _S24 + 13
- d0:  2949644304	sw s0,16(fp)		.30 -- store content of s0 in _VSEED9
- d4:  2413232148	lw s7,20(fp)		.31 -- load content from _VI11 in s7
- d8:  0000000000	sll zero,zero,0		.31 -- Nop
- dc:  0653721601	addiu s7,s7,1		.32 -- _S25 = _S25 + 1
- e0:  2950103060	sw s7,20(fp)		.33 -- store content of s7 in _VI11
- e4:  2413035520	lw s4,0(fp)		.34 -- load content from _VINIT1 in s4
- e8:  0000000000	sll zero,zero,0		.34 -- Nop
- ec:  0646713748	addiu t4,s4,4500		.35 -- _T28 = _S27 + 4500
- f0:  2412838932	lw s1,20(fp)		.36 -- load content from _VI11 in s1
- f4:  0000000000	sll zero,zero,0		.36 -- Nop
- f8:  0036442147	subu v0,s1,t4		.37
- fc:  0071368658	bltz v0,48 <bitCount+0x34>		.37 -- branch if register < 0
-100:  0000000000	sll zero,zero,0		.37 -- Nop
-104:  2413101060	lw s5,4(fp)		.38 -- load content from _VCORE3 in s5
-108:  0000000000	sll zero,zero,0		.38 -- Nop
-10c:  0001403200	sll t5,s5,5		.39 -- _T31 = _S30 << 5
-110:  2413166604	lw s6,12(fp)		.40 -- load content from _VZERO7 in s6
-114:  0000000000	sll zero,zero,0		.40 -- Nop
-118:  0028731425	addu t5,t5,s6		.41 -- _T31 = _T31 + _S32
-11c:  0000880768	sll t6,t5,2		.42 -- _T34 = _T31 << 2
-120:  2413035528	lw s4,8(fp)		.43 -- load content from _VTMP5 in s4
-124:  0000000000	sll zero,zero,0		.43 -- Nop
-128:  2916352000	sw s4,0(t6)		.44 -- store content of s4 in _G35[_T34]
-12c:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-130:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-134:  0065011720	jr ra		 -- epilog| return
-
-
-		<main>:
-  0:  0604522814	addiu t0,zero,18750		.2 -- load param (p1)
-  4:  0604260670	addiu a0,zero,18750		.2 -- push param
-  8:  0604569601	addiu t1,zero,1		.2 -- load param (p1)
-  c:  0604307457	addiu a1,zero,1		.2 -- push param
- 10:  0201326599	jal 1c <bitCount+0x0>		.2 -- jump to <bitCount>
- 14:  0000000000	sll zero,zero,0		.2 -- Nop
- 18:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 1c:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 20:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 24:  2412773376	lw s0,fp,0		.0 -- load content from _V1 in s0
- 28:  0000000000	sll zero,zero,0		.0 -- Nop
- 2c:  2948857856	sw a0,fp,0		.1 -- pop param
- 30:  2412838916	lw s1,fp,4		.2 -- load content from _V2 in s1
- 34:  0000000000	sll zero,zero,0		.2 -- Nop
- 38:  2948923396	sw a1,fp,4		.3 -- pop param
- 3c:  0605159424	addiu s2,zero,0		.4 -- copy _V3 ← 0
- 40:  2949775368	sw s2,fp,8		.5 -- store content of s2 in _V3
- 44:  0605224960	addiu s3,zero,0		.6 -- copy _V4 ← 0
- 48:  2949840908	sw s3,fp,12		.7 -- store content of s3 in _V4
- 4c:  1007943681	lui s4,1		.8 -- load param upper(p1)
- 50:  0915715956	ori s4,s4,46964		.8 -- load param lower(p1)
- 54:  2949906448	sw s4,fp,16		.9 -- store content of s4 in _V5
- 58:  2412773376	lw s0,fp,0		.10 -- load content from _V1 in s0
- 5c:  0000000000	sll zero,zero,0		.10 -- Nop
- 60:  0001091617	addu s5,zero,s0		.11 -- copy _V6 ← _V1
- 64:  2949971988	sw s5,fp,20		.12 -- store content of s5 in _V6
- 68:  0134217805	j 134 <bitCount+0x118>		.13 -- jump to bitCount+_i3
- 6c:  0000000000	sll zero,zero,0		.13 -- Nop
- 70:  0605421568	addiu s6,zero,0		.14 -- copy _V7 ← 0
- 74:  2950037528	sw s6,fp,24		.15 -- store content of s6 in _V7
- 78:  2413232144	lw s7,fp,16		.16 -- load content from _V5 in s7
- 7c:  0000000000	sll zero,zero,0		.16 -- Nop
- 80:  0001542177	addu s1,zero,s7		.17 -- copy _V8 ← _V5
- 84:  2949709852	sw s1,fp,28		.18 -- store content of s1 in _V8
- 88:  2412838940	lw s1,fp,28		.19 -- load content from _V8 in s1
- 8c:  0000000000	sll zero,zero,0		.19 -- Nop
- 90:  0035655715	subu v0,s1,zero		.20
- 94:  0406847517	blez zero,v0,10c <bitCount+0xf0>		.20 -- branch if register <= 0
- 98:  0000000000	sll zero,zero,0		.20 -- Nop
- 9c:  0134217788	j f0 <bitCount+0xd4>		.21 -- jump to bitCount+_i9
- a0:  0000000000	sll zero,zero,0		.21 -- Nop
- a4:  2412904472	lw s2,fp,24		.22 -- load content from _V7 in s2
- a8:  0000000000	sll zero,zero,0		.22 -- Nop
- ac:  0604831745	addiu t5,zero,1		.23 -- load param (p2)
- b0:  0642908161	addiu s2,s2,1		.23 -- _V7 = _V7 + 1
- b4:  2949775384	sw s2,fp,24		.24 -- store content of s2 in _V7
- b8:  2412970012	lw s3,fp,28		.25 -- load content from _V8 in s3
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  0604897281	addiu t6,zero,1		.26 -- load param (p2)
- c4:  0644874239	addiu t7,s3,-1		.26 -- _T9 = _V8 - 1
- c8:  2412970012	lw s3,fp,28		.27 -- load content from _V8 in s3
- cc:  0000000000	sll zero,zero,0		.27 -- Nop
- d0:  0040867876	and s3,s3,t7		.28 -- _V8 = _V8 & _T9
- d4:  2949840924	sw s3,fp,28		.29 -- store content of s3 in _V8
- d8:  2412970012	lw s3,fp,28		.30 -- load content from _V8 in s3
- dc:  0000000000	sll zero,zero,0		.30 -- Nop
- e0:  0375390211	bne zero,s3,f0 <bitCount+0xd4>		.31 -- branch if not equals
- e4:  0000000000	sll zero,zero,0		.31 -- Nop
- e8:  0134217790	j f8 <bitCount+0xdc>		.32 -- jump to bitCount+_i7
- ec:  0000000000	sll zero,zero,0		.32 -- Nop
- f0:  0134217769	j a4 <bitCount+0x88>		.33 -- jump to bitCount+_i6
- f4:  0000000000	sll zero,zero,0		.33 -- Nop
- f8:  2413035528	lw s4,fp,8		.34 -- load content from _V3 in s4
- fc:  2412773400	lw s0,fp,24		.35 -- load content from _V7 in s0
-100:  0000000000	sll zero,zero,0		.35 -- Nop
-104:  0043032609	addu s4,s4,s0		.36 -- _V3 = _V3 + _V7
-108:  2949906440	sw s4,fp,8		.37 -- store content of s4 in _V3
-10c:  2413101072	lw s5,fp,16		.38 -- load content from _V5 in s5
-110:  0000000000	sll zero,zero,0		.38 -- Nop
-114:  0604504077	addiu t0,zero,13		.39 -- load param (p2)
-118:  0649396237	addiu s5,s5,13		.39 -- _V5 = _V5 + 13
-11c:  2949971984	sw s5,fp,16		.40 -- store content of s5 in _V5
-120:  2413166612	lw s6,fp,20		.41 -- load content from _V6 in s6
-124:  0000000000	sll zero,zero,0		.41 -- Nop
-128:  0604569601	addiu t1,zero,1		.42 -- load param (p2)
-12c:  0651558913	addiu s6,s6,1		.42 -- _V6 = _V6 + 1
-130:  2950037524	sw s6,fp,20		.43 -- store content of s6 in _V6
-134:  2413232128	lw s7,fp,0		.44 -- load content from _V1 in s7
-138:  0000000000	sll zero,zero,0		.44 -- Nop
-13c:  0604639636	addiu t2,zero,4500		.45 -- load param (p2)
-140:  0652939668	addiu t3,s7,4500		.45 -- _T11 = _V1 + 4500
-144:  2412838932	lw s1,fp,20		.46 -- load content from _V6 in s1
-148:  0000000000	sll zero,zero,0		.46 -- Nop
-14c:  0036376611	subu v0,s1,t3		.47
-150:  0071368647	bltz 00000,v0,70 <bitCount+0x54>		.47 -- branch if register < 0
-154:  0000000000	sll zero,zero,0		.47 -- Nop
-158:  2412904452	lw s2,fp,4		.48 -- load content from _V2 in s2
-15c:  0000000000	sll zero,zero,0		.48 -- Nop
-160:  0001204257	addu t4,zero,s2		.49 -- copy _T12 ← _V2
-164:  0000813376	sll t5,t4,5		.50 -- _T13 = _T12 << 5
-168:  2412969996	lw s3,fp,12		.51 -- load content from _V4 in s3
-16c:  0000000000	sll zero,zero,0		.51 -- Nop
-170:  0001273889	addu t6,zero,s3		.52 -- copy _T15 ← _V4
-174:  0028207137	addu t5,t5,t6		.53 -- _T13 = _T13 + _T15
-178:  0000882816	sll t7,t5,2		.54 -- _T19 = _T13 << 2
-17c:  2412773384	lw s0,fp,8		.55 -- load content from _V3 in s0
-180:  0000000000	sll zero,zero,0		.55 -- Nop
-184:  2918449152	sw s4,t7,0		.57 -- store content of s4 in _G21[_T19]
-188:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-18c:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-190:  0065011720	jr ra		 -- epilog| return	  T< store >	
-*/

+ 0 - 234
src/samples/program_jun_bytes.go

@@ -59,237 +59,3 @@ func main() {
         origin[i] = i
     }
 }
-
-/**
-main.@preenche_matriz.main.@preenche_matriz.value : _V8
-main.@preenche_matriz.@for_0.main.@preenche_matriz.@for_0.i : _V6
-main.@preenche_matriz.@for_0.@for_1.COL : 4
-main.@preenche_matriz.main.@preenche_matriz.LM1 : _V3
-main.@preenche_matriz.@for_0.@for_1.LM1 : _V3
-main.main.result : _G90
-main.@preenche_matriz.w : _V1
-main.@preenche_matriz.@for_0.@for_1.main.@preenche_matriz.@for_0.@for_1.j : _V7
-main.@preenche_matriz.@for_0.@for_1.CM1 : _V5
-main.@preenche_matriz.@for_0.@for_1.value : _V8
-main.@preenche_matriz.@for_0.LIN : 4
-_V1 : main.@preenche_matriz.w
-_V3 : main.@preenche_matriz.LM1
-_V6 : main.@preenche_matriz.@for_0.i
-_V5 : main.@preenche_matriz.CM1
-main.@preenche_matriz.@for_0.i : _V6
-_V8 : main.@preenche_matriz.@for_0.@for_1.value
-_V7 : main.@preenche_matriz.@for_0.@for_1.j
-_G18 : main.main.origin
-main.@preenche_matriz.@for_0.@for_1.i : _V6
-main.@preenche_matriz.CM1 : _V5
-main.@preenche_matriz.LIN : 4
-main.@preenche_matriz.main.@preenche_matriz.CM1 : _V5
-main.@preenche_matriz.COL : 4
-main.@preenche_matriz.main.@preenche_matriz.w : _V1
-main.@preenche_matriz.@for_0.@for_1.origin : _G18
-main.main.origin : _G18
-_G90 : main.main.result
-main.@preenche_matriz.@for_0.@for_1.w : _V1
-main.@preenche_matriz.LM1 : _V3
-main.@preenche_matriz.@for_0.@for_1.j : _V7
-
-
-
-4 : main.@laplaciano.LIN
-main.@laplaciano.LIN : 4
-
-main.@laplaciano.COL : 4
-
-_V22 : main.@laplaciano.CM1
-main.@laplaciano.CM1 : _V22
-main.@laplaciano.main.@laplaciano.CM1 : _V22
-main.@laplaciano.@for_3.@for_4.CM1 : _V22
-
-_V20 : main.@laplaciano.LM1
-main.@laplaciano.LM1 : _V20
-main.@laplaciano.@for_3.LM1 : _V20
-main.@laplaciano.main.@laplaciano.LM1 : _V20
-
-main.@laplaciano.@for_3.i : _V23
-_V23 : main.@laplaciano.@for_3.i
-main.@laplaciano.@for_3.@for_4.i : _V23
-main.@laplaciano.@for_3.main.@laplaciano.@for_3.i : _V23
-
-main.@laplaciano.main.@laplaciano.l : _V36
-main.@laplaciano.@for_3.@for_4.l : _V36
-_V36 : main.@laplaciano.@for_3.@for_4.l
-
-_V24 : main.@laplaciano.@for_3.@for_4.j
-main.@laplaciano.@for_3.@for_4.j : _V24
-main.@laplaciano.@for_3.@for_4.main.@laplaciano.@for_3.@for_4.j : _V24
-
-main.@laplaciano.@for_3.@for_4.origin : _G18
-main.@laplaciano.@for_3.@for_4.result : _G90
-
-		<laplaciano>:
-16c:  0666763244	addiu sp,sp,-20		 -- prolog| push stack frame
-170:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
-174:  0605028355	addiu s0,zero,3		.0 -- copy _V20 ← 3
-178:  2949644288	sw s0,fp,0		.1 -- store content of s0 in _V20
-17c:  0605093891	addiu s1,zero,3		.2 -- copy _V22 ← 3
-180:  2949709828	sw s1,fp,4		.3 -- store content of s1 in _V22
-184:  0605159425	addiu s2,zero,1		.4 -- copy _V23 ← 1
-188:  2949775368	sw s2,fp,8		.5 -- store content of s2 in _V23
-18c:  0134217958	j 398 <laplaciano+0x22c>		.6 -- jump to laplaciano+_i20
-190:  0000000000	sll zero,zero,0		.6 -- Nop
-194:  0605224961	addiu s3,zero,1		.7 -- copy _V24 ← 1
-198:  2949840908	sw s3,fp,12		.8 -- store content of s3 in _V24
-19c:  0134217948	j 370 <laplaciano+0x204>		.9 -- jump to laplaciano+_i24
-1a0:  0000000000	sll zero,zero,0		.9 -- Nop
-1a4:  2413035528	lw s4,fp,8		.10 -- load content from _V23 in s4
-1a8:  0000000000	sll zero,zero,0		.10 -- Nop
-1ac:  0646840319	addiu t5,s4,-1		.11 -- _T26 = _V23 - 1
-1b0:  0000880768	sll t6,t5,2		.12 -- _T27 = _T26 << 2
-1b4:  2413101068	lw s5,fp,12		.13 -- load content from _V24 in s5
-1b8:  0000000000	sll zero,zero,0		.13 -- Nop
-1bc:  0001407009	addu t7,zero,s5		.14 -- copy _T29 ← _V24
-1c0:  0030371873	addu t6,t6,t7		.15 -- _T27 = _T27 + _T29
-1c4:  0000966784	sll t8,t6,2		.16 -- _T33 = _T27 << 2
-1c8:  0060342305	addu t8,gp,t8		.17
-1cc:  2400583680	lw s6,t8,0		.17
-1d0:  0000000000	sll zero,zero,0		.17 -- Nop
-1d4:  0001488929	addu s7,zero,s6		.17 -- copy s7 ← s6
-1d8:  2950103056	sw s7,fp,16		.18 -- store content of s7 in _V36
-1dc:  2413035528	lw s4,fp,8		.19 -- load content from _V23 in s4
-1e0:  0000000000	sll zero,zero,0		.19 -- Nop
-1e4:  0001327137	addu t0,zero,s4		.20 -- copy _T37 ← _V23
-1e8:  0000542848	sll t1,t0,2		.21 -- _T38 = _T37 << 2
-1ec:  2413101068	lw s5,fp,12		.22 -- load content from _V24 in s5
-1f0:  0000000000	sll zero,zero,0		.22 -- Nop
-1f4:  0648806399	addiu t3,s5,-1		.23 -- _T41 = _V24 - 1
-1f8:  0019613729	addu t1,t1,t3		.24 -- _T38 = _T38 + _T41
-1fc:  0000614528	sll t4,t1,2		.25 -- _T45 = _T38 << 2
-200:  0059531297	addu t4,gp,t4		.26
-204:  2374828032	lw t5,t4,0		.26
-208:  2413232144	lw s7,fp,16		.27 -- load content from _V36 in s7
-20c:  0000000000	sll zero,zero,0		.27 -- Nop
-210:  0049133601	addu s7,s7,t5		.28 -- _V36 = _V36 + _T47
-214:  2950103056	sw s7,fp,16		.29 -- store content of s7 in _V36
-218:  2413035528	lw s4,fp,8		.30 -- load content from _V23 in s4
-21c:  0000000000	sll zero,zero,0		.30 -- Nop
-220:  0001341473	addu t7,zero,s4		.31 -- copy _T48 ← _V23
-224:  0001011840	sll t6,t7,2		.32 -- _T49 = _T48 << 2
-228:  2413101068	lw s5,fp,12		.33 -- load content from _V24 in s5
-22c:  0000000000	sll zero,zero,0		.33 -- Nop
-230:  0648544257	addiu t0,s5,1		.34 -- _T52 = _V24 + 1
-234:  0029913121	addu t6,t6,t0		.35 -- _T49 = _T49 + _T52
-238:  0000938112	sll t2,t6,2		.36 -- _T56 = _T49 << 2
-23c:  0059396129	addu t2,gp,t2		.37
-240:  2370502656	lw t3,t2,0		.37
-244:  2413232144	lw s7,fp,16		.38 -- load content from _V36 in s7
-248:  0000000000	sll zero,zero,0		.38 -- Nop
-24c:  0049002529	addu s7,s7,t3		.39 -- _V36 = _V36 + _T58
-250:  2950103056	sw s7,fp,16		.40 -- store content of s7 in _V36
-254:  2413035528	lw s4,fp,8		.41 -- load content from _V23 in s4
-258:  0000000000	sll zero,zero,0		.41 -- Nop
-25c:  0646709249	addiu t4,s4,1		.42 -- _T60 = _V23 + 1
-260:  0000813184	sll t5,t4,2		.43 -- _T61 = _T60 << 2
-264:  2413101068	lw s5,fp,12		.44 -- load content from _V24 in s5
-268:  0000000000	sll zero,zero,0		.44 -- Nop
-26c:  0001407009	addu t7,zero,s5		.45 -- copy _T63 ← _V24
-270:  0028272673	addu t5,t5,t7		.46 -- _T61 = _T61 + _T63
-274:  0000901248	sll t8,t5,2		.47 -- _T67 = _T61 << 2
-278:  0060342305	addu t8,gp,t8		.48
-27c:  2399666176	lw t0,t8,0		.48
-280:  2413232144	lw s7,fp,16		.49 -- load content from _V36 in s7
-284:  0000000000	sll zero,zero,0		.49 -- Nop
-288:  0048805921	addu s7,s7,t0		.50 -- _V36 = _V36 + _T69
-28c:  2950103056	sw s7,fp,16		.51 -- store content of s7 in _V36
-290:  2413035528	lw s4,fp,8		.52 -- load content from _V23 in s4
-294:  0000000000	sll zero,zero,0		.52 -- Nop
-298:  0001339425	addu t6,zero,s4		.53 -- copy _T70 ← _V23
-29c:  0000938112	sll t2,t6,2		.54 -- _T71 = _T70 << 2
-2a0:  2413101068	lw s5,fp,12		.55 -- load content from _V24 in s5
-2a4:  0000000000	sll zero,zero,0		.55 -- Nop
-2a8:  0001398817	addu t3,zero,s5		.56 -- copy _T73 ← _V24
-2ac:  0021712929	addu t2,t2,t3		.57 -- _T71 = _T71 + _T73
-2b0:  0000673920	sll t1,t2,2		.58 -- _T77 = _T71 << 2
-2b4:  0059328545	addu t1,gp,t1		.59
-2b8:  2368929792	lw s3,t1,0		.59
-2bc:  0000000000	sll zero,zero,0		.59 -- Nop
-2c0:  0001269793	addu t4,zero,s3		.59 -- copy t4 ← s3
-2c4:  0604962820	addiu t7,zero,4		.60
-2c8:  0026175512	mult t4,t7		.60 -- _T80 = _T79 * 4
-2cc:  0000026642	mflo t5		.60
-2d0:  2413232144	lw s7,fp,16		.61 -- load content from _V36 in s7
-2d4:  0000000000	sll zero,zero,0		.61 -- Nop
-2d8:  0049133601	addu s7,s7,t5		.62 -- _V36 = _V36 + _T80
-2dc:  2950103056	sw s7,fp,16		.63 -- store content of s7 in _V36
-2e0:  2413232144	lw s7,fp,16		.64 -- load content from _V36 in s7
-2e4:  0000000000	sll zero,zero,0		.64 -- Nop
-2e8:  0605552895	addiu t8,zero,255		.65
-2ec:  0049811491	subu v0,s7,t8		.65
-2f0:  0406847493	blez v0,308 <laplaciano+0x19c>		.65 -- branch if register <= 0
-2f4:  0000000000	sll zero,zero,0		.65 -- Nop
-2f8:  0605421823	addiu s6,zero,255		.66 -- copy _V36 ← 255
-2fc:  2950037520	sw s6,fp,16		.67 -- store content of s6 in _V36
-300:  0134217931	j 32c <laplaciano+0x1c0>		.68 -- jump to laplaciano+_i25
-304:  0000000000	sll zero,zero,0		.68 -- Nop
-308:  2412773392	lw s0,fp,16		.69 -- load content from _V36 in s0
-30c:  0000000000	sll zero,zero,0		.69 -- Nop
-310:  0033558563	subu v0,s0,zero		.70
-314:  0071303173	bgez v0,32c <laplaciano+0x1c0>		.70 -- branch if register >= 0
-318:  0000000000	sll zero,zero,0		.70 -- Nop
-31c:  0605093888	addiu s1,zero,0		.71 -- copy _V36 ← 0
-320:  2949709840	sw s1,fp,16		.72 -- store content of s1 in _V36
-324:  0134217931	j 32c <laplaciano+0x1c0>		.73 -- jump to laplaciano+_i25
-328:  0000000000	sll zero,zero,0		.73 -- Nop
-32c:  2412904456	lw s2,fp,8		.74 -- load content from _V23 in s2
-330:  0000000000	sll zero,zero,0		.74 -- Nop
-334:  0001200161	addu t2,zero,s2		.75 -- copy _T81 ← _V23
-338:  0000673920	sll t1,t2,2		.76 -- _T82 = _T81 << 2
-33c:  2413035532	lw s4,fp,12		.77 -- load content from _V24 in s4
-340:  0000000000	sll zero,zero,0		.77 -- Nop
-344:  0001335329	addu t4,zero,s4		.78 -- copy _T84 ← _V24
-348:  0019679265	addu t1,t1,t4		.79 -- _T82 = _T82 + _T84
-34c:  0000620672	sll t7,t1,2		.80 -- _T88 = _T82 << 2
-350:  2413101072	lw s5,fp,16		.81 -- load content from _V36 in s5
-354:  0000000000	sll zero,zero,0		.81 -- Nop
-358:  0059734049	addu t7,gp,t7		.82
-35c:  2918514752	sw s5,t7,64		.82 -- store content of t7 in _G90[_T88]
-360:  2413232140	lw s7,fp,12		.83 -- load content from _V24 in s7
-364:  0000000000	sll zero,zero,0		.83 -- Nop
-368:  0653721601	addiu s7,s7,1		.84 -- _V24 = _V24 + 1
-36c:  2950103052	sw s7,fp,12		.85 -- store content of s7 in _V24
-370:  2413166604	lw s6,fp,12		.86 -- load content from _V24 in s6
-374:  2412773380	lw s0,fp,4		.87 -- load content from _V22 in s0
-378:  0000000000	sll zero,zero,0		.87 -- Nop
-37c:  0047190051	subu v0,s6,s0		.88
-380:  0071368584	bltz v0,1a4 <laplaciano+0x38>		.88 -- branch if register < 0
-384:  0000000000	sll zero,zero,0		.88 -- Nop
-388:  2412838920	lw s1,fp,8		.89 -- load content from _V23 in s1
-38c:  0000000000	sll zero,zero,0		.89 -- Nop
-390:  0640745473	addiu s1,s1,1		.90 -- _V23 = _V23 + 1
-394:  2949709832	sw s1,fp,8		.91 -- store content of s1 in _V23
-398:  2412904456	lw s2,fp,8		.92 -- load content from _V23 in s2
-39c:  2413035520	lw s4,fp,0		.93 -- load content from _V20 in s4
-3a0:  0000000000	sll zero,zero,0		.93 -- Nop
-3a4:  0039063587	subu v0,s2,s4		.94
-3a8:  0071368570	bltz v0,194 <laplaciano+0x28>		.94 -- branch if register < 0
-3ac:  0000000000	sll zero,zero,0		.94 -- Nop
-3b0:  0666697748	addiu sp,sp,20		 -- epilog| pop stack frame
-3b4:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-3b8:  0065011720	jr ra		 -- epilog| return
-
-
-load (int32) _V36		  T< load >		
-120:	 65:		if _V36 <= 255 goto <laplaciano+_i26>		  T< branch >		
-		<laplaciano+_i27>:
-121:	 66:		_V36 := 255		  T< copy >		
-122:	 67:		store (int32) _V36		  T< store >		
-123:	 68:		goto <laplaciano+_i25>		  T< jump >		
-		<laplaciano+_i26>:
-124:	 69:		load (int32) _V36		  T< load >		
-125:	 70:		if _V36 >= 0 goto <laplaciano+_i28>		  T< branch >		
-		<laplaciano+_i29>:
-126:	 71:		_V36 := 0		  T< copy >		
-127:	 72:		store (int32) _V36		  T< store >		
-128:	 73:		goto <laplaciano+_i25>		  T< jump >		
-		<laplaciano+_i28>:
-		<laplaciano+_i25>:
-*/

+ 5 - 144
src/samples/program_jun_laplaciano.go

@@ -1,5 +1,5 @@
 // Aplica o back-end do juninho
-@target          : mips 
+@target          : mipsjun
 // Especifica o tipo de metodo empregado para salvar o resultado da compilação
 @export          : simulation //MultCoreJun
 
@@ -103,150 +103,11 @@ func laplaciano() {
             result[i][j] = l
         }
     }
+
+    
 }
 
 func main() {
     preenche_matriz()
-    //laplaciano()
-}
-
-/**
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VW1)_S2
-$$$$$$$$$$$$$$$$ Get Reverse of @_S2 | {@_S2=_VW1, _VW1=_S2}
-Store:_S2:1
-$$$$$$$$$$$$$$$$ SetLoaded:_S2:false
-SET VAR (_VLM14)_S5
-$$$$$$$$$$$$$$$$ Get Reverse of @_S5 | {@_S2=_VW1, _VLM14=_S5, _VW1=_S2, @_S5=_VLM14}
-Store:_S5:_T3
-$$$$$$$$$$$$$$$$ SetLoaded:_S5:false
-SET VAR (_VCM17)_S8
-$$$$$$$$$$$$$$$$ Get Reverse of @_S8 | {@_S2=_VW1, _VLM14=_S5, _VCM17=_S8, @_S8=_VCM17, _VW1=_S2, @_S5=_VLM14}
-Store:_S8:_T6
-$$$$$$$$$$$$$$$$ SetLoaded:_S8:false
-SET VAR (_VI9)_S10
-$$$$$$$$$$$$$$$$ Get Reverse of @_S10 | {@_S2=_VW1, _VLM14=_S5, _VCM17=_S8, @_S10=_VI9, @_S8=_VCM17, _VI9=_S10, _VW1=_S2, @_S5=_VLM14}
-Store:_S10:0
-$$$$$$$$$$$$$$$$ SetLoaded:_S10:false
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VJ11)_S12
-$$$$$$$$$$$$$$$$ Get Reverse of @_S12 | {_VJ11=_S12, @_S12=_VJ11}
-Store:_S12:0
-$$$$$$$$$$$$$$$$ SetLoaded:_S12:false
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VI9)_S13
-$$$$$$$$$$$$$$$$ LOADED _S13 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S13:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S13 | {@_S13=_VI9, _VI9=_S13}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VI9)_S14
-SET VAR (_VLM14)_S15
-$$$$$$$$$$$$$$$$ LOADED _S14 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S14:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S14 | {_VLM14=_S15, @_S14=_VI9, @_S15=_VLM14, _VI9=_S14}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-$$$$$$$$$$$$$$$$ LOADED _S15 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S15:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S15 | {}
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VVALUE16)_S17
-$$$$$$$$$$$$$$$$ Get Reverse of @_S17 | {@_S17=_VVALUE16, _VVALUE16=_S17}
-Store:_S17:0
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:false
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VJ11)_S18
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S18 | {_VJ11=_S18, @_S18=_VJ11}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VJ11)_S19
-SET VAR (_VCM17)_S20
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S19 | {_VCM17=_S20, @_S20=_VCM17, _VJ11=_S19, @_S19=_VJ11}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-$$$$$$$$$$$$$$$$ LOADED _S20 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S20:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S20 | {}
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VVALUE16)_S21
-$$$$$$$$$$$$$$$$ Get Reverse of @_S21 | {@_S21=_VVALUE16, _VVALUE16=_S21}
-Store:_S21:0
-$$$$$$$$$$$$$$$$ SetLoaded:_S21:false
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VW1)_S22
-SET VAR (_VVALUE16)_S23
-$$$$$$$$$$$$$$$$ Get Reverse of @_S23 | {@_S22=_VW1, @_S23=_VVALUE16, _VVALUE16=_S23, _VW1=_S22}
-$$$$$$$$$$$$$$$$ LOADED _S22 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S22:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S22 | {@_S22=_VW1, @_S23=_VVALUE16, _VVALUE16=_S23, _VW1=_S22}
-Store:_S23:_S22
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:false
-$$$$$$$$$$$$$$$$ LOADED _S22 : true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S22 | {@_S22=_VW1, @_S23=_VVALUE16, _VVALUE16=_S23, _VW1=_S22}
-$$$$$$$$$$$$$$$$ LOADED _S22 : true
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VVALUE16)_S24
-SET VAR (_VI9)_S25
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S25 | {@_S24=_VVALUE16, @_S25=_VI9, _VI9=_S25, _VVALUE16=_S24}
-$$$$$$$$$$$$$$$$ LOADED _S25 : true
-SET VAR (_VJ11)_S27
-$$$$$$$$$$$$$$$$ LOADED _S27 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S27:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S27 | {_VJ11=_S27, @_S24=_VVALUE16, @_S25=_VI9, _VI9=_S25, @_S27=_VJ11, _VVALUE16=_S24}
-$$$$$$$$$$$$$$$$ LOADED _S27 : true
-SET VAR (_G30)_S31
-$$$$$$$$$$$$$$$$ Get Reverse of @_S31 | {@_S31=_G30, _VJ11=_S27, @_S24=_VVALUE16, @_S25=_VI9, _G30=_S31, _VI9=_S25, @_S27=_VJ11, _VVALUE16=_S24}
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S24 | {@_S31=_G30, _VJ11=_S27, @_S24=_VVALUE16, @_S25=_VI9, _G30=_S31, _VI9=_S25, @_S27=_VJ11, _VVALUE16=_S24}
-Store:_S31[_T29]:_S24
-$$$$$$$$$$$$$$$$ SetLoaded:_S31[_T29]:false
-$$$$$$$$$$$$$$$$ LOADED _S27 : true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S27 | {@_S31=_G30, _VJ11=_S27, @_S24=_VVALUE16, @_S25=_VI9, _G30=_S31, _VI9=_S25, @_S27=_VJ11, _VVALUE16=_S24}
-$$$$$$$$$$$$$$$$ LOADED _S27 : true
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VJ11)_S32
-$$$$$$$$$$$$$$$$ LOADED _S32 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S32:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S32 | {_VJ11=_S32, @_S32=_VJ11}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VI9)_S33
-$$$$$$$$$$$$$$$$ LOADED _S33 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S33:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S33 | {@_S33=_VI9, _VI9=_S33}
-$$$$$$$$$$$$$$$$ Get Reverse of @_S33 | {@_S33=_VI9, _VI9=_S33}
-$$$$$$$$$$$$$$$$ LOADED _S33 : true
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-SET VAR (_VI9)_S34
-$$$$$$$$$$$$$$$$ LOADED _S34 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S34:true
-$$$$$$$$$$$$$$$$ Get Reverse of @_S34 | {@_S34=_VI9, _VI9=_S34}
-Reset por (true) or era label
-$$$$$$$$$$$$$$$$ RESET 
-Reset por (false) or era label
-$$$$$$$$$$$$$$$$ RESET 
-*/
+    laplaciano()
+}

+ 65 - 398
src/samples/program_jun_lu.go

@@ -1,11 +1,11 @@
 // Aplica o back-end do juninho
-@target          : mips 
+@target          : mipsjun
 // Especifica o tipo de metodo empregado para salvar o resultado da compilação
 //@export          : MultCoreJun
 @export          : simulation
 
 // Diretorio onde o resultado da compilação será gravado
-@outputDirectory : `C:\Users\EUGENIO CARVALHO\Desktop\tmp\bitCount_1`
+@outputDirectory : `C:\Users\EUGENIO CARVALHO\Desktop\tmp\lu`
 
 // Quantidade de palavras de um bloco 32 palavras de 4bytes
 @cacheBlockSize: `32`
@@ -47,414 +47,81 @@
 
 package main;
 
-var (
-    result [4][32]int32
-)
-
-func bitCount(init int32, core int32){
-    var (
-        n int32
-        x int32
-        tmp  = 0
-        zero = 0
-        seed = 112500
-        //seed = 1000
-    )
-
-    for i:= init; i < init + 4500; i++ {
-        n = 0
-	x = seed
-        if x > 0 {
-            for true {
-                n++
-                if x = x & (x-1); x == 0 {
-                   break
-                }
-            }
-            tmp += n
-        }
-	seed +=13
-    }
-    result[core][zero] = tmp
-}
-
-func main(){
-    bitCount(18750,1)
-}
-
-/*
-
-$$$$$$$$$$$$$$$$ SetLoaded:_S6:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S8:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S10:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S12:false
-$$$$$$$$$$$$$$$$ LOADED _S2 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S2:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S14:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:false
-$$$$$$$$$$$$$$$$ LOADED _S15 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S15:true
-$$$$$$$$$$$$$$$$ LOADED _S17 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:true
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:false
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:false
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S22 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S22:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:false
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:false
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:false
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ LOADED _S27 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S27:true
-$$$$$$$$$$$$$$$$ LOADED _S26 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S26:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S30:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : true
-$$$$$$$$$$$$$$$$ LOADED _S32 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S32:true
-$$$$$$$$$$$$$$$$ LOADED _S32 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S36[_T34]:false
-$$$$$$$$$$$$$$$$ LOADED _S29 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S29:true
-
-package main
 
-import (
-	"fmt"
+const (
+    SIZE         = 20
+    INITIAL_LINE = 0
+    END_LINE     = 5
 )
 
 var (
-    result [4][32]int
+    M [SIZE][SIZE]int32
+    L [SIZE][SIZE]int32
+    lock bool
+    i int32
+    j int32
+    k int32
+    aux_div int32
+    res_div int32
+    aux_mkk int32
 )
 
-func bitCount(init int, core int){
-    var (
-        n int
-        x int
-        tmp  = 0
-        seed = 112500
-    )
-
-    for i:= init; i < init + 4500; i++ {
-        n = 0
-	x = seed
-	fmt.Println("X: ", x)
-        if x > 0 {
-            for true {
-                n++
-                if x = x & (x-1); x == 0 {
-                   break
-                }
+func preenche(){
+    if lock {return}
+
+    lock = true
+    /* Inicializa matrizes */
+    for i = 0; i < SIZE; i++ {
+        for j = 0; j < SIZE; j++{
+            if i == j {
+                M[i][j] = 1
+            }else{
+                M[i][j] = 1 + (i*SIZE) + j
             }
-            tmp += n
+            L[i][j] = 0
         }
-	seed +=13
     }
-    fmt.Println(tmp)
+    lock = false
 }
-*/
-
-/**	
-		<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217795	j 10c <bitCount+0xf8>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847517	blez v0,dc <bitCount+0xc8>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217774	j b8 <bitCount+0xa4>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2413101080	lw s5,24(fp)		.16 -- load content from _VN13 in s5
- 84:  0000000000	sll zero,zero,0		.16 -- Nop
- 88:  2949971992	sw s5,24(fp)		.17 -- store content of s5 in _VN13
- 8c:  2413232156	lw s7,28(fp)		.18 -- load content from _VX16 in s7
- 90:  0000000000	sll zero,zero,0		.18 -- Nop
- 94:  0653262847	addiu t7,s7,-1		.19 -- _T20 = _S19 - 1
- 98:  0049266724	and t8,s7,t7		.20 -- _T21 = _S19 & _T20
- 9c:  2950168604	sw t8,28(fp)		.21 -- store content of t8 in _VX16
- a0:  2413232156	lw s7,28(fp)		.22 -- load content from _VX16 in s7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0383778819	bne zero,s7,b8 <bitCount+0xa4>		.23 -- branch if not equals
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  0134217776	j c0 <bitCount+0xac>		.24 -- jump to bitCount+_i7
- b4:  0000000000	sll zero,zero,0		.24 -- Nop
- b8:  0134217757	j 74 <bitCount+0x60>		.25 -- jump to bitCount+_i6
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  2412904456	lw s2,8(fp)		.26 -- load content from _VTMP5 in s2
- c4:  2413035544	lw s4,24(fp)		.27 -- load content from _VN13 in s4
- c8:  0000000000	sll zero,zero,0		.27 -- Nop
- cc:  0039096353	addu s2,s2,s4		.28 -- _S23 = _S23 + _S22
- d0:  2412904456	lw s2,8(fp)		.29 -- load content from _VTMP5 in s2
- d4:  0000000000	sll zero,zero,0		.29 -- Nop
- d8:  2949775368	sw s2,8(fp)		.30 -- store content of s2 in _VTMP5
- dc:  2412773392	lw s0,16(fp)		.31 -- load content from _VSEED9 in s0
- e0:  0000000000	sll zero,zero,0		.31 -- Nop
- e4:  0638582797	addiu s0,s0,13		.32 -- _S24 = _S24 + 13
- e8:  2412773392	lw s0,16(fp)		.33 -- load content from _VSEED9 in s0
- ec:  0000000000	sll zero,zero,0		.33 -- Nop
- f0:  2949644304	sw s0,16(fp)		.34 -- store content of s0 in _VSEED9
- f4:  2413232148	lw s7,20(fp)		.35 -- load content from _VI11 in s7
- f8:  0000000000	sll zero,zero,0		.35 -- Nop
- fc:  0653721601	addiu s7,s7,1		.36 -- _S25 = _S25 + 1
-100:  2413232148	lw s7,20(fp)		.37 -- load content from _VI11 in s7
-104:  0000000000	sll zero,zero,0		.37 -- Nop
-108:  2950103060	sw s7,20(fp)		.38 -- store content of s7 in _VI11
-10c:  2413035520	lw s4,0(fp)		.39 -- load content from _VINIT1 in s4
-110:  0000000000	sll zero,zero,0		.39 -- Nop
-114:  0646713748	addiu t4,s4,4500		.40 -- _T28 = _S27 + 4500
-118:  2412838932	lw s1,20(fp)		.41 -- load content from _VI11 in s1
-11c:  0000000000	sll zero,zero,0		.41 -- Nop
-120:  0036442147	subu v0,s1,t4		.42
-124:  0071368648	bltz v0,48 <bitCount+0x34>		.42 -- branch if register < 0
-128:  0000000000	sll zero,zero,0		.42 -- Nop
-12c:  2413101060	lw s5,4(fp)		.43 -- load content from _VCORE3 in s5
-130:  0000000000	sll zero,zero,0		.43 -- Nop
-134:  0001403200	sll t5,s5,5		.44 -- _T31 = _S30 << 5
-138:  2413166604	lw s6,12(fp)		.45 -- load content from _VZERO7 in s6
-13c:  0000000000	sll zero,zero,0		.45 -- Nop
-140:  0028731425	addu t5,t5,s6		.46 -- _T31 = _T31 + _S32
-144:  0000880768	sll t6,t5,2		.47 -- _T34 = _T31 << 2
-148:  2413035528	lw s4,8(fp)		.48 -- load content from _VTMP5 in s4
-14c:  0000000000	sll zero,zero,0		.48 -- Nop
-150:  2916352000	sw s4,0(t6)		.49 -- store content of s4 in _G35[_T34]
-154:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-158:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-15c:  0065011720	jr ra		 -- epilog| return
-
+func lu(){
+    
+    //for ;lock;  {}
 
-Target[mips]:
-	<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217785	j e4 <bitCount+0xd0>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847511	blez v0,c4 <bitCount+0xb0>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217770	j a8 <bitCount+0x94>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
+    /* 4. ITERATIONS LOOP */
+    for k=INITIAL_LINE; k<SIZE-1; k++ {
  
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2949971992	sw s5,24(fp)		.16 -- store content of s5 in _VN13
- 84:  2413232156	lw s7,28(fp)		.17 -- load content from _VX16 in s7
- 88:  0000000000	sll zero,zero,0		.17 -- Nop
- 8c:  0653262847	addiu t7,s7,-1		.18 -- _T20 = _S19 - 1
- 90:  0049266724	and t8,s7,t7		.19 -- _T21 = _S19 & _T20
- 94:  2950168604	sw t8,28(fp)		.20 -- store content of t8 in _VX16
- 98:  0383778819	bne zero,s7,a8 <bitCount+0x94>		.21 -- branch if not equals
+    /* 4.1. PROCESS ROWS IN PARALLEL, DISTRIBUTE WITH nthreads STRIDE */
+        for i=k+1; i<END_LINE; i++ {
+            /* 4.1.1. COMPUTE L COLUMN */
+//            L[i][k] = M[i][k] / M[k][k];  //Era DIV, mas usava BREAK e daria trabalho fazer
+            aux_div = M[i][k]
+            aux_mkk = M[k][k]
+            res_div = 0
+             
+            if aux_div < 0 {
+                aux_div = aux_div * -1
+            }
  
- 9c:  0000000000	sll zero,zero,0		.21 -- Nop
- a0:  0134217772	j b0 <bitCount+0x9c>		.22 -- jump to bitCount+_i7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0134217757	j 74 <bitCount+0x60>		.23 -- jump to bitCount+_i6
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  2412904456	lw s2,8(fp)		.24 -- load content from _VTMP5 in s2
- b4:  2413035544	lw s4,24(fp)		.25 -- load content from _VN13 in s4
- b8:  0000000000	sll zero,zero,0		.25 -- Nop
- bc:  0039096353	addu s2,s2,s4		.26 -- _S23 = _S23 + _S22
- c0:  2949775368	sw s2,8(fp)		.27 -- store content of s2 in _VTMP5
+            if aux_mkk < 0 {
+                aux_mkk = aux_mkk * -1
+            }
  
- c4:  2412773392	lw s0,16(fp)		.28 -- load content from _VSEED9 in s0
- c8:  0000000000	sll zero,zero,0		.28 -- Nop
- cc:  0638582797	addiu s0,s0,13		.29 -- _S24 = _S24 + 13
- d0:  2949644304	sw s0,16(fp)		.30 -- store content of s0 in _VSEED9
- d4:  2413232148	lw s7,20(fp)		.31 -- load content from _VI11 in s7
- d8:  0000000000	sll zero,zero,0		.31 -- Nop
- dc:  0653721601	addiu s7,s7,1		.32 -- _S25 = _S25 + 1
- e0:  2950103060	sw s7,20(fp)		.33 -- store content of s7 in _VI11
- e4:  2413035520	lw s4,0(fp)		.34 -- load content from _VINIT1 in s4
- e8:  0000000000	sll zero,zero,0		.34 -- Nop
- ec:  0646713748	addiu t4,s4,4500		.35 -- _T28 = _S27 + 4500
- f0:  2412838932	lw s1,20(fp)		.36 -- load content from _VI11 in s1
- f4:  0000000000	sll zero,zero,0		.36 -- Nop
- f8:  0036442147	subu v0,s1,t4		.37
- fc:  0071368658	bltz v0,48 <bitCount+0x34>		.37 -- branch if register < 0
-100:  0000000000	sll zero,zero,0		.37 -- Nop
-104:  2413101060	lw s5,4(fp)		.38 -- load content from _VCORE3 in s5
-108:  0000000000	sll zero,zero,0		.38 -- Nop
-10c:  0001403200	sll t5,s5,5		.39 -- _T31 = _S30 << 5
-110:  2413166604	lw s6,12(fp)		.40 -- load content from _VZERO7 in s6
-114:  0000000000	sll zero,zero,0		.40 -- Nop
-118:  0028731425	addu t5,t5,s6		.41 -- _T31 = _T31 + _S32
-11c:  0000880768	sll t6,t5,2		.42 -- _T34 = _T31 << 2
-120:  2413035528	lw s4,8(fp)		.43 -- load content from _VTMP5 in s4
-124:  0000000000	sll zero,zero,0		.43 -- Nop
-128:  2916352000	sw s4,0(t6)		.44 -- store content of s4 in _G35[_T34]
-12c:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-130:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-134:  0065011720	jr ra		 -- epilog| return
-
+            for aux_div - aux_mkk >= 0 {
+                aux_div -= aux_mkk
+                res_div++
+            }
+            
+            L[i][k] = res_div
+            /* 4.1.2. COMPUTE M ROW ELEMENTS */
+            for j=k+1; j<SIZE; j++ {
+                M[i][j] = M[i][j] - L[i][k] * M[k][j]
+            }
+        }
+/* 4.2. END ITERATIONS LOOP */
+    }   
+}
 
-		<main>:
-  0:  0604522814	addiu t0,zero,18750		.2 -- load param (p1)
-  4:  0604260670	addiu a0,zero,18750		.2 -- push param
-  8:  0604569601	addiu t1,zero,1		.2 -- load param (p1)
-  c:  0604307457	addiu a1,zero,1		.2 -- push param
- 10:  0201326599	jal 1c <bitCount+0x0>		.2 -- jump to <bitCount>
- 14:  0000000000	sll zero,zero,0		.2 -- Nop
- 18:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 1c:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 20:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 24:  2412773376	lw s0,fp,0		.0 -- load content from _V1 in s0
- 28:  0000000000	sll zero,zero,0		.0 -- Nop
- 2c:  2948857856	sw a0,fp,0		.1 -- pop param
- 30:  2412838916	lw s1,fp,4		.2 -- load content from _V2 in s1
- 34:  0000000000	sll zero,zero,0		.2 -- Nop
- 38:  2948923396	sw a1,fp,4		.3 -- pop param
- 3c:  0605159424	addiu s2,zero,0		.4 -- copy _V3 ← 0
- 40:  2949775368	sw s2,fp,8		.5 -- store content of s2 in _V3
- 44:  0605224960	addiu s3,zero,0		.6 -- copy _V4 ← 0
- 48:  2949840908	sw s3,fp,12		.7 -- store content of s3 in _V4
- 4c:  1007943681	lui s4,1		.8 -- load param upper(p1)
- 50:  0915715956	ori s4,s4,46964		.8 -- load param lower(p1)
- 54:  2949906448	sw s4,fp,16		.9 -- store content of s4 in _V5
- 58:  2412773376	lw s0,fp,0		.10 -- load content from _V1 in s0
- 5c:  0000000000	sll zero,zero,0		.10 -- Nop
- 60:  0001091617	addu s5,zero,s0		.11 -- copy _V6 ← _V1
- 64:  2949971988	sw s5,fp,20		.12 -- store content of s5 in _V6
- 68:  0134217805	j 134 <bitCount+0x118>		.13 -- jump to bitCount+_i3
- 6c:  0000000000	sll zero,zero,0		.13 -- Nop
- 70:  0605421568	addiu s6,zero,0		.14 -- copy _V7 ← 0
- 74:  2950037528	sw s6,fp,24		.15 -- store content of s6 in _V7
- 78:  2413232144	lw s7,fp,16		.16 -- load content from _V5 in s7
- 7c:  0000000000	sll zero,zero,0		.16 -- Nop
- 80:  0001542177	addu s1,zero,s7		.17 -- copy _V8 ← _V5
- 84:  2949709852	sw s1,fp,28		.18 -- store content of s1 in _V8
- 88:  2412838940	lw s1,fp,28		.19 -- load content from _V8 in s1
- 8c:  0000000000	sll zero,zero,0		.19 -- Nop
- 90:  0035655715	subu v0,s1,zero		.20
- 94:  0406847517	blez zero,v0,10c <bitCount+0xf0>		.20 -- branch if register <= 0
- 98:  0000000000	sll zero,zero,0		.20 -- Nop
- 9c:  0134217788	j f0 <bitCount+0xd4>		.21 -- jump to bitCount+_i9
- a0:  0000000000	sll zero,zero,0		.21 -- Nop
- a4:  2412904472	lw s2,fp,24		.22 -- load content from _V7 in s2
- a8:  0000000000	sll zero,zero,0		.22 -- Nop
- ac:  0604831745	addiu t5,zero,1		.23 -- load param (p2)
- b0:  0642908161	addiu s2,s2,1		.23 -- _V7 = _V7 + 1
- b4:  2949775384	sw s2,fp,24		.24 -- store content of s2 in _V7
- b8:  2412970012	lw s3,fp,28		.25 -- load content from _V8 in s3
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  0604897281	addiu t6,zero,1		.26 -- load param (p2)
- c4:  0644874239	addiu t7,s3,-1		.26 -- _T9 = _V8 - 1
- c8:  2412970012	lw s3,fp,28		.27 -- load content from _V8 in s3
- cc:  0000000000	sll zero,zero,0		.27 -- Nop
- d0:  0040867876	and s3,s3,t7		.28 -- _V8 = _V8 & _T9
- d4:  2949840924	sw s3,fp,28		.29 -- store content of s3 in _V8
- d8:  2412970012	lw s3,fp,28		.30 -- load content from _V8 in s3
- dc:  0000000000	sll zero,zero,0		.30 -- Nop
- e0:  0375390211	bne zero,s3,f0 <bitCount+0xd4>		.31 -- branch if not equals
- e4:  0000000000	sll zero,zero,0		.31 -- Nop
- e8:  0134217790	j f8 <bitCount+0xdc>		.32 -- jump to bitCount+_i7
- ec:  0000000000	sll zero,zero,0		.32 -- Nop
- f0:  0134217769	j a4 <bitCount+0x88>		.33 -- jump to bitCount+_i6
- f4:  0000000000	sll zero,zero,0		.33 -- Nop
- f8:  2413035528	lw s4,fp,8		.34 -- load content from _V3 in s4
- fc:  2412773400	lw s0,fp,24		.35 -- load content from _V7 in s0
-100:  0000000000	sll zero,zero,0		.35 -- Nop
-104:  0043032609	addu s4,s4,s0		.36 -- _V3 = _V3 + _V7
-108:  2949906440	sw s4,fp,8		.37 -- store content of s4 in _V3
-10c:  2413101072	lw s5,fp,16		.38 -- load content from _V5 in s5
-110:  0000000000	sll zero,zero,0		.38 -- Nop
-114:  0604504077	addiu t0,zero,13		.39 -- load param (p2)
-118:  0649396237	addiu s5,s5,13		.39 -- _V5 = _V5 + 13
-11c:  2949971984	sw s5,fp,16		.40 -- store content of s5 in _V5
-120:  2413166612	lw s6,fp,20		.41 -- load content from _V6 in s6
-124:  0000000000	sll zero,zero,0		.41 -- Nop
-128:  0604569601	addiu t1,zero,1		.42 -- load param (p2)
-12c:  0651558913	addiu s6,s6,1		.42 -- _V6 = _V6 + 1
-130:  2950037524	sw s6,fp,20		.43 -- store content of s6 in _V6
-134:  2413232128	lw s7,fp,0		.44 -- load content from _V1 in s7
-138:  0000000000	sll zero,zero,0		.44 -- Nop
-13c:  0604639636	addiu t2,zero,4500		.45 -- load param (p2)
-140:  0652939668	addiu t3,s7,4500		.45 -- _T11 = _V1 + 4500
-144:  2412838932	lw s1,fp,20		.46 -- load content from _V6 in s1
-148:  0000000000	sll zero,zero,0		.46 -- Nop
-14c:  0036376611	subu v0,s1,t3		.47
-150:  0071368647	bltz 00000,v0,70 <bitCount+0x54>		.47 -- branch if register < 0
-154:  0000000000	sll zero,zero,0		.47 -- Nop
-158:  2412904452	lw s2,fp,4		.48 -- load content from _V2 in s2
-15c:  0000000000	sll zero,zero,0		.48 -- Nop
-160:  0001204257	addu t4,zero,s2		.49 -- copy _T12 ← _V2
-164:  0000813376	sll t5,t4,5		.50 -- _T13 = _T12 << 5
-168:  2412969996	lw s3,fp,12		.51 -- load content from _V4 in s3
-16c:  0000000000	sll zero,zero,0		.51 -- Nop
-170:  0001273889	addu t6,zero,s3		.52 -- copy _T15 ← _V4
-174:  0028207137	addu t5,t5,t6		.53 -- _T13 = _T13 + _T15
-178:  0000882816	sll t7,t5,2		.54 -- _T19 = _T13 << 2
-17c:  2412773384	lw s0,fp,8		.55 -- load content from _V3 in s0
-180:  0000000000	sll zero,zero,0		.55 -- Nop
-184:  2918449152	sw s4,t7,0		.57 -- store content of s4 in _G21[_T19]
-188:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-18c:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-190:  0065011720	jr ra		 -- epilog| return	  T< store >	
-*/
+func main(){
+    zomba := 10
+    lu()
+}

+ 98 - 404
src/samples/program_jun_quick.go

@@ -1,11 +1,11 @@
 // Aplica o back-end do juninho
-@target          : mips 
+@target          : mipsjun
 // Especifica o tipo de metodo empregado para salvar o resultado da compilação
 //@export          : MultCoreJun
 @export          : simulation
 
 // Diretorio onde o resultado da compilação será gravado
-@outputDirectory : `C:\Users\EUGENIO CARVALHO\Desktop\tmp\bitCount_1`
+@outputDirectory : `C:\Users\EUGENIO CARVALHO\Desktop\tmp\lu`
 
 // Quantidade de palavras de um bloco 32 palavras de 4bytes
 @cacheBlockSize: `32`
@@ -47,414 +47,108 @@
 
 package main;
 
-var (
-    result [4][32]int32
-)
-
-func bitCount(init int32, core int32){
-    var (
-        n int32
-        x int32
-        tmp  = 0
-        zero = 0
-        seed = 112500
-        //seed = 1000
-    )
-
-    for i:= init; i < init + 4500; i++ {
-        n = 0
-	x = seed
-        if x > 0 {
-            for true {
-                n++
-                if x = x & (x-1); x == 0 {
-                   break
-                }
-            }
-            tmp += n
-        }
-	seed +=13
-    }
-    result[core][zero] = tmp
-}
-
-func main(){
-    bitCount(18750,1)
-}
-
-/*
-
-$$$$$$$$$$$$$$$$ SetLoaded:_S6:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S8:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S10:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S12:false
-$$$$$$$$$$$$$$$$ LOADED _S2 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S2:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S14:false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:false
-$$$$$$$$$$$$$$$$ LOADED _S15 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S15:true
-$$$$$$$$$$$$$$$$ LOADED _S17 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S17:true
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:false
-$$$$$$$$$$$$$$$$ LOADED _S18 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S18:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S19 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:false
-$$$$$$$$$$$$$$$$ LOADED _S19 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S19:true
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S22 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S22:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:false
-$$$$$$$$$$$$$$$$ LOADED _S23 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S23:true
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:false
-$$$$$$$$$$$$$$$$ LOADED _S24 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S24:true
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:false
-$$$$$$$$$$$$$$$$ LOADED _S25 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S25:true
-$$$$$$$$$$$$$$$$ LOADED _S27 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S27:true
-$$$$$$$$$$$$$$$$ LOADED _S26 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S26:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S30:true
-$$$$$$$$$$$$$$$$ LOADED _S30 : true
-$$$$$$$$$$$$$$$$ LOADED _S32 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S32:true
-$$$$$$$$$$$$$$$$ LOADED _S32 : true
-$$$$$$$$$$$$$$$$ SetLoaded:_S36[_T34]:false
-$$$$$$$$$$$$$$$$ LOADED _S29 : false
-$$$$$$$$$$$$$$$$ SetLoaded:_S29:true
-
-package main
-
-import (
-	"fmt"
+const (
+	ArraySize = 8
 )
 
 var (
-    result [4][32]int
+	arr [ArraySize]int32
 )
 
-func bitCount(init int, core int){
-    var (
-        n int
-        x int
-        tmp  = 0
-        seed = 112500
-    )
-
-    for i:= init; i < init + 4500; i++ {
-        n = 0
-	x = seed
-	fmt.Println("X: ", x)
-        if x > 0 {
-            for true {
-                n++
-                if x = x & (x-1); x == 0 {
-                   break
-                }
-            }
-            tmp += n
-        }
-	seed +=13
-    }
-    fmt.Println(tmp)
+/* This function is same in both iterative and recursive*/
+func partition(l, h int32) int32 {
+	var (
+		limit, index, x, i, tmp int32
+	)
+	x      = arr[h]
+	i      = l - 1
+
+	for j := l; j < h; j++ {
+		if arr[j] <= x {
+			i++
+                        tmp = arr[i]
+                        arr[i] = arr[j]
+                        arr[j] = tmp
+		}
+	}
+	index = i + 1
+	//arr[h], arr[tmp] = , arr[h]
+
+        tmp = arr[index]
+        arr[index] = arr[h]
+        arr[h] = tmp
+
+	return i + 1
 }
-*/
-
-/**	
-		<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217795	j 10c <bitCount+0xf8>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847517	blez v0,dc <bitCount+0xc8>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217774	j b8 <bitCount+0xa4>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2413101080	lw s5,24(fp)		.16 -- load content from _VN13 in s5
- 84:  0000000000	sll zero,zero,0		.16 -- Nop
- 88:  2949971992	sw s5,24(fp)		.17 -- store content of s5 in _VN13
- 8c:  2413232156	lw s7,28(fp)		.18 -- load content from _VX16 in s7
- 90:  0000000000	sll zero,zero,0		.18 -- Nop
- 94:  0653262847	addiu t7,s7,-1		.19 -- _T20 = _S19 - 1
- 98:  0049266724	and t8,s7,t7		.20 -- _T21 = _S19 & _T20
- 9c:  2950168604	sw t8,28(fp)		.21 -- store content of t8 in _VX16
- a0:  2413232156	lw s7,28(fp)		.22 -- load content from _VX16 in s7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0383778819	bne zero,s7,b8 <bitCount+0xa4>		.23 -- branch if not equals
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  0134217776	j c0 <bitCount+0xac>		.24 -- jump to bitCount+_i7
- b4:  0000000000	sll zero,zero,0		.24 -- Nop
- b8:  0134217757	j 74 <bitCount+0x60>		.25 -- jump to bitCount+_i6
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  2412904456	lw s2,8(fp)		.26 -- load content from _VTMP5 in s2
- c4:  2413035544	lw s4,24(fp)		.27 -- load content from _VN13 in s4
- c8:  0000000000	sll zero,zero,0		.27 -- Nop
- cc:  0039096353	addu s2,s2,s4		.28 -- _S23 = _S23 + _S22
- d0:  2412904456	lw s2,8(fp)		.29 -- load content from _VTMP5 in s2
- d4:  0000000000	sll zero,zero,0		.29 -- Nop
- d8:  2949775368	sw s2,8(fp)		.30 -- store content of s2 in _VTMP5
- dc:  2412773392	lw s0,16(fp)		.31 -- load content from _VSEED9 in s0
- e0:  0000000000	sll zero,zero,0		.31 -- Nop
- e4:  0638582797	addiu s0,s0,13		.32 -- _S24 = _S24 + 13
- e8:  2412773392	lw s0,16(fp)		.33 -- load content from _VSEED9 in s0
- ec:  0000000000	sll zero,zero,0		.33 -- Nop
- f0:  2949644304	sw s0,16(fp)		.34 -- store content of s0 in _VSEED9
- f4:  2413232148	lw s7,20(fp)		.35 -- load content from _VI11 in s7
- f8:  0000000000	sll zero,zero,0		.35 -- Nop
- fc:  0653721601	addiu s7,s7,1		.36 -- _S25 = _S25 + 1
-100:  2413232148	lw s7,20(fp)		.37 -- load content from _VI11 in s7
-104:  0000000000	sll zero,zero,0		.37 -- Nop
-108:  2950103060	sw s7,20(fp)		.38 -- store content of s7 in _VI11
-10c:  2413035520	lw s4,0(fp)		.39 -- load content from _VINIT1 in s4
-110:  0000000000	sll zero,zero,0		.39 -- Nop
-114:  0646713748	addiu t4,s4,4500		.40 -- _T28 = _S27 + 4500
-118:  2412838932	lw s1,20(fp)		.41 -- load content from _VI11 in s1
-11c:  0000000000	sll zero,zero,0		.41 -- Nop
-120:  0036442147	subu v0,s1,t4		.42
-124:  0071368648	bltz v0,48 <bitCount+0x34>		.42 -- branch if register < 0
-128:  0000000000	sll zero,zero,0		.42 -- Nop
-12c:  2413101060	lw s5,4(fp)		.43 -- load content from _VCORE3 in s5
-130:  0000000000	sll zero,zero,0		.43 -- Nop
-134:  0001403200	sll t5,s5,5		.44 -- _T31 = _S30 << 5
-138:  2413166604	lw s6,12(fp)		.45 -- load content from _VZERO7 in s6
-13c:  0000000000	sll zero,zero,0		.45 -- Nop
-140:  0028731425	addu t5,t5,s6		.46 -- _T31 = _T31 + _S32
-144:  0000880768	sll t6,t5,2		.47 -- _T34 = _T31 << 2
-148:  2413035528	lw s4,8(fp)		.48 -- load content from _VTMP5 in s4
-14c:  0000000000	sll zero,zero,0		.48 -- Nop
-150:  2916352000	sw s4,0(t6)		.49 -- store content of s4 in _G35[_T34]
-154:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-158:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-15c:  0065011720	jr ra		 -- epilog| return
-
 
-Target[mips]:
-	<main>:
-  0:  0604260670	addiu a0,zero,18750		.2 -- push param
-  4:  0604307457	addiu a1,zero,1		.2 -- push param
-  8:  0201326597	jal 14 <bitCount+0x0>		.2 -- jump to <bitCount>
-  c:  0000000000	sll zero,zero,0		.2 -- Nop
- 10:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 14:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 18:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 1c:  2948857856	sw a0,0(fp)		.0 -- pop param
- 20:  2948923396	sw a1,4(fp)		.1 -- pop param
- 24:  2948595720	sw zero,8(fp)		.2 -- store content of zero in _VTMP5
- 28:  2948595724	sw zero,12(fp)		.3 -- store content of zero in _VZERO7
- 2c:  0604636136	addiu t2,zero,1000		.4 -- load param (p1)
- 30:  2949251088	sw t2,16(fp)		.4 -- store content of t2 in _VSEED9
- 34:  2413101056	lw s5,0(fp)		.5 -- load content from _VINIT1 in s5
- 38:  0000000000	sll zero,zero,0		.5 -- Nop
- 3c:  2949971988	sw s5,20(fp)		.6 -- store content of s5 in _VI11
- 40:  0134217785	j e4 <bitCount+0xd0>		.7 -- jump to bitCount+_i3
- 44:  0000000000	sll zero,zero,0		.7 -- Nop
- 48:  2948595736	sw zero,24(fp)		.8 -- store content of zero in _VN13
- 4c:  2412904464	lw s2,16(fp)		.9 -- load content from _VSEED9 in s2
- 50:  0000000000	sll zero,zero,0		.9 -- Nop
- 54:  2949775388	sw s2,28(fp)		.10 -- store content of s2 in _VX16
- 58:  2413035548	lw s4,28(fp)		.11 -- load content from _VX16 in s4
- 5c:  0000000000	sll zero,zero,0		.11 -- Nop
- 60:  0041947171	subu v0,s4,zero		.12
- 64:  0406847511	blez v0,c4 <bitCount+0xb0>		.12 -- branch if register <= 0
- 68:  0000000000	sll zero,zero,0		.12 -- Nop
- 6c:  0134217770	j a8 <bitCount+0x94>		.13 -- jump to bitCount+_i9
- 70:  0000000000	sll zero,zero,0		.13 -- Nop
- 
- 74:  2413101080	lw s5,24(fp)		.14 -- load content from _VN13 in s5
- 78:  0000000000	sll zero,zero,0		.14 -- Nop
- 7c:  0649396225	addiu s5,s5,1		.15 -- _S18 = _S18 + 1
- 80:  2949971992	sw s5,24(fp)		.16 -- store content of s5 in _VN13
- 84:  2413232156	lw s7,28(fp)		.17 -- load content from _VX16 in s7
- 88:  0000000000	sll zero,zero,0		.17 -- Nop
- 8c:  0653262847	addiu t7,s7,-1		.18 -- _T20 = _S19 - 1
- 90:  0049266724	and t8,s7,t7		.19 -- _T21 = _S19 & _T20
- 94:  2950168604	sw t8,28(fp)		.20 -- store content of t8 in _VX16
- 98:  0383778819	bne zero,s7,a8 <bitCount+0x94>		.21 -- branch if not equals
- 
- 9c:  0000000000	sll zero,zero,0		.21 -- Nop
- a0:  0134217772	j b0 <bitCount+0x9c>		.22 -- jump to bitCount+_i7
- a4:  0000000000	sll zero,zero,0		.22 -- Nop
- a8:  0134217757	j 74 <bitCount+0x60>		.23 -- jump to bitCount+_i6
- ac:  0000000000	sll zero,zero,0		.23 -- Nop
- b0:  2412904456	lw s2,8(fp)		.24 -- load content from _VTMP5 in s2
- b4:  2413035544	lw s4,24(fp)		.25 -- load content from _VN13 in s4
- b8:  0000000000	sll zero,zero,0		.25 -- Nop
- bc:  0039096353	addu s2,s2,s4		.26 -- _S23 = _S23 + _S22
- c0:  2949775368	sw s2,8(fp)		.27 -- store content of s2 in _VTMP5
- 
- c4:  2412773392	lw s0,16(fp)		.28 -- load content from _VSEED9 in s0
- c8:  0000000000	sll zero,zero,0		.28 -- Nop
- cc:  0638582797	addiu s0,s0,13		.29 -- _S24 = _S24 + 13
- d0:  2949644304	sw s0,16(fp)		.30 -- store content of s0 in _VSEED9
- d4:  2413232148	lw s7,20(fp)		.31 -- load content from _VI11 in s7
- d8:  0000000000	sll zero,zero,0		.31 -- Nop
- dc:  0653721601	addiu s7,s7,1		.32 -- _S25 = _S25 + 1
- e0:  2950103060	sw s7,20(fp)		.33 -- store content of s7 in _VI11
- e4:  2413035520	lw s4,0(fp)		.34 -- load content from _VINIT1 in s4
- e8:  0000000000	sll zero,zero,0		.34 -- Nop
- ec:  0646713748	addiu t4,s4,4500		.35 -- _T28 = _S27 + 4500
- f0:  2412838932	lw s1,20(fp)		.36 -- load content from _VI11 in s1
- f4:  0000000000	sll zero,zero,0		.36 -- Nop
- f8:  0036442147	subu v0,s1,t4		.37
- fc:  0071368658	bltz v0,48 <bitCount+0x34>		.37 -- branch if register < 0
-100:  0000000000	sll zero,zero,0		.37 -- Nop
-104:  2413101060	lw s5,4(fp)		.38 -- load content from _VCORE3 in s5
-108:  0000000000	sll zero,zero,0		.38 -- Nop
-10c:  0001403200	sll t5,s5,5		.39 -- _T31 = _S30 << 5
-110:  2413166604	lw s6,12(fp)		.40 -- load content from _VZERO7 in s6
-114:  0000000000	sll zero,zero,0		.40 -- Nop
-118:  0028731425	addu t5,t5,s6		.41 -- _T31 = _T31 + _S32
-11c:  0000880768	sll t6,t5,2		.42 -- _T34 = _T31 << 2
-120:  2413035528	lw s4,8(fp)		.43 -- load content from _VTMP5 in s4
-124:  0000000000	sll zero,zero,0		.43 -- Nop
-128:  2916352000	sw s4,0(t6)		.44 -- store content of s4 in _G35[_T34]
-12c:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-130:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-134:  0065011720	jr ra		 -- epilog| return
+func quickSortIterative(l, h int32) {
+	var (
+		top, p int32
+		// Create an auxiliary stack
+		stack [ArraySize]int32
+		// initialize top of stack
+	)
+	// push initial values of l and h to stack
+	stack[top] = l
+        top++
+	stack[top] = h
+	// Keep popping from stack while is not empty
+	for top >= 0 {
+		// Pop h and l
+
+		h = stack[top]
+		top--	
+                l = stack[top]
+		top--
+		// Set pivot element at its correct position
+		// in sorted array
+		
+                p = partition(l, h)
+		
+                // If there are elements on left side of pivot,
+		// then push left side to stack
+		if p-1 > l {
+			top++
+			stack[top] = l
+			top++
+			stack[top] = p - 1
+		}
+
+		// If there are elements on right side of pivot,
+		// then push right side to stack
+		if p+1 < h {
+			top++
+			stack[top] = p + 1
+			top++
+			stack[top] = h
+		}
+	}
+}
 
+// Driver program to test above functions
+func main() {
+	
+        /*
+            arr[0] = 4
+            arr[1] = 3
+            arr[2] = 5
+            arr[3] = 2
+            arr[4] = 1
+            arr[5] = 3
+            arr[6] = 2
+            arr[7] = 3
+        */
+        size := ArraySize - 1
+
+        j := 0
+
+        for i := size; i > 0; i-- {
+            arr[j] =  i
+            j++
+        }
+        //partition(0,7)
+        quickSortIterative(0, 7)
+        //quickSortIterative(0, 4)
+        //quickSortIterative(4, 7)
 
-		<main>:
-  0:  0604522814	addiu t0,zero,18750		.2 -- load param (p1)
-  4:  0604260670	addiu a0,zero,18750		.2 -- push param
-  8:  0604569601	addiu t1,zero,1		.2 -- load param (p1)
-  c:  0604307457	addiu a1,zero,1		.2 -- push param
- 10:  0201326599	jal 1c <bitCount+0x0>		.2 -- jump to <bitCount>
- 14:  0000000000	sll zero,zero,0		.2 -- Nop
- 18:  4294967295	stop 		 -- End of programa
-		<bitCount>:
- 1c:  0666763232	addiu sp,sp,-32		 -- prolog| push stack frame
- 20:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- 24:  2412773376	lw s0,fp,0		.0 -- load content from _V1 in s0
- 28:  0000000000	sll zero,zero,0		.0 -- Nop
- 2c:  2948857856	sw a0,fp,0		.1 -- pop param
- 30:  2412838916	lw s1,fp,4		.2 -- load content from _V2 in s1
- 34:  0000000000	sll zero,zero,0		.2 -- Nop
- 38:  2948923396	sw a1,fp,4		.3 -- pop param
- 3c:  0605159424	addiu s2,zero,0		.4 -- copy _V3 ← 0
- 40:  2949775368	sw s2,fp,8		.5 -- store content of s2 in _V3
- 44:  0605224960	addiu s3,zero,0		.6 -- copy _V4 ← 0
- 48:  2949840908	sw s3,fp,12		.7 -- store content of s3 in _V4
- 4c:  1007943681	lui s4,1		.8 -- load param upper(p1)
- 50:  0915715956	ori s4,s4,46964		.8 -- load param lower(p1)
- 54:  2949906448	sw s4,fp,16		.9 -- store content of s4 in _V5
- 58:  2412773376	lw s0,fp,0		.10 -- load content from _V1 in s0
- 5c:  0000000000	sll zero,zero,0		.10 -- Nop
- 60:  0001091617	addu s5,zero,s0		.11 -- copy _V6 ← _V1
- 64:  2949971988	sw s5,fp,20		.12 -- store content of s5 in _V6
- 68:  0134217805	j 134 <bitCount+0x118>		.13 -- jump to bitCount+_i3
- 6c:  0000000000	sll zero,zero,0		.13 -- Nop
- 70:  0605421568	addiu s6,zero,0		.14 -- copy _V7 ← 0
- 74:  2950037528	sw s6,fp,24		.15 -- store content of s6 in _V7
- 78:  2413232144	lw s7,fp,16		.16 -- load content from _V5 in s7
- 7c:  0000000000	sll zero,zero,0		.16 -- Nop
- 80:  0001542177	addu s1,zero,s7		.17 -- copy _V8 ← _V5
- 84:  2949709852	sw s1,fp,28		.18 -- store content of s1 in _V8
- 88:  2412838940	lw s1,fp,28		.19 -- load content from _V8 in s1
- 8c:  0000000000	sll zero,zero,0		.19 -- Nop
- 90:  0035655715	subu v0,s1,zero		.20
- 94:  0406847517	blez zero,v0,10c <bitCount+0xf0>		.20 -- branch if register <= 0
- 98:  0000000000	sll zero,zero,0		.20 -- Nop
- 9c:  0134217788	j f0 <bitCount+0xd4>		.21 -- jump to bitCount+_i9
- a0:  0000000000	sll zero,zero,0		.21 -- Nop
- a4:  2412904472	lw s2,fp,24		.22 -- load content from _V7 in s2
- a8:  0000000000	sll zero,zero,0		.22 -- Nop
- ac:  0604831745	addiu t5,zero,1		.23 -- load param (p2)
- b0:  0642908161	addiu s2,s2,1		.23 -- _V7 = _V7 + 1
- b4:  2949775384	sw s2,fp,24		.24 -- store content of s2 in _V7
- b8:  2412970012	lw s3,fp,28		.25 -- load content from _V8 in s3
- bc:  0000000000	sll zero,zero,0		.25 -- Nop
- c0:  0604897281	addiu t6,zero,1		.26 -- load param (p2)
- c4:  0644874239	addiu t7,s3,-1		.26 -- _T9 = _V8 - 1
- c8:  2412970012	lw s3,fp,28		.27 -- load content from _V8 in s3
- cc:  0000000000	sll zero,zero,0		.27 -- Nop
- d0:  0040867876	and s3,s3,t7		.28 -- _V8 = _V8 & _T9
- d4:  2949840924	sw s3,fp,28		.29 -- store content of s3 in _V8
- d8:  2412970012	lw s3,fp,28		.30 -- load content from _V8 in s3
- dc:  0000000000	sll zero,zero,0		.30 -- Nop
- e0:  0375390211	bne zero,s3,f0 <bitCount+0xd4>		.31 -- branch if not equals
- e4:  0000000000	sll zero,zero,0		.31 -- Nop
- e8:  0134217790	j f8 <bitCount+0xdc>		.32 -- jump to bitCount+_i7
- ec:  0000000000	sll zero,zero,0		.32 -- Nop
- f0:  0134217769	j a4 <bitCount+0x88>		.33 -- jump to bitCount+_i6
- f4:  0000000000	sll zero,zero,0		.33 -- Nop
- f8:  2413035528	lw s4,fp,8		.34 -- load content from _V3 in s4
- fc:  2412773400	lw s0,fp,24		.35 -- load content from _V7 in s0
-100:  0000000000	sll zero,zero,0		.35 -- Nop
-104:  0043032609	addu s4,s4,s0		.36 -- _V3 = _V3 + _V7
-108:  2949906440	sw s4,fp,8		.37 -- store content of s4 in _V3
-10c:  2413101072	lw s5,fp,16		.38 -- load content from _V5 in s5
-110:  0000000000	sll zero,zero,0		.38 -- Nop
-114:  0604504077	addiu t0,zero,13		.39 -- load param (p2)
-118:  0649396237	addiu s5,s5,13		.39 -- _V5 = _V5 + 13
-11c:  2949971984	sw s5,fp,16		.40 -- store content of s5 in _V5
-120:  2413166612	lw s6,fp,20		.41 -- load content from _V6 in s6
-124:  0000000000	sll zero,zero,0		.41 -- Nop
-128:  0604569601	addiu t1,zero,1		.42 -- load param (p2)
-12c:  0651558913	addiu s6,s6,1		.42 -- _V6 = _V6 + 1
-130:  2950037524	sw s6,fp,20		.43 -- store content of s6 in _V6
-134:  2413232128	lw s7,fp,0		.44 -- load content from _V1 in s7
-138:  0000000000	sll zero,zero,0		.44 -- Nop
-13c:  0604639636	addiu t2,zero,4500		.45 -- load param (p2)
-140:  0652939668	addiu t3,s7,4500		.45 -- _T11 = _V1 + 4500
-144:  2412838932	lw s1,fp,20		.46 -- load content from _V6 in s1
-148:  0000000000	sll zero,zero,0		.46 -- Nop
-14c:  0036376611	subu v0,s1,t3		.47
-150:  0071368647	bltz 00000,v0,70 <bitCount+0x54>		.47 -- branch if register < 0
-154:  0000000000	sll zero,zero,0		.47 -- Nop
-158:  2412904452	lw s2,fp,4		.48 -- load content from _V2 in s2
-15c:  0000000000	sll zero,zero,0		.48 -- Nop
-160:  0001204257	addu t4,zero,s2		.49 -- copy _T12 ← _V2
-164:  0000813376	sll t5,t4,5		.50 -- _T13 = _T12 << 5
-168:  2412969996	lw s3,fp,12		.51 -- load content from _V4 in s3
-16c:  0000000000	sll zero,zero,0		.51 -- Nop
-170:  0001273889	addu t6,zero,s3		.52 -- copy _T15 ← _V4
-174:  0028207137	addu t5,t5,t6		.53 -- _T13 = _T13 + _T15
-178:  0000882816	sll t7,t5,2		.54 -- _T19 = _T13 << 2
-17c:  2412773384	lw s0,fp,8		.55 -- load content from _V3 in s0
-180:  0000000000	sll zero,zero,0		.55 -- Nop
-184:  2918449152	sw s4,t7,0		.57 -- store content of s4 in _G21[_T19]
-188:  0666697760	addiu sp,sp,32		 -- epilog| pop stack frame
-18c:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-190:  0065011720	jr ra		 -- epilog| return	  T< store >	
-*/
+}

+ 25 - 187
src/samples/program_mult.go

@@ -45,194 +45,32 @@ func main() {
     preenche()
     multiplica()
 }
-
-
 /**
-			alloc (int32), 4 _G13		  T< alloc >		
-			alloc (int32), 4 _G18		  T< alloc >		
-			alloc (int32), 4 _G54		  T< alloc >		
-		<main>:
- 0:	 0:		call <preenche>		  T< call >		
- 1:	 1:		call <multiplica>		  T< call >		
-		<main-end>:
-		<preenche>:
-			alloc (int32), 1 _VJ5		  T< alloc >		
-			alloc (int32), 1 _VI3		  T< alloc >		
-			alloc (int32), 1 _VK1		  T< alloc >		
- 2:	 0:		store (int32) _VK1, 1		  T< store >		
- 3:	 1:		store (int32) _VI3, 0		  T< store >		
- 4:	 2:		goto <preenche+_i3>		  T< jump >		
-		<preenche+_i0>:
- 5:	 3:		store (int32) _VJ5, 0		  T< store >		
- 6:	 4:		goto <preenche+_i7>		  T< jump >		
-		<preenche+_i4>:
- 7:	 5:		load (int32) _VI3, _S8 --Copy value of index		  T< load >		
- 8:	 6:		_T9 := _S8 << 1		  T< assign >		
- 9:	 7:		load (int32) _VJ5, _S10 --Copy value of index		  T< load >		
-10:	 8:		_T9 := _T9 + _S10 --colls shift		  T< assign >		
-11:	 9:		_T12 := _T9 << 2		  T< assign >		
-12:	10:		load (int32) _VK1, _S7 --Load param (_S7)		  T< load >		
-13:	11:		store (int32) _G13[_T12], _S7		  T< store >		
-14:	12:		_S8 := _S8 --Copy value of index		  T< copy >		
-15:	13:		store (int32) _VI3, _S8		  T< store >		
-16:	14:		_T15 := _S8 << 1		  T< assign >		
-17:	15:		_S10 := _S10 --Copy value of index		  T< copy >		
-18:	16:		store (int32) _VJ5, _S10		  T< store >		
-19:	17:		_T15 := _T15 + _S10 --colls shift		  T< assign >		
-20:	18:		_T17 := _T15 << 2		  T< assign >		
-21:	19:		store (int32) _G18[_T17], _S7		  T< store >		
-22:	20:		_S7 := _S7 + 1		  T< assign >		
-23:	21:		store (int32) _VK1, _S7		  T< store >		
-24:	22:		_S10 := _S10 + 1		  T< assign >		
-25:	23:		store (int32) _VJ5, _S10		  T< store >		
-		<preenche+_i7>:
-26:	24:		load (int32) _VJ5, _S20 --Load param (_S20)		  T< load >		
-27:	25:		if _S20 < 2 goto <preenche+_i4>		  T< branch >		
-28:	26:		load (int32) _VI3, _S21 --Load param (_S21)		  T< load >		
-29:	27:		_S21 := _S21 + 1		  T< assign >		
-30:	28:		store (int32) _VI3, _S21		  T< store >		
-		<preenche+_i3>:
-31:	29:		load (int32) _VI3, _S22 --Load param (_S22)		  T< load >		
-32:	30:		if _S22 < 2 goto <preenche+_i0>		  T< branch >		
-		<preenche-end>:
-		<multiplica>:
-			alloc (int32), 1 _VK29		  T< alloc >		
-			alloc (int32), 1 _VJ27		  T< alloc >		
-			alloc (int32), 1 _VI25		  T< alloc >		
-			alloc (int32), 1 _VAUX23		  T< alloc >		
-33:	 0:		store (int32) _VAUX23, 0		  T< store >		
-34:	 1:		store (int32) _VI25, 0		  T< store >		
-35:	 2:		goto <multiplica+_i11>		  T< jump >		
-		<multiplica+_i8>:
-36:	 3:		store (int32) _VJ27, 0		  T< store >		
-37:	 4:		goto <multiplica+_i15>		  T< jump >		
-		<multiplica+_i12>:
-38:	 5:		store (int32) _VK29, 0		  T< store >		
-39:	 6:		goto <multiplica+_i19>		  T< jump >		
-		<multiplica+_i16>:
-40:	 7:		load (int32) _VI25, _S32 --Copy value of index		  T< load >		
-41:	 8:		_T33 := _S32 << 1		  T< assign >		
-42:	 9:		load (int32) _VK29, _S34 --Copy value of index		  T< load >		
-43:	10:		_T33 := _T33 + _S34 --colls shift		  T< assign >		
-44:	11:		_T36 := _T33 << 2		  T< assign >		
-45:	12:		load (int32) _G13[_T36], _T38		  T< load >		
-
-46:	13:		_S34 := _S34 --Copy value of index		  T< copy >		
-47:	14:		store (int32) _VK29, _S34		  T< store >		
+leadersList:[
+0,2
+ 2,2
+ 4,3
+ 7,12
+ 19,6
+ 25,13
+ 38, 3
+ 41,3
+ 44,2
+ 46,3
+ 49,4
+ 53,29
+ 82,3
+ 85,2
+ 87,4
+ 91,7
+ 98,4
+ 102,15
+ 117,41
+ 158,2
+ 160,3
+ 163,2
+ 165,3
+ 168,3
 
-48:	15:		_T39 := _S34 << 1		  T< assign >		
-49:	16:		load (int32) _VJ27, _S40 --Copy value of index		  T< load >		
-50:	17:		_T39 := _T39 + _S40 --colls shift		  T< assign >		
-51:	18:		_T42 := _T39 << 2		  T< assign >		
-52:	19:		load (int32) _G18[_T42], _T44		  T< load >		
-53:	20:		_T45 := _T38 * _T44		  T< assign >		
-54:	21:		load (int32) _VAUX23, _S31 --Load param (_S31)		  T< load >		
-55:	22:		_T46 := _S31 + _T45		  T< assign >		
-56:	23:		store (int32) _VAUX23, _T46		  T< store >		
-57:	24:		_S34 := _S34 + 1		  T< assign >		
-58:	25:		store (int32) _VK29, _S34		  T< store >		
-		<multiplica+_i19>:
-59:	26:		load (int32) _VK29, _S47 --Load param (_S47)		  T< load >		
-60:	27:		if _S47 < 2 goto <multiplica+_i16>		  T< branch >		
-61:	28:		load (int32) _VI25, _S49 --Copy value of index		  T< load >		
-62:	29:		_T50 := _S49 << 1		  T< assign >		
-63:	30:		load (int32) _VJ27, _S51 --Copy value of index		  T< load >		
-64:	31:		_T50 := _T50 + _S51 --colls shift		  T< assign >		
-65:	32:		_T53 := _T50 << 2		  T< assign >		
-66:	33:		load (int32) _VAUX23, _S48 --Load param (_S48)		  T< load >		
-67:	34:		store (int32) _G54[_T53], _S48		  T< store >		
-68:	35:		store (int32) _VAUX23, 0		  T< store >		
-69:	36:		_S51 := _S51 + 1		  T< assign >		
-70:	37:		store (int32) _VJ27, _S51		  T< store >		
-		<multiplica+_i15>:
-71:	38:		load (int32) _VJ27, _S56 --Load param (_S56)		  T< load >		
-72:	39:		if _S56 < 2 goto <multiplica+_i12>		  T< branch >		
-73:	40:		load (int32) _VI25, _S57 --Load param (_S57)		  T< load >		
-74:	41:		_S57 := _S57 + 1		  T< assign >		
-75:	42:		store (int32) _VI25, _S57		  T< store >		
-		<multiplica+_i11>:
-76:	43:		load (int32) _VI25, _S58 --Load param (_S58)		  T< load >		
-77:	44:		if _S58 < 2 goto <multiplica+_i8>		  T< branch >		
-		<multiplica-end>:
 
- ec:  0666763248	addiu sp,sp,-16		 -- prolog| push stack frame
- f0:  0001962017	addu fp,zero,sp		 -- prolog|copy fp ← sp
- f4:  2948595712	sw zero,0(fp)		.0 -- store content of zero in _VAUX23
- f8:  2948595716	sw zero,4(fp)		.1 -- store content of zero in _VI25
- fc:  0134217855	j 1fc <multiplica+0x110>		.2 -- jump to multiplica+_i11
-100:  0000000000	sll zero,zero,0		.2 -- Nop
-104:  2948595720	sw zero,8(fp)		.3 -- store content of zero in _VJ27
-108:  0134217844	j 1d0 <multiplica+0xe4>		.4 -- jump to multiplica+_i15
-10c:  0000000000	sll zero,zero,0		.4 -- Nop
-110:  2948595724	sw zero,12(fp)		.5 -- store content of zero in _VK29
-114:  0134217824	j 180 <multiplica+0x94>		.6 -- jump to multiplica+_i19
-118:  0000000000	sll zero,zero,0		.6 -- Nop
-11c:  2413101060	lw s5,4(fp)		.7 -- load content from _VI25 in s5
-120:  0000000000	sll zero,zero,0		.7 -- Nop
-124:  0001400896	sll t4,s5,1		.8 -- _T33 = _S32 << 1
-128:  2413232140	lw s7,12(fp)		.9 -- load content from _VK29 in s7
-12c:  0000000000	sll zero,zero,0		.9 -- Nop
-130:  0026697761	addu t4,t4,s7		.10 -- _T33 = _T33 + _S34
-134:  0000813184	sll t5,t4,2		.11 -- _T36 = _T33 << 2
-138:  2377580544	lw s7,0(t5)		.12 -- load content from _G13[_T36] in t6
-13c:  2950103052	sw s7,12(fp)		.14 -- store content of s7 in _VK29
-140:  0001538112	sll t7,s7,1		.15 -- _T39 = _S34 << 1
-144:  2412904456	lw s2,8(fp)		.16 -- load content from _VJ27 in s2
-148:  0000000000	sll zero,zero,0		.16 -- Nop
-14c:  0032667681	addu t7,t7,s2		.17 -- _T39 = _T39 + _S40
-150:  0001032320	sll t8,t7,2		.18 -- _T42 = _T39 << 2
-154:  2399666192	lw t0,16(t8)		.19 -- load content from _G18[_T42] in t0
-158:  0000000000	sll zero,zero,0		.19 -- Nop
-15c:  0029902872	mult t6,t0		.20 -- _T45 = _T38 * _T44
-160:  0000018450	mflo t1		.20
-164:  2413101056	lw s5,0(fp)		.21 -- load content from _VAUX23 in s5
-168:  0000000000	sll zero,zero,0		.21 -- Nop
-16c:  0044650529	addu t2,s5,t1		.22 -- _T46 = _S31 + _T45
-170:  2949251072	sw t2,0(fp)		.23 -- store content of t2 in _VAUX23
-174:  0604700673	addiu t3,zero,1		.24 -- load param (p2)
-178:  0653721601	addiu s7,s7,1		.24 -- _S34 = _S34 + 1
-17c:  2950103052	sw s7,12(fp)		.25 -- store content of s7 in _VK29
-180:  2412838924	lw s1,12(fp)		.26 -- load content from _VK29 in s1
-184:  0000000000	sll zero,zero,0		.26 -- Nop
-188:  0604766210	addiu t4,zero,2		.27 -- load param (p2)
-18c:  0036442147	subu v0,s1,t4		.27
-190:  0071368674	bltz v0,11c <multiplica+0x30>		.27 -- branch if register < 0
-194:  0000000000	sll zero,zero,0		.27 -- Nop
-198:  2412969988	lw s3,4(fp)		.28 -- load content from _VI25 in s3
-19c:  0000000000	sll zero,zero,0		.28 -- Nop
-1a0:  0001271872	sll t5,s3,1		.29 -- _T50 = _S49 << 1
-1a4:  2413035528	lw s4,8(fp)		.30 -- load content from _VJ27 in s4
-1a8:  0000000000	sll zero,zero,0		.30 -- Nop
-1ac:  0028600353	addu t5,t5,s4		.31 -- _T50 = _T50 + _S51
-1b0:  0000882816	sll t7,t5,2		.32 -- _T53 = _T50 << 2
-1b4:  2413166592	lw s6,0(fp)		.33 -- load content from _VAUX23 in s6
-1b8:  0000000000	sll zero,zero,0		.33 -- Nop
-1bc:  2918580256	sw s6,32(t7)		.34 -- store content of s6 in _G54[_T53]
-1c0:  2948595712	sw zero,0(fp)		.35 -- store content of zero in _VAUX23
-1c4:  0604897281	addiu t6,zero,1		.36 -- load param (p2)
-1c8:  0647233537	addiu s4,s4,1		.36 -- _S51 = _S51 + 1
-1cc:  2949906440	sw s4,8(fp)		.37 -- store content of s4 in _VJ27
-1d0:  2412904456	lw s2,8(fp)		.38 -- load content from _VJ27 in s2
-1d4:  0000000000	sll zero,zero,0		.38 -- Nop
-1d8:  0604504066	addiu t0,zero,2		.39 -- load param (p2)
-1dc:  0038277155	subu v0,s2,t0		.39
-1e0:  0071368651	bltz v0,110 <multiplica+0x24>		.39 -- branch if register < 0
-1e4:  0000000000	sll zero,zero,0		.39 -- Nop
-1e8:  2413166596	lw s6,4(fp)		.40 -- load content from _VI25 in s6
-1ec:  0000000000	sll zero,zero,0		.40 -- Nop
-1f0:  0604569601	addiu t1,zero,1		.41 -- load param (p2)
-1f4:  0651558913	addiu s6,s6,1		.41 -- _S57 = _S57 + 1
-1f8:  2950037508	sw s6,4(fp)		.42 -- store content of s6 in _VI25
-1fc:  2413232132	lw s7,4(fp)		.43 -- load content from _VI25 in s7
-200:  0000000000	sll zero,zero,0		.43 -- Nop
-204:  0604635138	addiu t2,zero,2		.44 -- load param (p2)
-208:  0048893987	subu v0,s7,t2		.44
-20c:  0071368637	bltz v0,104 <multiplica+0x18>		.44 -- branch if register < 0
-210:  0000000000	sll zero,zero,0		.44 -- Nop
-214:  0666697744	addiu sp,sp,16		 -- epilog| pop stack frame
-218:  0001962017	addu fp,zero,sp		 -- epilog| pop stack frame
-21c:  0065011720	jr ra		 -- epilog| return
 */
-
-
-

+ 5 - 0
src/targets/mips/Descriprion.java

@@ -376,6 +376,11 @@ public class Descriprion {
                     .Set("codop", "000101")
                     .Set("format", "I0"));
 
+//            put("bnez", I.copy()//r = Set
+//                    .Set("inst", "bnez")
+//                    .Set("codop", "000101")
+//                    .Set("format", "I0"));
+
             put("lb", I.copy()
                     .Set("inst", "lb")
                     .Set("codop", "100000c")

+ 46 - 23
src/targets/mips/MipsRegisterAllocMiddleware.java

@@ -68,9 +68,12 @@ public class MipsRegisterAllocMiddleware implements AllocatorInterface, Middlewa
                 }
 
                 // Libera registradores alocados temporariamente
+//                if (!free.isEmpty()) {
+//                    System.out.println("Liberando registradores:" + free);
                 while (!free.isEmpty()) {
                     registers.Free(free.pop());
                 }
+//                }
                 // Atribui os registradores a instrucao
                 Assign(inst);
             }
@@ -88,30 +91,43 @@ public class MipsRegisterAllocMiddleware implements AllocatorInterface, Middlewa
 
     protected void Assign(Instruction inst) throws Exception {
 
-//        System.out.println("Assign:" + inst.Get("type") + ":" + inst.Get("local.position"));
         String reg;
         String[] opDeslocamento = "<<,>>".split(",");
+//        BlockBaseOcorrences bb;
 
+//        System.out.println("Assign[" + inst + "]");
         for (String param : new String[]{"p1", "p2", "dst.indice", "p1.indice"}) {
 
             if (!inst.Has(param) || ((inst.in("op", opDeslocamento) && param.equals("p2")))) {
                 continue;
             }
 
-//            System.out.println("PARAM:[" + param + "value" + "]" + x.eq(param + "value", "true"));
-//            if (!x.in("op", opDeslocamento)) {
-//            } else 
             if (inst.eq(param + "value", "true") || inst.isNumber(param)) {
-                reg = registers.Lock("t");
-                free.push(reg);
-//                Load(inst, param);
-            } else {
+//                System.out.println("INST IM" + inst);
+                if (param.contains("indice")) {
+                    reg = "zero";
+                } else {
+
+                    reg = registers.Lock("t");
+
+//                if (reg == null) {
+//                    bb = group.Current();
+//                    reg = bb.Spill(Position(inst, bb)).getRegister();
+//                }
+                    if (reg != null) {
+//                    System.out.println("Lock temporary register " + reg);
+                        free.push(reg);
+                    }
+//                else {
+//                    System.out.println("temporary register null" + reg);
+//                }
+                }
 
+            } else {
 //                System.out.println("GX:" + param + "->" + x);
                 reg = GetRegister(inst, param);
 
             }
-
             inst.Set("reg." + param, reg);
 //            System.out.println("Assign:[" + param + "]" + inst);
         }
@@ -122,26 +138,31 @@ public class MipsRegisterAllocMiddleware implements AllocatorInterface, Middlewa
 
     }
 
+    protected int Position(Instruction x, BlockBaseOcorrences bb) throws Exception {
+        int position = x.GetInt("block.position"), leader = bb.getLeader();
+        // Corrige a posicao para iniciar de 0 para cada bloco basico referente ao lider de cada bloco.
+        return (leader == 0) ? position : position - leader;
+    }
 //    protected void Load(Instruction x, String param) {
 //        x.Set("reg." + param + ".load", "true");
 //    }
+
     protected String GetRegister(Instruction x, String address) throws Exception {
         BlockBaseOcorrences bb = group.Current();
 
         String reg, addr = bb.ToAliase(x, address);
-        int position = x.GetInt("block.position"), leader = bb.getLeader();
-        // Corrige a posicao para iniciar de 0 para cada bloco basico referente ao lider de cada bloco.
-        position = (leader == 0) ? position : position - leader;
+
+        int position = Position(x, bb);
 
         boolean dst = address.equals("dst");
 
-        System.out.println("GetRegister: (" + address + "):(" + addr + ") : ["
-                + instructionPosition
-                + " : "
-                + position
-                + " : "
-                + leader + "]");
-        System.out.println(x);
+//        System.out.println("GetRegister: (" + address + "):(" + addr + ") : ["
+//                + instructionPosition
+//                + " : "
+//                + position
+//                + " : "
+//                + leader + "]");
+//        System.out.println(x);
         Interval interval = bb.Get(addr, position);
 
 //        System.out.println(bb);
@@ -167,8 +188,10 @@ public class MipsRegisterAllocMiddleware implements AllocatorInterface, Middlewa
             }
             // Vincula o registrador com o intervalo
             interval.setRegister(reg);
+//            System.out.println("Set Register to interval: " + reg + "||" + interval);
         } else {
             reg = interval.getRegister();
+//            System.out.println("Get Register from interval: " + reg);
 
             // Se escreve no registrador e não é o ultimo intervalo marca para 
             // ser salvo marca para ser salvo.
@@ -190,10 +213,10 @@ public class MipsRegisterAllocMiddleware implements AllocatorInterface, Middlewa
             registers.Free(reg);
 
 //            System.out.println("reg(" + reg + ")persist(" + interval.Perisist() + ")");
-            if (reg.substring(0, 1).equals("s")
-                    && interval.Perisist()) {
-                x.Set("reg." + address + ".store", "true");
-            }
+//            if (reg.substring(0, 1).equals("s")
+//                    && interval.Perisist()) {
+//                x.Set("reg." + address + ".store", "true");
+//            }
         }
 
 //        System.out.println("}" + reg + "::" + position);

+ 3 - 0
src/targets/mips/Registers.java

@@ -54,6 +54,9 @@ public class Registers {
     }
 
     private String exec(String reg, String act) throws Exception {
+        if (reg == null) {
+            throw new Exception(String.format("Não foi possivel executar a ação '%s'. Registrador não pode ser null", act));
+        }
 //        System.out.println("Exec:" + reg + ":" + act);
         LinkedList<String> u, a;
         String r = null;

+ 81 - 53
src/targets/mips/Translate.java

@@ -23,8 +23,11 @@ import java.util.LinkedList;
 public class Translate extends API.TargetGen {
 
     protected String[] registersKeys = "reg.p1,reg.p2".split(",");
-    protected ArrayList<String> returnRegisters;
+
+    public static LinkedList<String> returnRegisters;
+
     protected HashMap<String, String> AddressCalculated = new HashMap<>();
+
     protected HashMap<String, String> comments = new HashMap<String, String>() {
         {
             put("beq", "branch if equals");
@@ -153,37 +156,43 @@ public class Translate extends API.TargetGen {
 
     @Override
     public void TranslateCall(Instruction inst) throws Exception {
-//        allocation.registers.ResetArgs();
+        ArrayList<Instruction> pushs = new ArrayList<>();
+        ResetReturnArgs();
         // Before load params
 
         //        Copy(inst, returnRegisters.remove(2))
 //                .Set("IR.position", inst.Get("block.position"))
 //                .Set("comment", "push param");
 //        System.out.println("Call" + inst);
-        ResetReturnArgs();
-
         Instruction retur;
 
         LinkedList<Instruction> intructions = getIR().Block().Instructions();
         int base = intructions.indexOf(inst);
 
-        for (int i = inst.GetInt("numParams"); i > 0; i--) {
-            retur = intructions.get(base - i);
-
-            Copy(retur, returnRegisters.remove(2))
+//        System.out.println("TranslateCall" + inst.GetInt("numParams"));
+        for (int i = inst.GetInt("numParams"), j = 1; i > 0; j--) {
+            retur = intructions.get(base + j);
+            if (retur.eq("type", "push_param")) {
+                pushs.add(0, retur);
+                i--;
+            }
+        }
+        for (Instruction push : pushs) {
+            Copy(push, returnRegisters.remove(2))
                     .Set("comment", "push param");
-
         }
 
-        Add(new Instruction("J", "jal")
-                .Set("label", inst.Get("funcname"))
-                .Set("comment", F("jump to <%s>", inst.Get("funcname")))
+        Add(
+                new Instruction("J", "jal")
+                        .Set("label", inst.Get("funcname"))
+                        .Set("comment", F("jump to <%s>", inst.Get("funcname")))
         );
         // After store results
         // Restaura o array de registradores de retorno para fazer o pop dos returns
         ResetReturnArgs();
 
-        Nop(false);
+        Nop(
+                false);
     }
 
     @Override
@@ -203,6 +212,7 @@ public class Translate extends API.TargetGen {
                     .Set("comment", "push return ");
 
         }
+        ResetReturnArgs();
     }
 
     @Override
@@ -225,7 +235,7 @@ public class Translate extends API.TargetGen {
     @Override
     public void TranslatePopParam(Instruction inst) throws Exception {
         // todo - resetar args
-        System.out.println("PopParam:" + inst);
+//        System.out.println("PopParam:" + inst);
         String dst = inst.Get("p1");
         // O indice é 2 por conta dos dois primeiros registradores {v0, v1}
 //        System.out.println("PopParams:" + inst);
@@ -321,6 +331,7 @@ public class Translate extends API.TargetGen {
         Instruction alloc = Copy("sp", "sp", "-" + data.Size())
                 .Set("comment", "prolog| push stack frame");
 
+//        System.out.println("Stack size for " + id + " -" + data.Size());
         if (!getTarget().Block().getName().equals("main")) {
             // Restaura o fp
             // Restaura o ra
@@ -338,7 +349,9 @@ public class Translate extends API.TargetGen {
                     ).Set("comment", F("prolog| backup %s", reg));
                 }
 
-                alloc.Set("offset", (data.Size() - 0));
+                alloc.Set("offset", "-" + data.Size());
+
+//                System.out.println("Update Stack size for " + id + " -" + data.Size());
             }
         }
 
@@ -453,15 +466,22 @@ public class Translate extends API.TargetGen {
     @Override
     public void TranslateLoad(Instruction inst) throws Exception {
 
-        if (inst.eq("block.position", "12")) {
-            System.out.println("Translate load:" + inst);
-        }
-
         String addr = inst.Get("p1"),
-                rd = inst.Get("reg.dst");
-
-        String rs = inst.Has("reg.p1.indice")
-                ? inst.Get("reg.p1.indice") : FrameRegister(addr);
+                rd = inst.Get("reg.dst"),
+                rs;
+
+        if (inst.Has("reg.p1.indice")) {
+            rs = inst.Get("reg.p1.indice");
+            // Se a variavel não for global adiciona o fp ao deslocamento
+            if (!addr.contains("_G")) {
+                Add(Descriprion.Instruction("addu"))
+                        .Set("rt", "fp")
+                        .Set("rs", rs)
+                        .Set("rd", rs);
+            }
+        } else {
+            rs = FrameRegister(addr);
+        }
 
         Instruction lw = LoadWord(
                 target.DEFAULT_WORD_TYPE,
@@ -470,40 +490,32 @@ public class Translate extends API.TargetGen {
                 Offset(addr)
         ).Set("comment", F("load content from %s in %s", addr, rd));
 
-        if (inst.eq("block.position", "12")) {
-            System.out.println("Translate load >> :" + lw);
-        }
     }
 
     @Override
     public void TranslateStore(Instruction inst) throws Exception {
-//        System.out.println("Translate store>> :" + inst);
-//        // Carrega o parametro p1 se constante
-//        // Caso a constante seja 0 a instrução não carrega o valor e atualiza o registrador fonte para zero
-//        LoadParam(inst, "p1", true);
-//
-//        String addr = inst.Get("dst"),
-//                rt = inst.Get("reg.dst");
-//
-//        String rs = inst.Has("reg.dst.indice")
-//                ? inst.Get("reg.dst.indice") : FrameRegister(addr);
-//
-//        StoreWord(
-//                target.DEFAULT_WORD_TYPE,
-//                rt,
-//                rs,
-//                Offset(addr)
-//        ).Set("comment", F("store content of %s in %s", rt, addr));
 
         // Carrega o parametro p1 se constante
         // Caso a constante seja 0 a instrução não carrega o valor e atualiza o registrador fonte para zero
         LoadParam(inst, "p1", true);
 
         String addr = inst.Get("dst"),
-                rt = inst.Get("reg.p1");
-
-        String rs = inst.Has("reg.dst.indice")
-                ? inst.Get("reg.dst.indice") : FrameRegister(addr);
+                rt = inst.Get("reg.p1"),
+                rs;
+
+//        System.out.println("Translate Store" + inst);
+        if (inst.Has("reg.dst.indice")) {
+            rs = inst.Get("reg.dst.indice");
+            // Se a variavel não for global adiciona o fp ao deslocamento
+            if (!addr.contains("_G")) {
+                Add(Descriprion.Instruction("addu"))
+                        .Set("rt", "fp")
+                        .Set("rs", rs)
+                        .Set("rd", rs);
+            }
+        } else {
+            rs = FrameRegister(addr);
+        }
 
         StoreWord(
                 target.DEFAULT_WORD_TYPE,
@@ -600,19 +612,29 @@ public class Translate extends API.TargetGen {
     }
 
     @Override
-    public void TranslatePushReturn(Instruction inst) {
+    public void TranslatePushReturn(Instruction inst) throws Exception {
         // Tratado no metodo 'TranslateReturn'
     }
 
     @Override
-    public void TranslatePushParam(Instruction inst) {
+    public void TranslatePushParam(Instruction inst) throws Exception {
         // Tratado no metodo 'TranslateCall'
+//        System.out.println("translate push param 2" + (returnRegisters == null) + "/");
+//        String reg = returnRegisters.remove(2);
+//        System.out.println("translate push param 1" + reg + "");
+//        Copy(inst, reg)
+//                .Set("comment", "push param");
     }
 
     @Override
     public IvannosysTargetArch Init(Code tac) throws Exception {
         this.IR = tac;
 
+//        ResetReturnArgs();
+//        Middleware.On("mips", "before.translate.block", (target, ir) -> {
+//            this.ResetReturnArgs();
+//            System.out.println("before.translate.block .... " + this.returnRegisters);
+//        });
         getTarget()
                 .setAddressIncrement(4)
                 .Template(new MipsTemplateDescription());
@@ -674,10 +696,15 @@ public class Translate extends API.TargetGen {
 //                System.out.println("bin:"
 //                        + "\n" + bin
 //                        + "\n" + offset
+//                        + "\n" + bin.length()
 //                        + "\n" + Long.toBinaryString(Integer.parseInt(bin.substring(0, 16), 2))
-//                        + "\n" + Long.toBinaryString(Integer.parseInt(bin.substring(16), 2)));
-                if (bin.substring(0, 16).contains("1")) {
+//                )
+//                );
+//                
+//                System.out.println(Long.toBinaryString(Integer.parseInt(bin.substring(16), 2));
+                if (value > 0 && bin.substring(0, 16).contains("1")) {
 
+//                    System.out.println("LOAD PARAM:" + bin);
                     upper = Integer.parseInt(bin.substring(0, 16), 2);
                     lower = Integer.parseInt(bin.substring(16), 2);
 
@@ -851,8 +878,8 @@ public class Translate extends API.TargetGen {
         return var.contains("_G") ? "gp" : "fp";
     }
 
-    private void ResetReturnArgs() {
-        returnRegisters = new ArrayList<String>() {
+    public static void ResetReturnArgs() {
+        returnRegisters = new LinkedList<String>() {
             {
                 add("v0");
                 add("v1");
@@ -862,6 +889,7 @@ public class Translate extends API.TargetGen {
                 add("a3");
             }
         };
+//        System.out.println("Resetei args" + returnRegisters);
     }
 
 }

+ 27 - 919
src/targets/mips/TranslateJun.java

@@ -5,244 +5,29 @@
  */
 package targets.mips;
 
-import API.Utils;
-import common.Code;
-import common.DataLayout;
 import common.Instruction;
-import common.IvannosysTargetArch;
-import common.Offset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
 
 /**
  * MipS tranSlation
  *
  * @author EUGENIO CARVALHO
  */
-public class Translate extends API.TargetGen {
+public class TranslateJun extends Translate {
 
-    protected String[] registersKeys = "reg.p1,reg.p2".split(",");
-    protected ArrayList<String> returnRegisters;
-    protected HashMap<String, String> AddressCalculated = new HashMap<>();
-    protected HashMap<String, String> comments = new HashMap<String, String>() {
-        {
-            put("beq", "branch if equals");
-            put("bne", "branch if not equals");
-            put("blez", "branch if register <= 0");
-            put("bltz", "branch if register < 0");
-            put("bgez", "branch if register >= 0");
-            put("bgtz", "branch if register > 0");
-        }
-    };
-    protected HashMap<String, Boolean> ctrlDataUpdate = new HashMap<>();
-
-    public Translate() {
-        super("mips");
-    }
-
-    @Override
-    public void TranslateLabel(Instruction inst) throws Exception {
-
-        Add(new Instruction()
-                .Set("type", "label")
-                .Set("format", "norender")
-                .Set("label", inst.Get("label")));
-
-        getTarget().RegisterLabelAddress(inst.Get("label"));
-    }
-
-    @Override
-    public void TranslateCopy(Instruction inst) throws Exception {
-        Instruction c = Copy(inst, inst.Get("reg.dst"));
-        if (c != null) {
-            c.Set("comment", F("copy %s ← %s", inst.Get("dst"), inst.Get("p1")));
-        }
-    }
-
-    @Override
-    public void TranslateAssign(Instruction inst) throws Exception {
-
-        String instruction = Descriprion.InstructionByOperator(inst);
-
-        String rd = inst.Get("reg.dst"),
-                dst = inst.Get("dst"),
-                op = inst.Get("op"),
-                rs,
-                offset;
-
-        Instruction ninst = new Instruction(instruction);
-
-        switch (Descriprion.Codops.get(instruction).Get("type")) {
-            //addi, addiu, slti, sltiu
-            case "I":
-
-                ninst.Set("rt", rd);
-//                System.out.println("Assign:" + inst);
-//                LoadParam(inst, "p1,p2", true);
-
-                if (inst.eq("p2value", "true")) {
-
-//                    LoadParam(inst, "p1");
-//                    ninst.Set("offset", (op.equals("-") ? "-" : "") + inst.Get("p2"))
-//                            .Set("rs", inst.Get("reg.p1"));
-                    offset = inst.Get("p2");
-                    rs = inst.Get("reg.p1");
-                } else {
-                    offset = inst.Get("p1");
-                    rs = inst.Get("reg.p2");
-//                    LoadParam(inst, "p2");
-//                    ninst.Set("offset", inst.Get("p1"))
-//                            .Set("rs", inst.Get("reg.p2"));
-                }
-
-                ninst.Set("offset", (op.equals("-") ? "-" : "") + offset)
-                        .Set("rs", rs);
-
-                break;
-            // mult, divu, sgtu ,sltu 
-            // sra, srl, sll
-            case "R":
-                LoadParam(inst, "p1,p2", true);
-                //
-
-                if (ninst.in("inst", "sll,srl,sra".split(","))) {
-                    rd = inst.Get("reg.dst");
-                    ninst.Set("sa", inst.Get("p2"))
-                            .Set("rt", inst.Get("reg.p1"));
-                } else {
-                    ninst.Set("rs", inst.Get("reg.p1"))
-                            .Set("rt", inst.Get("reg.p2"));
-                }
-                ninst.Set("rd", rd);
-//                System.out.println("inst["+rd+"]" + inst + ":" + ninst);
-                break;
-
-            default:
-                throw new Exception("Invalid instruction type");
-        }
-
-        Add(ninst).Set("comment", F(
-                "%s = %s %s %s",
-                dst,
-                inst.Get("p1"),
-                inst.Get("op"),
-                inst.Get("p2")
-        ));
-
-        // Verifica se a expr possui overflow
-        String overflow = Descriprion.Instruction(instruction).Get("overflow");
-
-        if (!overflow.equals("")) {
-            Add(new Instruction("R", overflow)
-                    .Set("rd", rd)
-            );
-        }
-//        StoreResult(inst, rd, dst);
-    }
-
-    @Override
-    public void TranslateJump(Instruction inst) throws Exception {
-        Add(new Instruction("J", "j")
-                .copy("label", inst)
-                .Set("comment", F("jump to %s", inst.Get("label")))
-        );
-
-        Nop(false);
-    }
-
-    @Override
-    public void TranslateCall(Instruction inst) throws Exception {
-//        allocation.registers.ResetArgs();
-        // Before load params
-
-        //        Copy(inst, returnRegisters.remove(2))
-//                .Set("IR.position", inst.Get("block.position"))
-//                .Set("comment", "push param");
-//        System.out.println("Call" + inst);
-        ResetReturnArgs();
-
-        Instruction retur;
-
-        LinkedList<Instruction> intructions = getIR().Block().Instructions();
-        int base = intructions.indexOf(inst);
-
-        for (int i = inst.GetInt("numParams"); i > 0; i--) {
-            retur = intructions.get(base - i);
-
-            Copy(retur, returnRegisters.remove(2))
-                    .Set("comment", "push param");
-
-        }
-
-        Add(new Instruction("J", "jal")
-                .Set("label", inst.Get("funcname"))
-                .Set("comment", F("jump to <%s>", inst.Get("funcname")))
-        );
-        // After store results
-        // Restaura o array de registradores de retorno para fazer o pop dos returns
-        ResetReturnArgs();
-
-        Nop(false);
-    }
-
-    @Override
-    public void TranslateReturn(Instruction inst) throws Exception {
-        // Restaura o array de registradores de retorno
-        ResetReturnArgs();
-
-        Instruction retur;
-        LinkedList<Instruction> intructions = getIR().Block().Instructions();
-        int base = intructions.indexOf(inst);
-
-        for (int i = inst.GetInt("p1"); i > 0; i--) {
-            retur = intructions.get(base - i);
-
-//                System.out.println("Return:" + retur);
-            Copy(retur, returnRegisters.remove(0))
-                    .Set("comment", "push return ");
-
-        }
-    }
-
-    @Override
-    public void TranslatePopReturn(Instruction inst) throws Exception {
-        String p1 = inst.Get("p1"), reg = returnRegisters.remove(0);
-        // Se for uma variavel temporaria
-        if (p1.contains("_T")) {
-            CopyReg(reg, inst.Get("reg.p1"));
-        } else {
-            StoreWord(
-                    target.DEFAULT_WORD_TYPE,
-                    reg,
-                    FrameRegister(p1),
-                    Offset(p1)
-            );
-        }
-//            System.out.println("Translate pop return" + inst);
-    }
-
-    @Override
-    public void TranslatePopParam(Instruction inst) throws Exception {
-        // todo - resetar args
-        System.out.println("PopParam:" + inst);
-        String dst = inst.Get("p1");
-        // O indice é 2 por conta dos dois primeiros registradores {v0, v1}
-//        System.out.println("PopParams:" + inst);
-        StoreWord(
-                target.DEFAULT_WORD_TYPE,
-                returnRegisters.remove(2),
-                FrameRegister(dst),
-                Offset(dst)
-        ).Set("comment", "pop param");
-
-//        System.out.println("POPpARAM:" + inst);
-//            LoadWord(inst.Get("reg.p1"), "fp", offset);
-    }
-
-    @Override
     public void TranslateBranch(Instruction inst) throws Exception {
-
+        //BEQ
+        //BNE
+
+        //BGTZ
+        //BGEZ
+        //BLTZ
+        //BNEZ
+//             "<" "bltz"
+//             ">" "bgtz"
+//            "<=" "blez"
+//            ">=" "bgez"
+//            "==" "beq"
+//            "!=" "bne"
         String instruction = Descriprion.InstructionByOperator(inst);
 
         LoadParam(inst, "p1,p2", true);
@@ -259,16 +44,26 @@ public class Translate extends API.TargetGen {
 
                 break;
             case "blez": // <= 0{[inst]}' ' {[rs]},{immediate}
+                Add(Descriprion.Instruction("slt"))
+                        .Set("rs", rs)
+                        .Set("rt", rt)
+                        .Set("rd", "v0")
+                        .Set("comment", "");
+                // Atualiza o tipo de branch
+                instruction = "bne";
+                branch = Descriprion.Instruction(instruction)
+                        .Set("rs", "v0")
+                        .Set("rt", "zero");
+                break;
             case "bltz": // <  0
             case "bgez": // >= 0
             case "bgtz": // >  0
 
-                Add(new Instruction("R", "subu")// Rd <-- [Rs] - [Rt];
+                Add(Descriprion.Instruction("subu"))
                         .Set("rs", rs)
                         .Set("rt", rt)
                         .Set("rd", "v0")
-                        .Set("comment", "")
-                );
+                        .Set("comment", "");
 
                 branch.Set("rs", "v0");
                 break;
@@ -281,691 +76,4 @@ public class Translate extends API.TargetGen {
         Nop(false);
     }
 
-    protected void Nop(Boolean checkDependence) throws Exception {
-
-        if (checkDependence) {
-            Instruction n = Next();
-            Integer dep = 0;
-            // Se existe uma proxima intrucao
-            if (n != null) {
-                String dst = currentIrInstruction.Get(
-                        currentIrInstruction.Has("reg.dst")
-                        ? "reg.dst" : "reg.p1"
-                );
-                for (String reg : registersKeys) {
-                    if (n.eq(reg, dst)) {
-                        dep++;
-                        break;
-                    }
-                }
-                if (dep == 0) {
-                    return;
-                }
-            }
-        }
-
-        Add(Descriprion.Instruction("nop"));
-    }
-
-    @Override
-    public void Prolog(String id) throws Exception {
-        DataLayout data = Context();
-        // Adiciona o label
-        Add(new Instruction()
-                .Set("type", "label")
-                .Set("format", "label")
-                .Set("label", id)
-        );
-
-        // Aloca o espaco da pilha
-        Instruction alloc = Copy("sp", "sp", "-" + data.Size())
-                .Set("comment", "prolog| push stack frame");
-
-        if (!getTarget().Block().getName().equals("main")) {
-            // Restaura o fp
-            // Restaura o ra
-//            boolean call = getIR().Block().HasCall();
-
-            if (getIR().Block().HasCall()) {
-//                int newvars = 0;
-                for (String reg : new String[]{"fp", "ra"}) {
-                    data.Add(reg, "int32", 1);
-                    StoreWord(
-                            target.DEFAULT_WORD_TYPE,
-                            reg,
-                            "sp",
-                            data.Offset(reg)
-                    ).Set("comment", F("prolog| backup %s", reg));
-                }
-
-                alloc.Set("offset", (data.Size() - 0));
-            }
-        }
-
-        if (alloc.getInt("offset", 0) != 0) {
-            // Copia o sp para o fp
-            CopyReg("sp", "fp").Prepend("comment", "prolog|");
-            ResetReturnArgs();
-        } else {
-            getTarget().Block().Remove(alloc);
-        }
-    }
-
-    /**
-     * Encerra a chamada de uma funcao
-     *
-     * @param id
-     * @throws Exception
-     */
-    @Override
-    public void Epilog(String id) throws Exception {
-        DataLayout data = Context();
-        if (!getTarget().Block().getName().equals("main")) {
-            // Restaura o fp
-            // Restaura o ra
-            boolean call = getIR().Block().HasCall();
-            for (String reg : new String[]{"fp", "ra"}) {
-                if (call) {
-                    LoadWord(
-                            target.DEFAULT_WORD_TYPE,
-                            reg,
-                            "sp",
-                            data.Offset(reg)
-                    ).Set("comment", F("epilog| restore ", reg));
-                }
-            }
-
-            // Desaloca a pilha
-            Copy("sp", "sp", Long.valueOf(data.Size()).toString())
-                    .Set("comment", "epilog| pop stack frame");
-            CopyReg("sp", "fp")
-                    .Set("comment", "epilog| pop stack frame");
-
-            Add(new Instruction("jr")
-                    .Set("rs", "ra")
-                    .Set("comment", "epilog| return"));
-
-        } else {
-            Add(Descriprion.Instruction("stop").copy());
-        }
-    }
-
-    @Override
-    public void TranslateIndexedAssignment(Instruction inst) throws Exception {
-//        //Fase de leitura
-//        IndexedRead(inst);
-//        //Fase de atribuicao
-//        IndexedDest(inst);
-    }
-
-    @Override
-    public void TranslateUnary(Instruction inst) throws Exception {
-        // Carrega o valor se nao esta em registrador
-//        System.out.println("Translate Unary:" + inst);
-
-        switch (inst.Get("op")) {
-            case "-": // Retorna o valor negado 10 -> -10
-
-                Add(new Instruction("subu")// Rd <-- [Rs] - [Rt];
-                        .Set("rd", inst.Get("reg.dst"))
-                        .Set("rs", "zero")
-                        .Set("rt", inst.Get("reg.p1"))
-                        .Set("comment", "negation arith")
-                );
-                break;
-            case "!": // XOR ( 0 1 -> 1) XOR( 1 1 -> 0)
-                Add(new Instruction("xori") // Rt <-- [Rs] AND (016 || [I15..0]); ;
-                        .Set("rt", inst.Get("reg.dst"))
-                        .Set("rs", inst.Get("reg.p1"))
-                        .Set("offset", "1")
-                        .Set("comment", "negation bool")
-                );
-                break;
-//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;//            case "*": // Copia do conteudo do ponteiro
-//
-//            case "&":  // Copia do endereco da variavel
-//                break;
-        }
-
-    }
-
-    @Override
-    public void TranslateLoad(Instruction inst) throws Exception {
-
-        if (inst.eq("block.position", "12")) {
-            System.out.println("Translate load:" + inst);
-        }
-
-        String addr = inst.Get("p1"),
-                rd = inst.Get("reg.dst");
-
-        String rs = inst.Has("reg.p1.indice")
-                ? inst.Get("reg.p1.indice") : FrameRegister(addr);
-
-        Instruction lw = LoadWord(
-                target.DEFAULT_WORD_TYPE,
-                rd,
-                rs,
-                Offset(addr)
-        ).Set("comment", F("load content from %s in %s", addr, rd));
-
-        if (inst.eq("block.position", "12")) {
-            System.out.println("Translate load >> :" + lw);
-        }
-    }
-
-    @Override
-    public void TranslateStore(Instruction inst) throws Exception {
-//        System.out.println("Translate store>> :" + inst);
-//        // Carrega o parametro p1 se constante
-//        // Caso a constante seja 0 a instrução não carrega o valor e atualiza o registrador fonte para zero
-//        LoadParam(inst, "p1", true);
-//
-//        String addr = inst.Get("dst"),
-//                rt = inst.Get("reg.dst");
-//
-//        String rs = inst.Has("reg.dst.indice")
-//                ? inst.Get("reg.dst.indice") : FrameRegister(addr);
-//
-//        StoreWord(
-//                target.DEFAULT_WORD_TYPE,
-//                rt,
-//                rs,
-//                Offset(addr)
-//        ).Set("comment", F("store content of %s in %s", rt, addr));
-
-        // Carrega o parametro p1 se constante
-        // Caso a constante seja 0 a instrução não carrega o valor e atualiza o registrador fonte para zero
-        LoadParam(inst, "p1", true);
-
-        String addr = inst.Get("dst"),
-                rt = inst.Get("reg.p1");
-
-        String rs = inst.Has("reg.dst.indice")
-                ? inst.Get("reg.dst.indice") : FrameRegister(addr);
-
-        StoreWord(
-                target.DEFAULT_WORD_TYPE,
-                rt,
-                rs,
-                Offset(addr)
-        ).Set("comment", F("store content of %s in %s", rt, addr));
-    }
-
-    /**
-     * Traducao de intrucoeS do tipo
-     *
-     * - x = &a - copia do endereco de uma varaivel <br>
-     * - x = *b - x recebe o conteudo da variavel referenciada por b<br>
-     * - *x = y - conpia o conteudo de y para o endereco armazenado em x
-     *
-     * @param inst
-     * @throws Exception
-     */
-    @Override
-    public void TranslatePointerAssignment(Instruction inst) throws Exception {
-        String p1 = inst.Get("p1"),
-                dst = inst.Get("dst"),
-                regdst = inst.Get("reg.dst"),
-                regp1 = inst.Get("reg.p1");
-
-        switch (inst.Get("op")) {
-
-            case "&": // Lendo o endereco de um ponteiro
-                Copy(regp1,
-                        FrameRegister(p1),
-                        Offset(p1)
-                ).Set("comment", F("copy address of ", p1));
-
-                System.out.println("PointerAssi&:" + inst);
-                // Se nao fez o store
-//                if (StoreResult(inst, regp1, dst) == null) {
-//                    CopyReg(regp1, regdst);
-//                            .Set("comment", "store content of " + regdst + " in " + dst);
-//                }
-                break;
-            case "*": // Lendo o conteudo de um ponteiro
-                /**
-                 * Carrega o valor contido no ponteiro<br>
-                 * Utiliza o valor como endereço em um segundo load que carrega
-                 * o dado<br>
-                 * lw ${p1},12($fp)<br>
-                 * lw ${dst},0(${p1}) $s<br>
-                 */
-                LoadWord(
-                        target.DEFAULT_WORD_TYPE,
-                        regp1,
-                        FrameRegister(p1),
-                        Offset(p1)
-                ).Set("comment", F("load address stored in %s", p1));
-
-                LoadWord(
-                        target.DEFAULT_WORD_TYPE,
-                        regdst,
-                        regp1,
-                        "0"
-                ).Set("comment", F("load content of address stored in %s", regp1));
-
-                /*Se for a ultima operacao de escrita nessa variavel salva em memoria*/
-//                Instruction store = StoreResult(inst, regdst, dst);
-//                if (store != null) {
-//                    store.Set("comment", "store content of " + regdst + " in " + dst);
-//                }
-                break;
-            default: // Atribuicao a um ponteiro
-                LoadParam(inst, "p1,p2", true);
-
-                /**
-                 * Carrega o valor dentro do endereco do ponteiro <br>
-                 * lw ${p1},12(${fp|gp})<br>
-                 * lw ${dst},0(${p1}) $s<br>
-                 * conteudo da variavel referenciada
-                 */
-                LoadWord(
-                        target.DEFAULT_WORD_TYPE,
-                        regdst,
-                        FrameRegister(dst),
-                        Offset(dst)
-                ).Set("comment", F("load address stored in %s", dst));
-                // Grava o valor do registrador na memoria
-                StoreWord(
-                        target.DEFAULT_WORD_TYPE,
-                        regp1,
-                        regdst,
-                        "0"
-                ).Set("comment", F("store content of %s in *%s", regp1, dst));
-        }
-
-    }
-
-    @Override
-    public void TranslatePushReturn(Instruction inst) {
-        // Tratado no metodo 'TranslateReturn'
-    }
-
-    @Override
-    public void TranslatePushParam(Instruction inst) {
-        // Tratado no metodo 'TranslateCall'
-    }
-
-    @Override
-    public IvannosysTargetArch Init(Code tac) throws Exception {
-        this.IR = tac;
-
-        getTarget()
-                .setAddressIncrement(4)
-                .Template(new MipsTemplateDescription());
-
-        return this;
-    }
-
-    /**
-     * Criar uma inStrucao que copia o valor ou conteudo do regiStrador para o
-     * regiStrador 'r'
-     *
-     * @param inst
-     * @param rt
-     * @return
-     */
-    protected Instruction Copy(Instruction inst, String rt) throws Exception {
-        Instruction c = null;
-
-        LoadParam(inst, "p1", false);
-
-        if (inst.eq("load.large.constante", "true")) {
-            System.out.println("COPY LARGE:" + currentTargetInstruction);
-
-        } else {
-            if (inst.IsValue("p1")) {
-                // andi Rt,Rs,immediate | Rt <-- [Rs] + ([I15]16 || [I15..0]);
-                c = Copy(rt, "zero", inst.Get("p1"));
-            } else {
-                // addu Rd,Rs,Rt | Rd <-- [Rs] + [Rt];
-                c = CopyReg(inst.Get("reg.p1"), rt);
-            }
-        }
-        return c;
-    }
-
-    /**
-     * @param inst
-     * @return
-     */
-    protected Instruction LoadParam(Instruction inst, String params, boolean copy) throws Exception {
-        return LoadParam(inst, params.split(","), copy);
-    }
-
-    protected Instruction LoadParam(Instruction inst, String[] params, boolean copy) throws Exception {
-        String offset, bin, reg, r;
-//        boolean loaded = false;
-        Long value;
-        Integer lower, upper;
-        Instruction loaded = null;
-
-        for (String param : params) {
-            if (inst.IsValue(param) && inst.Has("reg." + param)) {
-//                loaded = true;
-
-                offset = inst.Get(param);
-                value = Long.parseLong(offset);
-                bin = Utils.Pad(32, Long.toBinaryString(value));
-
-//                System.out.println("bin:"
-//                        + "\n" + bin
-//                        + "\n" + offset
-//                        + "\n" + Long.toBinaryString(Integer.parseInt(bin.substring(0, 16), 2))
-//                        + "\n" + Long.toBinaryString(Integer.parseInt(bin.substring(16), 2)));
-                if (bin.substring(0, 16).contains("1")) {
-
-                    upper = Integer.parseInt(bin.substring(0, 16), 2);
-                    lower = Integer.parseInt(bin.substring(16), 2);
-
-                    inst.Set("load.large.constante", "true");
-//                    System.out.println("Load param:" + inst);
-//                    r = inst.Get("reg.dst");
-                    r = inst.Get("reg." + param);
-
-//                    System.out.println("upper:" + upper);
-                    //clui $s0, upper(big)
-                    Add(Descriprion.Instruction("lui"))
-                            .Set("rt", r)
-                            .Set("offset", upper)
-                            .Set("comment", "load param upper(" + param + ")");
-                    //ori $s0, $s0, lower(big)
-
-                    loaded = Add(Descriprion.Instruction("ori"))
-                            .Set("rs", r)
-                            .Set("rt", r)
-                            .Set("offset", lower)
-                            .Set("comment", "load param lower(" + param + ")");
-                } else if (copy) {
-                    reg = "reg." + param;
-                    r = inst.Get(reg);
-                    if (offset.equals("0")) {
-                        inst.Set(reg, "zero");
-                        continue;
-                    }
-                    loaded = Copy(r, "zero", offset).Set("comment", "load param (" + param + ")");
-                }
-            }
-        }
-//        for (String param : params) {
-//            if (inst.IsValue(param) && inst.Has("reg." + param)) {
-//
-//                offset = inst.Get(param);
-//
-//                if (offset.equals("0")) {
-//                    inst.Set("reg." + param, "zero");
-//                    continue;
-//                }
-//
-//                Copy(inst.Get("reg." + param), "zero", offset);
-//            }
-//        }
-//        return loaded;
-        return loaded;
-    }
-
-    /**
-     * Copia o valor do regiStrador Src para o dSt
-     *
-     * @param src
-     *
-     * @param dst
-     * @return
-     */
-    protected Instruction CopyReg(String src, String dst) throws Exception {
-        return Add(new Instruction("addu")
-                .Set("rs", "zero")
-                .Set("rt", src)
-                .Set("rd", dst)
-                .Set("comment", F("copy %s ← %s", dst, src)));
-    }
-
-    protected Instruction Copy(String rt, String rs, Offset offset) throws Exception {
-        return Copy(rt, rs, "" + offset);
-    }
-
-    protected Instruction Copy(String rt, String rs, String offset) throws Exception {
-        return Add(new Instruction("addiu") // lw $rt, imm($rs)
-                .Set("rt", rt)
-                .Set("rs", rs)
-                .Set("offset", offset)
-                .Set("comment", F("copy %s ← %s", rs, rt))
-        );
-    }
-
-    protected Instruction StoreWord(String type, String rt, String rs, Offset offset) throws Exception {
-        Instruction n = Next();
-        String inst;
-
-        switch (type) {
-            case "byte":
-            case "int8":
-            case "uint8":
-            case "bool":
-                inst = "sb"; // Load byte
-                break;
-            case "int16":
-            case "uint16":
-                inst = "sh"; //Load half
-                break;
-            default:
-                inst = "sw"; // Load word
-        }
-        Instruction sw = Add(new Instruction(inst)
-                .Set("rt", rt)
-                .Set("rs", rs)
-                .Set("offset", offset.getAddress() + offset.getShift()));
-
-        return sw;
-    }
-
-    protected Instruction StoreWord(String type, String rt, String rs, String offset) throws Exception {
-        return StoreWord(type, rt, rs, new Offset(Long.parseLong(offset), 0L));
-    }
-
-    protected Instruction LoadWord(String type, String rt, String rs, Offset offset) throws Exception {
-        Instruction n = Next();
-        String inst;
-        switch (type) {
-            case "byte":
-            case "int8":
-            case "uint8":
-            case "bool":
-//                LB -- Load byte 8 bits
-//                Operation:$t = MEM[$s + offset]; advance_pc (4);
-//                Syntax: lb $t, offset($s)
-//                Offset é o endereço base da variavel
-//                Shift é o byte a ser lido
-
-                inst = "lb";
-                break;
-            case "int16":
-            case "uint16":
-//                LW -- Load half 16 bits
-//                Operation:$t = MEM[$s + offset]; advance_pc (4);
-//                Syntax: lw $t, offset($s) 
-                inst = "lh";
-                break;
-            default:
-//                LW -- Load word 32 bits
-//                Operation:$t = MEM[$s + offset]; advance_pc (4);
-//                Syntax: lw $t, offset($s)
-                inst = "lw"; // Load word
-        }
-
-        Instruction lw = Add(new Instruction(inst) // lw $rt, imm($rs)
-                .Set("rt", rt)
-                .Set("rs", rs)
-                .Set("offset", offset.getAddress() + offset.getShift())
-        );
-
-        Nop(true);
-
-        return lw;
-    }
-
-    protected Instruction LoadWord(String type, String rt, String rs, String offset) throws Exception {
-        return LoadWord(type, rt, rs, new Offset(Long.parseLong(offset), 0L));
-    }
-
-    @Override
-    protected Instruction Add(Instruction inst) throws Exception {
-        if (!inst.eq("type", "label")) {
-            getTarget().PositionInc();
-            Instruction definiction = Descriprion.Instruction(inst.Get("inst"));
-            inst.Merge("sa,type,inst,codop,func,format", definiction);
-        }
-
-        if (currentIrInstruction != null) {
-            inst.Set("inloop", currentIrInstruction.Get("inloop"));
-        }
-
-//        System.out.println("Add:" + inst);
-        return super.Add(inst); //To change body of generated methods, choose Tools | Templates.
-    }
-
-    protected String FrameRegister(String var) {
-        return var.contains("_G") ? "gp" : "fp";
-    }
-
-    private void ResetReturnArgs() {
-        returnRegisters = new ArrayList<String>() {
-            {
-                add("v0");
-                add("v1");
-                add("a0");
-                add("a1");
-                add("a2");
-                add("a3");
-            }
-        };
-    }
-
 }
-
-//    protected void IndexedRead(Instruction inst) throws Exception {
-//        // Se a fonte é indexada
-//        if (inst.eq("src_indexed", "true")) {
-//            try {
-//                String p1 = inst.Get("p1"),
-//                        rt = inst.Get("reg.p1"),
-//                        rs = FrameRegister(p1);
-//
-////            System.out.println("Indexed read:" + inst);
-//                if (!inst.isNumber("p1.indice")) {
-//
-//                    String rd = inst.Get("reg.p1.indice");
-//                    if (!AddressCalculated.containsKey(p1)) {
-//                        Add(new Instruction("addu")
-//                                .Set("rd", rd)
-//                                .Set("rs", rs)
-//                                .Set("rt", rd));
-//                        AddressCalculated.put(p1, rs);
-//                    }
-//                    rs = rd;
-//                }
-//                // Carrega o conteudo enderecado em rt para rt
-//                LoadWord(
-//                        target.DEFAULT_WORD_TYPE,
-//                        rt,
-//                        rs,
-//                        Offset(p1)
-//                );
-//
-//            } catch (Exception ex) {
-//                Logger.getLogger(Translate.class.getName()).log(Level.SEVERE, null, ex);
-//            }
-//
-//        } else {
-//            // Se não é indexada carrega o parametro normalmente
-//            LoadParam(inst);
-//        }
-//    }
-//
-//    /**
-//     * FaSe de atribuicao
-//     *
-//     * @param inst
-//     */
-//    protected void IndexedDest(Instruction inst) throws Exception {
-////        System.out.println("Indexeds:" + inst);
-//
-//        String regp1 = inst.Get("reg.p1"),
-//                regdst = inst.Get("reg.dst");
-//
-//        // Valor atribuido é indexado
-//        // 1 - Verificar se deve ser armazenado ou copiado
-////        boolean dstIndexed = inst.eq("dst.indexed", "true");
-//        if (inst.eq("dst.indexed", "true")) {
-////        if (dstIndexed || inst.eq("reg.dst.store", "true")) {
-//            // deve ser armazenado
-//            String dst = inst.Get("dst"),
-//                    rs = FrameRegister(dst);
-////                if (dstIndexed) {
-//            if (!inst.isNumber("dst.indice")) {
-//                // Offset agora deve ser 0 pois o registrador conterá o endereco completo
-////                    offset = 0;
-//                String rd = inst.Get("reg.dst.indice");
-//                if (!AddressCalculated.containsKey(dst)) {
-//                    Add(new Instruction("addu")
-//                            .Set("rd", rd)
-//                            .Set("rs", rs)
-//                            .Set("rt", rd)
-//                    );
-//                    AddressCalculated.put(dst, rs);
-//                }
-//                rs = rd;
-//            }
-////            comment = "store in loaded address";
-////                } else {
-////                    comment = "store in " + dst;
-////                }//            System.out.println("Inst:" + inst);
-//            StoreWord(
-//                    target.DEFAULT_WORD_TYPE,
-//                    regp1,
-//                    rs,
-//                    Offset(dst)
-//            ).Set("comment", F("store content of %s in %s", rs, dst));
-//
-//        } else { // deve ser copiado
-//            CopyReg(regp1, regdst);
-//        }
-//    }
-//    public void CopyData(LinkedHashMap<String, Node> dst, LinkedHashMap<String, Node> src) throws Exception {
-//    public void CopyData(DataLayout dst, DataLayout src) throws Exception {
-//        Node value;
-//        LinkedHashMap<String, Node> svalues = src.values(),
-//                dvalues = dst.values();
-//
-//        for (Map.Entry<String, Node> x : svalues.entrySet()) {
-//            value = x.getValue().copy();
-//            value.S("size", value.GetInt("size") * WORD_INC);
-////            System.out.println("Copy:[" + x.getKey() + "][" + value.Get("id") + "]" + value.Get("size") + "\n" + value);
-////            dvalues.put(x.getKey(), value);
-//
-//            dst.Set(x.getKey(), value);
-//        }
-//    }

+ 27 - 6
src/tools/mips/MipsProcessor.java

@@ -75,6 +75,11 @@ public class MipsProcessor {
                 settings);
 
         SetBreak(this.settings.Get("breakpoints"));
+
+        if (this.settings.eq("step.by.step", "true")) {
+            this.settings.Set("mode", "debug");
+        }
+
     }
 
     public MipsProcessor SetBreak(String address) {
@@ -111,11 +116,15 @@ public class MipsProcessor {
     }
 
     protected void Log(String msg) {
+        Log(msg, Long.toHexString(PC));
+    }
+
+    protected void Log(String msg, String pc) {
         if (!settings.eq("mode", "debug")) {
             return;
         }
 
-        if (breakPoint.size() > 0 && !breakPoint.containsKey(Long.toHexString(PC))) {
+        if (breakPoint.size() > 0 && !breakPoint.containsKey(pc)) {
             return;
         }
 
@@ -154,15 +163,15 @@ public class MipsProcessor {
 
                 cAddress = Long.toHexString(PC);
 
+                Log("Execute [Interation: " + (interation++)
+                        + "][PC: " + cAddress
+                        + "][Inst: " + instruction.Get("inst")
+                        + "] Next PC:" + Long.toHexString(PC) + "{", cAddress);
                 // Executa a instrucao
                 Execute(instruction);
 
                 // PC já incrementou
-                Log("Execute [Interation: " + (interation++)
-                        + "][PC: " + cAddress
-                        + "][Inst: " + instruction.Get("inst")
-                        + "] Next PC:" + Long.toHexString(PC)
-                        + "\nRegistradores(\n" + RBank + ")\n");
+                Log("}\nRegistradores(\n" + RBank + ")\n", cAddress);
 
                 // Verifica o controle de execução do simulador
                 if ((stepByStep || breakPoint.containsKey(cAddress)) && br != null) {
@@ -202,6 +211,9 @@ public class MipsProcessor {
             case "000001":
                 key = codop + rt;
                 break;
+//            case "000100": //bne bnez
+//                key = codop + rs;
+//                break;
             default:
                 key = codop;
         }
@@ -268,6 +280,9 @@ public class MipsProcessor {
                 case "000001":
                     key += instruction.Get("rt");
                     break;
+//                case "000100": //bne bnez
+//                    key += instruction.Get("rs");
+//                    System.out.println("INIT INSTRUCTION:'" + key + "'");
             }
 
             instructions.put(key, instruction);
@@ -410,6 +425,8 @@ public class MipsProcessor {
                 }
                 break;
             case "bne":
+//            case "bnez":
+//                System.out.println("BNE(" + RBank.R(rs) + " / " + RBank.R(rt) + ")" + (RBank.R(rs) != RBank.R(rt)));
                 if (RBank.R(rs) != RBank.R(rt)) {
                     PC += ((imm + 1) << 2);
                     return;
@@ -479,6 +496,10 @@ public class MipsProcessor {
                         WORD // uma palavra inteira
                 );
 
+                if (settings.eq("mode", "debug")) {
+                    DataMemory.Save();
+                }
+
                 Log(String.format("Store '%d' no endereco '%d'\n", RBank.R(rt), RBank.R(rs) + imm));
                 break;
 //            case "xori":

+ 27 - 10
src/tools/mips/memory/md.memory

@@ -23,15 +23,32 @@ DATA_RADIX = BIN;
 
 CONTENT
 BEGIN
-[4..124]:	00000000000000000000000000000000;
-00128:	00000000000000001001110110101111;	% dec 40367 %
-[132..16348]:	00000000000000000000000000000000;
-16352:	00000000000000000100100100111110;	% dec 18750 %
-16356:	00000000000000000000000000000001;	% dec 1 %
-16360:	00000000000000001001110110101111;	% dec 40367 %
-16364:	00000000000000000000000000000000;	% dec 0 %
-16368:	00000000000000101001101111111000;	% dec 171000 %
-16372:	00000000000000000101101011010010;	% dec 23250 %
-16376:	00000000000000000000000000001100;	% dec 12 %
+00000:	00000000000000000000000000000000;	% dec 0 %
+00004:	00000000000000000000000000000001;	% dec 1 %
+00008:	00000000000000000000000000000010;	% dec 2 %
+00012:	00000000000000000000000000000011;	% dec 3 %
+00016:	00000000000000000000000000000100;	% dec 4 %
+00020:	00000000000000000000000000000101;	% dec 5 %
+00024:	00000000000000000000000000000110;	% dec 6 %
+00028:	00000000000000000000000000000111;	% dec 7 %
+[32..16284]:	00000000000000000000000000000000;
+16288:	00000000000000000000000000000011;	% dec 3 %
+16292:	00000000000000000000000000000100;	% dec 4 %
+16296:	00000000000000000000000000000011;	% dec 3 %
+16300:	00000000000000000000000000000010;	% dec 2 %
+16304:	00000000000000000000000000000100;	% dec 4 %
+16308:	00000000000000000000000000000100;	% dec 4 %
+16312:	00000000000000000000000000000011;	% dec 3 %
+16316:	00000000000000000000000000000011;	% dec 3 %
+16320:	00000000000000000000000000000100;	% dec 4 %
+16324:	11111111111111111111111111111111;	% dec -1 %
+16328:	00000000000000000000000000000011;	% dec 3 %
+16332:	00000000000000000000000000000100;	% dec 4 %
+[16336..16356]:	00000000000000000000000000000000;
+16360:	00000000000000000000000000000011;	% dec 3 %
+16364:	11111111111111111111111111110100;	% dec -12 %
+16368:	00000000000000000000000001101100;	% dec 108 %
+16372:	00000000000000000000000000000111;	% dec 7 %
+16376:	00000000000000000000000000000111;	% dec 7 %
 16380:	00000000000000000000000000000000;	% dec 0 %
 END;

+ 212 - 76
src/tools/mips/memory/mi.memory

@@ -23,85 +23,221 @@ DATA_RADIX = BIN;
 
 CONTENT
 BEGIN
-000:	00100100000001000100100100111110;	% dec 604260670 %
-004:	00100100000001010000000000000001;	% dec 604307457 %
-008:	00001100000000000000000000000101;	% dec 201326597 %
-012:	00000000000000000000000000000000;	% dec 0 %
-016:	11111111111111111111111111111111;	% dec -1 %
-020:	00100111101111011111111111100000;	% dec 666763232 %
-024:	00000000000111011111000000100001;	% dec 1962017 %
-028:	10101111110001000000000000000000;	% dec -1346109440 %
-032:	10101111110001010000000000000100;	% dec -1346043900 %
-036:	10101111110000000000000000001000;	% dec -1346371576 %
-040:	10101111110000000000000000001100;	% dec -1346371572 %
-044:	00111100000010100000000000000001;	% dec 1007288321 %
-048:	00110101010010101011011101110100;	% dec 894089076 %
-052:	10101111110010100000000000010000;	% dec -1345716208 %
-056:	10001111110101010000000000000000;	% dec -1881866240 %
-060:	00000000000000000000000000000000;	% dec 0 %
-064:	10101111110101010000000000010100;	% dec -1344995308 %
-068:	00001000000000000000000000111100;	% dec 134217788 %
-072:	00000000000000000000000000000000;	% dec 0 %
-076:	10101111110000000000000000011000;	% dec -1346371560 %
-080:	10001111110100100000000000010000;	% dec -1882062832 %
+000:	00100111101111011111111111110100;	% dec 666763252 %
+004:	00000000000111011111000000100001;	% dec 1962017 %
+008:	00100100000010010000000000000111;	% dec 604569607 %
+012:	10101111110010010000000000000000;	% dec -1345781760 %
+016:	10101111110000000000000000000100;	% dec -1346371580 %
+020:	10001111110100100000000000000000;	% dec -1882062848 %
+024:	00000000000000000000000000000000;	% dec 0 %
+028:	10101111110100100000000000001000;	% dec -1345191928 %
+032:	00001000000000000000000000010100;	% dec 134217748 %
+036:	00000000000000000000000000000000;	% dec 0 %
+040:	10001111110101010000000000000100;	% dec -1881866236 %
+044:	00000000000000000000000000000000;	% dec 0 %
+048:	00000000000101010101100010000000;	% dec 1398912 %
+052:	10001111110101110000000000001000;	% dec -1881735160 %
+056:	00000000000000000000000000000000;	% dec 0 %
+060:	10101101011101110000000000000000;	% dec -1384710144 %
+064:	00100110101101010000000000000001;	% dec 649396225 %
+068:	10101111110101010000000000000100;	% dec -1344995324 %
+072:	00100110111101111111111111111111;	% dec 653787135 %
+076:	10101111110101110000000000001000;	% dec -1344864248 %
+080:	10001111110100100000000000001000;	% dec -1882062840 %
 084:	00000000000000000000000000000000;	% dec 0 %
-088:	10101111110100100000000000011100;	% dec -1345191908 %
-092:	10001111110101000000000000011100;	% dec -1881931748 %
+088:	00000010010000000001000000100011;	% dec 37752867 %
+092:	00011100010000001111111111110010;	% dec 474021874 %
 096:	00000000000000000000000000000000;	% dec 0 %
-100:	00000010100000000001000000100011;	% dec 41947171 %
-104:	00011000010000000000000000011001;	% dec 406847513 %
-108:	00000000000000000000000000000000;	% dec 0 %
-112:	00001000000000000000000000101101;	% dec 134217773 %
-116:	00000000000000000000000000000000;	% dec 0 %
-120:	10001111110101010000000000011000;	% dec -1881866216 %
-124:	00000000000000000000000000000000;	% dec 0 %
-128:	00100110101101010000000000000001;	% dec 649396225 %
-132:	10101111110101010000000000011000;	% dec -1344995304 %
-136:	10001111110101110000000000011100;	% dec -1881735140 %
-140:	00000000000000000000000000000000;	% dec 0 %
-144:	00100110111011111111111111111111;	% dec 653262847 %
-148:	00000010111011111100000000100100;	% dec 49266724 %
-152:	10101111110110000000000000011100;	% dec -1344798692 %
-156:	10001111110101110000000000011100;	% dec -1881735140 %
+100:	00100100000001000000000000000000;	% dec 604241920 %
+104:	00100100000001010000000000000111;	% dec 604307463 %
+108:	00001100000000000000000000011110;	% dec 201326622 %
+112:	00000000000000000000000000000000;	% dec 0 %
+116:	11111111111111111111111111111111;	% dec -1 %
+120:	00100111101111011111111111001000;	% dec 666763208 %
+124:	10101111101111100000000000110000;	% dec -1346502608 %
+128:	10101111101111110000000000110100;	% dec -1346437068 %
+132:	00000000000111011111000000100001;	% dec 1962017 %
+136:	10101111110001000000000000000000;	% dec -1346109440 %
+140:	10101111110001010000000000000100;	% dec -1346043900 %
+144:	10001111110100110000000000001000;	% dec -1881997304 %
+148:	00000000000000000000000000000000;	% dec 0 %
+152:	00000000000100110100000010000000;	% dec 1261696 %
+156:	10001111110101000000000000000000;	% dec -1881931776 %
 160:	00000000000000000000000000000000;	% dec 0 %
-164:	00010110111000000000000000000011;	% dec 383778819 %
-168:	00000000000000000000000000000000;	% dec 0 %
-172:	00001000000000000000000000101111;	% dec 134217775 %
-176:	00000000000000000000000000000000;	% dec 0 %
-180:	00001000000000000000000000011110;	% dec 134217758 %
-184:	00000000000000000000000000000000;	% dec 0 %
-188:	10001111110100100000000000001000;	% dec -1882062840 %
-192:	10001111110101000000000000011000;	% dec -1881931752 %
-196:	00000000000000000000000000000000;	% dec 0 %
-200:	00000010010101001001000000100001;	% dec 39096353 %
-204:	10101111110100100000000000001000;	% dec -1345191928 %
-208:	10001111110100000000000000010000;	% dec -1882193904 %
+164:	00000001000111100100000000100001;	% dec 18759713 %
+168:	10101101000101000000000000001100;	% dec -1391198196 %
+172:	00100110011100110000000000000001;	% dec 645070849 %
+176:	10101111110100110000000000001000;	% dec -1345126392 %
+180:	00000000000100110101000010000000;	% dec 1265792 %
+184:	10001111110101100000000000000100;	% dec -1881800700 %
+188:	00000000000000000000000000000000;	% dec 0 %
+192:	00000001010111100101000000100001;	% dec 22958113 %
+196:	10101101010101100000000000001100;	% dec -1386872820 %
+200:	00001000000000000000000001111110;	% dec 134217854 %
+204:	00000000000000000000000000000000;	% dec 0 %
+208:	10001111110101000000000000001000;	% dec -1881931768 %
 212:	00000000000000000000000000000000;	% dec 0 %
-216:	00100110000100000000000000001101;	% dec 638582797 %
-220:	10101111110100000000000000010000;	% dec -1345322992 %
-224:	10001111110101110000000000010100;	% dec -1881735148 %
+216:	00000000000101000101100010000000;	% dec 1333376 %
+220:	00000001011111100101100000100001;	% dec 25057313 %
+224:	10001101011011000000000000001100;	% dec -1922301940 %
 228:	00000000000000000000000000000000;	% dec 0 %
-232:	00100110111101110000000000000001;	% dec 653721601 %
-236:	10101111110101110000000000010100;	% dec -1344864236 %
-240:	10001111110101000000000000000000;	% dec -1881931776 %
-244:	00000000000000000000000000000000;	% dec 0 %
-248:	00100110100011000001000110010100;	% dec 646713748 %
-252:	10001111110100010000000000010100;	% dec -1882128364 %
-256:	00000000000000000000000000000000;	% dec 0 %
-260:	00000010001011000001000000100011;	% dec 36442147 %
-264:	00000100010000001111111111010000;	% dec 71368656 %
-268:	00000000000000000000000000000000;	% dec 0 %
-272:	10001111110101010000000000000100;	% dec -1881866236 %
-276:	00000000000000000000000000000000;	% dec 0 %
-280:	00000000000101010110100101000000;	% dec 1403200 %
-284:	10001111110101100000000000001100;	% dec -1881800692 %
-288:	00000000000000000000000000000000;	% dec 0 %
-292:	00000001101101100110100000100001;	% dec 28731425 %
-296:	00000000000011010111000010000000;	% dec 880768 %
-300:	10001111110101000000000000001000;	% dec -1881931768 %
-304:	00000000000000000000000000000000;	% dec 0 %
-308:	10101101110101000000000000000000;	% dec -1378615296 %
-312:	00100111101111010000000000100000;	% dec 666697760 %
-316:	00000000000111011111000000100001;	% dec 1962017 %
-320:	00000011111000000000000000001000;	% dec 65011720 %
+232:	10101111110011000000000000000100;	% dec -1345585148 %
+236:	00100110100101001111111111111111;	% dec 647299071 %
+240:	00000000000101000111000010000000;	% dec 1339520 %
+244:	00000001110111100111000000100001;	% dec 31354913 %
+248:	10001101110011110000000000001100;	% dec -1915813876 %
+252:	00000000000000000000000000000000;	% dec 0 %
+256:	10101111110011110000000000000000;	% dec -1345388544 %
+260:	00100110100101001111111111111111;	% dec 647299071 %
+264:	10101111110101000000000000001000;	% dec -1345060856 %
+268:	10001111110101100000000000000000;	% dec -1881800704 %
+272:	00000000000000000000000000000000;	% dec 0 %
+276:	10001111110101110000000000000100;	% dec -1881735164 %
+280:	00000000000000000000000000000000;	% dec 0 %
+284:	00000000000101100010000000100001;	% dec 1450017 %
+288:	00000000000101110010100000100001;	% dec 1517601 %
+292:	00001100000000000000000010001010;	% dec 201326730 %
+296:	00000000000000000000000000000000;	% dec 0 %
+300:	00000000000000100100000000100001;	% dec 147489 %
+304:	10101111110010000000000000101100;	% dec -1345847252 %
+308:	10001111110100110000000000101100;	% dec -1881997268 %
+312:	00000000000000000000000000000000;	% dec 0 %
+316:	00100110011010101111111111111111;	% dec 644546559 %
+320:	10001111110100000000000000000000;	% dec -1882193920 %
+324:	00000000000000000000000000000000;	% dec 0 %
+328:	00000001010100000001000000101010;	% dec 22024234 %
+332:	00010100010000000000000000010001;	% dec 339738641 %
+336:	00000000000000000000000000000000;	% dec 0 %
+340:	10001111110101100000000000001000;	% dec -1881800696 %
+344:	00000000000000000000000000000000;	% dec 0 %
+348:	00100110110101100000000000000001;	% dec 651558913 %
+352:	00000000000101100110000010000000;	% dec 1466496 %
+356:	10001111110101110000000000000000;	% dec -1881735168 %
+360:	00000000000000000000000000000000;	% dec 0 %
+364:	00000001100111100110000000100001;	% dec 27156513 %
+368:	10101101100101110000000000001100;	% dec -1382612980 %
+372:	00100110110101100000000000000001;	% dec 651558913 %
+376:	10101111110101100000000000001000;	% dec -1344929784 %
+380:	10001111110101000000000000101100;	% dec -1881931732 %
+384:	00000000000000000000000000000000;	% dec 0 %
+388:	00100110100011111111111111111111;	% dec 646971391 %
+392:	00000000000101101100000010000000;	% dec 1491072 %
+396:	00000011000111101100000000100001;	% dec 52346913 %
+400:	10101111000011110000000000001100;	% dec -1357971444 %
+404:	10001111110101110000000000101100;	% dec -1881735124 %
+408:	00000000000000000000000000000000;	% dec 0 %
+412:	00100110111010010000000000000001;	% dec 652804097 %
+416:	10001111110100010000000000000100;	% dec -1882128380 %
+420:	00000000000000000000000000000000;	% dec 0 %
+424:	00000001001100010001000000100011;	% dec 19992611 %
+428:	00000100010000010000000000010010;	% dec 71368722 %
+432:	00000000000000000000000000000000;	% dec 0 %
+436:	10001111110101000000000000001000;	% dec -1881931768 %
+440:	00000000000000000000000000000000;	% dec 0 %
+444:	00100110100101000000000000000001;	% dec 647233537 %
+448:	10101111110101000000000000001000;	% dec -1345060856 %
+452:	10001111110100000000000000101100;	% dec -1882193876 %
+456:	00000000000000000000000000000000;	% dec 0 %
+460:	00100110000011000000000000000001;	% dec 638320641 %
+464:	00000000000101000110100010000000;	% dec 1337472 %
+468:	00000001101111100110100000100001;	% dec 29255713 %
+472:	10101101101011000000000000001100;	% dec -1381236724 %
+476:	00100110100101000000000000000001;	% dec 647233537 %
+480:	10101111110101000000000000001000;	% dec -1345060856 %
+484:	00000000000101000111100010000000;	% dec 1341568 %
+488:	10001111110101010000000000000100;	% dec -1881866236 %
+492:	00000000000000000000000000000000;	% dec 0 %
+496:	00000001111111100111100000100001;	% dec 33454113 %
+500:	10101101111101010000000000001100;	% dec -1376452596 %
+504:	10001111110100000000000000001000;	% dec -1882193912 %
+508:	00000000000000000000000000000000;	% dec 0 %
+512:	00000010000000000001000000100011;	% dec 33558563 %
+516:	00000100010000011111111110110010;	% dec 71434162 %
+520:	00000000000000000000000000000000;	% dec 0 %
+524:	10001111101111100000000000110000;	% dec -1883373520 %
+528:	00000000000000000000000000000000;	% dec 0 %
+532:	10001111101111110000000000110100;	% dec -1883307980 %
+536:	00000000000000000000000000000000;	% dec 0 %
+540:	00100111101111010000000000111000;	% dec 666697784 %
+544:	00000000000111011111000000100001;	% dec 1962017 %
+548:	00000011111000000000000000001000;	% dec 65011720 %
+552:	00100111101111011111111111100100;	% dec 666763236 %
+556:	00000000000111011111000000100001;	% dec 1962017 %
+560:	10101111110001000000000000000000;	% dec -1346109440 %
+564:	10101111110001010000000000000100;	% dec -1346043900 %
+568:	10001111110100100000000000000100;	% dec -1882062844 %
+572:	00000000000000000000000000000000;	% dec 0 %
+576:	00000000000100100100000010000000;	% dec 1196160 %
+580:	10001101000010010000000000000000;	% dec -1928790016 %
+584:	00000000000000000000000000000000;	% dec 0 %
+588:	10101111110010010000000000001000;	% dec -1345781752 %
+592:	10001111110101010000000000000000;	% dec -1881866240 %
+596:	00000000000000000000000000000000;	% dec 0 %
+600:	00100110101010111111111111111111;	% dec 648806399 %
+604:	10101111110010110000000000001100;	% dec -1345650676 %
+608:	10101111110101010000000000010000;	% dec -1344995312 %
+612:	00001000000000000000000010111010;	% dec 134217914 %
+616:	00000000000000000000000000000000;	% dec 0 %
+620:	10001111110100100000000000010000;	% dec -1882062832 %
+624:	00000000000000000000000000000000;	% dec 0 %
+628:	00000000000100100110000010000000;	% dec 1204352 %
+632:	10001101100011010000000000000000;	% dec -1920139264 %
+636:	10001111110100000000000000001000;	% dec -1882193912 %
+640:	00000000000000000000000000000000;	% dec 0 %
+644:	00000001101100000001000000100011;	% dec 28315683 %
+648:	00011100010000000000000000010011;	% dec 473956371 %
+652:	00000000000000000000000000000000;	% dec 0 %
+656:	10001111110101010000000000001100;	% dec -1881866228 %
+660:	00000000000000000000000000000000;	% dec 0 %
+664:	00100110101101010000000000000001;	% dec 649396225 %
+668:	10101111110101010000000000001100;	% dec -1344995316 %
+672:	00000000000101010111100010000000;	% dec 1407104 %
+676:	10001101111110000000000000000000;	% dec -1913126912 %
+680:	00000000000000000000000000000000;	% dec 0 %
+684:	10101111110110000000000000010100;	% dec -1344798700 %
+688:	10001111110100110000000000010000;	% dec -1881997296 %
+692:	00000000000000000000000000000000;	% dec 0 %
+696:	00000000000100110100000010000000;	% dec 1261696 %
+700:	10001101000010010000000000000000;	% dec -1928790016 %
+704:	00000000000101010101000010000000;	% dec 1396864 %
+708:	10101101010010010000000000000000;	% dec -1387724800 %
+712:	00000000000100110101100010000000;	% dec 1267840 %
+716:	10001111110101100000000000010100;	% dec -1881800684 %
+720:	00000000000000000000000000000000;	% dec 0 %
+724:	10101101011101100000000000000000;	% dec -1384775680 %
+728:	10001111110101000000000000010000;	% dec -1881931760 %
+732:	00000000000000000000000000000000;	% dec 0 %
+736:	00100110100101000000000000000001;	% dec 647233537 %
+740:	10101111110101000000000000010000;	% dec -1345060848 %
+744:	10001111110100000000000000010000;	% dec -1882193904 %
+748:	10001111110100010000000000000100;	% dec -1882128380 %
+752:	00000000000000000000000000000000;	% dec 0 %
+756:	00000010000100010001000000100011;	% dec 34672675 %
+760:	00000100010000001111111111011100;	% dec 71368668 %
+764:	00000000000000000000000000000000;	% dec 0 %
+768:	10001111110101110000000000001100;	% dec -1881735156 %
+772:	00000000000000000000000000000000;	% dec 0 %
+776:	00100110111011100000000000000001;	% dec 653131777 %
+780:	10101111110011100000000000011000;	% dec -1345454056 %
+784:	10001111110100100000000000011000;	% dec -1882062824 %
+788:	00000000000000000000000000000000;	% dec 0 %
+792:	00000000000100100111100010000000;	% dec 1210496 %
+796:	10001101111110000000000000000000;	% dec -1913126912 %
+800:	00000000000000000000000000000000;	% dec 0 %
+804:	10101111110110000000000000010100;	% dec -1344798700 %
+808:	10001111110100010000000000000100;	% dec -1882128380 %
+812:	00000000000000000000000000000000;	% dec 0 %
+816:	00000000000100010100000010000000;	% dec 1130624 %
+820:	10001101000010010000000000000000;	% dec -1928790016 %
+824:	00000000000100100101000010000000;	% dec 1200256 %
+828:	10101101010010010000000000000000;	% dec -1387724800 %
+832:	00000000000100010101100010000000;	% dec 1136768 %
+836:	10001111110101010000000000010100;	% dec -1881866220 %
+840:	00000000000000000000000000000000;	% dec 0 %
+844:	10101101011101010000000000000000;	% dec -1384841216 %
+848:	00100110111011010000000000000001;	% dec 653066241 %
+852:	00000000000011010001000000100001;	% dec 856097 %
+856:	00100111101111010000000000011100;	% dec 666697756 %
+860:	00000000000111011111000000100001;	% dec 1962017 %
+864:	00000011111000000000000000001000;	% dec 65011720 %
 END;