Dev Shed Lounge
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDev Shed Lounge

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 29th, 2003, 06:04 PM
suffeks suffeks is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 86 suffeks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m 52 sec
Reputation Power: 6
assembly code optimizing

so i've been making some assembly code on sparc, now, is there a program which can optimize the program for me, like remove NOP's, etc and re-display the code?

please let me know, thanks. windows version is preferrable.

Reply With Quote
  #2  
Old September 29th, 2003, 06:51 PM
infamous41md's Avatar
infamous41md infamous41md is offline
not a fan of fascism (n00b)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Feb 2003
Location: ct
Posts: 2,756 infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 11 h 4 m 29 sec
Reputation Power: 26
isnt that what the link loader does? from 'man ld'
Quote:
−O level
If level is a numeric values greater than zero ld optimizes the
output. This might take significantly longer and therefore proba‐
bly should only be enabled for the final binary.


my question is: if you are already writing in asm, then why have you inserted NOP's in the first place?

Reply With Quote
  #3  
Old September 29th, 2003, 09:16 PM
suffeks suffeks is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 86 suffeks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m 52 sec
Reputation Power: 6
because i'm just learning the language. so instead of learning how to rid them, which i somewhat know how to do, and which is time consuming, i thought there might be an easier way?

Reply With Quote
  #4  
Old September 30th, 2003, 12:26 AM
infamous41md's Avatar
infamous41md infamous41md is offline
not a fan of fascism (n00b)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Feb 2003
Location: ct
Posts: 2,756 infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 11 h 4 m 29 sec
Reputation Power: 26
im sorry but i still dont understand what you're talking about. maybe i'm slow or something, could u explain it better? r u trying to write shellcode?

Reply With Quote
  #5  
Old September 30th, 2003, 12:55 AM
suffeks suffeks is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 86 suffeks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 29 m 52 sec
Reputation Power: 6
/*program that finds max value of 2x^3 - 7x^2 + 33x - 128 between x=-4 and x=6. */

Code:

                .global main
main:
	save	%sp, -96, %sp	!memory allocation
	mov	-4, %l0		!initialize -4 as start value
	mov	6, %l1		!initialize 6 as end value
	mov	-1000, %l5	!set condition code -1000 for loop
	
loop:
	mov	%l0, %o0		!move constant into x
	mov	%l0, %o1		!move constant into x again
	call	.mul		!multiply x*x
	nop
	mov	%l0, %o1
	mov	%o0, %l3		!store x*x for later use
	call	.mul		!multiply x*x*x
	nop
	mov	2, %o1		!set 2 for multiplying
	call	.mul		!multiply 2*x*x*x
	nop
	mov	%o0, %l4		!store 2x^3
	
	mov	%l3, %o0		!retrieve x^2
	mov	7, %o1		!get 7
	call	.mul		!7x^2
	nop
	sub	%l4, %o0, %l4	!store (2x^3)-(7x^2)
	
	mov	%l0, %o0		!get x
	mov	33, %o1		!get 33
	call	.mul		!33*x
	nop
	add	%l4, %o0, %l4	!store (2x^3)-(7x^2)+33x
	
	sub	%l4, 128, %l4	!store (2x^3)-(7x^2)+33x-128
	
check:
	cmp	%l4, %l5		!x>=0 then loop
	bl	next		!if then goto next loop
	nop
	mov	%l4, %l5		!store high value
	nop
	
next:
	cmp	%l1, %l0		!check x
	add	%l0, 1, %l0	!x++
	be	end		!goto end
	nop
	ba	loop		!goto loop
	nop
	
end:
	mov	1, %g1		!trap dispatch
	ta	0		!trap to system


now, i need that optimized, such as filling delay slots by not using NOPs.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDev Shed Lounge > assembly code optimizing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT