<s> inline bool isProgramMemoryAccess ( MemSDNode const * N ) { auto V = N -> getMemOperand ( ) -> getValue ( ) ;

return ( V != nullptr ) ? isProgramMemoryAddress ( V ) : false ;


<s> return ( V != nullptr ) ? isProgramMemoryAddress ( V ) : false ;


<s> bool isProgramMemoryAddress ( T * V ) {

return cast < PointerType > ( V -> getType ( ) ) -> getAddressSpace ( ) == ProgramMemory ;


<s> adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value &= <NUM_LIT> ; break ; case <STR_LIT> : Value >>= <NUM_LIT> ; adjust :: unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value &= <NUM_LIT> ; break ; case <STR_LIT> : adjust :: fixup_6 ( Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: fixup_6_adiw ( Fixup , Value , Ctx ) ; break ; case <STR_LIT> :

adjust :: fixup_port5 ( Fixup , Value , Ctx ) ;


<s> static void adjustRelativeBranch ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {

signed_width ( Size + <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ;


<s> static void adjustRelativeBranch ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { signed_width ( Size + <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; <STR_LIT> :: adjustBranchTarget ( Value ) ;


<s> static void fixup_6 ( const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {

unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ;


<s> Value = ( ( Value & <NUM_LIT> ) << <NUM_LIT> ) | ( ( Value & <NUM_LIT> ) << <NUM_LIT> ) | ( Value & <NUM_LIT> ) ;


<s> assert ( ( Count % <NUM_LIT> ) == <NUM_LIT> && <STR_LIT> ) ;


<s> break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value &= <NUM_LIT> ; break ;


return Infos [ Kind - FirstTargetFixupKind ] ;


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


<s> adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ;


<s> void adjustBranch ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { unsigned_width ( Size + <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; <STR_LIT> :: adjustBranchTarget ( Value ) ;


<s> switch ( Kind ) { default : llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : adjust :: fixup_7_pcrel ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: fixup_13_pcrel ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: fixup_call ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ;


<s> void adjustRelativeBranch ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { signed_width ( Size + <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value -= <NUM_LIT> ; <STR_LIT> :: adjustBranchTarget ( Value ) ;


<s> auto NumBytes = ( NumBits / <NUM_LIT> ) + ( ( NumBits % <NUM_LIT> ) == <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= Data . size ( ) && <STR_LIT> ) ;

for ( unsigned i = <NUM_LIT> ; i < NumBytes ; ++ i ) {


<s> <ISA_LIT>AsmBackend ( Triple :: OSType OSType ) : MCAsmBackend ( ) , OSType ( OSType ) {


<s> std :: unique_ptr < MCObjectWriter > <ISA_LIT>AsmBackend :: createObjectWriter ( raw_pwrite_stream & OS ) const {

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


<s> uint64_t lower = Value & <NUM_LIT> ;

Value = ( upper << <NUM_LIT> ) | lower ;


<s> void fixup_13_pcrel ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { adjustRelativeBranch ( Size , Fixup , Value , Ctx ) ; Value &= <NUM_LIT> ;


<s> void fixup_6_adiw ( const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value = ( ( Value & <NUM_LIT> ) << <NUM_LIT> ) | ( Value & <NUM_LIT> ) ;


<s> void fixup_7_pcrel ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {

adjustRelativeBranch ( Size , Fixup , Value , Ctx ) ;


<s> void fixup_7_pcrel ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { adjustRelativeBranch ( Size , Fixup , Value , Ctx ) ; Value &= <NUM_LIT> ;


<s> auto top = Value & ( <NUM_LIT> << <NUM_LIT> ) ; auto middle = Value & ( <NUM_LIT> << <NUM_LIT> ) ; auto bottom = Value & <NUM_LIT> ; Value = ( top << <NUM_LIT> ) | ( middle << <NUM_LIT> ) | ( bottom << <NUM_LIT> ) ;


Value = ( top << <NUM_LIT> ) | ( middle << <NUM_LIT> ) | ( bottom << <NUM_LIT> ) ;


<s> unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value &= <NUM_LIT> ;


<s> unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value = ( ( Value & <NUM_LIT> ) << <NUM_LIT> ) | ( Value & <NUM_LIT> ) ;


<s> void hh8 ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { Value = ( Value & <NUM_LIT> ) >> <NUM_LIT> ; <STR_LIT> ( Size , Fixup , Value , Ctx ) ;


<s> Value = ( Value & <NUM_LIT> ) >> <NUM_LIT> ; <STR_LIT> ( Size , Fixup , Value , Ctx ) ;


<STR_LIT> ( Size , Fixup , Value , Ctx ) ;


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


<s> void ms8 ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {

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


<s> void neg ( uint64_t & Value ) { Value *= - <NUM_LIT> ;


<s> Diagnostic += <STR_LIT> + std :: to_string ( Min ) + <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportFatalError ( Fixup . getLoc ( ) , Diagnostic ) ; } else { llvm_unreachable ( Diagnostic . c_str ( ) ) ; }


<s> std :: string Diagnostic = <STR_LIT> + Description ; int64_t Max = maxUIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportFatalError ( Fixup . getLoc ( ) , Diagnostic ) ; } else { llvm_unreachable ( Diagnostic . c_str ( ) ) ; } }


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( uint64_t Count , MCObjectWriter * OW ) const { assert ( ( Count % <NUM_LIT> ) == <NUM_LIT> && <STR_LIT> ) ; OW -> WriteZeros ( Count ) ; return true ;


<s> bool <ISA_LIT>AsmBackend :: writeNopData ( uint64_t Count , MCObjectWriter * OW ) const { assert ( ( Count % <NUM_LIT> ) == <NUM_LIT> && <STR_LIT> ) ; OW -> WriteZeros ( Count ) ;


<s> case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ;


<s> auto NumBytes = ( NumBits / <NUM_LIT> ) + ( ( NumBits % <NUM_LIT> ) == <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= DataSize && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i < NumBytes ; ++ i ) { uint8_t mask = ( ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ) ; Data [ Offset + i ] |= mask ; }


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : IsResolved = false ; break ; default :

if ( Target . getSymA ( ) -> getSymbol ( ) . isTemporary ( ) ) Value += <NUM_LIT> ;


<s> std :: string Diagnostic = <STR_LIT> + Description ; int64_t Min = minIntN ( Width ) ; int64_t Max = maxIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Min ) + <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportError ( Fixup . getLoc ( ) , Diagnostic ) ; } else {

llvm_unreachable ( Diagnostic . c_str ( ) ) ;


<s> if ( ! isUIntN ( Width , Value ) ) { std :: string Diagnostic = <STR_LIT> + Description ; int64_t Max = maxUIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportError ( Fixup . getLoc ( ) , Diagnostic ) ; } else { llvm_unreachable ( Diagnostic . c_str ( ) ) ; } }


<s> auto NumBits = Info . TargetSize + Info . TargetOffset ; auto NumBytes = ( NumBits / <NUM_LIT> ) + ( ( NumBits % <NUM_LIT> ) == <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= DataSize && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i < NumBytes ; ++ i ) { uint8_t mask = ( ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ) ; Data [ Offset + i ] |= mask ;


<s> static void adjustBranch ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {

unsigned_width ( Size + <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ;


<s> adjust :: fixup_13_pcrel ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: fixup_call ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( Kind == <STR_LIT> ) adjust :: pm ( Value ) ; adjust :: <STR_LIT> ( Value ) ; adjust :: <STR_LIT> ( Size , Fixup , Value , Ctx ) ; break ;


<s> MCFixupKindInfo Info = getFixupKindInfo ( Fixup . getKind ( ) ) ; auto NumBits = Info . TargetSize + Info . TargetOffset ; auto NumBytes = ( NumBits / <NUM_LIT> ) + ( ( NumBits % <NUM_LIT> ) == <NUM_LIT> ? <NUM_LIT> : <NUM_LIT> ) ; Value <<= Info . TargetOffset ; unsigned Offset = Fixup . getOffset ( ) ; assert ( Offset + NumBytes <= Data . size ( ) && <STR_LIT> ) ; for ( unsigned i = <NUM_LIT> ; i < NumBytes ; ++ i ) { uint8_t mask = ( ( ( Value >> ( i * <NUM_LIT> ) ) & <NUM_LIT> ) ) ; Data [ Offset + i ] |= mask ;


<s> <ISA_LIT>AsmBackend ( Triple :: OSType OSType ) : MCAsmBackend ( <STR_LIT> ) , OSType ( OSType ) {


<s> return new <ISA_LIT>AsmBackend ( STI . getTargetTriple ( ) . getOS ( ) ) ;


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


<s> uint64_t lower = Value & <NUM_LIT> ; Value = ( upper << <NUM_LIT> ) | lower ;


<s> uint64_t upper = Value & <NUM_LIT> ; uint64_t lower = Value & <NUM_LIT> ; Value = ( upper << <NUM_LIT> ) | lower ;


<s> bool fixupNeedsRelaxation ( const MCFixup & Fixup , uint64_t Value , const MCRelaxableFragment * DF , const MCAsmLayout & Layout ) const override { llvm_unreachable ( <STR_LIT> ) ; return false ;


<s> adjustRelativeBranch ( Size , Fixup , Value , Ctx ) ;


<s> static void fixup_7_pcrel ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { adjustRelativeBranch ( Size , Fixup , Value , Ctx ) ; Value &= <NUM_LIT> ;


<s> auto top = Value & ( <NUM_LIT> << <NUM_LIT> ) ; auto middle = Value & ( <NUM_LIT> << <NUM_LIT> ) ;


<s> static void fixup_port5 ( const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { unsigned_width ( <NUM_LIT> , Value , std :: string ( <STR_LIT> ) , Fixup , Ctx ) ; Value &= <NUM_LIT> ;


<s> static void fixup_port6 ( const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {


if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo ( Kind ) ;


<s> Value = ( Value & <NUM_LIT> ) >> <NUM_LIT> ;


<s> static void hi8 ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) {


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


<s> static void ms8 ( unsigned Size , const MCFixup & Fixup , uint64_t & Value , MCContext * Ctx = nullptr ) { Value = ( Value & <NUM_LIT> ) >> <NUM_LIT> ;


<s> static void pm ( uint64_t & Value ) {


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


<s> static void signed_width ( unsigned Width , uint64_t Value , std :: string Description , const MCFixup & Fixup , MCContext * Ctx = nullptr ) { if ( ! isIntN ( Width , Value ) ) { std :: string Diagnostic = <STR_LIT> + Description ; int64_t Min = minIntN ( Width ) ; int64_t Max = maxIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Min ) + <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportFatalError ( Fixup . getLoc ( ) , Diagnostic ) ; } else { llvm_unreachable ( Diagnostic . c_str ( ) ) ;


<s> std :: string Diagnostic = <STR_LIT> + Description ; int64_t Min = minIntN ( Width ) ; int64_t Max = maxIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Min ) + <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportFatalError ( Fixup . getLoc ( ) , Diagnostic ) ; } else {


<s> int64_t Max = maxUIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ; if ( Ctx ) { Ctx -> reportFatalError ( Fixup . getLoc ( ) , Diagnostic ) ; } else { llvm_unreachable ( Diagnostic . c_str ( ) ) ; } }


<s> static void unsigned_width ( unsigned Width , uint64_t Value , std :: string Description , const MCFixup & Fixup , MCContext * Ctx = nullptr ) { if ( ! isUIntN ( Width , Value ) ) { std :: string Diagnostic = <STR_LIT> + Description ; int64_t Max = maxUIntN ( Width ) ; Diagnostic += <STR_LIT> + std :: to_string ( Max ) + <STR_LIT> ;


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

const auto * CE = cast < MCConstantExpr > ( getImm ( ) ) ;


<s> assert ( ( Kind == k_Register || Kind == k_Memri ) && <STR_LIT> ) ; return RegImm . Reg ;


<s> bool isImm ( ) const override { return Kind == k_Immediate ;


<s> if ( ! isImm ( ) ) return false ; const auto * CE = dyn_cast < MCConstantExpr > ( getImm ( ) ) ;


<s> bool isImmCom8 ( ) const { if ( ! isImm ( ) ) return false ; const auto * CE = dyn_cast < MCConstantExpr > ( getImm ( ) ) ; if ( ! CE ) return false ; int64_t Value = CE -> getValue ( ) ;


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


<s> void print ( raw_ostream & O ) const override { switch ( Kind ) { case k_Token : O << <STR_LIT> << getToken ( ) << <STR_LIT> ; break ; case k_Register : O << <STR_LIT> << getReg ( ) ; break ; case k_Immediate :

O << <STR_LIT> << * getImm ( ) << <STR_LIT> ;


<s> LLVM_FALLTHROUGH ; case AsmToken :: LParen : case AsmToken :: Integer : case AsmToken :: Dot : return tryParseExpression ( Operands ) ; case AsmToken :: Plus : case AsmToken :: Minus : { switch ( getLexer ( ) . peekTok ( ) . getKind ( ) ) { case AsmToken :: Integer : case AsmToken :: BigNum : case AsmToken :: Identifier :


<s> bool <ISA_LIT>AsmParser :: parseOperand ( OperandVector & Operands ) { DEBUG ( dbgs ( ) << <STR_LIT> ) ; switch ( getLexer ( ) . getKind ( ) ) { default : return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; case AsmToken :: Identifier : if ( ! tryParseRegisterOperand ( Operands ) ) { return false ; } LLVM_FALLTHROUGH ; case AsmToken :: LParen :


<s> } StringRef ModifierName = Parser . getTok ( ) . getString ( ) ; ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( ModifierName ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { Parser . Lex ( ) ; Parser . Lex ( ) ; if ( Parser . getTok ( ) . getString ( ) == GENERATE_STUBS && Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier ) { std :: string GSModName = ModifierName . str ( ) + <STR_LIT> + GENERATE_STUBS ; ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( GSModName ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) Parser . Lex ( ) ; } } else { return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } if ( tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus || tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Plus ) { Parser . Lex ( ) ; assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: LParen ) ; Parser . Lex ( ) ; } MCExpr const * InnerExpression ; if ( getParser ( ) . parseExpression ( InnerExpression ) ) return true ; if ( tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus || tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Plus ) { assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: RParen ) ; Parser . Lex ( ) ; } assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: RParen ) ; Parser . Lex ( ) ; MCExpr const * Expression = <ISA_LIT>MCExpr :: create ( ModifierKind , InnerExpression , isNegated , getContext ( ) ) ; SMLoc E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; Operands . push_back ( <STR_LIT> ( Expression , S , E ) ) ;


<s> std :: ostringstream RegName ; RegName << <STR_LIT> << RegNum ; RegNum = MatchRegisterName ( RegName . str ( ) ) ; if ( RegNum != <STR_LIT> ) { Op . makeReg ( RegNum ) ; if ( validateOperandClass ( Op , Expected ) == Match_Success ) { return Match_Success ; } } } } if ( Op . isReg ( ) ) { if ( isSubclass ( Expected , MCK_DREGS ) ) { unsigned correspondingDREG = toDREG ( Op . getReg ( ) ) ; if ( correspondingDREG != <STR_LIT> ) { Op . makeReg ( correspondingDREG ) ; return validateOperandClass ( Op , Expected ) ; } }


<s> if ( ReadCount == <NUM_LIT> && Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier && Tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus && Tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Identifier ) { MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( <STR_LIT> ) ; <ISA_LIT>Streamer . EmitValueForModiferKind ( Symbol , SizeInBytes , L , <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ; return false ; } if ( Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier && Parser . getLexer ( ) . peekTok ( ) . getKind ( ) == AsmToken :: LParen ) { StringRef ModifierName = Parser . getTok ( ) . getString ( ) ; <ISA_LIT>MCExpr :: VariantKind ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( ModifierName . str ( ) . c_str ( ) ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { Parser . Lex ( ) ; Parser . Lex ( ) ; } else { return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( Parser . getTok ( ) . getString ( ) ) ; <ISA_LIT>Streamer . EmitValueForModiferKind ( Symbol , SizeInBytes , L , ModifierKind ) ; return false ; } auto parseOne = [ & ] ( ) -> bool { const MCExpr * Value ; if ( Parser . parseExpression ( Value ) ) return true ; Parser . getStreamer ( ) . EmitValue ( Value , SizeInBytes , L ) ; return false ; } ;


<s> StringRef ModifierName = Parser . getTok ( ) . getString ( ) ; <ISA_LIT>MCExpr :: VariantKind ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( ModifierName . str ( ) . c_str ( ) ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { Parser . Lex ( ) ; Parser . Lex ( ) ; } else { return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( Parser . getTok ( ) . getString ( ) ) ; <ISA_LIT>Streamer . EmitValueForModiferKind ( Symbol , SizeInBytes , L , ModifierKind ) ; return false ; } auto parseOne = [ & ] ( ) -> bool {


<s> <ISA_LIT>Operand ( unsigned Reg , MCExpr const * Imm , SMLoc const & S , SMLoc const & E ) : Kind ( k_Memri ) , RegImm ( {


<s> SMLoc ErrorLoc = Loc ; char const * Diag = nullptr ; if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) { Diag = <STR_LIT> ; } else { <ISA_LIT>Operand const & Op = ( <ISA_LIT>Operand const & ) * Operands [ ErrorInfo ] ;

if ( Op . getStartLoc ( ) != SMLoc ( ) ) {


<s> if ( ErrorInfo != ~ <NUM_LIT> ) { if ( ErrorInfo >= Operands . size ( ) ) { Diag = <STR_LIT> ; } else { <ISA_LIT>Operand const & Op = ( <ISA_LIT>Operand const & ) * Operands [ ErrorInfo ] ;


<s> MCAsmParserExtension :: Initialize ( Parser ) ; MRI = getContext ( ) . getRegisterInfo ( ) ;

setAvailableFeatures ( ComputeAvailableFeatures ( STI . getFeatureBits ( ) ) ) ;


<s> MRI = getContext ( ) . getRegisterInfo ( ) ; setAvailableFeatures ( ComputeAvailableFeatures ( STI . getFeatureBits ( ) ) ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateImm ( const MCExpr * Val , SMLoc S , SMLoc E ) { return make_unique < <ISA_LIT>Operand > ( Val , S , E ) ;


<s> return make_unique < <ISA_LIT>Operand > ( RegNum , Val , S , E ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateMemri ( unsigned RegNum , const MCExpr * Val , SMLoc S , SMLoc E ) {

return make_unique < <ISA_LIT>Operand > ( RegNum , Val , S , E ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateToken ( StringRef Str , SMLoc S ) {

return make_unique < <ISA_LIT>Operand > ( Str , S ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateToken ( StringRef Str , SMLoc S ) { return make_unique < <ISA_LIT>Operand > ( Str , S ) ;


<s> Out . EmitInstruction ( Inst , STI ) ; return false ;


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


<s> bool <ISA_LIT>AsmParser :: ParseDirective ( llvm :: AsmToken DirectiveID ) { return true ;


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseMemriOperand ( OperandVector & Operands ) { DEBUG ( dbgs ( ) << <STR_LIT> ) ; SMLoc E , S ; MCExpr const * Expression ; int RegNo ; { RegNo = parseRegister ( ) ; if ( RegNo == <STR_LIT> ) return MatchOperand_ParseFail ; S = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; Parser . Lex ( ) ; }


<s> DEBUG ( dbgs ( ) << <STR_LIT> ) ; SMLoc E , S ; MCExpr const * Expression ; int RegNo ; { RegNo = parseRegister ( ) ; if ( RegNo == <STR_LIT> ) return MatchOperand_ParseFail ; S = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; Parser . Lex ( ) ; } { if ( getParser ( ) . parseExpression ( Expression ) ) return MatchOperand_ParseFail ; E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; }

Operands . push_back ( <STR_LIT> ( RegNo , Expression , S , E ) ) ;


EndLoc = Parser . getTok ( ) . getLoc ( ) ;


<s> StartLoc = Parser . getTok ( ) . getLoc ( ) ; RegNo = parseRegister ( ) ; EndLoc = Parser . getTok ( ) . getLoc ( ) ; return ( RegNo == <STR_LIT> ) ;


<s> return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } MCExpr const * InnerExpression ; if ( getParser ( ) . parseExpression ( InnerExpression ) ) return true ; assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: RParen ) ; Parser . Lex ( ) ; MCExpr const * Expression = <ISA_LIT>MCExpr :: create ( ModifierKind , InnerExpression , isNegated , getContext ( ) ) ; SMLoc E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; Operands . push_back ( <STR_LIT> ( Expression , S , E ) ) ;


<s> unsigned MatchResult = MatchInstructionImpl ( Operands , Inst , ErrorInfo , MatchingInlineAsm ) ; switch ( MatchResult ) { case Match_Success : return emit ( Inst , Loc , Out ) ; case Match_MissingFeature : return missingFeature ( Loc , ErrorInfo ) ; case Match_InvalidOperand : return invalidOperand ( Loc , Operands , ErrorInfo ) ; case Match_MnemonicFail :


<s> AsmToken const & T = Parser . getTok ( ) ; Operands . push_back ( <STR_LIT> ( RegNo , T . getLoc ( ) , T . getEndLoc ( ) ) ) ; Parser . Lex ( ) ; return false ;


<s> default : return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; case AsmToken :: Identifier : if ( ! tryParseRegisterOperand ( Operands ) ) { return false ; } LLVM_FALLTHROUGH ; case AsmToken :: LParen : case AsmToken :: Integer : case AsmToken :: Dot : return tryParseExpression ( Operands ) ; case AsmToken :: Plus : case AsmToken :: Minus : { switch ( getLexer ( ) . peekTok ( ) . getKind ( ) ) { case AsmToken :: Integer : case AsmToken :: BigNum : case AsmToken :: Identifier :


<s> return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; case AsmToken :: Identifier : if ( ! tryParseRegisterOperand ( Operands ) ) { return false ; } LLVM_FALLTHROUGH ; case AsmToken :: LParen : case AsmToken :: Integer : case AsmToken :: Dot : return tryParseExpression ( Operands ) ; case AsmToken :: Plus : case AsmToken :: Minus : { switch ( getLexer ( ) . peekTok ( ) . getKind ( ) ) { case AsmToken :: Integer : case AsmToken :: BigNum : case AsmToken :: Identifier : case AsmToken :: Real : if ( ! tryParseExpression ( Operands ) ) return false ; default : break ; }

Operands . push_back ( <STR_LIT> ( Parser . getTok ( ) . getString ( ) , Parser . getTok ( ) . getLoc ( ) ) ) ;


<s> void addExpr ( MCInst & Inst , const MCExpr * Expr ) const { if ( ! Expr ) Inst . addOperand ( MCOperand :: createImm ( <NUM_LIT> ) ) ;

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


<s> const MCConstantExpr * CE = dyn_cast < MCConstantExpr > ( getImm ( ) ) ; Inst . addOperand ( MCOperand :: createImm ( ~ ( uint8_t ) CE -> getValue ( ) ) ) ;


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


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


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


<s> MCAsmParserExtension :: Initialize ( Parser ) ; MRI = getContext ( ) . getRegisterInfo ( ) ; setAvailableFeatures ( ComputeAvailableFeatures ( STI . getFeatureBits ( ) ) ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateImm ( const MCExpr * Val , SMLoc S , SMLoc E ) {

return std :: make_unique < <ISA_LIT>Operand > ( Val , S , E ) ;


<s> return std :: make_unique < <ISA_LIT>Operand > ( Val , S , E ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateMemri ( unsigned RegNum , const MCExpr * Val , SMLoc S , SMLoc E ) {

return std :: make_unique < <ISA_LIT>Operand > ( RegNum , Val , S , E ) ;


<s> return std :: make_unique < <ISA_LIT>Operand > ( RegNum , S , E ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateReg ( unsigned RegNum , SMLoc S , SMLoc E ) { return std :: make_unique < <ISA_LIT>Operand > ( RegNum , S , E ) ;


<s> return std :: make_unique < <ISA_LIT>Operand > ( Str , S ) ;


<s> static std :: unique_ptr < <ISA_LIT>Operand > CreateToken ( StringRef Str , SMLoc S ) { return std :: make_unique < <ISA_LIT>Operand > ( Str , S ) ;


<s> void <ISA_LIT>AsmParser :: eatComma ( ) {

if ( getLexer ( ) . is ( AsmToken :: Comma ) ) {


<s> Inst . setLoc ( Loc ) ; Out . emitInstruction ( Inst , STI ) ; return false ;


<s> SMLoc getEndLoc ( ) const { return End ;


<s> const MCExpr * getImm ( ) const { assert ( ( Kind == k_Immediate || Kind == k_Memri ) && <STR_LIT> ) ; return RegImm . Imm ;


<s> unsigned getReg ( ) const { assert ( ( Kind == k_Register || Kind == k_Memri ) && <STR_LIT> ) ;


<s> SMLoc getStartLoc ( ) const { return Start ;


<s> StringRef getToken ( ) const { assert ( Kind == k_Token && <STR_LIT> ) ; return Tok ;


<s> StringRef getToken ( ) const { assert ( Kind == k_Token && <STR_LIT> ) ;


<s> bool isImm ( ) const { return Kind == k_Immediate ;


<s> const MCConstantExpr * CE = dyn_cast < MCConstantExpr > ( getImm ( ) ) ;


<s> const MCConstantExpr * CE = dyn_cast < MCConstantExpr > ( getImm ( ) ) ; if ( ! CE ) return false ; int64_t Value = CE -> getValue ( ) ; return isUInt < <NUM_LIT> > ( Value ) ;


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


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


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

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


<s> void makeToken ( StringRef Token ) { Kind = k_Token ; Tok = Token ;


<s> MCInst Inst ; unsigned MatchResult = MatchInstructionImpl ( Operands , Inst , ErrorInfo , MatchingInlineAsm ) ; switch ( MatchResult ) { case Match_Success : return emit ( Inst , Loc , Out ) ; case Match_MissingFeature : return missingFeature ( Loc , ErrorInfo ) ; case Match_InvalidOperand : return invalidOperand ( Loc , Operands , ErrorInfo ) ; case Match_MnemonicFail : return Error ( Loc , <STR_LIT> ) ;


<s> bool <ISA_LIT>AsmParser :: missingFeature ( llvm :: SMLoc const & Loc , uint64_t const & ErrorInfo ) {


<s> parseLiteralValues ( SIZE_LONG , DirectiveID . getLoc ( ) ) ;

} else if ( IDVal . lower ( ) == <STR_LIT> || IDVal . lower ( ) == <STR_LIT> ) {


<s> parseLiteralValues ( SIZE_LONG , DirectiveID . getLoc ( ) ) ; } else if ( IDVal . lower ( ) == <STR_LIT> || IDVal . lower ( ) == <STR_LIT> ) { parseLiteralValues ( SIZE_WORD , DirectiveID . getLoc ( ) ) ;

} else if ( IDVal . lower ( ) == <STR_LIT> ) {


<s> auto MatchResult = MatchOperandParserImpl ( Operands , Mnemonic ) ; if ( MatchResult == MatchOperand_Success ) { continue ; } if ( MatchResult == MatchOperand_ParseFail ) { SMLoc Loc = getLexer ( ) . getLoc ( ) ; Parser . eatToEndOfStatement ( ) ; return Error ( Loc , <STR_LIT> ) ; } if ( parseOperand ( Operands ) ) { SMLoc Loc = getLexer ( ) . getLoc ( ) ; Parser . eatToEndOfStatement ( ) ; return Error ( Loc , <STR_LIT> ) ;


<s> continue ; } if ( MatchResult == MatchOperand_ParseFail ) { SMLoc Loc = getLexer ( ) . getLoc ( ) ; Parser . eatToEndOfStatement ( ) ; return Error ( Loc , <STR_LIT> ) ; } if ( parseOperand ( Operands ) ) { SMLoc Loc = getLexer ( ) . getLoc ( ) ; Parser . eatToEndOfStatement ( ) ; return Error ( Loc , <STR_LIT> ) ; } } Parser . Lex ( ) ; return false ;


<s> if ( Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier && Parser . getLexer ( ) . peekTok ( ) . getKind ( ) == AsmToken :: LParen ) { StringRef ModifierName = Parser . getTok ( ) . getString ( ) ; <ISA_LIT>MCExpr :: VariantKind ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( ModifierName . str ( ) . c_str ( ) ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { Parser . Lex ( ) ; Parser . Lex ( ) ; } else { return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( Parser . getTok ( ) . getString ( ) ) ; <ISA_LIT>Streamer . emitValueForModiferKind ( Symbol , SizeInBytes , L , ModifierKind ) ; return false ; } auto parseOne = [ & ] ( ) -> bool { const MCExpr * Value ; if ( Parser . parseExpression ( Value ) ) return true ; Parser . getStreamer ( ) . emitValue ( Value , SizeInBytes , L ) ; return false ; } ; return ( parseMany ( parseOne ) ) ;


<s> AsmToken Tokens [ <NUM_LIT> ] ; size_t ReadCount = Parser . getLexer ( ) . peekTokens ( Tokens ) ; if ( ReadCount == <NUM_LIT> && Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier && Tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus && Tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Identifier ) { MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( <STR_LIT> ) ; <ISA_LIT>Streamer . emitValueForModiferKind ( Symbol , SizeInBytes , L , <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) ; return false ; }

if ( Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier && Parser . getLexer ( ) . peekTok ( ) . getKind ( ) == AsmToken :: LParen ) {


<s> if ( getParser ( ) . parseExpression ( Expression ) ) return MatchOperand_ParseFail ; E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; }


<s> E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ; } Operands . push_back ( <STR_LIT> ( RegNo , Expression , S , E ) ) ; return MatchOperand_Success ;


<s> LLVM_DEBUG ( dbgs ( ) << <STR_LIT> ) ; switch ( getLexer ( ) . getKind ( ) ) { default : return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; case AsmToken :: Identifier : if ( ! tryParseRegisterOperand ( Operands ) ) { return false ; } LLVM_FALLTHROUGH ; case AsmToken :: LParen : case AsmToken :: Integer : case AsmToken :: Dot : return tryParseExpression ( Operands ) ; case AsmToken :: Plus : case AsmToken :: Minus : { switch ( getLexer ( ) . peekTok ( ) . getKind ( ) ) { case AsmToken :: Integer : case AsmToken :: BigNum : case AsmToken :: Identifier : case AsmToken :: Real : if ( ! tryParseExpression ( Operands ) ) return false ; break ; default : break ; } Operands . push_back ( <STR_LIT> ( Parser . getTok ( ) . getString ( ) , Parser . getTok ( ) . getLoc ( ) ) ) ;


<s> StartLoc = Parser . getTok ( ) . getLoc ( ) ; RegNo = parseRegister ( false ) ; EndLoc = Parser . getTok ( ) . getLoc ( ) ;


<s> RegNo = parseRegister ( false ) ; EndLoc = Parser . getTok ( ) . getLoc ( ) ; return ( RegNo == <STR_LIT> ) ;


<s> int <ISA_LIT>AsmParser :: parseRegisterName ( ) { int RegNum = parseRegisterName ( & MatchRegisterName ) ; if ( RegNum == <STR_LIT> ) RegNum = parseRegisterName ( & MatchRegisterAltName ) ;


<s> O << <STR_LIT> << getReg ( ) ; break ; case k_Immediate : O << <STR_LIT> << * getImm ( ) << <STR_LIT> ; break ; case k_Memri : { O << <STR_LIT> << getReg ( ) << '+' << * getImm ( ) << <STR_LIT> ; break ; }


<s> break ; case k_Register : O << <STR_LIT> << getReg ( ) ; break ; case k_Immediate : O << <STR_LIT> << * getImm ( ) << <STR_LIT> ; break ; case k_Memri : { O << <STR_LIT> << getReg ( ) << '+' << * getImm ( ) << <STR_LIT> ; break ;


<s> unsigned toDREG ( unsigned Reg , unsigned From = <STR_LIT> ) {

MCRegisterClass const * Class = & <ISA_LIT>MCRegisterClasses [ <STR_LIT> ] ;


<s> if ( getParser ( ) . parseExpression ( Expression ) ) return true ; SMLoc E = SMLoc :: getFromPointer ( Parser . getTok ( ) . getLoc ( ) . getPointer ( ) - <NUM_LIT> ) ;

Operands . push_back ( <STR_LIT> ( Expression , S , E ) ) ;


<s> SMLoc S = Parser . getTok ( ) . getLoc ( ) ; if ( ! tryParseRelocExpression ( Operands ) ) return false ; if ( ( Parser . getTok ( ) . getKind ( ) == AsmToken :: Plus || Parser . getTok ( ) . getKind ( ) == AsmToken :: Minus ) && Parser . getLexer ( ) . peekTok ( ) . getKind ( ) == AsmToken :: Identifier ) { return true ; } MCExpr const * Expression ;

if ( getParser ( ) . parseExpression ( Expression ) ) return true ;


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: tryParseRegister ( unsigned & RegNo , SMLoc & StartLoc , SMLoc & EndLoc ) { StartLoc = Parser . getTok ( ) . getLoc ( ) ; RegNo = parseRegister ( true ) ; EndLoc = Parser . getTok ( ) . getLoc ( ) ;

if ( RegNo == <STR_LIT> ) return MatchOperand_NoMatch ;


<s> if ( RegNo == <STR_LIT> ) return true ; AsmToken const & T = Parser . getTok ( ) ; Operands . push_back ( <STR_LIT> ( RegNo , T . getLoc ( ) , T . getEndLoc ( ) ) ) ; Parser . Lex ( ) ; return false ;


<s> isNegated = false ; } if ( CurTok == AsmToken :: Minus || CurTok == AsmToken :: Plus ) Parser . Lex ( ) ; } } if ( Parser . getTok ( ) . getKind ( ) != AsmToken :: Identifier || Parser . getLexer ( ) . peekTok ( ) . getKind ( ) != AsmToken :: LParen ) { return true ; } StringRef ModifierName = Parser . getTok ( ) . getString ( ) ; ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( ModifierName . str ( ) . c_str ( ) ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) { Parser . Lex ( ) ; Parser . Lex ( ) ; if ( Parser . getTok ( ) . getString ( ) == GENERATE_STUBS && Parser . getTok ( ) . getKind ( ) == AsmToken :: Identifier ) { std :: string GSModName = ModifierName . str ( ) + <STR_LIT> + GENERATE_STUBS ; ModifierKind = <ISA_LIT>MCExpr :: getKindByName ( GSModName . c_str ( ) ) ; if ( ModifierKind != <ISA_LIT>MCExpr :: VK_<ISA_LIT>_None ) Parser . Lex ( ) ; } } else { return Error ( Parser . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } if ( tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus || tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Plus ) { Parser . Lex ( ) ; assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: LParen ) ; Parser . Lex ( ) ; } MCExpr const * InnerExpression ; if ( getParser ( ) . parseExpression ( InnerExpression ) ) return true ; if ( tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Minus || tokens [ <NUM_LIT> ] . getKind ( ) == AsmToken :: Plus ) { assert ( Parser . getTok ( ) . getKind ( ) == AsmToken :: RParen ) ;


<s> MatchClassKind Expected = static_cast < MatchClassKind > ( ExpectedKind ) ; if ( Op . isImm ( ) ) { if ( MCConstantExpr const * Const = dyn_cast < MCConstantExpr > ( Op . getImm ( ) ) ) { int64_t RegNum = Const -> getValue ( ) ; std :: ostringstream RegName ; RegName << <STR_LIT> << RegNum ; RegNum = MatchRegisterName ( RegName . str ( ) . c_str ( ) ) ; if ( RegNum != <STR_LIT> ) { Op . makeReg ( RegNum ) ; if ( validateOperandClass ( Op , Expected ) == Match_Success ) { return Match_Success ; } } } } if ( Op . isReg ( ) ) { if ( isSubclass ( Expected , MCK_DREGS ) ) { unsigned correspondingDREG = toDREG ( Op . getReg ( ) ) ; if ( correspondingDREG != <STR_LIT> ) {


<s> bool Error = AsmPrinter :: PrintAsmOperand ( MI , OpNum , AsmVariant , ExtraCode , O ) ; if ( Error && ExtraCode && ExtraCode [ <NUM_LIT> ] ) { if ( ExtraCode [ <NUM_LIT> ] != <NUM_LIT> ) return true ; if ( ExtraCode [ <NUM_LIT> ] >= 'A' && ExtraCode [ <NUM_LIT> ] <= 'Z' ) { const MachineOperand & RegOp = MI -> getOperand ( OpNum ) ; assert ( RegOp . isReg ( ) && <STR_LIT> <STR_LIT> ) ; unsigned Reg = RegOp . getReg ( ) ; unsigned ByteNumber = ExtraCode [ <NUM_LIT> ] - 'A' ; unsigned OpFlags = MI -> getOperand ( OpNum - <NUM_LIT> ) . getImm ( ) ; unsigned NumOpRegs = InlineAsm :: getNumOperandRegisters ( OpFlags ) ; ( void ) NumOpRegs ; const <ISA_LIT>Subtarget & STI = MF -> getSubtarget < <ISA_LIT>Subtarget > ( ) ; const TargetRegisterInfo & TRI = * STI . getRegisterInfo ( ) ; unsigned BytesPerReg = TRI . getMinimalPhysRegClass ( Reg ) -> getSize ( ) ; assert ( BytesPerReg <= <NUM_LIT> && <STR_LIT> ) ; unsigned RegIdx = ByteNumber / BytesPerReg ; assert ( RegIdx < NumOpRegs && <STR_LIT> ) ; Reg = MI -> getOperand ( OpNum + RegIdx ) . getReg ( ) ; if ( BytesPerReg == <NUM_LIT> ) {

Reg = TRI . getSubReg ( Reg , ByteNumber % BytesPerReg ? <STR_LIT> : <STR_LIT> ) ;


<s> unsigned NumOpRegs = InlineAsm :: getNumOperandRegisters ( OpFlags ) ; ( void ) NumOpRegs ; const <ISA_LIT>Subtarget & STI = MF -> getSubtarget < <ISA_LIT>Subtarget > ( ) ; const TargetRegisterInfo & TRI = * STI . getRegisterInfo ( ) ; unsigned BytesPerReg = TRI . getMinimalPhysRegClass ( Reg ) -> getSize ( ) ; assert ( BytesPerReg <= <NUM_LIT> && <STR_LIT> ) ; unsigned RegIdx = ByteNumber / BytesPerReg ; assert ( RegIdx < NumOpRegs && <STR_LIT> ) ; Reg = MI -> getOperand ( OpNum + RegIdx ) . getReg ( ) ; if ( BytesPerReg == <NUM_LIT> ) { Reg = TRI . getSubReg ( Reg , ByteNumber % BytesPerReg ? <STR_LIT> : <STR_LIT> ) ; } O << <ISA_LIT>InstPrinter :: getPrettyRegisterName ( Reg , MRI ) ; return false ; } }

if ( Error ) printOperand ( MI , OpNum , O ) ;


<s> ( void ) MO ; assert ( MO . isReg ( ) && <STR_LIT> ) ; if ( MI -> getOperand ( OpNum ) . getReg ( ) == <STR_LIT> ) { O << <STR_LIT> ; } else { assert ( MI -> getOperand ( OpNum ) . getReg ( ) == <STR_LIT> && <STR_LIT> ) ; O << <STR_LIT> ; }

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


<s> } unsigned OpFlags = MI -> getOperand ( OpNum - <NUM_LIT> ) . getImm ( ) ; unsigned NumOpRegs = InlineAsm :: getNumOperandRegisters ( OpFlags ) ; if ( NumOpRegs == <NUM_LIT> ) {

O << '+' << MI -> getOperand ( OpNum + <NUM_LIT> ) . getImm ( ) ;


<s> MCInst I ; MCInstLowering . lowerInstruction ( * MI , I ) ; EmitToStreamer ( * OutStreamer , I ) ;


<s> MCInstLowering . lowerInstruction ( * MI , I ) ; EmitToStreamer ( * OutStreamer , I ) ;


<s> bool <ISA_LIT>AsmPrinter :: PrintAsmMemoryOperand ( const MachineInstr * MI , unsigned OpNum , unsigned AsmVariant , const char * ExtraCode , raw_ostream & O ) { if ( ExtraCode && ExtraCode [ <NUM_LIT> ] ) { llvm_unreachable ( <STR_LIT> ) ; } const MachineOperand & MO = MI -> getOperand ( OpNum ) ; ( void ) MO ; assert ( MO . isReg ( ) && <STR_LIT> ) ;

if ( MI -> getOperand ( OpNum ) . getReg ( ) == <STR_LIT> ) {


<s> case MachineOperand :: MO_ExternalSymbol : O << * GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) ; break ; case MachineOperand :: MO_MachineBasicBlock : O << * MO . getMBB ( ) -> getSymbol ( ) ; break ; default : llvm_unreachable ( <STR_LIT> ) ;


<s> const TargetRegisterClass * RC = TRI . getMinimalPhysRegClass ( Reg ) ; unsigned BytesPerReg = TRI . getRegSizeInBits ( * RC ) / <NUM_LIT> ; assert ( BytesPerReg <= <NUM_LIT> && <STR_LIT> ) ; unsigned RegIdx = ByteNumber / BytesPerReg ; assert ( RegIdx < NumOpRegs && <STR_LIT> ) ; Reg = MI -> getOperand ( OpNum + RegIdx ) . getReg ( ) ; if ( BytesPerReg == <NUM_LIT> ) { Reg = TRI . getSubReg ( Reg , ByteNumber % BytesPerReg ? <STR_LIT> : <STR_LIT> ) ; } O << <ISA_LIT>InstPrinter :: getPrettyRegisterName ( Reg , MRI ) ; return false ; } }


<s> OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegSPL ( ) , MMI -> getContext ( ) ) ) ; if ( SubTM -> hasEIJMPCALL ( ) ) OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegEIND ( ) , MMI -> getContext ( ) ) ) ; if ( SubTM -> hasELPM ( ) ) OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegRAMPZ ( ) , MMI -> getContext ( ) ) ) ;


<s> OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getRegZeroIndex ( ) , MMI -> getContext ( ) ) ) ; OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegSREG ( ) , MMI -> getContext ( ) ) ) ; if ( ! SubTM -> hasSmallStack ( ) ) OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegSPH ( ) , MMI -> getContext ( ) ) ) ;

OutStreamer -> emitAssignment ( MMI -> getContext ( ) . getOrCreateSymbol ( StringRef ( <STR_LIT> ) ) , MCConstantExpr :: create ( SubTM -> getIORegSPL ( ) , MMI -> getContext ( ) ) ) ;


<s> <ISA_LIT>AsmPrinter ( TargetMachine & TM , std :: unique_ptr < MCStreamer > Streamer ) : AsmPrinter ( TM , std :: move ( Streamer ) ) , MRI ( * TM . getMCRegisterInfo ( ) ) {


<s> MCSymbol * DoCopyData = OutContext . getOrCreateSymbol ( <STR_LIT> ) ; MCSymbol * DoClearBss = OutContext . getOrCreateSymbol ( <STR_LIT> ) ;

OutStreamer -> emitRawComment ( <STR_LIT> ) ;


<s> MCInst I ; MCInstLowering . lowerInstruction ( * MI , I ) ;


<s> void <ISA_LIT>AsmPrinter :: emitXXStructor ( const DataLayout & DL , const Constant * CV ) { if ( ! EmittedStructorSymbolAttrs ) { OutStreamer -> emitRawComment ( <STR_LIT> <STR_LIT> ) ; OutStreamer -> emitRawComment ( <STR_LIT> ) ; MCSymbol * CtorsSym = OutContext . getOrCreateSymbol ( <STR_LIT> ) ; OutStreamer -> emitSymbolAttribute ( CtorsSym , MCSA_Global ) ; MCSymbol * DtorsSym = OutContext . getOrCreateSymbol ( <STR_LIT> ) ; OutStreamer -> emitSymbolAttribute ( DtorsSym , MCSA_Global ) ; EmittedStructorSymbolAttrs = true ; }

AsmPrinter :: emitXXStructor ( DL , CV ) ;


<s> LLVM_EXTERNAL_VISIBILITY void LLVMInitialize<ISA_LIT>AsmPrinter ( ) { llvm :: RegisterAsmPrinter < llvm :: <ISA_LIT>AsmPrinter > X ( llvm :: getThe<ISA_LIT>Target ( ) ) ;


<s> const MCExpr * Expr = MCSymbolRefExpr :: create ( getSymbol ( GV ) , Ctx ) ; return <ISA_LIT>MCExpr :: create ( <ISA_LIT>MCExpr :: VK_<ISA_LIT>_PM , Expr , false , Ctx ) ; }


<s> } else { assert ( MI -> getOperand ( OpNum ) . getReg ( ) == <STR_LIT> && <STR_LIT> ) ; O << <STR_LIT> ; } unsigned OpFlags = MI -> getOperand ( OpNum - <NUM_LIT> ) . getImm ( ) ; unsigned NumOpRegs = InlineAsm :: getNumOperandRegisters ( OpFlags ) ; if ( NumOpRegs == <NUM_LIT> ) {


<s> if ( ExtraCode [ <NUM_LIT> ] != <NUM_LIT> ) return true ; if ( ExtraCode [ <NUM_LIT> ] >= 'A' && ExtraCode [ <NUM_LIT> ] <= 'Z' ) { const MachineOperand & RegOp = MI -> getOperand ( OpNum ) ; assert ( RegOp . isReg ( ) && <STR_LIT> <STR_LIT> ) ; Register Reg = RegOp . getReg ( ) ; unsigned ByteNumber = ExtraCode [ <NUM_LIT> ] - 'A' ; unsigned OpFlags = MI -> getOperand ( OpNum - <NUM_LIT> ) . getImm ( ) ; unsigned NumOpRegs = InlineAsm :: getNumOperandRegisters ( OpFlags ) ; ( void ) NumOpRegs ; const <ISA_LIT>Subtarget & STI = MF -> getSubtarget < <ISA_LIT>Subtarget > ( ) ;

const TargetRegisterInfo & TRI = * STI . getRegisterInfo ( ) ;


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


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


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


<s> Inst . addOperand ( MCOperand :: createImm ( Field << <NUM_LIT> ) ) ;


<s> unsigned r = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) + <NUM_LIT> ;

if ( DecodeGPR8RegisterClass ( Inst , d , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;


<s> unsigned addr = <NUM_LIT> ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ; unsigned reg = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ;

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


<s> static DecodeStatus decodeFIOBIT ( MCInst & Inst , unsigned Insn , uint64_t Address , const MCDisassembler * Decoder ) { unsigned addr = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ;

unsigned b = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ;


<s> unsigned addr = <NUM_LIT> ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ; unsigned reg = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; if ( DecodeGPR8RegisterClass ( Inst , reg , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( addr ) ) ; return MCDisassembler :: Success ;


<s> static DecodeStatus decodeFLPMX ( MCInst & Inst , unsigned Insn , uint64_t Address , const MCDisassembler * Decoder ) { if ( decodeFRd ( Inst , Insn , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ) ) ;


<s> if ( DecodeGPR8RegisterClass ( Inst , r , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;


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

unsigned rd = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) + <NUM_LIT> ;


<s> k |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; k |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ; if ( DecodeGPR8RegisterClass ( Inst , d , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; if ( DecodeGPR8RegisterClass ( Inst , d , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( k ) ) ;


<s> if ( DecodeGPR8RegisterClass ( Inst , d , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;


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

unsigned Register = GPRDecoderTable [ RegNo ] ;


<s> static DecodeStatus DecodeLD8RegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const MCDisassembler * Decoder ) { if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ; unsigned Register = GPRDecoderTable [ RegNo + <NUM_LIT> ] ;

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


<s> Inst . addOperand ( MCOperand :: createReg ( ( Insn & <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ) ) ; Inst . addOperand ( MCOperand :: createImm ( Insn & <NUM_LIT> ) ) ; return MCDisassembler :: Success ;


<s> switch ( Size ) { case <NUM_LIT> : return DecoderTable16 ; case <NUM_LIT> : return DecoderTable32 ;


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


<s> { Result = readInstruction16 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) return Result ; Result = decodeLoadStore ( Instr , Insn , Address , this ) ; if ( Result != MCDisassembler :: Fail ) return Result ; } { Result = readInstruction32 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ;

if ( Result != MCDisassembler :: Fail ) {


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


<s> Size = <NUM_LIT> ; Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ; return MCDisassembler :: Success ;


<s> static DecodeStatus readInstruction32 ( ArrayRef < uint8_t > Bytes , uint64_t Address , uint64_t & Size , uint32_t & Insn ) { if ( Bytes . size ( ) < <NUM_LIT> ) { Size = <NUM_LIT> ; return MCDisassembler :: Fail ; } Size = <NUM_LIT> ;

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


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

unsigned d = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) + <NUM_LIT> ;


<s> static DecodeStatus decodeFLPMX ( MCInst & Inst , unsigned Insn , uint64_t Address , const void * Decoder ) { if ( decodeFRd ( Inst , Insn , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;

Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ) ) ;


<s> unsigned rd = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) + <NUM_LIT> ; unsigned rr = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) + <NUM_LIT> ; if ( DecodeGPR8RegisterClass ( Inst , rd , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; if ( DecodeGPR8RegisterClass ( Inst , rr , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; return MCDisassembler :: Success ;


<s> if ( DecodeGPR8RegisterClass ( Inst , d , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( k ) ) ;


<s> unsigned d = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) * <NUM_LIT> + <NUM_LIT> ; unsigned k = <NUM_LIT> ; k |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; k |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ;


<s> if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ; unsigned Register = GPRDecoderTable [ RegNo + <NUM_LIT> ] ; Inst . addOperand ( MCOperand :: createReg ( Register ) ) ;


<s> static DecodeStatus DecodeLD8RegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const void * Decoder ) { if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ; unsigned Register = GPRDecoderTable [ RegNo + <NUM_LIT> ] ; Inst . addOperand ( MCOperand :: createReg ( Register ) ) ; return MCDisassembler :: Success ;


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


<s> static DecodeStatus DecodePTRREGSRegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const void * Decoder ) { return MCDisassembler :: Success ;


<s> Result = readInstruction16 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) return Result ;


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

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


<s> Size = <NUM_LIT> ; return MCDisassembler :: Fail ; } Size = <NUM_LIT> ; Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ;


<s> return MCDisassembler :: Fail ; } Size = <NUM_LIT> ;


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


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


<s> addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ; unsigned reg = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ;


<s> Inst . addOperand ( MCOperand :: createImm ( addr ) ) ;

if ( DecodeGPR8RegisterClass ( Inst , reg , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;


<s> unsigned b = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; Inst . addOperand ( MCOperand :: createImm ( addr ) ) ; Inst . addOperand ( MCOperand :: createImm ( b ) ) ;


<s> Inst . addOperand ( MCOperand :: createImm ( addr ) ) ; Inst . addOperand ( MCOperand :: createImm ( b ) ) ;


<s> if ( DecodeGPR8RegisterClass ( Inst , reg , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( addr ) ) ;


<s> addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; addr |= fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) << <NUM_LIT> ; unsigned reg = fieldFromInstruction ( Insn , <NUM_LIT> , <NUM_LIT> ) ; if ( DecodeGPR8RegisterClass ( Inst , reg , Address , Decoder ) == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Inst . addOperand ( MCOperand :: createImm ( addr ) ) ;


<s> static DecodeStatus DecodeGPR8RegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const void * Decoder ) { if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ; unsigned Register = GPRDecoderTable [ RegNo ] ; Inst . addOperand ( MCOperand :: createReg ( Register ) ) ; return MCDisassembler :: Success ;


<s> if ( RegNo > <NUM_LIT> ) return MCDisassembler :: Fail ; unsigned Register = GPRDecoderTable [ RegNo + <NUM_LIT> ] ;


<s> static DecodeStatus DecodePTRREGSRegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const void * Decoder ) { assert ( false && <STR_LIT> ) ; return MCDisassembler :: Success ;


<s> case <NUM_LIT> : return DecoderTable32 ; default : llvm_unreachable ( <STR_LIT> ) ; }


<s> Result = readInstruction16 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) return Result ; } { Result = readInstruction32 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ;


<s> Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) return Result ; } { Result = readInstruction32 ( Bytes , Address , Size , Insn ) ; if ( Result == MCDisassembler :: Fail ) return MCDisassembler :: Fail ; Result = decodeInstruction ( getDecoderTable ( Size ) , Instr , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) { return Result ; } return MCDisassembler :: Fail ; }


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


<s> std :: unique_ptr < MCELFObjectTargetWriter > MOTW ( new <ISA_LIT>ELFObjectWriter ( OSABI ) ) ;

return createELFObjectWriter ( std :: move ( MOTW ) , OS , true ) ;


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


<s> return createELFObjectWriter ( MOTW , OS , true ) ;


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


<s> return ELF :: R_<ISA_LIT>_32 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_7_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_13_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_CALL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_6 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_6_ADIW ;


<s> default : llvm_unreachable ( <STR_LIT> ) ; case MCSymbolRefExpr :: VK_None : return ELF :: R_<ISA_LIT>_8 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_DIFF8 : return ELF :: R_<ISA_LIT>_DIFF8 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_LO8 : return ELF :: R_<ISA_LIT>_8_LO8 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_HI8 : return ELF :: R_<ISA_LIT>_8_HI8 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_HLO8 : return ELF :: R_<ISA_LIT>_8_HLO8 ; } case FK_Data_4 : switch ( Modifier ) { default : llvm_unreachable ( <STR_LIT> ) ; case MCSymbolRefExpr :: VK_None : return ELF :: R_<ISA_LIT>_32 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_DIFF32 : return ELF :: R_<ISA_LIT>_DIFF32 ; } case FK_Data_2 : switch ( Modifier ) { default : llvm_unreachable ( <STR_LIT> ) ; case MCSymbolRefExpr :: VK_None : return ELF :: R_<ISA_LIT>_16 ; case MCSymbolRefExpr :: VK_<ISA_LIT>_NONE : case MCSymbolRefExpr :: VK_<ISA_LIT>_PM : return ELF :: R_<ISA_LIT>_16_PM ; case MCSymbolRefExpr :: VK_<ISA_LIT>_DIFF16 : return ELF :: R_<ISA_LIT>_DIFF16 ; } case <STR_LIT> : return ELF :: R_<ISA_LIT>_32 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_7_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_13_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_NEG ; case <STR_LIT> :


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


<s> } case <STR_LIT> : return ELF :: R_<ISA_LIT>_32 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_7_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_13_PCREL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_16_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_PM ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HI8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_HH8_LDI_PM_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_CALL ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_6 ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_6_ADIW ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_MS8_LDI ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_MS8_LDI_NEG ; case <STR_LIT> : return ELF :: R_<ISA_LIT>_LO8_LDI_GS ; case <STR_LIT> :


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


<s> if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>1 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>2 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>25 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>3 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>31 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>35 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>4 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>5 ;

else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>51 ;


<s> unsigned EFlags = MCA . getELFHeaderEFlags ( ) ; EFlags |= getEFlagsForFeatureSet ( STI . getFeatureBits ( ) ) ;


<s> MCAssembler & MCA = getStreamer ( ) . getAssembler ( ) ;

unsigned EFlags = MCA . getELFHeaderEFlags ( ) ;


<s> else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>31 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>35 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>4 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>5 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>51 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>6 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_<ISA_LIT>TINY ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_XMEGA1 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_XMEGA2 ; else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_XMEGA3 ;

else if ( Features [ <STR_LIT> ] ) EFlags |= ELF :: EF_<ISA_LIT>_ARCH_XMEGA4 ;


<s> <ISA_LIT>ExpandPseudo ( ) : MachineFunctionPass ( ID ) {

initialize<ISA_LIT>ExpandPseudoPass ( * PassRegistry :: getPassRegistry ( ) ) ;


<s> MachineInstrBuilder buildMI ( Block & MBB , BlockIt MBBI , unsigned Opcode , unsigned DstReg ) { return BuildMI ( MBB , MBBI , MBBI -> getDebugLoc ( ) , TII -> get ( Opcode ) , DstReg ) ;


<s> return new <ISA_LIT>ExpandPseudo ( ) ;


<s> unsigned SrcLoReg , SrcHiReg , DstLoReg , DstHiReg ; unsigned DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; unsigned SrcReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( SrcReg , SrcLoReg , SrcHiReg ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , OpLo ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; auto MIBHI = buildMI ( MBB , MBBI , OpHi ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ;

if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;


<s> auto MIBHI = buildMI ( MBB , MBBI , OpHi ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIBHI -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ; MI . eraseFromParent ( ) ; return true ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( SCRATCH_REGISTER , RegState :: Define ) . addImm ( SREG_ADDR ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( <NUM_LIT> ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( <NUM_LIT> ) ; f ( MI ) ;

buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( SREG_ADDR ) . addReg ( SCRATCH_REGISTER ) ;


<s> auto Op1 = MI . getOperand ( <NUM_LIT> ) ; auto Op2 = MI . getOperand ( <NUM_LIT> ) ; unsigned LoadOpcode = ( Width == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ; unsigned StoreOpcode = ( Width == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ;

buildMI ( MBB , MBBI , LoadOpcode ) . add ( Op1 ) . add ( Op2 ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandAtomicBinaryOp ( unsigned Opcode , Block & MBB , BlockIt MBBI ) {

return expandAtomicBinaryOp ( Opcode , MBB , MBBI , [ ] ( MachineInstr & MI ) { } ) ;


<s> return expandAtomicBinaryOp ( Opcode , MBB , MBBI , [ ] ( MachineInstr & MI ) { } ) ;


<s> auto MIBLO = buildMI ( MBB , MBBI , Op ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MI . eraseFromParent ( ) ;


<s> bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; unsigned Imm = MI . getOperand ( <NUM_LIT> ) . getImm ( ) ; unsigned Lo8 = Imm & <NUM_LIT> ; unsigned Hi8 = ( Imm >> <NUM_LIT> ) & <NUM_LIT> ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ;

if ( ! isLogicImmOpRedundant ( Op , Lo8 ) ) {


<s> bool Modified = false ; BlockIt MBBI = MBB . begin ( ) , E = MBB . end ( ) ; while ( MBBI != E ) { BlockIt NMBBI = std :: next ( MBBI ) ; Modified |= expandMI ( MBB , MBBI ) ; MBBI = NMBBI ;


<s> StringRef getPassName ( ) const override {


<s> bool <ISA_LIT>ExpandPseudo :: isLogicImmOpRedundant ( unsigned Op , unsigned ImmVal ) const { if ( Op == <STR_LIT> && ImmVal == <NUM_LIT> ) return true ; if ( Op == <STR_LIT> && ImmVal == <NUM_LIT> ) return true ; return false ;


<s> isLogicImmOpRedundant ( unsigned Op , unsigned ImmVal ) const { if ( Op == <STR_LIT> && ImmVal == <NUM_LIT> ) return true ; if ( Op == <STR_LIT> && ImmVal == <NUM_LIT> ) return true ; return false ;


<s> TRI = STI . getRegisterInfo ( ) ; TII = STI . getInstrInfo ( ) ; MF . getProperties ( ) . set ( MachineFunctionProperties :: Property :: TracksLiveness ) ; for ( Block & MBB : MF ) { bool ContinueExpanding = true ; unsigned ExpandCount = <NUM_LIT> ;


<s> MachineBasicBlock & MBB = * MI . getParent ( ) ; RegScavenger RS ; RS . enterBasicBlock ( MBB ) ; RS . forward ( MI ) ; BitVector Candidates = TRI -> getAllocatableSet ( * MBB . getParent ( ) , & <STR_LIT> ) ;

for ( MachineOperand & MO : MI . operands ( ) ) {


<s> for ( MachineOperand & MO : MI . operands ( ) ) { if ( MO . isReg ( ) && MO . getReg ( ) != <NUM_LIT> && ! MO . isDef ( ) && ! TargetRegisterInfo :: isVirtualRegister ( MO . getReg ( ) ) ) Candidates . reset ( MO . getReg ( ) ) ; } BitVector Available = RS . getRegsAvailable ( & <STR_LIT> ) ; Available &= Candidates ; signed Reg = Available . find_first ( ) ;

assert ( Reg != - <NUM_LIT> && <STR_LIT> ) ;


<s> bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg ) . addImm ( <NUM_LIT> ) -> getOperand ( <NUM_LIT> ) . setIsUndef ( true ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ;

buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addImm ( <NUM_LIT> ) -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;


<s> bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg ) . addImm ( <NUM_LIT> ) -> getOperand ( <NUM_LIT> ) . setIsUndef ( true ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addImm ( <NUM_LIT> ) -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ; MI . eraseFromParent ( ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandASRB7Rd ( Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ;

bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; auto MIRRC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ;

if ( ImpIsDead ) MIRRC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , RegState :: Kill ) . addReg ( DstHiReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) . addReg ( DstLoReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , RegState :: Kill ) . addReg ( DstHiReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg ) ; auto MIROL = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MIROL -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;

MIROL -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define ) . addReg ( DstHiReg , RegState :: Kill ) . addReg ( DstHiReg , RegState :: Kill ) ; auto MISBC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , RegState :: Kill ) . addReg ( DstHiReg , RegState :: Kill ) ; if ( ImpIsDead ) MISBC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MISBC -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandASRW15Rd ( Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; Register DstLoReg , DstHiReg ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ;

TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandASRW7Rd ( Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; Register DstLoReg , DstHiReg ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) . addReg ( DstLoReg , RegState :: Kill ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg ) ;

buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) ;


<s> const <ISA_LIT>Subtarget & STI = MBB . getParent ( ) -> getSubtarget < <ISA_LIT>Subtarget > ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( SCRATCH_REGISTER , RegState :: Define ) . addImm ( STI . getIORegSREG ( ) ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( <NUM_LIT> ) ; f ( MI ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( STI . getIORegSREG ( ) ) . addReg ( SCRATCH_REGISTER ) ; MI . eraseFromParent ( ) ; return true ;


<s> Register Bank = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addImm ( STI . getIORegRAMPZ ( ) ) . addReg ( Bank ) ; } if ( DstReg == SrcReg ) TmpReg = scavengeGPR8 ( MI ) ; Register CurDstLoReg = ( DstReg == SrcReg ) ? TmpReg : DstLoReg ; Register CurDstHiReg = ( DstReg == SrcReg ) ? TmpReg : DstHiReg ; auto MIBLO = buildMI ( MBB , MBBI , OpLo ) . addReg ( CurDstLoReg , RegState :: Define ) . addReg ( SrcReg ) ; if ( TmpReg ) buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( TmpReg ) ;

auto MIBHI = buildMI ( MBB , MBBI , OpHi ) . addReg ( CurDstHiReg , RegState :: Define ) . addReg ( SrcReg , getKillRegState ( SrcIsKill ) ) ;


<s> bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) -> getOperand ( <NUM_LIT> ) . setIsUndef ( true ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; auto MIRRC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MIRRC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIRRC -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; auto MIRRC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MIRRC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIRRC -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ; MI . eraseFromParent ( ) ;


<s> bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , RegState :: Kill ) ; auto MI0 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addImm ( <NUM_LIT> ) ; MI0 -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MI1 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MI1 -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MI . eraseFromParent ( ) ; return true ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) -> getOperand ( <NUM_LIT> ) . setIsUndef ( true ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) ; auto MIRRC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MIRRC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIRRC -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandLSRB7Rd ( Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ;

buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , RegState :: Kill ) . addReg ( DstReg , RegState :: Kill ) -> getOperand ( <NUM_LIT> ) . setIsUndef ( true ) ;


<s> Register DstLoReg , DstHiReg ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) ;

auto MI0 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addImm ( <NUM_LIT> ) ;


<s> Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) ; auto MI0 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addImm ( <NUM_LIT> ) ; MI0 -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MIBHI = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) ;


<s> buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) ; auto MI0 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) . addImm ( <NUM_LIT> ) ; MI0 -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MI1 = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , RegState :: Kill ) . addReg ( DstHiReg ) ;

MI1 -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;


<s> unsigned ExpandCount = <NUM_LIT> ; do { assert ( ExpandCount < <NUM_LIT> && <STR_LIT> ) ; ( void ) ExpandCount ; bool BlockModified = expandMBB ( MBB ) ; Modified |= BlockModified ; ExpandCount ++ ; ContinueExpanding = BlockModified ; } while ( ContinueExpanding ) ; }


<s> Register SrcReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( SrcReg , SrcLoReg , SrcHiReg ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ;

buildMI ( MBB , MBBI , OpLo ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ;


<s> Register SrcLoReg , SrcHiReg , DstLoReg , DstHiReg ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; Register SrcReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( SrcReg , SrcLoReg , SrcHiReg ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; auto MIBLO = buildMI ( MBB , MBBI , Op ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;


<s> auto MIBLO = buildMI ( MBB , MBBI , Op ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( SrcIsKill ) ) . addImm ( Lo8 ) ; MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; } if ( ! isLogicImmOpRedundant ( Op , Hi8 ) ) { auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( SrcIsKill ) ) . addImm ( Hi8 ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; } MI . eraseFromParent ( ) ; return true ;


<s> Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; unsigned Imm = MI . getOperand ( <NUM_LIT> ) . getImm ( ) ; unsigned Lo8 = Imm & <NUM_LIT> ; unsigned Hi8 = ( Imm >> <NUM_LIT> ) & <NUM_LIT> ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; if ( ! isLogicImmOpRedundant ( Op , Lo8 ) ) { auto MIBLO = buildMI ( MBB , MBBI , Op ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( SrcIsKill ) ) . addImm ( Lo8 ) ; MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; } if ( ! isLogicImmOpRedundant ( Op , Hi8 ) ) { auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( SrcIsKill ) ) . addImm ( Hi8 ) ;

if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;


<s> EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; case <STR_LIT> : EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ;


<s> if ( MO . isReg ( ) && MO . getReg ( ) != <NUM_LIT> && ! MO . isDef ( ) && ! Register :: isVirtualRegister ( MO . getReg ( ) ) ) Candidates . reset ( MO . getReg ( ) ) ; } BitVector Available = RS . getRegsAvailable ( & <STR_LIT> ) ; Available &= Candidates ;

signed Reg = Available . find_first ( ) ;


<s> for ( MachineOperand & MO : MI . operands ( ) ) { if ( MO . isReg ( ) && MO . getReg ( ) != <NUM_LIT> && ! MO . isDef ( ) && ! Register :: isVirtualRegister ( MO . getReg ( ) ) ) Candidates . reset ( MO . getReg ( ) ) ; } BitVector Available = RS . getRegsAvailable ( & <STR_LIT> ) ; Available &= Candidates ; signed Reg = Available . find_first ( ) ;


<s> expandArith ( unsigned OpLo , unsigned OpHi , Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; unsigned SrcLoReg , SrcHiReg , DstLoReg , DstHiReg ; Register DstReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; Register SrcReg = MI . getOperand ( <NUM_LIT> ) . getReg ( ) ; bool DstIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( SrcReg , SrcLoReg , SrcHiReg ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , OpLo ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; auto MIBHI = buildMI ( MBB , MBBI , OpHi ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIBHI -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ; MI . eraseFromParent ( ) ; return true ;


<s> TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; auto MIBLO = buildMI ( MBB , MBBI , Op ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MI . eraseFromParent ( ) ;


<s> MIBLO -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; } if ( ! isLogicImmOpRedundant ( Op , Hi8 ) ) { auto MIBHI = buildMI ( MBB , MBBI , Op ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( SrcIsKill ) ) . addImm ( Hi8 ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; }


<s> BitVector Candidates = TRI -> getAllocatableSet ( * MBB . getParent ( ) , & <STR_LIT> ) ; for ( MachineOperand & MO : MI . operands ( ) ) { if ( MO . isReg ( ) && MO . getReg ( ) != <NUM_LIT> && ! MO . isDef ( ) && ! Register :: isVirtualRegister ( MO . getReg ( ) ) ) Candidates . reset ( MO . getReg ( ) ) ; } BitVector Available = RS . getRegsAvailable ( & <STR_LIT> ) ; Available &= Candidates ; signed Reg = Available . find_first ( ) ; assert ( Reg != - <NUM_LIT> && <STR_LIT> ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandMI ( Block & MBB , BlockIt MBBI ) { MachineInstr & MI = * MBBI ; int Opcode = MBBI -> getOpcode ( ) ; case Op : \ return expand < Op > ( MBB , MI ) switch ( Opcode ) { EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; case <STR_LIT> : EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ;


<s> case Op : \ return expand < Op > ( MBB , MI ) switch ( Opcode ) { EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; case <STR_LIT> : EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ; EXPAND ( <STR_LIT> ) ;


<s> bool <ISA_LIT>ExpandPseudo :: expandAtomicArithmeticOp ( unsigned Width , unsigned ArithOpcode , Block & MBB , BlockIt MBBI ) { return expandAtomic ( MBB , MBBI , [ & ] ( MachineInstr & MI ) { auto Op1 = MI . getOperand ( <NUM_LIT> ) ; auto Op2 = MI . getOperand ( <NUM_LIT> ) ; unsigned LoadOpcode = ( Width == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ; unsigned StoreOpcode = ( Width == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ; buildMI ( MBB , MBBI , LoadOpcode ) . addOperand ( Op1 ) . addOperand ( Op2 ) ; buildMI ( MBB , MBBI , ArithOpcode ) . addOperand ( Op1 ) . addOperand ( Op1 ) . addOperand ( Op2 ) ; buildMI ( MBB , MBBI , StoreOpcode ) . addOperand ( Op2 ) . addOperand ( Op1 ) ;


<s> auto Op1 = MI . getOperand ( <NUM_LIT> ) ; auto Op2 = MI . getOperand ( <NUM_LIT> ) ;

MachineInstr & NewInst = * buildMI ( MBB , MBBI , Opcode ) . addOperand ( Op1 ) . addOperand ( Op2 ) . getInstr ( ) ;


<s> MachineInstrBuilder buildMI ( Block & MBB , BlockIt MBBI , unsigned Opcode , Register DstReg ) {

return BuildMI ( MBB , MBBI , MBBI -> getDebugLoc ( ) , TII -> get ( Opcode ) , DstReg ) ;


<s> MachineInstrBuilder buildMI ( Block & MBB , BlockIt MBBI , unsigned Opcode , Register DstReg ) { return BuildMI ( MBB , MBBI , MBBI -> getDebugLoc ( ) , TII -> get ( Opcode ) , DstReg ) ;


<s> bool SrcIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; TRI -> splitReg ( SrcReg , SrcLoReg , SrcHiReg ) ; TRI -> splitReg ( DstReg , DstLoReg , DstHiReg ) ; buildMI ( MBB , MBBI , OpLo ) . addReg ( DstLoReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstLoReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcLoReg , getKillRegState ( SrcIsKill ) ) ; auto MIBHI = buildMI ( MBB , MBBI , OpHi ) . addReg ( DstHiReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstHiReg , getKillRegState ( DstIsKill ) ) . addReg ( SrcHiReg , getKillRegState ( SrcIsKill ) ) ; if ( ImpIsDead ) MIBHI -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ;

MIBHI -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;


<s> bool DstIsKill = MI . getOperand ( <NUM_LIT> ) . isKill ( ) ; bool ImpIsDead = MI . getOperand ( <NUM_LIT> ) . isDead ( ) ; buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ; auto MIRRC = buildMI ( MBB , MBBI , <STR_LIT> ) . addReg ( DstReg , RegState :: Define | getDeadRegState ( DstIsDead ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) . addReg ( DstReg , getKillRegState ( DstIsKill ) ) ; if ( ImpIsDead ) MIRRC -> getOperand ( <NUM_LIT> ) . setIsDead ( ) ; MIRRC -> getOperand ( <NUM_LIT> ) . setIsKill ( ) ;