PreviousUpNext

15.3.156  src/lib/compiler/back/low/sparc32/code/machcode-sparc32.codemade.api

## machcode-sparc32.codemade.api
#
# This file generated at   2015-12-06:08:43:07   by
#
#     src/lib/compiler/back/low/tools/arch/make-sourcecode-for-machcode-xxx-package.pkg
#
# from the architecture description file
#
#     src/lib/compiler/back/low/sparc32/sparc32.architecture-description
#
# Edits to this file will be LOST on next system rebuild.

# Compiled by:
#     src/lib/compiler/back/low/sparc32/backend-sparc32.lib


# This api specifies an abstract view of the SPARC32 instruction set.
#
# The idea is that the Base_Op sumtype defines
# one constructor for each SPARC32 machine instruction.
#
# Machcode allows us to do tasks like instruction selection and peephole optimization
#  (not currently implemented) without yet worrying about the details of the actual
# target-architecture binary encoding of instructions.
#
# This file is a concrete instantiation of the general Machcode_Form api defined in:
#
#     src/lib/compiler/back/low/code/machcode-form.api
#
# At runtime our SPARC32 machcode representation of the program being compiled is produced by

#     src/lib/compiler/back/low/sparc32/treecode/translate-treecode-to-machcode-sparc32-g.pkg
#
# Later, absolute executable binary machine code is produced by
#
#     src/lib/compiler/back/low/sparc32/emit/translate-machcode-to-execode-sparc32-g.codemade.pkg
#
# For display purposes, human-readable target-architecture assembly code is be produced
# from the machcode representation by
#
#     src/lib/compiler/back/low/sparc32/emit/translate-machcode-to-asmcode-sparc32-g.codemade.pkg
#
# This modules is mechanically generated from our architecture-description file by
#
#     src/lib/compiler/back/low/tools/arch/make-sourcecode-for-translate-machcode-to-asmcode-xxx-g-package.pkg
#
# This api is implemented in:
#
#     src/lib/compiler/back/low/sparc32/code/machcode-sparc32-g.codemade.pkg

stipulate
    package lbl =  codelabel;                                                   # codelabel                     is from   src/lib/compiler/back/low/code/codelabel.pkg
    package nt  =  note;                                                        # note                          is from   src/lib/src/note.pkg
    package rkj =  registerkinds_junk;                                          # registerkinds_junk            is from   src/lib/compiler/back/low/code/registerkinds-junk.pkg
herein

    api Machcode_Sparc32 {
        #
        package rgk:  Registerkinds_Sparc32;                                    # Registerkinds_Sparc32 is from   src/lib/compiler/back/low/sparc32/code/registerkinds-sparc32.codemade.pkg
        package tcf:  Treecode_Form;                                            # Treecode_Form                 is from   src/lib/compiler/back/low/treecode/treecode-form.api
        package lac:  Late_Constant;                                            # Late_Constant                 is from   src/lib/compiler/back/low/code/late-constant.api
        package rgn:  Ramregion;                                                # Ramregion                     is from   src/lib/compiler/back/low/code/ramregion.api
        
        sharing lac == tcf::lac;                                                # "lac" == "late_constant".
        sharing rgn == tcf::rgn;                                                # "rgn" == "region".
        
        Load = LDSB
             | LDSH
             | LDUB
             | LDUH
             | LD
             | LDX
             | LDD
             ;

        Store = STB
              | STH
              | ST
              | STX
              | STD
              ;

        Fload = LDF
              | LDDF
              | LDQF
              | LDFSR
              | LDXFSR
              ;

        Fstore = STF
               | STDF
               | STFSR
               ;

        Arith = AND
              | ANDCC
              | ANDN
              | ANDNCC
              | OR
              | ORCC
              | ORN
              | ORNCC
              | XOR
              | XORCC
              | XNOR
              | XNORCC
              | ADD
              | ADDCC
              | TADD
              | TADDCC
              | TADDTV
              | TADDTVCC
              | SUB
              | SUBCC
              | TSUB
              | TSUBCC
              | TSUBTV
              | TSUBTVCC
              | UMUL
              | UMULCC
              | SMUL
              | SMULCC
              | UDIV
              | UDIVCC
              | SDIV
              | SDIVCC
              | MULX
              | SDIVX
              | UDIVX
              ;

        Shift = SLL
              | SRL
              | SRA
              | SLLX
              | SRLX
              | SRAX
              ;

        Farith1 = FITOS
                | FITOD
                | FITOQ
                | FSTOI
                | FDTOI
                | FQTOI
                | FSTOD
                | FSTOQ
                | FDTOS
                | FDTOQ
                | FQTOS
                | FQTOD
                | FMOVS
                | FNEGS
                | FABSS
                | FMOVD
                | FNEGD
                | FABSD
                | FMOVQ
                | FNEGQ
                | FABSQ
                | FSQRTS
                | FSQRTD
                | FSQRTQ
                ;

        Farith2 = FADDS
                | FADDD
                | FADDQ
                | FSUBS
                | FSUBD
                | FSUBQ
                | FMULS
                | FMULD
                | FMULQ
                | FSMULD
                | FDMULQ
                | FDIVS
                | FDIVD
                | FDIVQ
                ;

        Fcmp = FCMPS
             | FCMPD
             | FCMPQ
             | FCMPES
             | FCMPED
             | FCMPEQ
             ;

        Branch = BN
               | BE
               | BLE
               | BL
               | BLEU
               | BCS
               | BNEG
               | BVS
               | BA
               | BNE
               | BG
               | BGE
               | BGU
               | BCC
               | BPOS
               | BVC
               ;

        Rcond = RZ
              | RLEZ
              | RLZ
              | RNZ
              | RGZ
              | RGEZ
              ;

        Cc = ICC
           | XCC
           ;

        Prediction = PT
                   | PN
                   ;

        Fbranch = FBN
                | FBNE
                | FBLG
                | FBUL
                | FBL
                | FBUG
                | FBG
                | FBU
                | FBA
                | FBE
                | FBUE
                | FBGE
                | FBUGE
                | FBLE
                | FBULE
                | FBO
                ;

        Effective_Address = DIRECT      rkj::Codetemp_Info
                          | FDIRECT     rkj::Codetemp_Info
                          | DISPLACE { base: rkj::Codetemp_Info, 
                                       disp: tcf::Label_Expression, 
                                       ramregion: rgn::Ramregion
                                     }

                          ;

        Fsize = SS
              | DD
              | QQ
              ;

        Operand = REG   rkj::Codetemp_Info
                | IMMED Int
                | LAB   tcf::Label_Expression
                | LO    tcf::Label_Expression
                | HI    tcf::Label_Expression
                ;

        Addressing_Mode = (rkj::Codetemp_Info, Operand);
        Base_Op = LOAD { l: Load, 
                         d: rkj::Codetemp_Info, 
                         r: rkj::Codetemp_Info, 
                         i: Operand, 
                         ramregion: rgn::Ramregion
                       }

                | STORE { s: Store, 
                          d: rkj::Codetemp_Info, 
                          r: rkj::Codetemp_Info, 
                          i: Operand, 
                          ramregion: rgn::Ramregion
                        }

                | FLOAD { l: Fload, 
                          r: rkj::Codetemp_Info, 
                          i: Operand, 
                          d: rkj::Codetemp_Info, 
                          ramregion: rgn::Ramregion
                        }

                | FSTORE { s: Fstore, 
                           d: rkj::Codetemp_Info, 
                           r: rkj::Codetemp_Info, 
                           i: Operand, 
                           ramregion: rgn::Ramregion
                         }

                | UNIMP { const22: Int }
                | SETHI { i: Int, 
                          d: rkj::Codetemp_Info
                        }

                | ARITH { a: Arith, 
                          r: rkj::Codetemp_Info, 
                          i: Operand, 
                          d: rkj::Codetemp_Info
                        }

                | SHIFT { s: Shift, 
                          r: rkj::Codetemp_Info, 
                          i: Operand, 
                          d: rkj::Codetemp_Info
                        }

                | MOVICC { b: Branch, 
                           i: Operand, 
                           d: rkj::Codetemp_Info
                         }

                | MOVFCC { b: Fbranch, 
                           i: Operand, 
                           d: rkj::Codetemp_Info
                         }

                | MOVR { rcond: Rcond, 
                         r: rkj::Codetemp_Info, 
                         i: Operand, 
                         d: rkj::Codetemp_Info
                       }

                | FMOVICC { size: Fsize, 
                            b: Branch, 
                            r: rkj::Codetemp_Info, 
                            d: rkj::Codetemp_Info
                          }

                | FMOVFCC { size: Fsize, 
                            b: Fbranch, 
                            r: rkj::Codetemp_Info, 
                            d: rkj::Codetemp_Info
                          }

                | BICC { b: Branch, 
                         a: Bool, 
                         label: lbl::Codelabel, 
                         nop: Bool
                       }

                | FBFCC { b: Fbranch, 
                          a: Bool, 
                          label: lbl::Codelabel, 
                          nop: Bool
                        }

                | BR { rcond: Rcond, 
                       p: Prediction, 
                       r: rkj::Codetemp_Info, 
                       a: Bool, 
                       label: lbl::Codelabel, 
                       nop: Bool
                     }

                | BP { b: Branch, 
                       p: Prediction, 
                       cc: Cc, 
                       a: Bool, 
                       label: lbl::Codelabel, 
                       nop: Bool
                     }

                | JMP { r: rkj::Codetemp_Info, 
                        i: Operand, 
                        labs: List( lbl::Codelabel ), 
                        nop: Bool
                      }

                | JMPL { r: rkj::Codetemp_Info, 
                         i: Operand, 
                         d: rkj::Codetemp_Info, 
                         defs: rgk::Codetemplists, 
                         uses: rgk::Codetemplists, 
                         cuts_to: List( lbl::Codelabel ), 
                         nop: Bool, 
                         ramregion: rgn::Ramregion
                       }

                | CALL { defs: rgk::Codetemplists, 
                         uses: rgk::Codetemplists, 
                         label: lbl::Codelabel, 
                         cuts_to: List( lbl::Codelabel ), 
                         nop: Bool, 
                         ramregion: rgn::Ramregion
                       }

                | TICC { t: Branch, 
                         cc: Cc, 
                         r: rkj::Codetemp_Info, 
                         i: Operand
                       }

                | FPOP1 { a: Farith1, 
                          r: rkj::Codetemp_Info, 
                          d: rkj::Codetemp_Info
                        }

                | FPOP2 { a: Farith2, 
                          r1: rkj::Codetemp_Info, 
                          r2: rkj::Codetemp_Info, 
                          d: rkj::Codetemp_Info
                        }

                | FCMP { cmp: Fcmp, 
                         r1: rkj::Codetemp_Info, 
                         r2: rkj::Codetemp_Info, 
                         nop: Bool
                       }

                | SAVE { r: rkj::Codetemp_Info, 
                         i: Operand, 
                         d: rkj::Codetemp_Info
                       }

                | RESTORE { r: rkj::Codetemp_Info, 
                            i: Operand, 
                            d: rkj::Codetemp_Info
                          }

                | RDY { d: rkj::Codetemp_Info }
                | WRY { r: rkj::Codetemp_Info, 
                        i: Operand
                      }

                | RET { leaf: Bool, 
                        nop: Bool
                      }

                | SOURCE { }
                | SINK { }
                | PHI { }
                ;

        Machine_Op
          = LIVE  { regs: rgk::Codetemplists,   spilled: rgk::Codetemplists }
          | DEAD  { regs: rgk::Codetemplists,   spilled: rgk::Codetemplists }
          #
          | COPY  { kind:               rkj::Registerkind,
                    size_in_bits:       Int,
                    dst:                List( rkj::Codetemp_Info ),
                    src:                List( rkj::Codetemp_Info ),
                    tmp:                Null_Or( Effective_Address )                    # NULL if |dst| == |src| == 1
                  }
          #
          | NOTE  { op:         Machine_Op,
                    note:               nt::Note
                  }
          #
          | BASE_OP  Base_Op
          ;
        
        load: { l: Load, 
                d: rkj::Codetemp_Info, 
                r: rkj::Codetemp_Info, 
                i: Operand, 
                ramregion: rgn::Ramregion
              }
              -> Machine_Op;

        store: { s: Store, 
                 d: rkj::Codetemp_Info, 
                 r: rkj::Codetemp_Info, 
                 i: Operand, 
                 ramregion: rgn::Ramregion
               }
               -> Machine_Op;

        fload: { l: Fload, 
                 r: rkj::Codetemp_Info, 
                 i: Operand, 
                 d: rkj::Codetemp_Info, 
                 ramregion: rgn::Ramregion
               }
               -> Machine_Op;

        fstore: { s: Fstore, 
                  d: rkj::Codetemp_Info, 
                  r: rkj::Codetemp_Info, 
                  i: Operand, 
                  ramregion: rgn::Ramregion
                }
                -> Machine_Op;

        unimp: { const22: Int } -> Machine_Op;

        sethi: { i: Int, 
                 d: rkj::Codetemp_Info
               }
               -> Machine_Op;

        arith: { a: Arith, 
                 r: rkj::Codetemp_Info, 
                 i: Operand, 
                 d: rkj::Codetemp_Info
               }
               -> Machine_Op;

        shift: { s: Shift, 
                 r: rkj::Codetemp_Info, 
                 i: Operand, 
                 d: rkj::Codetemp_Info
               }
               -> Machine_Op;

        movicc: { b: Branch, 
                  i: Operand, 
                  d: rkj::Codetemp_Info
                }
                -> Machine_Op;

        movfcc: { b: Fbranch, 
                  i: Operand, 
                  d: rkj::Codetemp_Info
                }
                -> Machine_Op;

        movr: { rcond: Rcond, 
                r: rkj::Codetemp_Info, 
                i: Operand, 
                d: rkj::Codetemp_Info
              }
              -> Machine_Op;

        fmovicc: { size: Fsize, 
                   b: Branch, 
                   r: rkj::Codetemp_Info, 
                   d: rkj::Codetemp_Info
                 }
                 -> Machine_Op;

        fmovfcc: { size: Fsize, 
                   b: Fbranch, 
                   r: rkj::Codetemp_Info, 
                   d: rkj::Codetemp_Info
                 }
                 -> Machine_Op;

        bicc: { b: Branch, 
                a: Bool, 
                label: lbl::Codelabel, 
                nop: Bool
              }
              -> Machine_Op;

        fbfcc: { b: Fbranch, 
                 a: Bool, 
                 label: lbl::Codelabel, 
                 nop: Bool
               }
               -> Machine_Op;

        br: { rcond: Rcond, 
              p: Prediction, 
              r: rkj::Codetemp_Info, 
              a: Bool, 
              label: lbl::Codelabel, 
              nop: Bool
            }
            -> Machine_Op;

        bp: { b: Branch, 
              p: Prediction, 
              cc: Cc, 
              a: Bool, 
              label: lbl::Codelabel, 
              nop: Bool
            }
            -> Machine_Op;

        jmp: { r: rkj::Codetemp_Info, 
               i: Operand, 
               labs: List( lbl::Codelabel ), 
               nop: Bool
             }
             -> Machine_Op;

        jmpl: { r: rkj::Codetemp_Info, 
                i: Operand, 
                d: rkj::Codetemp_Info, 
                defs: rgk::Codetemplists, 
                uses: rgk::Codetemplists, 
                cuts_to: List( lbl::Codelabel ), 
                nop: Bool, 
                ramregion: rgn::Ramregion
              }
              -> Machine_Op;

        call: { defs: rgk::Codetemplists, 
                uses: rgk::Codetemplists, 
                label: lbl::Codelabel, 
                cuts_to: List( lbl::Codelabel ), 
                nop: Bool, 
                ramregion: rgn::Ramregion
              }
              -> Machine_Op;

        ticc: { t: Branch, 
                cc: Cc, 
                r: rkj::Codetemp_Info, 
                i: Operand
              }
              -> Machine_Op;

        fpop1: { a: Farith1, 
                 r: rkj::Codetemp_Info, 
                 d: rkj::Codetemp_Info
               }
               -> Machine_Op;

        fpop2: { a: Farith2, 
                 r1: rkj::Codetemp_Info, 
                 r2: rkj::Codetemp_Info, 
                 d: rkj::Codetemp_Info
               }
               -> Machine_Op;

        fcmp: { cmp: Fcmp, 
                r1: rkj::Codetemp_Info, 
                r2: rkj::Codetemp_Info, 
                nop: Bool
              }
              -> Machine_Op;

        save: { r: rkj::Codetemp_Info, 
                i: Operand, 
                d: rkj::Codetemp_Info
              }
              -> Machine_Op;

        restore: { r: rkj::Codetemp_Info, 
                   i: Operand, 
                   d: rkj::Codetemp_Info
                 }
                 -> Machine_Op;

        rdy: { d: rkj::Codetemp_Info } -> Machine_Op;

        wry: { r: rkj::Codetemp_Info, 
               i: Operand
             }
             -> Machine_Op;

        ret: { leaf: Bool, 
               nop: Bool
             }
             -> Machine_Op;

        source: { } -> Machine_Op;

        sink: { } -> Machine_Op;

        phi: { } -> Machine_Op;

    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext