MSVC hook function prologue

Stefan Dösinger stefan@codeweavers.com
Fri Sep 4 12:18:00 GMT 2009


Am Friday 04 September 2009 13:47:20 schrieb Paolo Bonzini:
> > I guess the error isn't about the const_int 0, but about operand 0. Any
> > ideas?
>
> Yes, you need this:
>
>      [(set (match_operand:SI 0 "register_operand" "=r")
>            (match_operand:SI 1 "register_operand" "r"))
>       (unspec_volatile [(const_int 0)] UNSPECV_VSWAPMOV)]
That works, thanks!

I just found the "=r" and "r" stuff myself almost at the same time your mail 
arrived. But what does the "SI" do? I haven't found 

Now I went a step further, and implemented the suggestion from amylaar in this 
mail:
http://gcc.gnu.org/ml/gcc/2009-01/msg00174.html

> If you make it a parallel where the actual oprtation is paired with an
> empty unspec, no REG_FRAME_RELATED_EXPR is needed.  If the actual operation
> is hidden in the RTL, however, you have to add it in a 
REG_FRAME_RELATED_EXPR.
> The latter alternative is more complicated.  However, there is a benefit to
> choosing this: win the stack realign or !frame_pointer_needed cases, the
> (early) move of esp to ebp is not really supposed to establish a frame
> pointer, and thus you then don't want any cfi information emitted for it.
> Thus, you can then simply leave out the REG_FRAME_RELATED_EXPR note.

Now the definition looks like this:
(define_insn "vswapmov"
  [(parallel
    [(set (match_operand:SI 0 "register_operand" "=r")
          (match_operand:SI 1 "register_operand" "r"))
     (unspec_volatile [(const_int 0)] UNSPECV_VSWAPMOV)]
   )]
  ""
  "movl.s\t%1,%0"
  [(set_attr "length" "2")
   (set_attr "length_immediate" "0")
   (set_attr "modrm" "0")])

I am still compiling, so I don't know if it works yet.

I attached the current state of the whole patch. I added the attribute to the 
documentation, and generated the patch with function names this time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msvc_prologue.diff
Type: text/x-diff
Size: 7709 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20090904/7a4cdcd3/attachment.bin>


More information about the Gcc mailing list