<s> inline static bool modifiesOp ( unsigned AluOp ) { return isPreOp ( AluOp ) || isPostOp ( AluOp ) ;


<s> inline static unsigned encode<ISA_LIT>AluCode ( unsigned AluOp ) { unsigned const OP_ENCODING_MASK = <NUM_LIT> ;


<s> unsigned const OP_ENCODING_MASK = <NUM_LIT> ; return AluOp & OP_ENCODING_MASK ;


<s> unsigned const ALU_MASK = <NUM_LIT> ; return AluOp & ALU_MASK ;


<s> inline static AluCode isdTo<ISA_LIT>AluCode ( <STR_LIT> Node_type ) { switch ( Node_type ) { case <STR_LIT> : return AluCode :: ADD ; case <STR_LIT> : return AluCode :: ADDC ; case <STR_LIT> : return AluCode :: SUB ; case <STR_LIT> : return AluCode :: SUBB ; case <STR_LIT> : return AluCode :: AND ; case <STR_LIT> :


<s> inline static bool isPreOp ( unsigned AluOp ) {


<s> case AND : return <STR_LIT> ; case OR : return <STR_LIT> ; case XOR : return <STR_LIT> ; case SHL : return <STR_LIT> ; case SRL :


<s> case ADDC : return <STR_LIT> ; case SUB : return <STR_LIT> ; case SUBB : return <STR_LIT> ; case AND : return <STR_LIT> ; case OR : return <STR_LIT> ;


<s> inline static unsigned makePostOp ( unsigned AluOp ) {

assert ( ! isPreOp ( AluOp ) && <STR_LIT> ) ;


<s> inline static bool modifiesOp ( unsigned AluOp ) { return isPreOp ( AluOp ) | isPostOp ( AluOp ) ;


<s> inline static AluCode stringTo<ISA_LIT>AluCode ( StringRef S ) { return StringSwitch < AluCode > ( S ) . Case ( <STR_LIT> , ADD ) . Case ( <STR_LIT> , ADDC ) . Case ( <STR_LIT> , SUB ) . Case ( <STR_LIT> , SUBB ) . Case ( <STR_LIT> , AND ) . Case ( <STR_LIT> , OR ) . Case ( <STR_LIT> , XOR ) . Case ( <STR_LIT> , SHL ) . Case ( <STR_LIT> , SRL ) . Case ( <STR_LIT> , SRA ) . Default ( UNKNOWN ) ;


<s> return StringSwitch < AluCode > ( S ) . Case ( <STR_LIT> , ADD ) . Case ( <STR_LIT> , ADDC ) . Case ( <STR_LIT> , SUB ) . Case ( <STR_LIT> , SUBB ) . Case ( <STR_LIT> , AND ) . Case ( <STR_LIT> , OR ) . Case ( <STR_LIT> , XOR ) . Case ( <STR_LIT> , SHL ) . Case ( <STR_LIT> , SRL ) . Case ( <STR_LIT> , SRA ) . Default ( UNKNOWN ) ;


<s> void <ISA_LIT>AsmBackend :: applyFixup ( const MCAssembler & Asm , const MCFixup & Fixup , const MCValue & Target , MutableArrayRef < char > Data , uint64_t Value , bool , const MCSubtargetInfo * ) const { MCFixupKind Kind = Fixup . getKind ( ) ; Value = adjustFixupValue ( static_cast < unsigned > ( Kind ) , Value ) ; if ( ! Value ) return ; unsigned Offset = Fixup . getOffset ( ) ; unsigned NumBytes = ( getFixupKindInfo ( Kind ) . TargetSize + <NUM_LIT> ) / <NUM_LIT> ; unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ; CurVal |= Value & Mask ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; Data [ Offset + Idx ] = static_cast < uint8_t > ( ( CurVal >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ;


<s> <ISA_LIT>AsmBackend ( const Target & T , Triple :: OSType OST ) : MCAsmBackend ( <STR_LIT> ) , OSType ( OST ) {


<s> bool mayNeedRelaxation ( const MCInst & , const MCSubtargetInfo & STI ) const override { return false ;


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( raw_ostream & OS , uint64_t Count ) const { if ( ( Count % <NUM_LIT> ) != <NUM_LIT> ) return false ; for ( uint64_t i = <NUM_LIT> ; i < Count ; i += <NUM_LIT> ) OS . write ( <STR_LIT> , <NUM_LIT> ) ; return true ;


<s> MCFixupKind Kind = Fixup . getKind ( ) ; Value = adjustFixupValue ( static_cast < unsigned > ( Kind ) , Value ) ; if ( ! Value ) return ; unsigned Offset = Fixup . getOffset ( ) ; unsigned NumBytes = ( getFixupKindInfo ( Kind ) . TargetSize + <NUM_LIT> ) / <NUM_LIT> ; unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ; CurVal |= Value & Mask ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) {


<s> Value = adjustFixupValue ( static_cast < unsigned > ( Kind ) , Value ) ; if ( ! Value ) return ; unsigned Offset = Fixup . getOffset ( ) ; unsigned NumBytes = ( getFixupKindInfo ( Kind ) . TargetSize + <NUM_LIT> ) / <NUM_LIT> ; unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ;


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCRegisterInfo & , const Triple & TheTriple , StringRef ) { if ( ! TheTriple . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ;

return new <ISA_LIT>AsmBackend ( T , TheTriple . getOS ( ) ) ;


<s> if ( ! TheTriple . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ; return new <ISA_LIT>AsmBackend ( T , TheTriple . getOS ( ) ) ;


<s> unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ;


<s> unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ; CurVal |= Value & Mask ;


<s> if ( ! TheTriple . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ;


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCRegisterInfo & MRI , const Triple & TheTriple , StringRef CPU ) { if ( ! TheTriple . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ;


<s> bool mayNeedRelaxation ( const MCInst & Inst ) const override { return false ;


<s> void relaxInstruction ( const MCInst & Inst , MCInst & Res ) const override {


<s> unsigned NumBytes = ( getFixupKindInfo ( Kind ) . TargetSize + <NUM_LIT> ) / <NUM_LIT> ; unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ;


<s> MCObjectWriter * <ISA_LIT>AsmBackend :: createObjectWriter ( raw_pwrite_stream & OS ) const { return create<ISA_LIT>ELFObjectWriter ( OS , MCELFObjectTargetWriter :: getOSABI ( OSType ) ) ;


<s> return create<ISA_LIT>ELFObjectWriter ( OS , MCELFObjectTargetWriter :: getOSABI ( OSType ) ) ;


<s> void relaxInstruction ( const MCInst & Inst , const MCSubtargetInfo & STI , MCInst & Res ) const override {


<s> for ( uint64_t i = <NUM_LIT> ; i < Count ; i += <NUM_LIT> ) OS . write ( <STR_LIT> , <NUM_LIT> ) ; return true ;


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( raw_ostream & OS , uint64_t Count , const MCSubtargetInfo * STI ) const { if ( ( Count % <NUM_LIT> ) != <NUM_LIT> ) return false ; for ( uint64_t i = <NUM_LIT> ; i < Count ; i += <NUM_LIT> ) OS . write ( <STR_LIT> , <NUM_LIT> ) ;


<s> CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ; CurVal |= Value & Mask ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) {


<s> unsigned FullSize = <NUM_LIT> ; uint64_t CurVal = <NUM_LIT> ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; CurVal |= static_cast < uint64_t > ( static_cast < uint8_t > ( Data [ Offset + Idx ] ) ) << ( i * <NUM_LIT> ) ; } uint64_t Mask = ( static_cast < uint64_t > ( - <NUM_LIT> ) >> ( <NUM_LIT> - getFixupKindInfo ( Kind ) . TargetSize ) ) ; CurVal |= Value & Mask ; for ( unsigned i = <NUM_LIT> ; i != NumBytes ; ++ i ) { unsigned Idx = ( FullSize - <NUM_LIT> - i ) ; Data [ Offset + Idx ] = static_cast < uint8_t > ( ( CurVal >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ;


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCSubtargetInfo & STI , const MCRegisterInfo & , const MCTargetOptions & ) { const Triple & TT = STI . getTargetTriple ( ) ;

if ( ! TT . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ;


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCSubtargetInfo & STI , const MCRegisterInfo & , const MCTargetOptions & ) { const Triple & TT = STI . getTargetTriple ( ) ; if ( ! TT . isOSBinFormatELF ( ) ) llvm_unreachable ( <STR_LIT> ) ;

return new <ISA_LIT>AsmBackend ( T , TT . getOS ( ) ) ;


<s> const MCFixupKindInfo & <ISA_LIT>AsmBackend :: getFixupKindInfo ( MCFixupKind Kind ) const { static const MCFixupKindInfo Infos [ <STR_LIT> ] = {


<s> { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo ( Kind ) ; assert ( unsigned ( Kind - FirstTargetFixupKind ) < getNumFixupKinds ( ) && <STR_LIT> ) ; return Infos [ Kind - FirstTargetFixupKind ] ;


<s> <ISA_LIT>AsmBackend ( const Target & T , Triple :: OSType OST ) : MCAsmBackend ( ) , OSType ( OST ) {


<s> bool mayNeedRelaxation ( const MCInst & ) const override {


<s> void relaxInstruction ( const MCInst & , const MCSubtargetInfo & , MCInst & ) const override {


<s> for ( uint64_t i = <NUM_LIT> ; i < Count ; i += <NUM_LIT> ) OW -> write32 ( <NUM_LIT> ) ;


<s> assert ( N == <NUM_LIT> && <STR_LIT> ) ;


<s> assert ( N == <NUM_LIT> && <STR_LIT> ) ; addExpr ( Inst , getImm ( ) ) ;


<s> if ( Expr == nullptr ) Inst . addOperand ( MCOperand :: createImm ( <NUM_LIT> ) ) ;

else if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Expr ) ) Inst . addOperand ( MCOperand :: createImm ( static_cast < int32_t > ( ConstExpr -> getValue ( ) ) ) ) ;


<s> if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( getImm ( ) ) ) Inst . addOperand ( MCOperand :: createImm ( ConstExpr -> getValue ( ) >> <NUM_LIT> ) ) ; else assert ( false && <STR_LIT> ) ;


<s> Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) { const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ;

assert ( isa < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) && cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ) ;


<s> void addImmShiftOperands ( MCInst & Inst , unsigned N ) const { assert ( N == <NUM_LIT> && <STR_LIT> ) ;


if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( getImm ( ) ) ) Inst . addOperand ( MCOperand :: createImm ( ConstExpr -> getValue ( ) & <NUM_LIT> ) ) ;


<s> } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) { const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ; assert ( isa < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) && cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ;


<s> assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCSymbolRefExpr > ( getImm ( ) ) ) { const MCSymbolRefExpr * SymbolRefExpr = dyn_cast < MCSymbolRefExpr > ( getImm ( ) ) ; assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == MCSymbolRefExpr :: VK_None ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) { const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ; const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ; assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ;


<s> assert ( N == <NUM_LIT> && <STR_LIT> ) ; const MCExpr * Expr = getMemOffset ( ) ;


<s> const MCExpr * Expr = getMemOffset ( ) ;


<s> assert ( N == <NUM_LIT> && <STR_LIT> ) ; Inst . addOperand ( MCOperand :: createReg ( getMemBaseReg ( ) ) ) ;

const MCExpr * Expr = getMemOffset ( ) ;


<s> Inst . addOperand ( MCOperand :: createReg ( getMemBaseReg ( ) ) ) ; const MCExpr * Expr = getMemOffset ( ) ; addExpr ( Inst , Expr ) ;

Inst . addOperand ( MCOperand :: createImm ( getMemOp ( ) ) ) ;


<s> Inst . addOperand ( MCOperand :: createReg ( getMemBaseReg ( ) ) ) ;

assert ( getMemOffsetReg ( ) != <NUM_LIT> && <STR_LIT> ) ;


<s> if ( isMemRegImm ( ) ) addMemRegImmOperands ( Inst , N ) ; if ( isMemRegReg ( ) ) addMemRegRegOperands ( Inst , N ) ;


<s> Inst . addOperand ( MCOperand :: createReg ( getReg ( ) ) ) ;


<s> static unsigned AluWithPrePost ( unsigned AluCode , bool PreOp , bool PostOp ) { if ( PreOp ) return LPAC :: makePreOp ( AluCode ) ; if ( PostOp ) return LPAC :: makePostOp ( AluCode ) ; return AluCode ;


<s> if ( PreOp ) return LPAC :: makePreOp ( AluCode ) ; if ( PostOp ) return LPAC :: makePostOp ( AluCode ) ;


<s> Op -> Imm . Value = Value ; Op -> StartLoc = Start ; Op -> EndLoc = End ; return Op ;


<s> Op -> Reg . RegNum = RegNum ; Op -> StartLoc = Start ; Op -> EndLoc = End ; return Op ;


<s> Op -> Tok . Length = Str . size ( ) ; Op -> StartLoc = Start ; Op -> EndLoc = Start ; return Op ;


<s> unsigned getMemBaseReg ( ) const { assert ( isMem ( ) && <STR_LIT> ) ;


<s> unsigned getMemBaseReg ( ) const { assert ( isMem ( ) && <STR_LIT> ) ; return Mem . BaseReg ;


<s> unsigned getMemOffsetReg ( ) const { assert ( isMem ( ) && <STR_LIT> ) ;


<s> unsigned getMemOp ( ) const { assert ( isMem ( ) && <STR_LIT> ) ;


<s> return StringRef ( Tok . Data , Tok . Length ) ;


<s> assert ( isToken ( ) && <STR_LIT> ) ;

return StringRef ( Tok . Data , Tok . Length ) ;


<s> bool isBrImm ( ) { if ( ! isImm ( ) ) return false ; const MCConstantExpr * MCE = dyn_cast < MCConstantExpr > ( Imm . Value ) ; if ( ! MCE ) return true ; int64_t Value = MCE -> getValue ( ) ; return isShiftedUInt < <NUM_LIT> , <NUM_LIT> > ( static_cast < int32_t > ( Value ) ) ;


<s> bool isBrImm ( ) { if ( ! isImm ( ) ) return false ;

const MCConstantExpr * MCE = dyn_cast < MCConstantExpr > ( Imm . Value ) ;


<s> uint64_t Value = ConstExpr -> getValue ( ) ; return Value < LPCC :: UNKNOWN ;


<s> if ( ! isImm ( ) ) return false ; const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ; if ( ! ConstExpr ) return false ; uint64_t Value = ConstExpr -> getValue ( ) ; return Value < LPCC :: UNKNOWN ;


<s> bool isHiImm16 ( ) { if ( ! isImm ( ) ) return false ; if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ) { int64_t Value = ConstExpr -> getValue ( ) ; return Value != <NUM_LIT> && isShiftedUInt < <NUM_LIT> , <NUM_LIT> > ( Value ) ; } if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Imm . Value ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ;

if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Imm . Value ) ) if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ;


<s> bool isHiImm16 ( ) { if ( ! isImm ( ) ) return false ; if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ) { int64_t Value = ConstExpr -> getValue ( ) ; return Value != <NUM_LIT> && isShiftedUInt < <NUM_LIT> , <NUM_LIT> > ( Value ) ; }

if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Imm . Value ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ;


<s> bool isHiImm16And ( ) { if ( ! isImm ( ) ) return false ; const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ; if ( ConstExpr ) {

int64_t Value = ConstExpr -> getValue ( ) ;


<s> int64_t Value = ConstExpr -> getValue ( ) ;

return ( Value != <NUM_LIT> ) && ( ( Value & ~ <NUM_LIT> ) == <NUM_LIT> ) ;


<s> if ( ! isImm ( ) ) return false ; const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ;


<s> bool isImm10 ( ) { if ( ! isImm ( ) ) return false ; const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ;


<s> bool isImmShift ( ) { if ( ! isImm ( ) ) return false ; const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ; if ( ! ConstExpr ) return false ; int64_t Value = ConstExpr -> getValue ( ) ; return ( Value >= - <NUM_LIT> ) && ( Value <= <NUM_LIT> ) ;


<s> const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( Imm . Value ) ; if ( ! ConstExpr ) return false ;


<s> return isUInt < <NUM_LIT> > ( static_cast < int32_t > ( Value ) ) ; } if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Imm . Value ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ; if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Imm . Value ) ) if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ;


<s> } if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Imm . Value ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ; if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Imm . Value ) ) if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ;


return ( ( Value & ~ <NUM_LIT> ) == <NUM_LIT> ) ;


<s> int64_t Value = ConstExpr -> getValue ( ) ; return ( ( Value & ~ <NUM_LIT> ) == <NUM_LIT> ) ;


<s> if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Imm . Value ) ) if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ;


<s> return isInt < <NUM_LIT> > ( static_cast < int32_t > ( Value ) ) ; } if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Imm . Value ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ; if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Imm . Value ) ) if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ;


<s> if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ;

if ( const MCSymbolRefExpr * SymbolRefExpr = dyn_cast < MCSymbolRefExpr > ( BinaryExpr -> getLHS ( ) ) ) return SymbolRefExpr -> getKind ( ) == MCSymbolRefExpr :: VK_None ;


<s> return isMemImm ( ) || isMemRegImm ( ) || isMemRegReg ( ) ;


<s> bool isMemImm ( ) const { return Kind == MEMORY_IMM ;


<s> if ( Operands . size ( ) < <NUM_LIT> ) return false ; else if ( Operands [ <NUM_LIT> ] -> isToken ( ) && Operands [ <NUM_LIT> ] -> isReg ( ) && Operands [ <NUM_LIT> ] -> isImm ( ) && Operands [ <NUM_LIT> ] -> isImm ( ) && Operands [ <NUM_LIT> ] -> isReg ( ) ) Offset = <NUM_LIT> ; else if ( Operands [ <NUM_LIT> ] -> isToken ( ) && Operands [ <NUM_LIT> ] -> isToken ( ) && Operands [ <NUM_LIT> ] -> isReg ( ) && Operands [ <NUM_LIT> ] -> isImm ( ) && Operands [ <NUM_LIT> ] -> isImm ( ) && Operands [ <NUM_LIT> ] -> isReg ( ) ) Offset = <NUM_LIT> ; else return false ; int PossibleAluOpIdx = Offset + <NUM_LIT> ;

int PossibleBaseIdx = Offset + <NUM_LIT> ;


<s> int PossibleAluOpIdx = Offset + <NUM_LIT> ; int PossibleBaseIdx = Offset + <NUM_LIT> ; int PossibleDestIdx = Offset + <NUM_LIT> ;

if ( <ISA_LIT>Operand * PossibleAluOp = static_cast < <ISA_LIT>Operand * > ( Operands [ PossibleAluOpIdx ] . get ( ) ) ) if ( PossibleAluOp -> isImm ( ) ) if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( PossibleAluOp -> getImm ( ) ) ) Modifies = LPAC :: modifiesOp ( ConstExpr -> getValue ( ) ) ;


<s> bool isMemSpls ( ) const { return isMemRegImm ( ) || isMemRegReg ( ) ;


<s> bool isReg ( ) const override { return Kind == REGISTER ;


<s> bool isToken ( ) const override { return Kind == TOKEN ;


<s> <ISA_LIT>AsmParser ( const MCSubtargetInfo & STI , MCAsmParser & Parser , const MCInstrInfo & MII , const MCTargetOptions & Options ) : MCTargetAsmParser ( Options , STI , MII ) , Parser ( Parser ) , Lexer ( Parser . getLexer ( ) ) , SubtargetInfo ( STI ) { setAvailableFeatures ( ComputeAvailableFeatures ( SubtargetInfo . getFeatureBits ( ) ) ) ;


<s> <ISA_LIT>AsmParser ( const MCSubtargetInfo & STI , MCAsmParser & Parser , const MCInstrInfo & MII , const MCTargetOptions & Options ) : MCTargetAsmParser ( Options , STI , MII ) , Parser ( Parser ) , Lexer ( Parser . getLexer ( ) ) , SubtargetInfo ( STI ) {

setAvailableFeatures ( ComputeAvailableFeatures ( SubtargetInfo . getFeatureBits ( ) ) ) ;


<s> explicit <ISA_LIT>Operand ( KindTy Kind ) : MCParsedAsmOperand ( ) , Kind ( Kind ) {


<s> RegisterMCAsmParser < <ISA_LIT>AsmParser > x ( getThe<ISA_LIT>Target ( ) ) ;


<s> void LLVMInitialize<ISA_LIT>AsmParser ( ) {

RegisterMCAsmParser < <ISA_LIT>AsmParser > x ( getThe<ISA_LIT>Target ( ) ) ;


<s> if ( ErrorInfo >= Operands . size ( ) ) return Error ( IdLoc , <STR_LIT> ) ; ErrorLoc = ( ( <ISA_LIT>Operand & ) * Operands [ ErrorInfo ] ) . getStartLoc ( ) ; if ( ErrorLoc == SMLoc ( ) ) ErrorLoc = IdLoc ; } return Error ( ErrorLoc , <STR_LIT> ) ;


<s> return Error ( IdLoc , <STR_LIT> ) ; case Match_InvalidOperand : { ErrorLoc = IdLoc ; if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) return Error ( IdLoc , <STR_LIT> ) ; ErrorLoc = ( ( <ISA_LIT>Operand & ) * Operands [ ErrorInfo ] ) . getStartLoc ( ) ; if ( ErrorLoc == SMLoc ( ) ) ErrorLoc = IdLoc ; }


<s> return StringSwitch < bool > ( static_cast < const <ISA_LIT>Operand & > ( * Operands [ <NUM_LIT> ] ) . getToken ( ) ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . Default ( false ) ;


<s> if ( Operands . size ( ) < <NUM_LIT> || ! IsRegister ( * Operands [ <NUM_LIT> ] ) || ! IsRegister ( * Operands [ <NUM_LIT> ] ) ) return false ;

return StringSwitch < bool > ( static_cast < const <ISA_LIT>Operand & > ( * Operands [ <NUM_LIT> ] ) . getToken ( ) ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . StartsWith ( <STR_LIT> , true ) . Default ( false ) ;


<s> const MCExpr * Imm = Op -> getImm ( ) ; Op -> Kind = MEMORY_IMM ; Op -> Mem . BaseReg = <NUM_LIT> ; Op -> Mem . AluOp = LPAC :: ADD ; Op -> Mem . OffsetReg = <NUM_LIT> ;


<s> const MCExpr * Imm = Op -> getImm ( ) ; Op -> Kind = MEMORY_REG_IMM ; Op -> Mem . BaseReg = BaseReg ; Op -> Mem . AluOp = AluOp ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > MorphToMemRegImm ( unsigned BaseReg , std :: unique_ptr < <ISA_LIT>Operand > Op , unsigned AluOp ) { const MCExpr * Imm = Op -> getImm ( ) ; Op -> Kind = MEMORY_REG_IMM ;


<s> Op -> Mem . BaseReg = BaseReg ; Op -> Mem . AluOp = AluOp ; Op -> Mem . OffsetReg = OffsetReg ;


<s> unsigned <ISA_LIT>AsmParser :: parseAluOperator ( bool PreOp , bool PostOp ) { StringRef IdString ; Parser . parseIdentifier ( IdString ) ; unsigned AluCode = LPAC :: stringTo<ISA_LIT>AluCode ( IdString ) ; if ( AluCode == LPAC :: UNKNOWN ) {

Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ;


<s> bool <ISA_LIT>AsmParser :: ParseDirective ( AsmToken ) {


<s> if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: LParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return nullptr ; } Lexer . Lex ( ) ; if ( Parser . parseIdentifier ( Identifier ) ) return nullptr ; } if ( Lexer . getKind ( ) == AsmToken :: Plus && Parser . parseExpression ( RHS ) ) return nullptr ; if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: RParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return nullptr ; } Lexer . Lex ( ) ; } End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ; const MCExpr * Expr = MCSymbolRefExpr :: create ( Sym , getContext ( ) ) ;

Res = <ISA_LIT>MCExpr :: create ( Kind , Expr , getContext ( ) ) ;


<s> SMLoc End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; const MCExpr * Res , * RHS = nullptr ; <ISA_LIT>MCExpr :: VariantKind Kind = <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ; if ( Lexer . getKind ( ) != AsmToken :: Identifier ) return nullptr ; StringRef Identifier ; if ( Parser . parseIdentifier ( Identifier ) ) return nullptr ; if ( Identifier . equals_lower ( <STR_LIT> ) ) Kind = <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ; else if ( Identifier . equals_lower ( <STR_LIT> ) ) Kind = <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ; if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: LParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return nullptr ; } Lexer . Lex ( ) ; if ( Parser . parseIdentifier ( Identifier ) ) return nullptr ; } if ( Lexer . getKind ( ) == AsmToken :: Plus && Parser . parseExpression ( RHS ) ) return nullptr ; if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: RParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return nullptr ; } Lexer . Lex ( ) ; }


<s> return parseIdentifier ( ) ; case AsmToken :: Plus : case AsmToken :: Minus : case AsmToken :: Integer : case AsmToken :: Dot : if ( ! Parser . parseExpression ( ExprVal ) ) return <STR_LIT> ( ExprVal , Start , End ) ; LLVM_FALLTHROUGH ; default :


<s> Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; Operands . insert ( Operands . begin ( ) + <NUM_LIT> , <STR_LIT> ( MCConstantExpr :: create ( LPCC :: ICC_T , getContext ( ) ) , NameLoc , NameLoc ) ) ; } if ( Lexer . is ( AsmToken :: EndOfStatement ) && Name . startswith ( <STR_LIT> ) && Operands . size ( ) == <NUM_LIT> ) { Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; } while ( Lexer . isNot ( AsmToken :: EndOfStatement ) && Lexer . is ( AsmToken :: Comma ) ) { Lex ( ) ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; } if ( IsMemoryAssignmentError ( Operands ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return true ; } if ( MaybePredicatedInst ( Operands ) ) { Operands . insert ( Operands . begin ( ) + <NUM_LIT> , <STR_LIT> ( MCConstantExpr :: create ( LPCC :: ICC_T , getContext ( ) ) , NameLoc , NameLoc ) ) ; }


<s> if ( Lexer . is ( AsmToken :: EndOfStatement ) ) return false ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; if ( Lexer . is ( AsmToken :: EndOfStatement ) && Name == <STR_LIT> && Operands . size ( ) == <NUM_LIT> ) { Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; Operands . insert ( Operands . begin ( ) + <NUM_LIT> , <STR_LIT> ( MCConstantExpr :: create ( LPCC :: ICC_T , getContext ( ) ) , NameLoc , NameLoc ) ) ; } if ( Lexer . is ( AsmToken :: EndOfStatement ) && Name . startswith ( <STR_LIT> ) && Operands . size ( ) == <NUM_LIT> ) { Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ;


<s> Op = parseRegister ( ) ; if ( ! Op ) { if ( ! Offset ) { if ( ( Op = parseImmediate ( ) ) && Lexer . is ( AsmToken :: RBrac ) ) { Parser . Lex ( ) ; if ( shouldBeSls ( * Op ) ) { Operands . push_back ( <STR_LIT> ( std :: move ( Op ) ) ) ; } else { if ( ! Op -> isLoImm16Signed ( ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return MatchOperand_ParseFail ; } Operands . push_back ( <STR_LIT> ( <STR_LIT> , std :: move ( Op ) , LPAC :: ADD ) ) ; } return MatchOperand_Success ; } } Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ; } BaseReg = Op -> getReg ( ) ; if ( ! PreOp ) PostOp = parsePrePost ( Type , & OffsetValue ) ; if ( Lexer . is ( AsmToken :: RBrac ) ) { Parser . Lex ( ) ; if ( ! Offset ) { SMLoc Start = Parser . getTok ( ) . getLoc ( ) ; SMLoc End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ;

const MCConstantExpr * OffsetConstExpr = MCConstantExpr :: create ( OffsetValue , getContext ( ) ) ;


<s> OperandMatchResultTy Result = MatchOperandParserImpl ( * Operands , Mnemonic ) ; if ( Result == MatchOperand_Success ) return Result ; if ( Result == MatchOperand_ParseFail ) { Parser . eatToEndOfStatement ( ) ; return Result ; } std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ; if ( ! Op ) Op = parseImmediate ( ) ; if ( ! Op ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ;


<s> if ( ! Op ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; Parser . eatToEndOfStatement ( ) ; return MatchOperand_ParseFail ; } Operands -> push_back ( std :: move ( Op ) ) ;


<s> if ( Lexer . is ( AsmToken :: Minus ) ) * OffsetValue = - SizeForSuffix ( Type ) ; else if ( Lexer . is ( AsmToken :: Plus ) ) * OffsetValue = SizeForSuffix ( Type ) ; else return false ; Parser . Lex ( ) ; Parser . Lex ( ) ; } else if ( Lexer . is ( AsmToken :: Star ) ) { Parser . Lex ( ) ; PreOrPost = true ; } return PreOrPost ;


<s> std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ; if ( Op != nullptr ) RegNum = Op -> getReg ( ) ;


<s> const AsmToken & Tok = getParser ( ) . getTok ( ) ; StartLoc = Tok . getLoc ( ) ; EndLoc = Tok . getEndLoc ( ) ; std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ;

if ( Op != nullptr ) RegNum = Op -> getReg ( ) ;


<s> case MEMORY_IMM : OS << <STR_LIT> << * getMemOffset ( ) << <STR_LIT> ; break ; case MEMORY_REG_IMM : OS << <STR_LIT> << getMemBaseReg ( ) << <STR_LIT> << * getMemOffset ( ) << <STR_LIT> ; break ; case MEMORY_REG_REG :

assert ( getMemOffset ( ) == nullptr ) ;


<s> if ( const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( Op . getImm ( ) ) ) return SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ; if ( const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( Op . getImm ( ) ) ) { const <ISA_LIT>MCExpr * LHSSymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) ;

return ( LHSSymbolRefExpr && LHSSymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ;


<s> return StringSwitch < int > ( T ) . EndsWith ( <STR_LIT> , <NUM_LIT> ) . EndsWith ( <STR_LIT> , <NUM_LIT> ) . Default ( <NUM_LIT> ) ;


<s> static int SizeForSuffix ( StringRef T ) {

return StringSwitch < int > ( T ) . EndsWith ( <STR_LIT> , <NUM_LIT> ) . EndsWith ( <STR_LIT> , <NUM_LIT> ) . Default ( <NUM_LIT> ) ;


<s> if ( Name . endswith ( <STR_LIT> ) ) { Mnemonic = Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; IsBRR = true ; } if ( Mnemonic [ <NUM_LIT> ] == 'b' || ( Mnemonic [ <NUM_LIT> ] == 's' && ! Mnemonic . startswith ( <STR_LIT> ) && ! Mnemonic . startswith ( <STR_LIT> ) ) ) { LPCC :: CondCode CondCode = LPCC :: suffixTo<ISA_LIT>CondCode ( Mnemonic . substr ( <NUM_LIT> , Next ) ) ; if ( CondCode != LPCC :: UNKNOWN ) { Mnemonic = Mnemonic . slice ( <NUM_LIT> , <NUM_LIT> ) ; Operands -> push_back ( <STR_LIT> ( Mnemonic , NameLoc ) ) ; Operands -> push_back ( <STR_LIT> ( MCConstantExpr :: create ( CondCode , getContext ( ) ) , NameLoc , NameLoc ) ) ;


<s> void addHiImm16Operands ( MCInst & Inst , unsigned N ) const { assert ( N == <NUM_LIT> && <STR_LIT> ) ; if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( getImm ( ) ) ) Inst . addOperand ( MCOperand :: createImm ( ConstExpr -> getValue ( ) >> <NUM_LIT> ) ) ; else if ( isa < <ISA_LIT>MCExpr > ( getImm ( ) ) ) { const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( getImm ( ) ) ; assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) {

const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ;


<s> assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) { const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ; assert ( BinaryExpr && isa < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) && cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ) ;


<s> if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( getImm ( ) ) ) Inst . addOperand ( MCOperand :: createImm ( ConstExpr -> getValue ( ) & <NUM_LIT> ) ) ; else if ( isa < <ISA_LIT>MCExpr > ( getImm ( ) ) ) { const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( getImm ( ) ) ; assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCSymbolRefExpr > ( getImm ( ) ) ) { const MCSymbolRefExpr * SymbolRefExpr = dyn_cast < MCSymbolRefExpr > ( getImm ( ) ) ;

assert ( SymbolRefExpr && SymbolRefExpr -> getKind ( ) == MCSymbolRefExpr :: VK_None ) ;


<s> auto Op = std :: make_unique < <ISA_LIT>Operand > ( IMMEDIATE ) ; Op -> Imm . Value = Value ; Op -> StartLoc = Start ; Op -> EndLoc = End ;


<s> Op -> Reg . RegNum = RegNum ; Op -> StartLoc = Start ; Op -> EndLoc = End ;


<s> Op -> Tok . Length = Str . size ( ) ; Op -> StartLoc = Start ; Op -> EndLoc = Start ;


<s> LLVM_EXTERNAL_VISIBILITY void LLVMInitialize<ISA_LIT>AsmParser ( ) { RegisterMCAsmParser < <ISA_LIT>AsmParser > x ( getThe<ISA_LIT>Target ( ) ) ;


<s> RegisterMCAsmParser < <ISA_LIT>AsmParser > x ( getThe<ISA_LIT>Target ( ) ) ;


<s> case Match_InvalidOperand : { ErrorLoc = IdLoc ; if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) return Error ( IdLoc , <STR_LIT> ) ; ErrorLoc = ( ( <ISA_LIT>Operand & ) * Operands [ ErrorInfo ] ) . getStartLoc ( ) ; if ( ErrorLoc == SMLoc ( ) ) ErrorLoc = IdLoc ;


<s> bool <ISA_LIT>AsmParser :: ParseRegister ( unsigned & RegNum , SMLoc & StartLoc , SMLoc & EndLoc ) { const AsmToken & Tok = getParser ( ) . getTok ( ) ; StartLoc = Tok . getLoc ( ) ; EndLoc = Tok . getEndLoc ( ) ; std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( false ) ;


<s> std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( true ) ; if ( Op == nullptr ) return MatchOperand_NoMatch ; RegNum = Op -> getReg ( ) ;


<s> const AsmToken & Tok = getParser ( ) . getTok ( ) ; StartLoc = Tok . getLoc ( ) ;


<s> } if ( Lexer . is ( AsmToken :: EndOfStatement ) && Name . startswith ( <STR_LIT> ) && Operands . size ( ) == <NUM_LIT> ) { Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; } while ( Lexer . isNot ( AsmToken :: EndOfStatement ) && Lexer . is ( AsmToken :: Comma ) ) { Lexer . Lex ( ) ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; } if ( IsMemoryAssignmentError ( Operands ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return true ;


<s> if ( Name . endswith ( <STR_LIT> ) ) { Mnemonic = Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; IsBRR = true ; } if ( Mnemonic [ <NUM_LIT> ] == 'b' || ( Mnemonic [ <NUM_LIT> ] == 's' && ! Mnemonic . startswith ( <STR_LIT> ) && ! Mnemonic . startswith ( <STR_LIT> ) ) ) { LPCC :: CondCode CondCode = LPCC :: suffixTo<ISA_LIT>CondCode ( Mnemonic . substr ( <NUM_LIT> , Next ) ) ; if ( CondCode != LPCC :: UNKNOWN ) { Mnemonic = Mnemonic . slice ( <NUM_LIT> , <NUM_LIT> ) ; Operands -> push_back ( <STR_LIT> ( Mnemonic , NameLoc ) ) ; Operands -> push_back ( <STR_LIT> ( MCConstantExpr :: create ( CondCode , getContext ( ) ) , NameLoc , NameLoc ) ) ; if ( IsBRR ) { Operands -> push_back ( <STR_LIT> ( <STR_LIT> , NameLoc ) ) ;


<s> int PossibleBaseIdx = Offset + <NUM_LIT> ; int PossibleDestIdx = Offset + <NUM_LIT> ; if ( <ISA_LIT>Operand * PossibleAluOp = static_cast < <ISA_LIT>Operand * > ( Operands [ PossibleAluOpIdx ] . get ( ) ) ) if ( PossibleAluOp -> isImm ( ) ) if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( PossibleAluOp -> getImm ( ) ) ) Modifies = LPAC :: modifiesOp ( ConstExpr -> getValue ( ) ) ; return Modifies && Operands [ PossibleBaseIdx ] -> isReg ( ) && Operands [ PossibleDestIdx ] -> isReg ( ) && Operands [ PossibleBaseIdx ] -> getReg ( ) == Operands [ PossibleDestIdx ] -> getReg ( ) ;


<s> void LLVMInitialize<ISA_LIT>AsmParser ( ) { RegisterMCAsmParser < <ISA_LIT>AsmParser > x ( The<ISA_LIT>Target ) ;


<s> if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) return Error ( IdLoc , <STR_LIT> ) ; ErrorLoc = ( ( <ISA_LIT>Operand & ) * Operands [ ErrorInfo ] ) . getStartLoc ( ) ; if ( ErrorLoc == SMLoc ( ) ) ErrorLoc = IdLoc ; } return Error ( ErrorLoc , <STR_LIT> ) ; } default : break ; }


<s> if ( Identifier . equals_lower ( <STR_LIT> ) ) Kind = <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ; else if ( Identifier . equals_lower ( <STR_LIT> ) ) Kind = <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ; if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: LParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return <NUM_LIT> ; } Lexer . Lex ( ) ; if ( Parser . parseIdentifier ( Identifier ) ) return <NUM_LIT> ; } if ( Lexer . getKind ( ) == AsmToken :: Plus && Parser . parseExpression ( RHS ) ) return <NUM_LIT> ; if ( Kind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { if ( Lexer . getKind ( ) != AsmToken :: RParen ) { Error ( Lexer . getLoc ( ) , <STR_LIT> ) ; return <NUM_LIT> ; } Lexer . Lex ( ) ; } End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( Identifier ) ; const MCExpr * Expr = MCSymbolRefExpr :: create ( Sym , getContext ( ) ) ; Res = <ISA_LIT>MCExpr :: create ( Kind , Expr , getContext ( ) ) ; if ( RHS ) Res = MCBinaryExpr :: createAdd ( Res , RHS , getContext ( ) ) ; return <STR_LIT> ( Res , Start , End ) ;


<s> std :: unique_ptr < <ISA_LIT>Operand > <ISA_LIT>AsmParser :: parseImmediate ( ) { SMLoc Start = Parser . getTok ( ) . getLoc ( ) ; SMLoc End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; const MCExpr * ExprVal ; switch ( Lexer . getKind ( ) ) {


<s> } while ( Lexer . isNot ( AsmToken :: EndOfStatement ) && Lexer . is ( AsmToken :: Comma ) ) { Lex ( ) ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; } if ( IsMemoryAssignmentError ( Operands ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return true ; } if ( MaybePredicatedInst ( Operands ) ) { Operands . insert ( Operands . begin ( ) + <NUM_LIT> , <STR_LIT> ( MCConstantExpr :: create ( LPCC :: ICC_T , getContext ( ) ) , NameLoc , NameLoc ) ) ; } return false ;


<s> Operands . push_back ( <STR_LIT> ( std :: move ( Op ) ) ) ; } else { if ( ! Op -> isLoImm16Signed ( ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return MatchOperand_ParseFail ; } Operands . push_back ( <STR_LIT> ( <STR_LIT> , std :: move ( Op ) , LPAC :: ADD ) ) ; } return MatchOperand_Success ; } } Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ; } BaseReg = Op -> getReg ( ) ; if ( ! PreOp ) PostOp = parsePrePost ( Type , & OffsetValue ) ; if ( Lexer . is ( AsmToken :: RBrac ) ) { Parser . Lex ( ) ; if ( ! Offset ) { SMLoc Start = Parser . getTok ( ) . getLoc ( ) ; SMLoc End = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; const MCConstantExpr * OffsetConstExpr = MCConstantExpr :: create ( OffsetValue , getContext ( ) ) ; Offset = <STR_LIT> ( OffsetConstExpr , Start , End ) ; } } else { if ( Offset || OffsetValue != <NUM_LIT> ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ; } AluOp = parseAluOperator ( PreOp , PostOp ) ; Offset = parseRegister ( ) ; if ( ! BaseReg || Lexer . isNot ( AsmToken :: RBrac ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; return MatchOperand_ParseFail ;


<s> OperandMatchResultTy Result = MatchOperandParserImpl ( * Operands , Mnemonic ) ; if ( Result == MatchOperand_Success ) return Result ; if ( Result == MatchOperand_ParseFail ) { Parser . eatToEndOfStatement ( ) ; return Result ; } std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ;


<s> if ( Result == MatchOperand_ParseFail ) { Parser . eatToEndOfStatement ( ) ; return Result ; } std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ; if ( ! Op ) Op = parseImmediate ( ) ; if ( ! Op ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; Parser . eatToEndOfStatement ( ) ;


<s> if ( Op != <NUM_LIT> ) RegNum = Op -> getReg ( ) ; return ( Op == <NUM_LIT> ) ;


<s> bool <ISA_LIT>AsmParser :: ParseRegister ( unsigned & RegNum , SMLoc & StartLoc , SMLoc & EndLoc ) { std :: unique_ptr < <ISA_LIT>Operand > Op = parseRegister ( ) ; if ( Op != <NUM_LIT> ) RegNum = Op -> getReg ( ) ; return ( Op == <NUM_LIT> ) ;


<s> Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; } while ( Lexer . isNot ( AsmToken :: EndOfStatement ) && Lexer . is ( AsmToken :: Comma ) ) { Lex ( ) ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; } if ( IsMemoryAssignmentError ( Operands ) ) { Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; return true ; } return false ;


<s> if ( Lexer . is ( AsmToken :: EndOfStatement ) && Name . startswith ( <STR_LIT> ) && Operands . size ( ) == <NUM_LIT> ) { Operands . erase ( Operands . begin ( ) , Operands . begin ( ) + <NUM_LIT> ) ; Operands . insert ( Operands . begin ( ) , <STR_LIT> ( <STR_LIT> , NameLoc ) ) ; } while ( Lexer . isNot ( AsmToken :: EndOfStatement ) && Lexer . is ( AsmToken :: Comma ) ) { Lex ( ) ; if ( parseOperand ( & Operands , Mnemonic ) != MatchOperand_Success ) return true ; } if ( IsMemoryAssignmentError ( Operands ) ) {

Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> <STR_LIT> ) ;


<s> explicit <ISA_LIT>Operand ( KindTy Kind ) : Kind ( Kind ) {


<s> else if ( isa < <ISA_LIT>MCExpr > ( getImm ( ) ) ) { const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( getImm ( ) ) ; assert ( SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) {


<s> const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ; assert ( dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) && dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_HI ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ;


<s> if ( const MCConstantExpr * ConstExpr = dyn_cast < MCConstantExpr > ( getImm ( ) ) ) Inst . addOperand ( MCOperand :: createImm ( static_cast < int32_t > ( ConstExpr -> getValue ( ) ) ) ) ; else if ( isa < <ISA_LIT>MCExpr > ( getImm ( ) ) ) { const <ISA_LIT>MCExpr * SymbolRefExpr = dyn_cast < <ISA_LIT>MCExpr > ( getImm ( ) ) ; assert ( SymbolRefExpr -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ) ; Inst . addOperand ( MCOperand :: createExpr ( getImm ( ) ) ) ; } else if ( isa < MCBinaryExpr > ( getImm ( ) ) ) { const MCBinaryExpr * BinaryExpr = dyn_cast < MCBinaryExpr > ( getImm ( ) ) ;

assert ( dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) && dyn_cast < <ISA_LIT>MCExpr > ( BinaryExpr -> getLHS ( ) ) -> getKind ( ) == <ISA_LIT>MCExpr :: VK_<ISA_LIT>_ABS_LO ) ;


<s> <ISA_LIT>AsmParser ( const MCSubtargetInfo & STI , MCAsmParser & Parser , const MCInstrInfo & MII , const MCTargetOptions & Options ) : MCTargetAsmParser ( Options , STI ) , Parser ( Parser ) , Lexer ( Parser . getLexer ( ) ) , SubtargetInfo ( STI ) {


<s> case MachineOperand :: MO_Register : O << <ISA_LIT>InstPrinter :: getRegisterName ( MO . getReg ( ) ) ; break ; case MachineOperand :: MO_Immediate : O << MO . getImm ( ) ; break ; case MachineOperand :: MO_MachineBasicBlock : O << * MO . getMBB ( ) -> getSymbol ( ) ; break ; case MachineOperand :: MO_GlobalAddress : if ( TF == <STR_LIT> ) O << <STR_LIT> << * getSymbol ( MO . getGlobal ( ) ) << <STR_LIT> ; else O << * getSymbol ( MO . getGlobal ( ) ) ; break ; case MachineOperand :: MO_BlockAddress : { MCSymbol * BA = GetBlockAddressSymbol ( MO . getBlockAddress ( ) ) ; O << BA -> getName ( ) ; break ; } case MachineOperand :: MO_ExternalSymbol : if ( TF == <STR_LIT> ) O << <STR_LIT> << * GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) << <STR_LIT> ; else O << * GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) ; break ; case MachineOperand :: MO_JumpTableIndex : O << MAI -> getPrivateGlobalPrefix ( ) << <STR_LIT> << getFunctionNumber ( ) << '_' << MO . getIndex ( ) ; break ; case MachineOperand :: MO_ConstantPoolIndex : O << MAI -> getPrivateGlobalPrefix ( ) << <STR_LIT> << getFunctionNumber ( ) << '_' << MO . getIndex ( ) ; return ; default : llvm_unreachable ( <STR_LIT> ) ;


<s> case 'H' : { if ( OpNo == <NUM_LIT> ) return true ; const MachineOperand & FlagsOP = MI -> getOperand ( OpNo - <NUM_LIT> ) ; if ( ! FlagsOP . isImm ( ) ) return true ; unsigned Flags = FlagsOP . getImm ( ) ; unsigned NumVals = InlineAsm :: getNumOperandRegisters ( Flags ) ; if ( NumVals != <NUM_LIT> ) return true ; unsigned RegOp = OpNo + <NUM_LIT> ;

if ( RegOp >= MI -> getNumOperands ( ) ) return true ;


<s> if ( NumVals != <NUM_LIT> ) return true ; unsigned RegOp = OpNo + <NUM_LIT> ; if ( RegOp >= MI -> getNumOperands ( ) ) return true ; const MachineOperand & MO = MI -> getOperand ( RegOp ) ; if ( ! MO . isReg ( ) ) return true ; Register Reg = MO . getReg ( ) ; O << <ISA_LIT>InstPrinter :: getRegisterName ( Reg ) ; return false ; } default : return AsmPrinter :: PrintAsmOperand ( MI , OpNo , ExtraCode , O ) ; } } printOperand ( MI , OpNo , O ) ;


<s> <ISA_LIT>MCInstLower MCInstLowering ( OutContext , * this ) ; MCSubtargetInfo STI = getSubtargetInfo ( ) ; MCInst TmpInst ; MCInstLowering . Lower ( MI , TmpInst ) ; OutStreamer -> EmitInstruction ( TmpInst , STI ) ;


<s> MCInstLowering . Lower ( MI , TmpInst ) ; TmpInst . setOpcode ( <STR_LIT> ) ; OutStreamer -> EmitInstruction ( TmpInst , STI ) ; } else {

OutStreamer -> EmitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) . addReg ( <STR_LIT> ) . addImm ( LPCC :: ICC_T ) , STI ) ;


<s> StringRef getPassName ( ) const override {


<s> StringRef getPassName ( ) const override { return <STR_LIT> ;


<s> const MachineOperand & FlagsOP = MI -> getOperand ( OpNo - <NUM_LIT> ) ; if ( ! FlagsOP . isImm ( ) ) return true ; unsigned Flags = FlagsOP . getImm ( ) ; unsigned NumVals = InlineAsm :: getNumOperandRegisters ( Flags ) ; if ( NumVals != <NUM_LIT> ) return true ; unsigned RegOp = OpNo + <NUM_LIT> ; if ( RegOp >= MI -> getNumOperands ( ) ) return true ; const MachineOperand & MO = MI -> getOperand ( RegOp ) ; if ( ! MO . isReg ( ) ) return true ; unsigned Reg = MO . getReg ( ) ; O << <ISA_LIT>InstPrinter :: getRegisterName ( Reg ) ; return false ; } default : return AsmPrinter :: PrintAsmOperand ( MI , OpNo , ExtraCode , O ) ; } }


<s> const MachineOperand & FlagsOP = MI -> getOperand ( OpNo - <NUM_LIT> ) ; if ( ! FlagsOP . isImm ( ) ) return true ; unsigned Flags = FlagsOP . getImm ( ) ; unsigned NumVals = InlineAsm :: getNumOperandRegisters ( Flags ) ; if ( NumVals != <NUM_LIT> ) return true ; unsigned RegOp = OpNo + <NUM_LIT> ; if ( RegOp >= MI -> getNumOperands ( ) ) return true ; const MachineOperand & MO = MI -> getOperand ( RegOp ) ; if ( ! MO . isReg ( ) ) return true ; unsigned Reg = MO . getReg ( ) ; O << <ISA_LIT>InstPrinter :: getRegisterName ( Reg ) ; return false ; }


<s> case MachineOperand :: MO_MachineBasicBlock : O << * MO . getMBB ( ) -> getSymbol ( ) ; break ; case MachineOperand :: MO_GlobalAddress : O << * getSymbol ( MO . getGlobal ( ) ) ; break ; case MachineOperand :: MO_BlockAddress : { MCSymbol * BA = GetBlockAddressSymbol ( MO . getBlockAddress ( ) ) ; O << BA -> getName ( ) ; break ; } case MachineOperand :: MO_ExternalSymbol : O << * GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) ; break ; case MachineOperand :: MO_JumpTableIndex : O << MAI -> getPrivateGlobalPrefix ( ) << <STR_LIT> << getFunctionNumber ( ) << '_' << MO . getIndex ( ) ; break ; case MachineOperand :: MO_ConstantPoolIndex : O << MAI -> getPrivateGlobalPrefix ( ) << <STR_LIT> << getFunctionNumber ( ) << '_' << MO . getIndex ( ) ;


<s> LLVM_EXTERNAL_VISIBILITY void LLVMInitialize<ISA_LIT>AsmPrinter ( ) {

RegisterAsmPrinter < <ISA_LIT>AsmPrinter > X ( getThe<ISA_LIT>Target ( ) ) ;


<s> MCSubtargetInfo STI = getSubtargetInfo ( ) ; MCInst TmpInst ; MCInstLowering . Lower ( MI , TmpInst ) ;

OutStreamer -> emitInstruction ( TmpInst , STI ) ;


<s> OutStreamer -> emitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) , STI ) ; OutStreamer -> emitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) , STI ) ; if ( MI -> getOpcode ( ) == <STR_LIT> ) { MCInst TmpInst ; MCInstLowering . Lower ( MI , TmpInst ) ; TmpInst . setOpcode ( <STR_LIT> ) ; OutStreamer -> emitInstruction ( TmpInst , STI ) ;


<s> continue ; } customEmitInstruction ( & * I ) ; } while ( ( ++ I != E ) && I -> isInsideBundle ( ) ) ;


<s> MachineBasicBlock :: const_instr_iterator E = MI -> getParent ( ) -> instr_end ( ) ; do { if ( I -> isCall ( ) ) { emitCallInstruction ( & * I ) ;


<s> void <ISA_LIT>AsmPrinter :: customEmitInstruction ( const MachineInstr * MI ) { <ISA_LIT>MCInstLower MCInstLowering ( OutContext , * Mang , * this ) ; MCSubtargetInfo STI = getSubtargetInfo ( ) ; MCInst TmpInst ; MCInstLowering . Lower ( MI , TmpInst ) ;

OutStreamer -> EmitInstruction ( TmpInst , STI ) ;


<s> <ISA_LIT>MCInstLower MCInstLowering ( OutContext , * Mang , * this ) ;

MCSubtargetInfo STI = getSubtargetInfo ( ) ;


<s> void <ISA_LIT>AsmPrinter :: emitCallInstruction ( const MachineInstr * MI ) { assert ( ( MI -> getOpcode ( ) == <STR_LIT> || MI -> getOpcode ( ) == <STR_LIT> ) && <STR_LIT> ) ; <ISA_LIT>MCInstLower MCInstLowering ( OutContext , * Mang , * this ) ; MCSubtargetInfo STI = getSubtargetInfo ( ) ; OutStreamer -> EmitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) , STI ) ; OutStreamer -> EmitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) , STI ) ; if ( MI -> getOpcode ( ) == <STR_LIT> ) { MCInst TmpInst ; MCInstLowering . Lower ( MI , TmpInst ) ;


<s> MCSubtargetInfo STI = getSubtargetInfo ( ) ; OutStreamer -> EmitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) , STI ) ; OutStreamer -> EmitInstruction ( MCInstBuilder ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) , STI ) ;

if ( MI -> getOpcode ( ) == <STR_LIT> ) {


} while ( ( ++ I != E ) && I -> isInsideBundle ( ) ) ;


<s> if ( ! AsmPrinter :: isBlockOnlyReachableByFallthrough ( MBB ) ) return false ; MachineBasicBlock :: const_iterator I = Pred -> end ( ) ; while ( I != Pred -> begin ( ) && ! ( -- I ) -> isTerminator ( ) ) { }


<s> const MachineBasicBlock * Pred = * MBB -> pred_begin ( ) ;

if ( const BasicBlock * B = Pred -> getBasicBlock ( ) ) if ( isa < SwitchInst > ( B -> getTerminator ( ) ) ) return false ;


<s> explicit <ISA_LIT>AsmPrinter ( TargetMachine & TM , std :: unique_ptr < MCStreamer > Streamer ) : AsmPrinter ( TM , std :: move ( Streamer ) ) {


<s> if ( ExtraCode [ <NUM_LIT> ] ) return true ; switch ( ExtraCode [ <NUM_LIT> ] ) { case 'H' : { if ( OpNo == <NUM_LIT> ) return true ; const MachineOperand & FlagsOP = MI -> getOperand ( OpNo - <NUM_LIT> ) ; if ( ! FlagsOP . isImm ( ) ) return true ; unsigned Flags = FlagsOP . getImm ( ) ; unsigned NumVals = InlineAsm :: getNumOperandRegisters ( Flags ) ; if ( NumVals != <NUM_LIT> ) return true ; unsigned RegOp = OpNo + <NUM_LIT> ; if ( RegOp >= MI -> getNumOperands ( ) ) return true ; const MachineOperand & MO = MI -> getOperand ( RegOp ) ; if ( ! MO . isReg ( ) ) return true ; unsigned Reg = MO . getReg ( ) ; O << <ISA_LIT>InstPrinter :: getRegisterName ( Reg ) ; return false ;


<s> unsigned RegOp = OpNo + <NUM_LIT> ; if ( RegOp >= MI -> getNumOperands ( ) ) return true ; const MachineOperand & MO = MI -> getOperand ( RegOp ) ; if ( ! MO . isReg ( ) ) return true ; unsigned Reg = MO . getReg ( ) ; O << <ISA_LIT>InstPrinter :: getRegisterName ( Reg ) ;


<s> case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ; case <STR_LIT> : return <NUM_LIT> ;


<s> case LPCC :: ICC_EQ : return <STR_LIT> ; case LPCC :: ICC_VC : return <STR_LIT> ; case LPCC :: ICC_VS : return <STR_LIT> ; case LPCC :: ICC_PL : return <STR_LIT> ; case LPCC :: ICC_MI : return <STR_LIT> ; case LPCC :: ICC_GE : return <STR_LIT> ; case LPCC :: ICC_LT : return <STR_LIT> ; case LPCC :: ICC_GT : return <STR_LIT> ; case LPCC :: ICC_LE : return <STR_LIT> ; case LPCC :: ICC_UGT : return <STR_LIT> ; case LPCC :: ICC_ULE : return <STR_LIT> ; case LPCC :: ICC_ULT : return <STR_LIT> ; case LPCC :: ICC_UGE : return <STR_LIT> ; default :


<s> inline static CondCode suffixTo<ISA_LIT>CondCode ( StringRef S ) { return StringSwitch < CondCode > ( S ) . EndsWith ( <STR_LIT> , LPCC :: ICC_F ) . EndsWith ( <STR_LIT> , LPCC :: ICC_HI ) . EndsWith ( <STR_LIT> , LPCC :: ICC_UGT ) . EndsWith ( <STR_LIT> , LPCC :: ICC_LS ) . EndsWith ( <STR_LIT> , LPCC :: ICC_ULE ) . EndsWith ( <STR_LIT> , LPCC :: ICC_CC ) . EndsWith ( <STR_LIT> , LPCC :: ICC_ULT ) . EndsWith ( <STR_LIT> , LPCC :: ICC_CS ) . EndsWith ( <STR_LIT> , LPCC :: ICC_UGE ) . EndsWith ( <STR_LIT> , LPCC :: ICC_NE ) . EndsWith ( <STR_LIT> , LPCC :: ICC_EQ ) . EndsWith ( <STR_LIT> , LPCC :: ICC_VC ) . EndsWith ( <STR_LIT> , LPCC :: ICC_VS ) . EndsWith ( <STR_LIT> , LPCC :: ICC_PL ) . EndsWith ( <STR_LIT> , LPCC :: ICC_MI ) . EndsWith ( <STR_LIT> , LPCC :: ICC_GE ) . EndsWith ( <STR_LIT> , LPCC :: ICC_LT ) . EndsWith ( <STR_LIT> , LPCC :: ICC_GT ) . EndsWith ( <STR_LIT> , LPCC :: ICC_LE ) . EndsWith ( <STR_LIT> , LPCC :: ICC_T ) . Default ( LPCC :: UNKNOWN ) ;


<s> bool SawStore = false ; for ( MachineBasicBlock :: reverse_instr_iterator I ( Slot ) ; I != MBB . instr_rend ( ) ; ++ I ) { if ( I -> isDebugValue ( ) ) continue ; MachineBasicBlock :: instr_iterator FI ( std :: next ( I ) . base ( ) ) ; if ( I -> hasUnmodeledSideEffects ( ) || I -> isInlineAsm ( ) || I -> isLabel ( ) || FI == LastFiller || I -> isPseudo ( ) ) break ; if ( delayHasHazard ( FI , SawLoad , SawStore , RegDefs , RegUses ) ) { insertDefsUses ( FI , RegDefs , RegUses ) ;


<s> bool SawStore = false ; for ( MachineBasicBlock :: reverse_instr_iterator I ( Slot ) ; I != MBB . instr_rend ( ) ; ++ I ) { if ( I -> isDebugValue ( ) ) continue ; MachineBasicBlock :: instr_iterator FI ( std :: next ( I ) . base ( ) ) ; if ( I -> hasUnmodeledSideEffects ( ) || I -> isInlineAsm ( ) || I -> isLabel ( ) || FI == LastFiller || I -> isPseudo ( ) ) break ; if ( delayHasHazard ( FI , SawLoad , SawStore , RegDefs , RegUses ) ) { insertDefsUses ( FI , RegDefs , RegUses ) ; continue ;


<s> const char * getPassName ( ) const override { return <STR_LIT> ;


<s> return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: AllVRegsAllocated ) ;


<s> ++ RI ; assert ( RI -> getOpcode ( ) == <STR_LIT> && RI -> getOperand ( <NUM_LIT> ) . isReg ( ) && RI -> getOperand ( <NUM_LIT> ) . getReg ( ) == <STR_LIT> && RI -> getOperand ( <NUM_LIT> ) . isReg ( ) && RI -> getOperand ( <NUM_LIT> ) . getReg ( ) == <STR_LIT> ) ; ++ RI ; MachineBasicBlock :: instr_iterator FI ( RI . base ( ) ) ; MBB . splice ( std :: next ( I ) , & MBB , FI , I ) ; FilledSlots += <NUM_LIT> ; } else {

if ( ! NopDelaySlotFiller && findDelayInstr ( MBB , I , J ) ) {


<s> insertDefsUses ( Slot , RegDefs , RegUses ) ; bool SawLoad = false ; bool SawStore = false ; for ( MachineBasicBlock :: reverse_instr_iterator I = ++ Slot . getReverse ( ) ; I != MBB . instr_rend ( ) ; ++ I ) {


<s> for ( MachineBasicBlock :: reverse_instr_iterator I = ++ Slot . getReverse ( ) ; I != MBB . instr_rend ( ) ; ++ I ) { if ( I -> isDebugValue ( ) ) continue ; MachineBasicBlock :: instr_iterator FI = I . getReverse ( ) ;

if ( I -> hasUnmodeledSideEffects ( ) || I -> isInlineAsm ( ) || I -> isLabel ( ) || FI == LastFiller || I -> isPseudo ( ) ) break ;


<s> } if ( MI -> mayStore ( ) ) { if ( SawStore ) return true ; SawStore = true ; if ( SawLoad ) return true ; } assert ( ( ! MI -> isCall ( ) && ! MI -> isReturn ( ) ) && <STR_LIT> ) ; for ( const MachineOperand & MO : MI -> operands ( ) ) { unsigned Reg ; if ( ! MO . isReg ( ) || ! ( Reg = MO . getReg ( ) ) ) continue ;


<s> if ( MI -> mayLoad ( ) ) { if ( SawStore ) return true ; SawLoad = true ; } if ( MI -> mayStore ( ) ) { if ( SawStore ) return true ; SawStore = true ; if ( SawLoad ) return true ; } assert ( ( ! MI -> isCall ( ) && ! MI -> isReturn ( ) ) && <STR_LIT> ) ; for ( const MachineOperand & MO : MI -> operands ( ) ) { unsigned Reg ; if ( ! MO . isReg ( ) || ! ( Reg = MO . getReg ( ) ) ) continue ; if ( MO . isDef ( ) ) { if ( isRegInSet ( RegDefs , Reg ) || isRegInSet ( RegUses , Reg ) ) return true ; } if ( MO . isUse ( ) ) {

if ( isRegInSet ( RegDefs , Reg ) ) return true ;


<s> bool runOnMachineFunction ( MachineFunction & MF ) override {

const <ISA_LIT>Subtarget & Subtarget = MF . getSubtarget < <ISA_LIT>Subtarget > ( ) ;


<s> FunctionPass * llvm :: create<ISA_LIT>DelaySlotFillerPass ( const <ISA_LIT>TargetMachine & ) { return new Filler ( ) ;


<s> bool Filler :: delayHasHazard ( MachineBasicBlock :: instr_iterator MI , bool & SawLoad , bool & SawStore , SmallSet < unsigned , <NUM_LIT> > & RegDefs , SmallSet < unsigned , <NUM_LIT> > & RegUses ) { if ( MI -> isImplicitDef ( ) || MI -> isKill ( ) ) return true ; if ( MI -> mayLoad ( ) ) { if ( SawStore ) return true ; SawLoad = true ; } if ( MI -> mayStore ( ) ) { if ( SawStore ) return true ; SawStore = true ; if ( SawLoad ) return true ; } assert ( ( ! MI -> isCall ( ) && ! MI -> isReturn ( ) ) && <STR_LIT> ) ; for ( unsigned I = <NUM_LIT> , E = MI -> getNumOperands ( ) ; I != E ; ++ I ) { const MachineOperand & MO = MI -> getOperand ( I ) ; unsigned Reg ;

if ( ! MO . isReg ( ) || ! ( Reg = MO . getReg ( ) ) ) continue ;


<s> unsigned Reg ; if ( ! MO . isReg ( ) || ! ( Reg = MO . getReg ( ) ) ) continue ; if ( MO . isDef ( ) ) { if ( isRegInSet ( RegDefs , Reg ) || isRegInSet ( RegUses , Reg ) ) return true ; } if ( MO . isUse ( ) ) { if ( isRegInSet ( RegDefs , Reg ) ) return true ; } }


<s> explicit Filler ( ) : MachineFunctionPass ( ID ) {


<s> if ( I -> isDebugInstr ( ) ) continue ; MachineBasicBlock :: instr_iterator FI = I . getReverse ( ) ; if ( I -> hasUnmodeledSideEffects ( ) || I -> isInlineAsm ( ) || I -> isLabel ( ) || FI == LastFiller || I -> isPseudo ( ) ) break ; if ( delayHasHazard ( FI , SawLoad , SawStore , RegDefs , RegUses ) ) { insertDefsUses ( FI , RegDefs , RegUses ) ; continue ; } Filler = FI ; return true ;


<s> bool Filler :: findDelayInstr ( MachineBasicBlock & MBB , MachineBasicBlock :: instr_iterator Slot , MachineBasicBlock :: instr_iterator & Filler ) { SmallSet < unsigned , <NUM_LIT> > RegDefs ; SmallSet < unsigned , <NUM_LIT> > RegUses ; insertDefsUses ( Slot , RegDefs , RegUses ) ; bool SawLoad = false ; bool SawStore = false ; for ( MachineBasicBlock :: reverse_instr_iterator I = ++ Slot . getReverse ( ) ; I != MBB . instr_rend ( ) ; ++ I ) {


<s> return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: NoVRegs ) ;


<s> unsigned E = MI -> isCall ( ) || MI -> isReturn ( ) ? MCID . getNumOperands ( ) : MI -> getNumOperands ( ) ; for ( unsigned I = <NUM_LIT> ; I != E ; ++ I ) { const MachineOperand & MO = MI -> getOperand ( I ) ; unsigned Reg ; if ( ! MO . isReg ( ) || ! ( Reg = MO . getReg ( ) ) ) continue ; if ( MO . isDef ( ) ) RegDefs . insert ( Reg ) ;

else if ( MO . isUse ( ) ) RegUses . insert ( Reg ) ;


<s> for ( MCRegAliasIterator AI ( Reg , TRI , true ) ; AI . isValid ( ) ; ++ AI ) if ( RegSet . count ( * AI ) ) return true ;


<s> MBB . splice ( std :: next ( I ) , & MBB , FI , I ) ; FilledSlots += <NUM_LIT> ; } else { if ( ! NopDelaySlotFiller && findDelayInstr ( MBB , I , J ) ) { MBB . splice ( std :: next ( I ) , & MBB , J ) ; } else { BuildMI ( MBB , std :: next ( I ) , DebugLoc ( ) , TII -> get ( <STR_LIT> ) ) ; } ++ FilledSlots ; } Changed = true ; LastFiller = ++ I ; MIBundleBuilder ( MBB , InstrWithSlot , std :: next ( LastFiller ) ) ; } } return Changed ;


<s> const <ISA_LIT>Subtarget & Subtarget = MF . getSubtarget < <ISA_LIT>Subtarget > ( ) ; TII = Subtarget . getInstrInfo ( ) ; TRI = Subtarget . getRegisterInfo ( ) ; bool Changed = false ; for ( MachineFunction :: iterator FI = MF . begin ( ) , FE = MF . end ( ) ; FI != FE ; ++ FI ) Changed |= runOnMachineBasicBlock ( * FI ) ;


<s> bool runOnMachineFunction ( MachineFunction & MF ) override { const <ISA_LIT>Subtarget & Subtarget = MF . getSubtarget < <ISA_LIT>Subtarget > ( ) ; TII = Subtarget . getInstrInfo ( ) ; TRI = Subtarget . getRegisterInfo ( ) ;


<s> static MCDisassembler * create<ISA_LIT>Disassembler ( const Target & , const MCSubtargetInfo & STI , MCContext & Ctx ) { return new <ISA_LIT>Disassembler ( STI , Ctx ) ;


<s> if ( ! tryAddingSymbolicOperand ( Insn + Address , false , Address , <NUM_LIT> , <NUM_LIT> , MI , Decoder ) ) MI . addOperand ( MCOperand :: createImm ( Insn ) ) ; return MCDisassembler :: Success ;


<s> static DecodeStatus decodeBranch ( MCInst & MI , unsigned Insn , uint64_t Address , const MCDisassembler * Decoder ) { if ( ! tryAddingSymbolicOperand ( Insn + Address , false , Address , <NUM_LIT> , <NUM_LIT> , MI , Decoder ) ) MI . addOperand ( MCOperand :: createImm ( Insn ) ) ;


<s> static DecodeStatus decodePredicateOperand ( MCInst & Inst , unsigned Val , uint64_t Address , const MCDisassembler * Decoder ) { if ( Val >= LPCC :: UNKNOWN ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( Val ) ) ;


<s> Inst . addOperand ( MCOperand :: createImm ( SignExtend32 < <NUM_LIT> > ( Offset ) ) ) ; return MCDisassembler :: Success ;


<s> unsigned Register = ( Insn >> <NUM_LIT> ) & <NUM_LIT> ;

Inst . addOperand ( MCOperand :: createReg ( GPRDecoderTable [ Register ] ) ) ;


<s> static DecodeStatus decodeRrMemoryValue ( MCInst & Inst , unsigned Insn , uint64_t Address , const MCDisassembler * Decoder ) { unsigned Register = ( Insn >> <NUM_LIT> ) & <NUM_LIT> ; Inst . addOperand ( MCOperand :: createReg ( GPRDecoderTable [ Register ] ) ) ; Register = ( Insn >> <NUM_LIT> ) & <NUM_LIT> ; Inst . addOperand ( MCOperand :: createReg ( GPRDecoderTable [ Register ] ) ) ;


<s> static DecodeStatus decodeShiftImm ( MCInst & Inst , unsigned Insn , uint64_t Address , const MCDisassembler * Decoder ) {

unsigned Offset = ( Insn & <NUM_LIT> ) ;


<s> Result = decodeInstruction ( DecoderTable<ISA_LIT>32 , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) { PostOperandDecodeAdjust ( Instr , Insn ) ; Size = <NUM_LIT> ; return Result ; } return MCDisassembler :: Fail ;


<s> if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( DecoderTable<ISA_LIT>32 , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) {

PostOperandDecodeAdjust ( Instr , Insn ) ;


<s> <ISA_LIT>Disassembler :: <ISA_LIT>Disassembler ( const MCSubtargetInfo & STI , MCContext & Ctx ) : MCDisassembler ( STI , Ctx ) {


<s> LLVM_EXTERNAL_VISIBILITY void LLVMInitialize<ISA_LIT>Disassembler ( ) {

TargetRegistry :: RegisterMCDisassembler ( getThe<ISA_LIT>Target ( ) , create<ISA_LIT>Disassembler ) ;


<s> switch ( PQ ) { case <NUM_LIT> : if ( Instr . getOperand ( <NUM_LIT> ) . isReg ( ) ) { Instr . getOperand ( <NUM_LIT> ) . setReg ( <STR_LIT> ) ; } if ( Instr . getOperand ( <NUM_LIT> ) . isImm ( ) ) Instr . getOperand ( <NUM_LIT> ) . setImm ( <NUM_LIT> ) ; break ; case <NUM_LIT> : AluOp = LPAC :: makePostOp ( AluOp ) ; break ; case <NUM_LIT> : break ; case <NUM_LIT> : AluOp = LPAC :: makePreOp ( AluOp ) ; break ; } Instr . addOperand ( MCOperand :: createImm ( AluOp ) ) ; }


<s> } Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ;


<s> return Decoder -> tryAddingSymbolicOperand ( MI , Value , Address , IsBranch , Offset , Width , <NUM_LIT> ) ;


<s> static bool tryAddingSymbolicOperand ( int64_t Value , bool IsBranch , uint64_t Address , uint64_t Offset , uint64_t Width , MCInst & MI , const MCDisassembler * Decoder ) {

return Decoder -> tryAddingSymbolicOperand ( MI , Value , Address , IsBranch , Offset , Width , <NUM_LIT> ) ;


<s> if ( Val >= LPCC :: UNKNOWN ) return MCDisassembler :: Fail ;

Inst . addOperand ( MCOperand :: createImm ( Val ) ) ;


<s> Inst . addOperand ( MCOperand :: createReg ( GPRDecoderTable [ Register ] ) ) ; unsigned Offset = ( Insn & <NUM_LIT> ) ; Inst . addOperand ( MCOperand :: createImm ( SignExtend32 < <NUM_LIT> > ( Offset ) ) ) ;


<s> static DecodeStatus decodeRrMemoryValue ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {

unsigned Register = ( Insn >> <NUM_LIT> ) & <NUM_LIT> ;


<s> static DecodeStatus decodeShiftImm ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) {


<s> unsigned Register = ( Insn >> <NUM_LIT> ) & <NUM_LIT> ; Inst . addOperand ( MCOperand :: createReg ( GPRDecoderTable [ Register ] ) ) ; unsigned Offset = ( Insn & <NUM_LIT> ) ; Inst . addOperand ( MCOperand :: createImm ( SignExtend32 < <NUM_LIT> > ( Offset ) ) ) ; return MCDisassembler :: Success ;


<s> Result = decodeInstruction ( DecoderTable<ISA_LIT>32 , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) { PostOperandDecodeAdjust ( Instr , Insn ) ; Size = <NUM_LIT> ;


<s> DecodeStatus <ISA_LIT>Disassembler :: getInstruction ( MCInst & Instr , uint64_t & Size , ArrayRef < uint8_t > Bytes , uint64_t Address , raw_ostream & , raw_ostream & ) const {


<s> return Dis -> tryAddingSymbolicOperand ( MI , Value , Address , IsBranch , Offset , Width ) ;


<s> TargetRegistry :: RegisterMCDisassembler ( getThe<ISA_LIT>Target ( ) , create<ISA_LIT>Disassembler ) ;


<s> return new <ISA_LIT>Disassembler ( STI , Ctx ) ;


<s> if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ;

unsigned Reg = GPRDecoderTable [ RegNo ] ;


<s> unsigned Reg = GPRDecoderTable [ RegNo ] ;

Inst . addOperand ( MCOperand :: createReg ( Reg ) ) ;


<s> if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( DecoderTable<ISA_LIT>32 , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) { PostOperandDecodeAdjust ( Instr , Insn ) ; Size = <NUM_LIT> ;


<s> Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ;


<s> ~ <ISA_LIT>Disassembler ( ) override {


return Decoder -> tryAddingSymbolicOperand ( MI , Value , Address , IsBranch , Offset , Width ) ;


<s> return std :: make_unique < <ISA_LIT>ELFObjectWriter > ( OSABI ) ;


<s> std :: unique_ptr < MCObjectTargetWriter > llvm :: create<ISA_LIT>ELFObjectWriter ( uint8_t OSABI ) { return llvm :: make_unique < <ISA_LIT>ELFObjectWriter > ( OSABI ) ;


<s> std :: unique_ptr < MCObjectWriter > llvm :: create<ISA_LIT>ELFObjectWriter ( raw_pwrite_stream & OS , uint8_t OSABI ) {

return createELFObjectWriter ( llvm :: make_unique < <ISA_LIT>ELFObjectWriter > ( OSABI ) , OS , false ) ;


<s> Type = ELF :: R_LANAI_21 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_21_F ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_25 ; break ; case <STR_LIT> : case FK_Data_4 : Type = ELF :: R_LANAI_32 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_HI16 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_LO16 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_NONE ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } return Type ;


<s> case ELF :: R_LANAI_32 : case ELF :: R_LANAI_HI16 : return true ; default :


<s> case ELF :: R_LANAI_21_F : case ELF :: R_LANAI_25 : case ELF :: R_LANAI_32 : case ELF :: R_LANAI_HI16 : return true ; default : return false ; }


<s> MCELFObjectTargetWriter * MOTW = new <ISA_LIT>ELFObjectWriter ( OSABI ) ;

return createELFObjectWriter ( MOTW , OS , false ) ;


<s> Type = ELF :: R_LANAI_25 ; break ; case <STR_LIT> : case FK_Data_4 : Type = ELF :: R_LANAI_32 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_HI16 ; break ; case <STR_LIT> : Type = ELF :: R_LANAI_LO16 ; break ;


<s> <ISA_LIT>ELFObjectWriter :: <ISA_LIT>ELFObjectWriter ( uint8_t OSABI ) : MCELFObjectTargetWriter ( false , OSABI , ELF :: EM_LANAI , true ) {


<s> case ELF :: R_LANAI_32 : case ELF :: R_LANAI_HI16 : return true ; default : return false ;


<s> <ISA_LIT>ELFObjectWriter :: ~ <ISA_LIT>ELFObjectWriter ( ) {


<s> MachineBasicBlock :: iterator <ISA_LIT>FrameLowering :: eliminateCallFramePseudoInstr ( MachineFunction & MF , MachineBasicBlock & MBB , MachineBasicBlock :: iterator I ) const {


<s> const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; DebugLoc DL = MBBI -> getDebugLoc ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: ADD ) ;


<s> MachineBasicBlock :: iterator MBBI = MBB . getLastNonDebugInstr ( ) ; const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; DebugLoc DL = MBBI -> getDebugLoc ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) ;

BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: ADD ) ;


<s> while ( MBBI != MBB -> end ( ) ) { MachineInstr & MI = * MBBI ++ ; if ( MI . getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI . getDebugLoc ( ) ; Register Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; Register Src = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; BuildMI ( * MBB , MI , DL , LII . get ( <STR_LIT> ) , Dst ) . addReg ( Src ) . addImm ( MaxCallFrameSize ) ; MI . eraseFromParent ( ) ; } }


<s> unsigned MaxCallFrameSize = MF . getFrameInfo ( ) . getMaxCallFrameSize ( ) ; for ( MachineFunction :: iterator MBB = MF . begin ( ) , E = MF . end ( ) ; MBB != E ; ++ MBB ) { MachineBasicBlock :: iterator MBBI = MBB -> begin ( ) ; while ( MBBI != MBB -> end ( ) ) { MachineInstr & MI = * MBBI ++ ; if ( MI . getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI . getDebugLoc ( ) ; Register Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ;

Register Src = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ;


<s> void <ISA_LIT>FrameLowering :: determineCalleeSaves ( MachineFunction & MF , BitVector & SavedRegs , RegScavenger * RS ) const { TargetFrameLowering :: determineCalleeSaves ( MF , SavedRegs , RS ) ; MachineFrameInfo & MFI = MF . getFrameInfo ( ) ; const <ISA_LIT>RegisterInfo * LRI = static_cast < const <ISA_LIT>RegisterInfo * > ( STI . getRegisterInfo ( ) ) ; int Offset = - <NUM_LIT> ; MFI . CreateFixedObject ( <NUM_LIT> , Offset , true ) ; Offset -= <NUM_LIT> ; MFI . CreateFixedObject ( <NUM_LIT> , Offset , true ) ; Offset -= <NUM_LIT> ; if ( LRI -> hasBasePointer ( MF ) ) { MFI . CreateFixedObject ( <NUM_LIT> , Offset , true ) ; SavedRegs . reset ( LRI -> getBaseRegister ( ) ) ; }


<s> assert ( & MF . front ( ) == & MBB && <STR_LIT> ) ; MachineFrameInfo & MFI = MF . getFrameInfo ( ) ; const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; MachineBasicBlock :: iterator MBBI = MBB . begin ( ) ; DebugLoc DL ; determineFrameLayout ( MF ) ; unsigned StackSize = MFI . getStackSize ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) . setMIFlag ( MachineInstr :: FrameSetup ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) . setMIFlag ( MachineInstr :: FrameSetup ) ; if ( StackSize != <NUM_LIT> ) { BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( StackSize ) . setMIFlag ( MachineInstr :: FrameSetup ) ; } if ( MFI . hasVarSizedObjects ( ) ) replaceAdjDynAllocPseudo ( MF ) ;


<s> void <ISA_LIT>FrameLowering :: emitPrologue ( MachineFunction & MF , MachineBasicBlock & MBB ) const { assert ( & MF . front ( ) == & MBB && <STR_LIT> ) ; MachineFrameInfo & MFI = MF . getFrameInfo ( ) ; const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; MachineBasicBlock :: iterator MBBI = MBB . begin ( ) ; DebugLoc DL ; determineFrameLayout ( MF ) ; unsigned StackSize = MFI . getStackSize ( ) ;

BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) . setMIFlag ( MachineInstr :: FrameSetup ) ;


<s> ++ MBB ) { MachineBasicBlock :: iterator MBBI = MBB -> begin ( ) ; while ( MBBI != MBB -> end ( ) ) { MachineInstr & MI = * MBBI ++ ; if ( MI . getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI . getDebugLoc ( ) ;

unsigned Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ;


<s> unsigned FrameSize = MFI . getStackSize ( ) ; Align StackAlign = LRI -> needsStackRealignment ( MF ) ? MFI . getMaxAlign ( ) : getStackAlign ( ) ; unsigned MaxCallFrameSize = MFI . getMaxCallFrameSize ( ) ; if ( MFI . hasVarSizedObjects ( ) ) MaxCallFrameSize = alignTo ( MaxCallFrameSize , StackAlign ) ; MFI . setMaxCallFrameSize ( MaxCallFrameSize ) ;

if ( ! ( hasReservedCallFrame ( MF ) && MFI . adjustsStack ( ) ) ) FrameSize += MaxCallFrameSize ;


<s> explicit <ISA_LIT>FrameLowering ( const <ISA_LIT>Subtarget & Subtarget ) : TargetFrameLowering ( StackGrowsDown , Align ( <NUM_LIT> ) , <NUM_LIT> ) , STI ( Subtarget ) {


<s> bool hasFP ( const MachineFunction & MF ) const override {


<s> bool hasFP ( const MachineFunction & MF ) const override { return true ;


<s> Align StackAlign = LRI -> hasStackRealignment ( MF ) ? MFI . getMaxAlign ( ) : getStackAlign ( ) ; unsigned MaxCallFrameSize = MFI . getMaxCallFrameSize ( ) ; if ( MFI . hasVarSizedObjects ( ) ) MaxCallFrameSize = alignTo ( MaxCallFrameSize , StackAlign ) ; MFI . setMaxCallFrameSize ( MaxCallFrameSize ) ; if ( ! ( hasReservedCallFrame ( MF ) && MFI . adjustsStack ( ) ) ) FrameSize += MaxCallFrameSize ;

FrameSize = alignTo ( FrameSize , StackAlign ) ;


<s> unsigned FrameSize = MFI . getStackSize ( ) ; Align StackAlign = LRI -> hasStackRealignment ( MF ) ? MFI . getMaxAlign ( ) : getStackAlign ( ) ; unsigned MaxCallFrameSize = MFI . getMaxCallFrameSize ( ) ; if ( MFI . hasVarSizedObjects ( ) ) MaxCallFrameSize = alignTo ( MaxCallFrameSize , StackAlign ) ; MFI . setMaxCallFrameSize ( MaxCallFrameSize ) ; if ( ! ( hasReservedCallFrame ( MF ) && MFI . adjustsStack ( ) ) ) FrameSize += MaxCallFrameSize ; FrameSize = alignTo ( FrameSize , StackAlign ) ;


<s> for ( MachineBasicBlock & MBB : MF ) { for ( MachineInstr & MI : llvm :: make_early_inc_range ( MBB ) ) { if ( MI . getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI . getDebugLoc ( ) ;

Register Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ;


<s> void <ISA_LIT>FrameLowering :: replaceAdjDynAllocPseudo ( MachineFunction & MF ) const { const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; unsigned MaxCallFrameSize = MF . getFrameInfo ( ) -> getMaxCallFrameSize ( ) ; for ( MachineFunction :: iterator MBB = MF . begin ( ) , E = MF . end ( ) ; MBB != E ; ++ MBB ) { MachineBasicBlock :: iterator MBBI = MBB -> begin ( ) ; while ( MBBI != MBB -> end ( ) ) { MachineInstr * MI = MBBI ++ ; if ( MI -> getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI -> getDebugLoc ( ) ; unsigned Dst = MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ; unsigned Src = MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ; BuildMI ( * MBB , MI , DL , LII . get ( <STR_LIT> ) , Dst ) . addReg ( Src ) . addImm ( MaxCallFrameSize ) ; MI -> eraseFromParent ( ) ; } } }


<s> void <ISA_LIT>FrameLowering :: replaceAdjDynAllocPseudo ( MachineFunction & MF ) const { const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ; unsigned MaxCallFrameSize = MF . getFrameInfo ( ) -> getMaxCallFrameSize ( ) ; for ( MachineFunction :: iterator MBB = MF . begin ( ) , E = MF . end ( ) ; MBB != E ; ++ MBB ) { MachineBasicBlock :: iterator MBBI = MBB -> begin ( ) ; while ( MBBI != MBB -> end ( ) ) { MachineInstr * MI = MBBI ++ ; if ( MI -> getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI -> getDebugLoc ( ) ; unsigned Dst = MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ; unsigned Src = MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ; BuildMI ( * MBB , MI , DL , LII . get ( <STR_LIT> ) , Dst ) . addReg ( Src ) . addImm ( MaxCallFrameSize ) ;


<s> TargetFrameLowering :: determineCalleeSaves ( MF , SavedRegs , RS ) ; MachineFrameInfo * MFI = MF . getFrameInfo ( ) ; const <ISA_LIT>RegisterInfo * LRI = static_cast < const <ISA_LIT>RegisterInfo * > ( STI . getRegisterInfo ( ) ) ; int Offset = - <NUM_LIT> ; MFI -> CreateFixedObject ( <NUM_LIT> , Offset , true ) ; Offset -= <NUM_LIT> ; MFI -> CreateFixedObject ( <NUM_LIT> , Offset , true ) ; Offset -= <NUM_LIT> ; if ( LRI -> hasBasePointer ( MF ) ) { MFI -> CreateFixedObject ( <NUM_LIT> , Offset , true ) ;

SavedRegs . reset ( LRI -> getBaseRegister ( ) ) ;


<s> MachineFrameInfo * MFI = MF . getFrameInfo ( ) ; const <ISA_LIT>RegisterInfo * LRI = STI . getRegisterInfo ( ) ; unsigned FrameSize = MFI -> getStackSize ( ) ; unsigned StackAlign = LRI -> needsStackRealignment ( MF ) ? MFI -> getMaxAlignment ( ) : getStackAlignment ( ) ; unsigned MaxCallFrameSize = MFI -> getMaxCallFrameSize ( ) ; if ( MFI -> hasVarSizedObjects ( ) ) MaxCallFrameSize = alignTo ( MaxCallFrameSize , StackAlign ) ; MFI -> setMaxCallFrameSize ( MaxCallFrameSize ) ; if ( ! ( hasReservedCallFrame ( MF ) && MFI -> adjustsStack ( ) ) ) FrameSize += MaxCallFrameSize ; FrameSize = alignTo ( FrameSize , StackAlign ) ;


<s> MachineBasicBlock :: iterator <ISA_LIT>FrameLowering :: eliminateCallFramePseudoInstr ( MachineFunction & , MachineBasicBlock & MBB , MachineBasicBlock :: iterator I ) const {


<s> DebugLoc DL = MBBI -> getDebugLoc ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) ;


<s> void <ISA_LIT>FrameLowering :: emitEpilogue ( MachineFunction & , MachineBasicBlock & MBB ) const { MachineBasicBlock :: iterator MBBI = MBB . getLastNonDebugInstr ( ) ; const <ISA_LIT>InstrInfo & LII = * static_cast < const <ISA_LIT>InstrInfo * > ( STI . getInstrInfo ( ) ) ;


<s> DebugLoc DL ; determineFrameLayout ( MF ) ; unsigned StackSize = MFI -> getStackSize ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) . setMIFlag ( MachineInstr :: FrameSetup ) ;

BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) . setMIFlag ( MachineInstr :: FrameSetup ) ;


<s> DebugLoc DL ; determineFrameLayout ( MF ) ; unsigned StackSize = MFI -> getStackSize ( ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) ) . addReg ( <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - <NUM_LIT> ) . addImm ( LPAC :: makePreOp ( LPAC :: ADD ) ) . setMIFlag ( MachineInstr :: FrameSetup ) ; BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( <NUM_LIT> ) . setMIFlag ( MachineInstr :: FrameSetup ) ; if ( StackSize != <NUM_LIT> ) { BuildMI ( MBB , MBBI , DL , LII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( StackSize ) . setMIFlag ( MachineInstr :: FrameSetup ) ;


<s> bool hasFP ( const MachineFunction & ) const override {


<s> explicit <ISA_LIT>FrameLowering ( const <ISA_LIT>Subtarget & Subtarget ) : TargetFrameLowering ( StackGrowsDown , <NUM_LIT> , <NUM_LIT> ) , STI ( Subtarget ) {


<s> DebugLoc DL = MI . getDebugLoc ( ) ; unsigned Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; unsigned Src = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ;

BuildMI ( * MBB , MI , DL , LII . get ( <STR_LIT> ) , Dst ) . addReg ( Src ) . addImm ( MaxCallFrameSize ) ;


<s> if ( MI . getOpcode ( ) == <STR_LIT> ) { DebugLoc DL = MI . getDebugLoc ( ) ; unsigned Dst = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; unsigned Src = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; BuildMI ( * MBB , MI , DL , LII . get ( <STR_LIT> ) , Dst ) . addReg ( Src ) . addImm ( MaxCallFrameSize ) ; MI . eraseFromParent ( ) ;


<s> if ( ! printAlias ( MI , OS ) && ! printAliasInstr ( MI , OS ) ) printInstruction ( MI , OS ) ;


<s> if ( ! printAlias ( MI , OS ) && ! printAliasInstr ( MI , OS ) ) printInstruction ( MI , OS ) ; printAnnotation ( OS , Annotation ) ;


<s> void <ISA_LIT>InstPrinter :: printMemRiOperand ( const MCInst * MI , int OpNo , raw_ostream & OS , const char * Modifier ) {

const MCOperand & RegOp = MI -> getOperand ( OpNo ) ;


<s> OS << <STR_LIT> << getRegisterName ( RegOp . getReg ( ) ) ; if ( LPAC :: isPostOp ( AluCode ) ) OS << <STR_LIT> ; OS << <STR_LIT> << LPAC :: lanaiAluCodeToString ( AluCode ) << <STR_LIT> ; OS << <STR_LIT> << getRegisterName ( OffsetOp . getReg ( ) ) ; OS << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printMemSplsOperand ( const MCInst * MI , int OpNo , raw_ostream & OS , const char * Modifier ) { const MCOperand & RegOp = MI -> getOperand ( OpNo ) ; const MCOperand & OffsetOp = MI -> getOperand ( OpNo + <NUM_LIT> ) ; const MCOperand & AluOp = MI -> getOperand ( OpNo + <NUM_LIT> ) ; const unsigned AluCode = AluOp . getImm ( ) ;

printMemoryImmediateOffset < <NUM_LIT> > ( MAI , OffsetOp , OS ) ;


<s> if ( ! printAlias ( MI , OS ) && ! printAliasInstr ( MI , OS ) ) printInstruction ( MI , Address , OS ) ;


<s> static StringRef decIncOperator ( const MCInst * MI ) {

if ( MI -> getOperand ( <NUM_LIT> ) . getImm ( ) < <NUM_LIT> ) return <STR_LIT> ;


<s> unsigned AluCode = MI -> getOperand ( <NUM_LIT> ) . getImm ( ) ; return LPAC :: isPostOp ( AluCode ) && usesGivenOffset ( MI , AddOffset ) ;


<s> static bool isPostIncrementForm ( const MCInst * MI , int AddOffset ) {

unsigned AluCode = MI -> getOperand ( <NUM_LIT> ) . getImm ( ) ;


<s> <ISA_LIT>InstPrinter ( const MCAsmInfo & MAI , const MCInstrInfo & MII , const MCRegisterInfo & MRI ) : MCInstPrinter ( MAI , MII , MRI ) {


<s> case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryStoreIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryStoreIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ;


<s> bool <ISA_LIT>InstPrinter :: printAlias ( const MCInst * MI , raw_ostream & OS ) { switch ( MI -> getOpcode ( ) ) { case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryLoadIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryStoreIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryStoreIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ; case <STR_LIT> : return printMemoryStoreIncrement ( MI , OS , <STR_LIT> , <NUM_LIT> ) ;


<s> if ( CC >= LPCC :: UNKNOWN ) OS << <STR_LIT> ;

else OS << lanaiCondCodeToString ( CC ) ;


<s> void <ISA_LIT>InstPrinter :: printCCOperand ( const MCInst * MI , int OpNo , raw_ostream & OS ) { LPCC :: CondCode CC = static_cast < LPCC :: CondCode > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ; if ( CC >= LPCC :: UNKNOWN ) OS << <STR_LIT> ;


<s> const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . isImm ( ) ) {

OS << formatHex ( ( Op . getImm ( ) << <NUM_LIT> ) | <NUM_LIT> ) ;


<s> } else { assert ( Op . isExpr ( ) && <STR_LIT> ) ; Op . getExpr ( ) -> print ( OS , & MAI ) ; }


<s> void <ISA_LIT>InstPrinter :: printInst ( const MCInst * MI , raw_ostream & OS , StringRef Annotation , const MCSubtargetInfo & ) { if ( ! printAlias ( MI , OS ) && ! printAliasInstr ( MI , OS ) ) printInstruction ( MI , OS ) ;


<s> assert ( Op . isExpr ( ) && <STR_LIT> ) ;

Op . getExpr ( ) -> print ( OS , & MAI ) ;


<s> if ( Op . isImm ( ) ) { OS << '[' << formatHex ( Op . getImm ( ) ) << ']' ; } else {

assert ( Op . isExpr ( ) && <STR_LIT> ) ;


<s> } else { assert ( Op . isExpr ( ) && <STR_LIT> ) ; OS << '[' ; Op . getExpr ( ) -> print ( OS , & MAI ) ; OS << ']' ;


<s> assert ( RegOp . isReg ( ) && <STR_LIT> ) ; OS << <STR_LIT> ;

if ( LPAC :: isPreOp ( AluCode ) ) OS << <STR_LIT> ;


<s> if ( OffsetOp . isImm ( ) ) { assert ( isInt < SizeInBits > ( OffsetOp . getImm ( ) ) && <STR_LIT> ) ; OS << OffsetOp . getImm ( ) ; } else OffsetOp . getExpr ( ) -> print ( OS , & MAI ) ;


<s> static void printMemoryImmediateOffset ( const MCAsmInfo & MAI , const MCOperand & OffsetOp , raw_ostream & OS ) { assert ( ( OffsetOp . isImm ( ) || OffsetOp . isExpr ( ) ) && <STR_LIT> ) ; if ( OffsetOp . isImm ( ) ) { assert ( isInt < SizeInBits > ( OffsetOp . getImm ( ) ) && <STR_LIT> ) ; OS << OffsetOp . getImm ( ) ;

} else OffsetOp . getExpr ( ) -> print ( OS , & MAI ) ;


<s> OS << <STR_LIT> << Opcode << <STR_LIT> << decIncOperator ( MI ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) ; return true ; } if ( isPostIncrementForm ( MI , AddOffset ) ) { OS << <STR_LIT> << Opcode << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << decIncOperator ( MI ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) ; return true ; }


<s> } if ( isPostIncrementForm ( MI , AddOffset ) ) { OS << <STR_LIT> << Opcode << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << decIncOperator ( MI ) << <STR_LIT> ; return true ;


<s> OS << <STR_LIT> << Opcode << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << <STR_LIT> << decIncOperator ( MI ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << <STR_LIT> ; return true ; } if ( isPostIncrementForm ( MI , AddOffset ) ) { OS << <STR_LIT> << Opcode << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << <STR_LIT> << getRegisterName ( MI -> getOperand ( <NUM_LIT> ) . getReg ( ) ) << decIncOperator ( MI ) << <STR_LIT> ; return true ;


<s> const unsigned AluCode = AluOp . getImm ( ) ; printMemoryImmediateOffset < <NUM_LIT> > ( MAI , OffsetOp , OS ) ; printMemoryBaseRegister ( OS , AluCode , RegOp ) ;


<s> const MCOperand & RegOp = MI -> getOperand ( OpNo ) ; const MCOperand & OffsetOp = MI -> getOperand ( OpNo + <NUM_LIT> ) ; const MCOperand & AluOp = MI -> getOperand ( OpNo + <NUM_LIT> ) ; const unsigned AluCode = AluOp . getImm ( ) ; assert ( OffsetOp . isReg ( ) && RegOp . isReg ( ) && <STR_LIT> ) ; OS << <STR_LIT> ; if ( LPAC :: isPreOp ( AluCode ) ) OS << <STR_LIT> ; OS << <STR_LIT> << getRegisterName ( RegOp . getReg ( ) ) ;

if ( LPAC :: isPostOp ( AluCode ) ) OS << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & OS , const char * Modifier ) { assert ( ( Modifier == <NUM_LIT> || Modifier [ <NUM_LIT> ] == <NUM_LIT> ) && <STR_LIT> ) ;

const MCOperand & Op = MI -> getOperand ( OpNo ) ;


<s> assert ( ( Modifier == <NUM_LIT> || Modifier [ <NUM_LIT> ] == <NUM_LIT> ) && <STR_LIT> ) ; const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . isReg ( ) ) OS << <STR_LIT> << getRegisterName ( Op . getReg ( ) ) ; else if ( Op . isImm ( ) ) OS << formatHex ( Op . getImm ( ) ) ; else { assert ( Op . isExpr ( ) && <STR_LIT> ) ; Op . getExpr ( ) -> print ( OS , & MAI ) ;


<s> LPCC :: CondCode CC = static_cast < LPCC :: CondCode > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ; if ( CC >= LPCC :: UNKNOWN ) OS << <STR_LIT> ;

else if ( CC != LPCC :: ICC_T ) OS << <STR_LIT> << lanaiCondCodeToString ( CC ) ;


<s> OS << StringRef ( getRegisterName ( RegNo ) ) . lower ( ) ;


<s> unsigned AluCode = MI -> getOperand ( <NUM_LIT> ) . getImm ( ) ;

return LPAC :: encode<ISA_LIT>AluCode ( AluCode ) == LPAC :: ADD && ( MI -> getOperand ( <NUM_LIT> ) . getImm ( ) == AddOffset || MI -> getOperand ( <NUM_LIT> ) . getImm ( ) == - AddOffset ) ;


<s> while ( Instruction != MBB . begin ( ) ) { -- Instruction ; if ( Instruction -> isDebugInstr ( ) ) continue ; if ( ! isUnpredicatedTerminator ( * Instruction ) ) break ; if ( ! Instruction -> isBranch ( ) ) return true ; if ( Instruction -> getOpcode ( ) == <STR_LIT> ) { if ( ! AllowModify ) { TrueBlock = Instruction -> getOperand ( <NUM_LIT> ) . getMBB ( ) ; continue ; } while ( std :: next ( Instruction ) != MBB . end ( ) ) { std :: next ( Instruction ) -> eraseFromParent ( ) ; } Condition . clear ( ) ; FalseBlock = nullptr ; if ( MBB . isLayoutSuccessor ( Instruction -> getOperand ( <NUM_LIT> ) . getMBB ( ) ) ) { TrueBlock = nullptr ; Instruction -> eraseFromParent ( ) ;


<s> bool <ISA_LIT>InstrInfo :: analyzeBranch ( MachineBasicBlock & MBB , MachineBasicBlock * & TrueBlock , MachineBasicBlock * & FalseBlock , SmallVectorImpl < MachineOperand > & Condition , bool AllowModify ) const { MachineBasicBlock :: iterator Instruction = MBB . end ( ) ; while ( Instruction != MBB . begin ( ) ) { -- Instruction ; if ( Instruction -> isDebugInstr ( ) ) continue ; if ( ! isUnpredicatedTerminator ( * Instruction ) ) break ; if ( ! Instruction -> isBranch ( ) ) return true ; if ( Instruction -> getOpcode ( ) == <STR_LIT> ) { if ( ! AllowModify ) { TrueBlock = Instruction -> getOperand ( <NUM_LIT> ) . getMBB ( ) ; continue ; } while ( std :: next ( Instruction ) != MBB . end ( ) ) { std :: next ( Instruction ) -> eraseFromParent ( ) ; } Condition . clear ( ) ; FalseBlock = nullptr ; if ( MBB . isLayoutSuccessor ( Instruction -> getOperand ( <NUM_LIT> ) . getMBB ( ) ) ) { TrueBlock = nullptr ; Instruction -> eraseFromParent ( ) ; Instruction = MBB . end ( ) ; continue ; } TrueBlock = Instruction -> getOperand ( <NUM_LIT> ) . getMBB ( ) ;


<s> CmpMask = ~ <NUM_LIT> ; CmpValue = MI . getOperand ( <NUM_LIT> ) . getImm ( ) ; return true ; case <STR_LIT> : SrcReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; SrcReg2 = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; CmpMask = ~ <NUM_LIT> ; CmpValue = <NUM_LIT> ; return true ; }


<s> FalseOp = <NUM_LIT> ; Cond . push_back ( MI . getOperand ( <NUM_LIT> ) ) ; Optimizable = true ; return false ;


<s> if ( MIa . hasUnmodeledSideEffects ( ) || MIb . hasUnmodeledSideEffects ( ) || MIa . hasOrderedMemoryRef ( ) || MIb . hasOrderedMemoryRef ( ) ) return false ; const TargetRegisterInfo * TRI = & getRegisterInfo ( ) ; MachineOperand * BaseOpA = nullptr , * BaseOpB = nullptr ; int64_t OffsetA = <NUM_LIT> , OffsetB = <NUM_LIT> ; unsigned int WidthA = <NUM_LIT> , WidthB = <NUM_LIT> ; if ( getMemOperandWithOffsetWidth ( MIa , BaseOpA , OffsetA , WidthA , TRI ) && getMemOperandWithOffsetWidth ( MIb , BaseOpB , OffsetB , WidthB , TRI ) ) { if ( BaseOpA -> isIdenticalTo ( * BaseOpB ) ) { int LowOffset = std :: min ( OffsetA , OffsetB ) ; int HighOffset = std :: max ( OffsetA , OffsetB ) ;

int LowWidth = ( LowOffset == OffsetA ) ? WidthA : WidthB ;


<s> const MachineOperand & MO = MI -> getOperand ( i ) ; if ( MO . isFI ( ) || MO . isCPI ( ) || MO . isJTI ( ) ) return nullptr ; if ( ! MO . isReg ( ) ) continue ; if ( MO . isTied ( ) ) return nullptr ; if ( TargetRegisterInfo :: isPhysicalRegister ( MO . getReg ( ) ) ) return nullptr ;

if ( MO . isDef ( ) && ! MO . isDead ( ) ) return nullptr ;


<s> BuildMI ( MBB , Position , DL , get ( <STR_LIT> ) , DestinationRegister ) . addReg ( SourceRegister , getKillRegState ( KillSource ) ) . addImm ( <NUM_LIT> ) ;


<s> void <ISA_LIT>InstrInfo :: copyPhysReg ( MachineBasicBlock & MBB , MachineBasicBlock :: iterator Position , const DebugLoc & DL , unsigned DestinationRegister , unsigned SourceRegister , bool KillSource ) const { if ( ! <STR_LIT> . contains ( DestinationRegister , SourceRegister ) ) { llvm_unreachable ( <STR_LIT> ) ; } BuildMI ( MBB , Position , DL , get ( <STR_LIT> ) , DestinationRegister ) . addReg ( SourceRegister , getKillRegState ( KillSource ) ) . addImm ( <NUM_LIT> ) ;


<s> return std :: make_pair ( TF , <NUM_LIT> ) ;


<s> bool <ISA_LIT>InstrInfo :: expandPostRAPseudo ( MachineInstr & ) const { return false ;


<s> case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; case <STR_LIT> : return <STR_LIT> ; default : return <STR_LIT> ; }


<s> bool <ISA_LIT>InstrInfo :: getMemOperandWithOffset ( MachineInstr & LdSt , MachineOperand * & BaseOp , int64_t & Offset , const TargetRegisterInfo * TRI ) const { switch ( LdSt . getOpcode ( ) ) { default : return false ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> :


<s> return false ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : Width = <NUM_LIT> ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : Width = <NUM_LIT> ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : Width = <NUM_LIT> ; break ; } BaseOp = & LdSt . getOperand ( <NUM_LIT> ) ; Offset = LdSt . getOperand ( <NUM_LIT> ) . getImm ( ) ;

assert ( BaseOp -> isReg ( ) && <STR_LIT> <STR_LIT> ) ;


<s> return LPCC :: ICC_VC ; case LPCC :: ICC_PL : return LPCC :: ICC_MI ; case LPCC :: ICC_MI : return LPCC :: ICC_PL ; case LPCC :: ICC_GE : return LPCC :: ICC_LT ; case LPCC :: ICC_LT : return LPCC :: ICC_GE ; case LPCC :: ICC_GT : return LPCC :: ICC_LE ; case LPCC :: ICC_LE :


<s> using namespace <ISA_LIT>II ; static const std :: pair < unsigned , const char * > TargetFlags [ ] = {

{ MO_ABS_HI , <STR_LIT> } , { MO_ABS_LO , <STR_LIT> } , { MO_NO_FLAG , <STR_LIT> } } ;


<s> static const std :: pair < unsigned , const char * > TargetFlags [ ] = {


<s> return <NUM_LIT> ; } assert ( ( Condition . size ( ) == <NUM_LIT> ) && <STR_LIT> ) ; unsigned ConditionalCode = Condition [ <NUM_LIT> ] . getImm ( ) ; BuildMI ( & MBB , DL , get ( <STR_LIT> ) ) . addMBB ( TrueBlock ) . addImm ( ConditionalCode ) ;


<s> assert ( TrueBlock && <STR_LIT> ) ; assert ( ! BytesAdded && <STR_LIT> ) ; if ( Condition . empty ( ) ) { assert ( ! FalseBlock && <STR_LIT> ) ; BuildMI ( & MBB , DL , get ( <STR_LIT> ) ) . addMBB ( TrueBlock ) ; return <NUM_LIT> ; } assert ( ( Condition . size ( ) == <NUM_LIT> ) && <STR_LIT> ) ;

unsigned ConditionalCode = Condition [ <NUM_LIT> ] . getImm ( ) ;


<s> if ( MI . getOpcode ( ) == <STR_LIT> ) if ( MI . getOperand ( <NUM_LIT> ) . isFI ( ) && MI . getOperand ( <NUM_LIT> ) . isImm ( ) && MI . getOperand ( <NUM_LIT> ) . getImm ( ) == <NUM_LIT> ) {

FrameIndex = MI . getOperand ( <NUM_LIT> ) . getIndex ( ) ;