igoto, icall ?

Usage of VEX tools

igoto, icall ?

Postby Ashu » Tue Sep 19, 2006 10:32 am

The current vex toolchain doesn't seem to support icall and igoto ?
I 've this code which gives error at the corresponding "igoto" lines


.section .text
.proc
.entry caller, sp=$r0.1, rl=$l0.0, asize=0, arg($r0.3:s32)
_incr::
;;
c0 add $r0.3 = $r0.10 , 1
;;
c0 igoto $l0.0
;;
.endp
.section .text
.proc
.entry caller, sp=$r0.1, rl=$l0.0, asize=-4, arg()
_main::
c0 sub $r0.1 = $r0.1 , 4
;;
c0 stw.l 0[$r0.1] = $l0.0
;;
c0 mov $r0.3 = 2
;;
c0 mov $r0.10 = $r0.3
;;
.call incr, caller, arg($r0.3:s32), ret($r0.3:s32)
c0 call $l0.0 = _incr
;;
c0 mov $r0.3 = 0
;;
c0 ldw.l $l0.0 = 0[$r0.1]
;;
c0 add $r0.1 = $r0.1 , 4
;;
c0 igoto $l0.0
;;
.endp
.import incr
.type incr,@function
Ashu
 
Posts: 7
Joined: Thu Jul 13, 2006 1:28 pm
Location: Noida, India

Postby Ashu » Tue Sep 19, 2006 3:01 pm

Indirect control instructions seems to work fine, using the same opcodes (i.e. call & goto)
as for the direct control ones.
If this is the case, then the doc. should be updated.

- Ashu
Ashu
 
Posts: 7
Joined: Thu Jul 13, 2006 1:28 pm
Location: Noida, India

Postby frb » Tue Sep 19, 2006 11:16 pm

Yes, the current toolchain overloads the same mnemonic call/goto for indirect call/goto. At some point in the past, we used icall/igoto, but then the compiler got ahead of the book...

In general, the best and most up to date source of information is always the compiler.

Try something like this

Code: Select all
extern int foo(int);
int (*funcp)(int) = foo;
int bar(int x) { return (*funcp)(x); }


This generates something like
Code: Select all
...
    c0 ldw $l0.0 = (funcp)[$r0.0]
    xnop 3
;;
.call $l0.0, caller, arg($r0.3:s32), ret($r0.3:s32)
    c0 call $l0.0 = $l0.0
;;
...


Note that you need the ".call" directive for the compiled simulator to work.
To generate an indirect goto, you can try compiling a (large, more than 8 cases) switch statement.
frb
 
Posts: 62
Joined: Thu Nov 12, 2009 3:44 pm


Return to VEX Tools



Who is online

Users browsing this forum: No registered users and 3 guests

cron