! InlineAsm and PUSH

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

! InlineAsm and PUSH

Post by remi_meier »

Hi

Code: Select all

Procedure test(a.l, b.l)
	!MOV eax, dword[p.v_a]
	; !p.v_b equ p.v_b + 4
	!PUSH eax
	!MOV ebx, dword[p.v_b]
	CallDebugger
EndProcedure
test(4, 5)
Thanks for the new optimizations, but now we have the problem to manage
it with only 3 registers :lol:
It would be cool if the compiler could check for simple PUSHs and POPs
and adjust the constants for FASM so we could save the regs ourselves.

Workaround:

Code: Select all

; Adjust aliases like this:
!p.v_b equ p.v_b + 4
; this will add 4 to p.v_b, use it for all local vars when using a PUSH
; - 4 for POP ;)
Athlon64 3700+, 1024MB Ram, Radeon X1600
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

you should address it like that: [p.v_b+4]
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Just use [p.v_something+4] once you did a push.
The ! is for direct asm access, which means the compiler leaves it alone.
If you want it to adjust to push and pop, just use the InlineASM option.

[EDIT] Hey Fred! I thought you were eating... how can you still beat me to the posting? :D
quidquid Latine dictum sit altum videtur
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

:lol:
Ok, another option then and this means it wont be done... Then I have to
live with it... (InlineAsm option is just too strange in IDE, why not introduce
a CompilerAsm, CompilerEndAsm? At the moment I am not really happy
when I have to tell the others to enable inline asm when they're just using
a little routine)
Athlon64 3700+, 1024MB Ram, Radeon X1600
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

[p.v_something+4] seems ok to me.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

i absolutly agree remi_meier´s idea for CompilerAsm, CompilerEndAsm !!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

i agree also
when compiling pbosl-libs in batch, i can't enable inlineasm for one file
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Yes. Good idea.
@}--`--,-- A rose by any other name ..
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: ! InlineAsm and PUSH

Post by jack »

remi_meier wrote:Thanks for the new optimizations, but now we have the problem to manage
it with only 3 registers :lol:
which registers are available for use ?
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

Eax, Ecx, Edx should be available.
Athlon64 3700+, 1024MB Ram, Radeon X1600
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

thanks remi_meier :)
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

you can use more as long you preserve them.
Post Reply