Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Instruction Attributes   [Contents][Index]


16.20.4 Example of Attribute Specifications

The judicious use of defaulting is important in the efficient use ofinsn attributes. Typically, insns are divided intotypes and anattribute, customarily calledtype, is used to represent thisvalue. This attribute is normally used only to define the default valuefor other attributes. An example will clarify this usage.

Assume we have a RISC machine with a condition code and in which onlyfull-word operations are performed in registers. Let us assume that wecan divide all insns into loads, stores, (integer) arithmeticoperations, floating point operations, and branches.

Here we will concern ourselves with determining the effect of an insn onthe condition code and will limit ourselves to the following possibleeffects: The condition code can be set unpredictably (clobbered), notbe changed, be set to agree with the results of the operation, or onlychanged if the item previously set into the condition code has beenmodified.

Here is part of a samplemd file for such a machine:

(define_attr "type" "load,store,arith,fp,branch" (const_string "arith"))(define_attr "cc" "clobber,unchanged,set,change0"             (cond [(eq_attr "type" "load")                        (const_string "change0")                    (eq_attr "type" "store,branch")                        (const_string "unchanged")                    (eq_attr "type" "arith")                        (if_then_else (match_operand:SI 0 "" "")                                      (const_string "set")                                      (const_string "clobber"))]                   (const_string "clobber")))(define_insn ""  [(set (match_operand:SI 0 "general_operand" "=r,r,m")        (match_operand:SI 1 "general_operand" "r,m,r"))]  ""  "@   move %0,%1   load %0,%1   store %0,%1"  [(set_attr "type" "arith,load,store")])

Note that we assume in the above example that arithmetic operationsperformed on quantities smaller than a machine word clobber the conditioncode since they will set the condition code to a value corresponding to thefull-word result.


Next:Computing the Length of an Insn, Previous:Assigning Attribute Values to Insns, Up:Instruction Attributes   [Contents][Index]


[8]ページ先頭

©2009-2026 Movatter.jp