public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* adding movz to machine description
@ 2006-07-21  9:55 Petar Bajic
  2006-07-21 16:30 ` Ian Lance Taylor
  0 siblings, 1 reply; 14+ messages in thread
From: Petar Bajic @ 2006-07-21  9:55 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

> ----- Original Message ----- 
> From: "Ian Lance Taylor" <iant@google.com>
>
>> What do you mean when you say that the instruction is not generated?
>> Your code looks OK.  Look at the .expand debugging dump (use -da to
>> generate all the RTL debugging dump files); do you see the instruction
>> there?  If so, trace it forward to see what happens to it.
>>
>> Ian
>>
>
> It's not generated, like it's not in the asm code. Instead, movsi_insn is
> used and bad asm code is generated.
>
> for c code :
> if (in1 == 0)
>    out = in2;
> return out;
>
> I expect asm to look like this
> lw r2,4(r30)  ; in2
> lw r16,(r30)  ; in1
> movz r1, r2, r16
>
> instead, code looks like this
>
> lw r2,4(r30)
> lw r16,(r30)
> movz r1,r2,r16
> movn r1,r16,r16
>
> expand debug file is in attach, I don't see that movsicc_expand is used...
> (although this is my first time to look at expand files)
> movsicc_insn first appears in short.c.11.ce1
>
> can you see why pattern is not matched with expand?
> 

[-- Attachment #2: short.c.00.expand --]
[-- Type: application/octet-stream, Size: 3936 bytes --]


;; Function main (main)


;; Generating RTL for tree basic block 0

;; Generating RTL for tree basic block 1

;; Generating RTL for tree basic block 2

;; Generating RTL for tree basic block 3


;;
;; Full RTL generated for this function:
;;
(note 2 0 11 NOTE_INSN_DELETED)

;; Start of basic block 0, registers live: (nil)
(note 11 2 6 0 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 6 11 7 0 (set (reg/v:SI 39 [ k ])
        (mem/i:SI (reg/f:SI 32 virtual-incoming-args) [2 k+0 S4 A32])) -1 (nil)
    (expr_list:REG_EQUIV (mem/i:SI (reg/f:SI 32 virtual-incoming-args) [2 k+0 S4 A32])
        (nil)))

(insn 7 6 8 0 (set (reg/v:SI 40 [ m ])
        (mem/i:SI (plus:SI (reg/f:SI 32 virtual-incoming-args)
                (const_int 4 [0x4])) [2 m+0 S4 A32])) -1 (nil)
    (expr_list:REG_EQUIV (mem/i:SI (plus:SI (reg/f:SI 32 virtual-incoming-args)
                (const_int 4 [0x4])) [2 m+0 S4 A32])
        (nil)))

(note 8 7 9 0 NOTE_INSN_FUNCTION_BEG)

(note 9 8 10 0 NOTE_INSN_DELETED)

(call_insn 10 9 12 0 (parallel [
            (call (mem:QI (symbol_ref:SI ("__main") [flags 0x41]) [0 S1 A8])
                (const_int 0 [0x0]))
            (clobber (reg:SI 31 r31))
        ]) -1 (nil)
    (expr_list:REG_EH_REGION (const_int 0 [0x0])
        (nil))
    (nil))
;; End of basic block 0, registers live:
 (nil)

;; Start of basic block 1, registers live: (nil)
(note 12 10 14 1 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn 14 12 15 1 (set:SI (reg:SI 41)
        (ne:SI (reg/v:SI 39 [ k ])
            (const_int 0 [0x0]))) -1 (nil)
    (nil))

(jump_insn 15 14 16 1 (set (pc)
        (if_then_else (ne:SI (const_int 0 [0x0])
                (reg:SI 41))
            (label_ref 21)
            (pc))) -1 (nil)
    (expr_list:REG_BR_PROB (const_int 3300 [0xce4])
        (nil)))
;; End of basic block 1, registers live:
 (nil)

;; Start of basic block 2, registers live: (nil)
(code_label 16 15 17 2 3 "" [0 uses])

(note 17 16 18 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 18 17 19 2 (set (reg/v:SI 37 [ f ])
        (reg/v:SI 40 [ m ])) -1 (nil)
    (nil))

(jump_insn 19 18 20 2 (set (pc)
        (label_ref 24)) -1 (nil)
    (nil))
;; End of basic block 2, registers live:
 (nil)

(barrier 20 19 21)

;; Start of basic block 3, registers live: (nil)
(code_label 21 20 22 3 2 "" [1 uses])

(note 22 21 23 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(insn 23 22 24 3 (set (reg/v:SI 37 [ f ])
        (const_int 0 [0x0])) -1 (nil)
    (nil))
;; End of basic block 3, registers live:
 (nil)

;; Start of basic block 4, registers live: (nil)
(code_label 24 23 25 4 4 "" [1 uses])

(note 25 24 26 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 26 25 27 4 (set (reg:SI 38 [ <result> ])
        (reg/v:SI 37 [ f ])) -1 (nil)
    (nil))

(jump_insn 27 26 28 4 (set (pc)
        (label_ref 31)) -1 (nil)
    (nil))
;; End of basic block 4, registers live:
 (nil)

(barrier 28 27 29)

(note 29 28 39 NOTE_INSN_FUNCTION_END)

;; Start of basic block 5, registers live: (nil)
(note 39 29 33 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(insn 33 39 34 5 (clobber (reg/i:SI 1 r1)) -1 (nil)
    (nil))

(insn 34 33 35 5 (clobber (reg:SI 38 [ <result> ])) -1 (nil)
    (nil))

(jump_insn 35 34 36 5 (set (pc)
        (label_ref 37)) -1 (nil)
    (nil))
;; End of basic block 5, registers live:
 (nil)

(barrier 36 35 31)

;; Start of basic block 6, registers live: (nil)
(code_label 31 36 40 6 1 "" [1 uses])

(note 40 31 32 6 [bb 6] NOTE_INSN_BASIC_BLOCK)

(insn 32 40 37 6 (set (reg/i:SI 1 r1)
        (reg:SI 38 [ <result> ])) -1 (nil)
    (nil))
;; End of basic block 6, registers live:
 (nil)

;; Start of basic block 7, registers live: (nil)
(code_label 37 32 41 7 5 "" [1 uses])

(note 41 37 38 7 [bb 7] NOTE_INSN_BASIC_BLOCK)

(insn 38 41 0 7 (use (reg/i:SI 1 r1)) -1 (nil)
    (nil))
;; End of basic block 7, registers live:
 (nil)


[-- Attachment #3: short.c.11.ce1 --]
[-- Type: application/octet-stream, Size: 3057 bytes --]


;; Function main

43 registers.

Register 37 used 2 times across 0 insns; set 2 times; user var; dies in 0 places.

Register 39 used 1 times across 0 insns; set 1 time; user var; dies in 0 places.

Register 40 used 1 times across 0 insns; set 1 time; user var; dies in 0 places.

Register 41 used 1 times across 0 insns; set 1 time; dies in 0 places.

4 basic blocks, 6 edges.

Basic block 0 prev -1, next 1, loop_depth 0, count 0, freq 10000, maybe hot.
Predecessors:  ENTRY [100.0%]  (fallthru)
Successors:  2 [33.0%]  1 [67.0%]  (fallthru)

Basic block 1 prev 0, next 2, loop_depth 0, count 0, freq 6700, maybe hot.
Predecessors:  0 [67.0%]  (fallthru)
Successors:  3 [100.0%] 

Basic block 2 prev 1, next 3, loop_depth 0, count 0, freq 3300, maybe hot.
Predecessors:  0 [33.0%] 
Successors:  3 [100.0%]  (fallthru)

Basic block 3 prev 2, next -2, loop_depth 0, count 0, freq 10000, maybe hot.
Predecessors:  1 [100.0%]  2 [100.0%]  (fallthru)
Successors:  EXIT [100.0%]  (fallthru)



try_optimize_cfg iteration 1


IF-THEN-ELSE block found, pass 1, start block 0 [insn 11], then 1 [17], else 2 [21], join 3 [24]
Conversion succeeded on pass 1.

1 possible IF blocks searched.
1 IF blocks converted.
3 true changes made.




try_optimize_cfg iteration 1

(note 2 0 11 NOTE_INSN_DELETED)

;; Start of basic block 0, registers live: (nil)
(note 11 2 6 0 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 6 11 7 0 (set (reg/v:SI 39 [ k ])
        (mem/i:SI (reg/f:SI 30 r30) [2 k+0 S4 A32])) 40 {movsi_general} (nil)
    (expr_list:REG_EQUIV (mem/i:SI (reg/f:SI 30 r30) [2 k+0 S4 A32])
        (nil)))

(insn 7 6 8 0 (set (reg/v:SI 40 [ m ])
        (mem/i:SI (plus:SI (reg/f:SI 30 r30)
                (const_int 4 [0x4])) [2 m+0 S4 A32])) 40 {movsi_general} (nil)
    (expr_list:REG_EQUIV (mem/i:SI (plus:SI (reg/f:SI 30 r30)
                (const_int 4 [0x4])) [2 m+0 S4 A32])
        (nil)))

(note 8 7 10 0 NOTE_INSN_FUNCTION_BEG)

(call_insn 10 8 14 0 (parallel [
            (call (mem:QI (symbol_ref:SI ("__main") [flags 0x41]) [0 S1 A8])
                (const_int 0 [0x0]))
            (clobber (reg:SI 31 r31))
        ]) -1 (nil)
    (expr_list:REG_EH_REGION (const_int 0 [0x0])
        (nil))
    (nil))

(insn 14 10 46 0 (set:SI (reg:SI 41)
        (ne:SI (reg/v:SI 39 [ k ])
            (const_int 0 [0x0]))) 61 {set_internal} (nil)
    (nil))

(insn 46 14 47 0 (set (reg:SI 43)
        (const_int 0 [0x0])) 40 {movsi_general} (nil)
    (nil))

(insn 47 46 29 0 (set (reg/v:SI 37 [ f ])
        (if_then_else:SI (eq (reg:SI 41)
                (const_int 0 [0x0]))
            (reg/v:SI 40 [ m ])
            (reg/v:SI 37 [ f ]))) 1 {movsicc_internal} (nil)
    (nil))

(note 29 47 32 0 NOTE_INSN_FUNCTION_END)

(insn 32 29 38 0 (set (reg/i:SI 1 r1 [ <result> ])
        (reg/v:SI 37 [ f ])) 40 {movsi_general} (nil)
    (nil))

(insn 38 32 0 0 (use (reg/i:SI 1 r1 [ <result> ])) -1 (nil)
    (nil))
;; End of basic block 0, registers live:
 (nil)


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Help required for c to VCG GDL flow chart
@ 2006-07-07 13:54 Sharad Pratap
  2006-07-07 14:24 ` adding movz to machine description Petar Bajic
  0 siblings, 1 reply; 14+ messages in thread
From: Sharad Pratap @ 2006-07-07 13:54 UTC (permalink / raw)
  To: gcc-help

 I am developing a c2vcg program which takes C Program text

  and produces GDL of flow chart usable for VCG (Visual

  Compiler Graphics,) This program can now work for normal

  ANSI C some time fails on some special. In this I simply written

  a Bison Grammer file generating GDL according to Sources.

  I want for my program to  work  for  GNU C, But I am not getting

  any starting point here. I didn't understand whether GEM could help

  for this.

  Please tell whether it is possible to integrate this program/module

  in GCC or it should be totally seperate from it. work as independent

  program. If it is good to integrate in GCC so please tell how should

  I start it in GCC me a starting point.

  This is my gram.y view for one construct.

 iteration_statement:
  FOR '(' ';' ';' ')' statement
         {
         crtnode (++node, strdup ("for (;;)"), "rhomb", NULL);
         crtedge (EDGE, node, $6->flows->entry, NULL, NULL);
         crtoutsedge (BENTNEAR/*EDGE*/, &($6->flows->outs), node, FORWARD);
         crtoutsedge (BACK, &($6->flows->cnt), node, FORWARD);

         $$ = $6;
         $$->flows->entry = node;
         $$->flows->sttyp = LOOP;
         push_link (&($$->flows->outs), crtnodtyp (node, LOOP));
         push_list (&($$->flows->outs), $6->flows->brk);
         $$->flows->brk = NULL;
         }

  Regard
       Sharad

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2006-08-11  9:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-21  9:55 adding movz to machine description Petar Bajic
2006-07-21 16:30 ` Ian Lance Taylor
2006-07-25 10:09   ` Petar Bajic
2006-07-25 13:39     ` Ian Lance Taylor
2006-07-25 14:10       ` Petar Bajic
2006-07-25 14:56         ` Ian Lance Taylor
2006-08-11 12:07       ` Petar Bajic
  -- strict thread matches above, loose matches on Subject: below --
2006-07-07 13:54 Help required for c to VCG GDL flow chart Sharad Pratap
2006-07-07 14:24 ` adding movz to machine description Petar Bajic
2006-07-07 17:39   ` Ian Lance Taylor
2006-07-12 11:10     ` Petar Bajic
2006-07-13  7:52       ` Ian Lance Taylor
2006-07-18 12:06         ` Petar Bajic
2006-07-18 14:35           ` Ian Lance Taylor
2006-07-25 18:25   ` Rask Ingemann Lambertsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).