<s> switch ( ( unsigned ) Fixup . getKind ( ) ) { case <STR_LIT> : { Value = alignTo < <NUM_LIT> > ( Value - <NUM_LIT> ) ; break ; }


<s> Value &= ~ ( uint64_t ( ~ <NUM_LIT> ) << Size ) ; <STR_LIT> :: write64le ( RawData , <STR_LIT> :: read64le ( RawData ) | Value ) ;


<s> Value /= Multiply ; Value &= ~ ( uint64_t ( ~ <NUM_LIT> ) << Size ) ;

<STR_LIT> :: write64le ( RawData , <STR_LIT> :: read64le ( RawData ) | Value ) ;


<s> applyDisplacement < <NUM_LIT> , <NUM_LIT> > ( Value , Data . slice ( Offset ) ) ; break ; } case FK_Data_4 : * reinterpret_cast < uint32_t * > ( Data . slice ( Offset ) . data ( ) ) = Value / <NUM_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ;


<s> break ; case <STR_LIT> : { applyDisplacement < <NUM_LIT> , <NUM_LIT> > ( Value , Data . slice ( Offset ) ) ; break ; } case FK_Data_4 : * reinterpret_cast < uint32_t * > ( Data . slice ( Offset ) . data ( ) ) = Value / <NUM_LIT> ;


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


<s> MCAsmBackend * llvm :: create<ISA_LIT>AsmBackend ( const Target & T , const MCRegisterInfo & MRI , const Triple & TT , StringRef CPU , const MCTargetOptions & Options ) {

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


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


<s> const MCFixupKindInfo & <ISA_LIT>AsmBackend :: getFixupKindInfo ( MCFixupKind Kind ) const { static const MCFixupKindInfo Infos [ <STR_LIT> ] = { { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } , { <STR_LIT> , <NUM_LIT> , <NUM_LIT> , MCFixupKindInfo :: FKF_IsPCRel } , } ; if ( Kind < FirstTargetFixupKind ) return MCAsmBackend :: getFixupKindInfo ( Kind ) ; assert ( unsigned ( Kind - FirstTargetFixupKind ) < getNumFixupKinds ( ) && <STR_LIT> ) ; return Infos [ Kind - FirstTargetFixupKind ] ;


<s> unsigned getNumFixupKinds ( ) const override {


<s> unsigned getRelocType ( MCContext & Ctx , const MCValue & Target , const MCFixup & Fixup , bool IsPCRel ) const override { case <STR_LIT> ## X : \ return ELF :: R_<ISA_LIT>_ ## X switch ( ( unsigned ) Fixup . getKind ( ) ) { FIXUP ( NONE ) ; FIXUP ( PC2_12 ) ;


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


<s> <ISA_LIT>ELFObjectWriter ( uint8_t OSABI , uint16_t EMachine ) : MCELFObjectTargetWriter ( false , OSABI , EMachine , true ) {


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


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


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


<s> bool writeNopData ( uint64_t Count , MCObjectWriter * OW ) const override { if ( ( Count % <NUM_LIT> ) != <NUM_LIT> ) return false ; for ( uint64_t i = <NUM_LIT> ; i < Count ; i += <NUM_LIT> ) OW -> write16 ( <NUM_LIT> ) ;


<s> void addImmOperands ( MCInst & Inst , unsigned N ) const { Inst . addOperand ( MCOperand :: createImm ( N ) ) ;


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


<s> void addRegOperands ( MCInst & Inst , unsigned N ) const { Inst . addOperand ( MCOperand :: createReg ( getReg ( ) ) ) ;


<s> auto Op = make_unique < <ISA_LIT>Operand > ( Immediate ) ; Op -> Imm . Val = Val ; Op -> StartLoc = S ; Op -> EndLoc = E ; return Op ;


<s> StringRef getToken ( ) const { llvm_unreachable ( <STR_LIT> ) ;


<s> if ( RegNo == <NUM_LIT> ) return Error ( StartLoc , <STR_LIT> ) ; Parser . Lex ( ) ; return false ; } bool ParseInstruction ( ParseInstructionInfo & Info , StringRef Name , SMLoc NameLoc , OperandVector & Operands ) override { return true ; } bool ParseDirective ( AsmToken DirectiveID ) override { return true ; } bool MatchAndEmitInstruction ( SMLoc IDLoc , unsigned & Opcode , OperandVector & Operands , MCStreamer & Out , uint64_t & ErrorInfo , bool MatchingInlineAsm ) override { MCInst Inst ; SMLoc ErrorLoc ; switch ( MatchInstructionImpl ( Operands , Inst , ErrorInfo , MatchingInlineAsm ) ) { case Match_Success : Inst . setLoc ( IDLoc ) ; Out . EmitInstruction ( Inst , STI ) ; return false ; default :


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


<s> void EmitConstantPool ( ) override {


<s> OutStreamer -> EmitLabel ( CurrentFnSym ) ;


<s> OutStreamer -> EmitLabel ( GetCPISymbol ( LabelID ) ) ; auto & MCPE = MF -> getConstantPool ( ) -> getConstants ( ) [ CPIdx ] ; if ( MCPE . isMachineConstantPoolEntry ( ) ) EmitMachineConstantPoolValue ( MCPE . Val . MachineCPVal ) ; else EmitGlobalConstant ( DL , MCPE . Val . ConstVal ) ; return ; } do { MCInst TmpInst ; InstLower . Lower ( & * MII , TmpInst ) ; EmitToStreamer ( * OutStreamer , TmpInst ) ; ++ MII ;

} while ( MII != MBB -> instr_end ( ) && MII -> isInsideBundle ( ) ) ;


<s> auto GV = static_cast < <ISA_LIT>ConstantPoolValue * > ( MCPV ) -> getGlobalValue ( ) ; auto * Expr = MCSymbolRefExpr :: create ( getSymbol ( GV ) , OutContext ) ;

OutStreamer -> EmitValue ( Expr , Size ) ;


<s> StringRef getPassName ( ) const override {


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


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


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


<s> } MachineFunctionProperties getRequiredProperties ( ) const override { return MachineFunctionProperties ( ) . set ( MachineFunctionProperties :: Property :: NoVRegs ) ; } StringRef getPassName ( ) const override { return <STR_LIT> ; } bool runOnMachineFunction ( MachineFunction & MF ) override { const std :: vector < MachineConstantPoolEntry > & CPs = MF . getConstantPool ( ) -> getConstants ( ) ; if ( CPs . empty ( ) ) return false ; auto * TII = MF . getSubtarget ( ) . getInstrInfo ( ) ; auto * BB = MF . CreateMachineBasicBlock ( ) ; BB -> setAlignment ( <NUM_LIT> ) ; MF . ensureAlignment ( <NUM_LIT> ) ; MF . push_back ( BB ) ; for ( size_t i = <NUM_LIT> , e = CPs . size ( ) ; i != e ; ++ i ) { auto Size = MF . getDataLayout ( ) . getTypeAllocSize ( CPs [ i ] . getType ( ) ) ; BuildMI ( * BB , BB -> end ( ) , DebugLoc ( ) , TII -> get ( <STR_LIT> ) ) . addImm ( i ) . addConstantPoolIndex ( i ) . addImm ( Size ) ; } return true ; } } ; char <STR_LIT> = <NUM_LIT> ; } FunctionPass * llvm :: create<ISA_LIT>ConstantIslandPass ( ) { return new <ISA_LIT>ConstantIslands ( ) ;


<s> return new <ISA_LIT>ConstantPoolValue ( Value ) ;


<s> for ( unsigned I = <NUM_LIT> , E = Constants . size ( ) ; I != E ; ++ I ) { if ( Constants [ I ] . isMachineConstantPoolEntry ( ) && ( Constants [ I ] . getAlignment ( ) & AlignMask ) == <NUM_LIT> ) { auto * CPV = static_cast < <ISA_LIT>ConstantPoolValue * > ( Constants [ I ] . Val . MachineCPVal ) ; if ( CPV -> Value == Value ) return I ; }


<s> return cast < GlobalValue > ( Value ) ;


<s> const GlobalValue * getGlobalValue ( ) const { return cast < GlobalValue > ( Value ) ;


<s> const Constant * getValue ( ) const { return Value ;


<s> <ISA_LIT>ConstantPoolValue :: <ISA_LIT>ConstantPoolValue ( const Constant * value ) : MachineConstantPoolValue ( value -> getType ( ) ) , Value ( value ) {


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


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


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


<s> bool Filler :: runOnMachineBasicBlock ( MachineBasicBlock & MBB ) { bool Changed = false ; for ( auto I = MBB . instr_begin ( ) ; I != MBB . instr_end ( ) ; ++ I ) {

if ( I -> hasDelaySlot ( ) && ! I -> isBundledWithSucc ( ) ) {


<s> bool Changed = false ; for ( auto FI = MF . begin ( ) , FE = MF . end ( ) ; FI != FE ; ++ FI ) Changed |= runOnMachineBasicBlock ( * FI ) ;


<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> DecodeStatus DecodeGPRRegisterClass ( MCInst & Inst , unsigned RegNo , uint64_t Address , const void * Decoder ) { Inst . addOperand ( MCOperand :: createReg ( <NUM_LIT> + RegNo ) ) ;


<s> DecodeStatus Result = MCDisassembler :: Fail ; Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ; Result = decodeInstruction ( DecoderTable16 , MI , Insn , Address , this , STI ) ; if ( Result != MCDisassembler :: Fail ) { Size = <NUM_LIT> ; return Result ; }


<s> uint16_t Insn = <NUM_LIT> ; DecodeStatus Result = MCDisassembler :: Fail ; Insn = ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) | ( Bytes [ <NUM_LIT> ] << <NUM_LIT> ) ; Result = decodeInstruction ( DecoderTable16 , MI , Insn , Address , this , STI ) ;

if ( Result != MCDisassembler :: Fail ) {


<s> void <ISA_LIT>FrameLowering :: determineCalleeSaves ( MachineFunction & MF , BitVector & SavedRegs , RegScavenger * RS ) const {

TargetFrameLowering :: determineCalleeSaves ( MF , SavedRegs , RS ) ;


<s> auto StackSize = MFI . getStackSize ( ) - MFI . getCalleeSavedInfo ( ) . size ( ) * <NUM_LIT> ; auto & TTI = * static_cast < const <ISA_LIT>Subtarget & > ( MF . getSubtarget ( ) ) . getInstrInfo ( ) ;


<s> auto DL = it == MBB . end ( ) ? DebugLoc { } : it -> getDebugLoc ( ) ; it = std :: prev ( it , MFI . getCalleeSavedInfo ( ) . size ( ) ) ;

if ( hasFP ( MF ) ) BuildMI ( MBB , it , DL , TTI . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) ;


<s> auto it = MBB . begin ( ) ; it = std :: next ( it , MFI . getCalleeSavedInfo ( ) . size ( ) ) ; DebugLoc DL ; if ( hasFP ( MF ) ) BuildMI ( MBB , it , DL , TTI . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) ; if ( isInt < <NUM_LIT> > ( - StackSize ) ) BuildMI ( MBB , it , DL , TTI . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - StackSize ) ; else { llvm_unreachable ( <STR_LIT> ) ; }


<s> auto StackSize = MFI . getStackSize ( ) - MFI . getCalleeSavedInfo ( ) . size ( ) * <NUM_LIT> ; auto & TTI = * static_cast < const <ISA_LIT>Subtarget & > ( MF . getSubtarget ( ) ) . getInstrInfo ( ) ; if ( StackSize == <NUM_LIT> ) return ; auto it = MBB . begin ( ) ; it = std :: next ( it , MFI . getCalleeSavedInfo ( ) . size ( ) ) ; DebugLoc DL ; if ( hasFP ( MF ) ) BuildMI ( MBB , it , DL , TTI . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) ; if ( isInt < <NUM_LIT> > ( - StackSize ) ) BuildMI ( MBB , it , DL , TTI . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( <STR_LIT> ) . addImm ( - StackSize ) ;


<s> explicit <ISA_LIT>FrameLowering ( unsigned Alignment ) : TargetFrameLowering ( StackGrowsDown , Alignment , <NUM_LIT> , Alignment ) {


<s> const TargetInstrInfo & TII = * MF . getSubtarget ( ) . getInstrInfo ( ) ; for ( unsigned i = <NUM_LIT> , e = CSI . size ( ) ; i != e ; ++ i ) BuildMI ( MBB , MI , DL , TII . get ( <STR_LIT> ) , CSI [ i ] . getReg ( ) ) . addReg ( <STR_LIT> ) ;


<s> for ( unsigned i = <NUM_LIT> , e = CSI . size ( ) ; i != e ; ++ i ) BuildMI ( MBB , MI , DL , TII . get ( <STR_LIT> ) , CSI [ i ] . getReg ( ) ) . addReg ( <STR_LIT> ) ; return true ;


<s> unsigned Reg = CSI [ i - <NUM_LIT> ] . getReg ( ) ; MBB . addLiveIn ( Reg ) ;

BuildMI ( MBB , MI , DL , TII . get ( <STR_LIT> ) , <STR_LIT> ) . addReg ( Reg ) . addReg ( Reg , RegState :: Kill ) ;


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


<s> void <ISA_LIT>InstPrinter :: printInst ( const MCInst * MI , raw_ostream & O , StringRef Annot , const MCSubtargetInfo & STI ) { printInstruction ( MI , O ) ;


<s> assert ( RegOp . isReg ( ) && <STR_LIT> ) ; O << '(' << formatImm ( OffsetOp . getImm ( ) ) << <STR_LIT> << getRegisterName ( RegOp . getReg ( ) ) << ')' ;


<s> void <ISA_LIT>InstPrinter :: printOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . isReg ( ) ) { O << StringRef ( getRegisterName ( Op . getReg ( ) ) ) . lower ( ) ;


<s> unsigned Opc = <STR_LIT> ; if ( <STR_LIT> . contains ( DestReg ) && <STR_LIT> . contains ( SrcReg ) ) { BuildMI ( MBB , MI , DL , get ( Opc ) , DestReg ) . addReg ( SrcReg , getKillRegState ( KillSrc ) ) ; return ; } if ( ! <STR_LIT> . contains ( SrcReg ) ) { Opc = [ & ] ( ) -> unsigned { switch ( SrcReg ) { case <STR_LIT> : \ return <STR_LIT> ## Type ## X CASE ( S , MACL ) ; CASE ( S , MACH ) ; CASE ( S , PR ) ; CASE ( C , GBR ) ; CASE ( C , VBR ) ; default : llvm_unreachable ( <STR_LIT> ) ; }


<s> if ( Cond . empty ( ) ) { assert ( ! FBB && <STR_LIT> ) ; BuildMI ( & MBB , DL , get ( <STR_LIT> ) ) . addMBB ( TBB ) ; return <NUM_LIT> ; } llvm_unreachable ( <STR_LIT> ) ;


<s> unsigned <ISA_LIT>InstrInfo :: insertBranch ( MachineBasicBlock & MBB , MachineBasicBlock * TBB , MachineBasicBlock * FBB , ArrayRef < MachineOperand > Cond , const DebugLoc & DL , int * BytesAdded ) const { assert ( ! BytesAdded && <STR_LIT> ) ; if ( Cond . empty ( ) ) { assert ( ! FBB && <STR_LIT> ) ; BuildMI ( & MBB , DL , get ( <STR_LIT> ) ) . addMBB ( TBB ) ;


<s> DebugLoc DL = MI != MBB . end ( ) ? MI -> getDebugLoc ( ) : DebugLoc ( ) ; BuildMI ( MBB , MI , DL , get ( <STR_LIT> ) , DstReg ) . addFrameIndex ( FrameIndex ) ;


<s> MachineBasicBlock :: iterator I = MBB . end ( ) ; unsigned Count = <NUM_LIT> ; while ( I != MBB . begin ( ) ) { -- I ; if ( I -> getOpcode ( ) != <STR_LIT> ) break ; I -> eraseFromParent ( ) ; I = MBB . end ( ) ; ++ Count ; } return Count ;


<s> assert ( ! BytesRemoved && <STR_LIT> ) ; MachineBasicBlock :: iterator I = MBB . end ( ) ; unsigned Count = <NUM_LIT> ; while ( I != MBB . begin ( ) ) { -- I ;

if ( I -> getOpcode ( ) != <STR_LIT> ) break ;


<s> DebugLoc DL = MI != MBB . end ( ) ? MI -> getDebugLoc ( ) : DebugLoc ( ) ; BuildMI ( MBB , MI , DL , get ( <STR_LIT> ) ) . addReg ( SrcReg , getKillRegState ( isKill ) ) . addFrameIndex ( FrameIndex ) ;


<s> StringRef getPassName ( ) const override {


<s> explicit <ISA_LIT>DAGToDAGISel ( <ISA_LIT>TargetMachine & TM ) : SelectionDAGISel ( TM ) {


<s> int FI = cast < FrameIndexSDNode > ( Node ) -> getIndex ( ) ; SDValue TFI = CurDAG -> getTargetFrameIndex ( FI , <STR_LIT> ) ; const auto Opc = <STR_LIT> ; CurDAG -> SelectNodeTo ( Node , Opc , <STR_LIT> , TFI ) ; return ;


<s> if ( auto * FIN = dyn_cast < FrameIndexSDNode > ( Addr . getOperand ( <NUM_LIT> ) ) ) Base = CurDAG -> getTargetFrameIndex ( FIN -> getIndex ( ) , <STR_LIT> ) ; else Base = Addr . getOperand ( <NUM_LIT> ) ;

Offset = CurDAG -> getTargetConstant ( CN -> getZExtValue ( ) >> ( j2log2 ( N ) - <NUM_LIT> ) , DL , <STR_LIT> ) ;


<s> MachineBasicBlock * <ISA_LIT>TargetLowering :: EmitInstrWithCustomInserter ( MachineInstr & MI , MachineBasicBlock * MBB ) const { auto MF = MBB -> getParent ( ) ; auto & Ctx = MF -> getFunction ( ) . getContext ( ) ; auto & TTI = * static_cast < const <ISA_LIT>Subtarget & > ( MF -> getSubtarget ( ) ) . getInstrInfo ( ) ; switch ( MI . getOpcode ( ) ) { case <STR_LIT> : { switch ( MI . getOperand ( <NUM_LIT> ) . getType ( ) ) { case MachineOperand :: MO_Immediate : { auto MBBI = MI . getIterator ( ) ; auto Pool = MF -> getConstantPool ( ) ; auto Imm = MI . getOperand ( <NUM_LIT> ) . getImm ( ) ; auto Constant = ConstantInt :: getSigned ( IntegerType :: get ( Ctx , <NUM_LIT> ) , Imm ) ; auto CPI = Pool -> getConstantPoolIndex ( Constant , <NUM_LIT> ) ; BuildMI ( * MBB , MBBI , MBBI -> getDebugLoc ( ) , TTI . get ( <STR_LIT> ) , MI . getOperand ( <NUM_LIT> ) . getReg ( ) ) . addConstantPoolIndex ( CPI ) ;


<s> case <STR_LIT> : break ; case <STR_LIT> : \ return # X CASE ( Ret ) ; CASE ( Call ) ; CASE ( Wrapper ) ; CASE ( SHL ) ;


<s> setStackPointerRegisterToSaveRestore ( <STR_LIT> ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Custom ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Expand ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Custom ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Custom ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Expand ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Expand ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Custom ) ; setOperationAction ( <STR_LIT> , <STR_LIT> , Expand ) ;


<s> bool isVarArg = CLI . IsVarArg ; CLI . IsTailCall = false ; assert ( ! isVarArg && <STR_LIT> ) ; SmallVector < CCValAssign , <NUM_LIT> > ArgLocs ; CCState CCInfo ( CallConv , isVarArg , MF , ArgLocs , * DAG . getContext ( ) ) ; CCInfo . AnalyzeCallOperands ( Outs , CC_<ISA_LIT> ) ; SmallVector < std :: pair < unsigned , SDValue > , <NUM_LIT> > RegsToPass ; SDValue Glue ; for ( size_t i = <NUM_LIT> , e = ArgLocs . size ( ) ; i != e ; ++ i ) { CCValAssign & VA = ArgLocs [ i ] ; SDValue Arg = OutVals [ i ] ; if ( VA . isRegLoc ( ) ) { Chain = DAG . getCopyToReg ( Chain , DL , VA . getLocReg ( ) , Arg , Glue ) ; Glue = Chain . getValue ( <NUM_LIT> ) ; RegsToPass . emplace_back ( VA . getLocReg ( ) , Arg ) ; } if ( isa < GlobalAddressSDNode > ( Callee ) ) Callee = LowerGlobalAddress ( Callee , DAG ) ; else if ( ExternalSymbolSDNode * E = dyn_cast < ExternalSymbolSDNode > ( Callee ) ) Callee = DAG . getTargetExternalSymbol ( E -> getSymbol ( ) , <STR_LIT> ) ; } SmallVector < SDValue , <NUM_LIT> > Ops { Chain , Callee } ; std :: transform ( RegsToPass . begin ( ) , RegsToPass . end ( ) , std :: back_inserter ( Ops ) , [ & ] ( std :: pair < unsigned , SDValue > & elt ) { return DAG . getRegister ( elt . first , elt . second . getValueType ( ) ) ; } ) ; if ( Glue . getNode ( ) ) Ops . push_back ( Glue ) ; SDVTList NodeTys = DAG . getVTList ( <STR_LIT> , <STR_LIT> ) ; Chain = DAG . getNode ( <STR_LIT> , DL , NodeTys , Ops ) ; Glue = Chain . getValue ( <NUM_LIT> ) ; { SmallVector < CCValAssign , <NUM_LIT> > RVLocs ; CCState CCInfo ( CallConv , isVarArg , DAG . getMachineFunction ( ) , RVLocs , * DAG . getContext ( ) ) ; CCInfo . AnalyzeCallResult ( Ins , RetCC_<ISA_LIT> ) ; for ( auto & Loc : RVLocs ) { auto RetValue = DAG . getCopyFromReg ( Chain , DL , Loc . getLocReg ( ) , Loc . getValVT ( ) , Glue ) ; Chain = RetValue . getValue ( <NUM_LIT> ) ; Glue = RetValue . getValue ( <NUM_LIT> ) ; InVals . push_back ( Chain . getValue ( <NUM_LIT> ) ) ; } } return Chain ;


<s> SmallVectorImpl < <STR_LIT> > & Outs = CLI . Outs ; SmallVectorImpl < SDValue > & OutVals = CLI . OutVals ; SmallVectorImpl < <STR_LIT> > & Ins = CLI . Ins ; SDValue Chain = CLI . Chain ; SDValue Callee = CLI . Callee ; CallingConv :: ID CallConv = CLI . CallConv ; bool isVarArg = CLI . IsVarArg ; CLI . IsTailCall = false ; assert ( ! isVarArg && <STR_LIT> ) ; SmallVector < CCValAssign , <NUM_LIT> > ArgLocs ; CCState CCInfo ( CallConv , isVarArg , MF , ArgLocs , * DAG . getContext ( ) ) ; CCInfo . AnalyzeCallOperands ( Outs , CC_<ISA_LIT> ) ; SmallVector < std :: pair < unsigned , SDValue > , <NUM_LIT> > RegsToPass ; SDValue Glue ; for ( size_t i = <NUM_LIT> , e = ArgLocs . size ( ) ; i != e ; ++ i ) { CCValAssign & VA = ArgLocs [ i ] ; SDValue Arg = OutVals [ i ] ; if ( VA . isRegLoc ( ) ) { Chain = DAG . getCopyToReg ( Chain , DL , VA . getLocReg ( ) , Arg , Glue ) ; Glue = Chain . getValue ( <NUM_LIT> ) ; RegsToPass . emplace_back ( VA . getLocReg ( ) , Arg ) ; } if ( isa < GlobalAddressSDNode > ( Callee ) ) Callee = LowerGlobalAddress ( Callee , DAG ) ; else if ( ExternalSymbolSDNode * E = dyn_cast < ExternalSymbolSDNode > ( Callee ) ) Callee = DAG . getTargetExternalSymbol ( E -> getSymbol ( ) , <STR_LIT> ) ; } SmallVector < SDValue , <NUM_LIT> > Ops { Chain , Callee } ; std :: transform ( RegsToPass . begin ( ) , RegsToPass . end ( ) , std :: back_inserter ( Ops ) , [ & ] ( std :: pair < unsigned , SDValue > & elt ) { return DAG . getRegister ( elt . first , elt . second . getValueType ( ) ) ; } ) ; if ( Glue . getNode ( ) ) Ops . push_back ( Glue ) ; SDVTList NodeTys = DAG . getVTList ( <STR_LIT> , <STR_LIT> ) ; Chain = DAG . getNode ( <STR_LIT> , DL , NodeTys , Ops ) ; Glue = Chain . getValue ( <NUM_LIT> ) ; { SmallVector < CCValAssign , <NUM_LIT> > RVLocs ; CCState CCInfo ( CallConv , isVarArg , DAG . getMachineFunction ( ) , RVLocs , * DAG . getContext ( ) ) ; CCInfo . AnalyzeCallResult ( Ins , RetCC_<ISA_LIT> ) ; for ( auto & Loc : RVLocs ) { auto RetValue = DAG . getCopyFromReg ( Chain , DL , Loc . getLocReg ( ) , Loc . getValVT ( ) , Glue ) ; Chain = RetValue . getValue ( <NUM_LIT> ) ; Glue = RetValue . getValue ( <NUM_LIT> ) ; InVals . push_back ( Chain . getValue ( <NUM_LIT> ) ) ;


<s> if ( CP -> isMachineConstantPoolEntry ( ) ) return DAG . getTargetConstantPool ( CP -> getMachineCPVal ( ) , PtrVT , CP -> getAlignment ( ) ) ;

else return DAG . getTargetConstantPool ( CP -> getConstVal ( ) , PtrVT , CP -> getAlignment ( ) ) ;


<s> SDValue Res = [ & ] { if ( CP -> isMachineConstantPoolEntry ( ) ) return DAG . getTargetConstantPool ( CP -> getMachineCPVal ( ) , PtrVT , CP -> getAlignment ( ) ) ;


<s> CCValAssign & VA = ArgLocs [ i ] ; MVT RegVT = VA . getLocVT ( ) ; const TargetRegisterClass * RC = getRegClassFor ( RegVT ) ; unsigned Reg = MF . addLiveIn ( VA . getLocReg ( ) , RC ) ; SDValue ArgValue = DAG . getCopyFromReg ( Chain , DL , Reg , RegVT ) ; InVals . push_back ( ArgValue ) ; }


<s> auto PtrVT = getPointerTy ( DAG . getDataLayout ( ) ) ; const GlobalValue * GV = cast < GlobalAddressSDNode > ( Op ) -> getGlobal ( ) ; auto * CPV = <ISA_LIT>ConstantPoolValue :: Create ( GV ) ; auto CP = DAG . getTargetConstantPool ( CPV , PtrVT , <NUM_LIT> ) ; CP = DAG . getNode ( <STR_LIT> , DL , <STR_LIT> , CP ) ; return DAG . getLoad ( PtrVT , DL , DAG . getEntryNode ( ) , CP , MachinePointerInfo :: getConstantPool ( MF ) , <NUM_LIT> ) ;


<s> switch ( Op . getOpcode ( ) ) { case <STR_LIT> : return LowerGlobalAddress ( Op , DAG ) ; case <STR_LIT> :


<s> auto Shift = Con -> getSExtValue ( ) ; auto InitShift = [ & ] ( ) -> uint8_t { if ( ! Shift || std :: find ( std :: begin ( Ls ) , std :: end ( Ls ) , Shift ) != std :: end ( Ls ) ) { auto Ret = Shift ; Shift = <NUM_LIT> ; return Ret ; } if ( Shift % <NUM_LIT> == <NUM_LIT> ) { Shift -= <NUM_LIT> ; return <NUM_LIT> ; } Shift -= <NUM_LIT> ; return <NUM_LIT> ; } ( ) ; SDValue Res = DAG . getNode ( Opcode , DL , <STR_LIT> , LHS , DAG . getConstant ( InitShift , DL , <STR_LIT> ) ) ; size_t CurrentSize = <NUM_LIT> ;


<s> <ISA_LIT>MCAsmInfo :: <ISA_LIT>MCAsmInfo ( const Triple & TheTriple ) { CodePointerSize = CalleeSaveStackSlotSize = <NUM_LIT> ;


<s> MCCodeEmitter * create<ISA_LIT>MCCodeEmitter ( const MCInstrInfo & MCII , const MCRegisterInfo & MRI , MCContext & Ctx ) { return new <ISA_LIT>MCCodeEmitter ( MCII , Ctx ) ;


<s> unsigned Shift = i * <NUM_LIT> ; EmitByte ( ( Val >> Shift ) & <NUM_LIT> , OS ) ;


<s> void <ISA_LIT>MCCodeEmitter :: EmitInstruction ( uint64_t Val , unsigned Size , const MCSubtargetInfo & STI , raw_ostream & OS ) const {

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


<s> unsigned Size = Desc . getSize ( ) ; if ( ! Size ) llvm_unreachable ( <STR_LIT> ) ; EmitInstruction ( Binary , Size , STI , OS ) ;


<s> if ( MO . isImm ( ) ) < unsigned > ( MO . getImm ( ) ) ; assert ( MO . isExpr ( ) && MO . getExpr ( ) -> getKind ( ) == MCExpr :: SymbolRef ) ; <STR_LIT> FixupKind = <STR_LIT> ; switch ( MI . getOpcode ( ) ) { case <STR_LIT> : case <STR_LIT> : FixupKind = <STR_LIT> ; break ;


<s> case <STR_LIT> : case <STR_LIT> : FixupKind = <STR_LIT> ; break ; case <STR_LIT> : FixupKind = <STR_LIT> ; break ; case <STR_LIT> : FixupKind = <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } Fixups . push_back ( MCFixup :: create ( <NUM_LIT> , MO . getExpr ( ) , MCFixupKind ( FixupKind ) , MI . getLoc ( ) ) ) ;


<s> <ISA_LIT>MCCodeEmitter ( const MCInstrInfo & mcii , MCContext & Ctx_ ) : MCII ( mcii ) , Ctx ( Ctx_ ) {


<s> MCSymbol * <ISA_LIT>MCInstLower :: GetExternalSymbolSymbol ( const MachineOperand & MO ) const {

return Printer . GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) ;


<s> MCSymbol * <ISA_LIT>MCInstLower :: GetExternalSymbolSymbol ( const MachineOperand & MO ) const { return Printer . GetExternalSymbolSymbol ( MO . getSymbolName ( ) ) ;


<s> public : <ISA_LIT>MCInstLower ( MCContext & ctx , AsmPrinter & printer ) : Ctx ( ctx ) , Printer ( printer ) { } using MachineOperandType = MachineOperand :: MachineOperandType ; void Lower ( const MachineInstr * MI , MCInst & OutMI ) const ; MCOperand LowerOperand ( const MachineOperand & MO ) const ; MCOperand LowerSymbolOperand ( const MachineOperand & MO , MCSymbol * Sym ) const ; MCSymbol * GetGlobalAddressSymbol ( const MachineOperand & MO ) const ; MCSymbol * GetExternalSymbolSymbol ( const MachineOperand & MO ) const ;


<s> void Lower ( const MachineInstr * MI , MCInst & OutMI ) const ; MCOperand LowerOperand ( const MachineOperand & MO ) const ; MCOperand LowerSymbolOperand ( const MachineOperand & MO , MCSymbol * Sym ) const ;

MCSymbol * GetGlobalAddressSymbol ( const MachineOperand & MO ) const ;


<s> for ( unsigned i = <NUM_LIT> , e = MI -> getNumOperands ( ) ; i != e ; ++ i ) { const MachineOperand & MO = MI -> getOperand ( i ) ; MCOperand MCOp = LowerOperand ( MO ) ; if ( MCOp . isValid ( ) ) OutMI . addOperand ( MCOp ) ; }


<s> switch ( MOTy ) { default : llvm_unreachable ( <STR_LIT> ) ; case MachineOperand :: MO_Register : if ( MO . isImplicit ( ) ) break ; return MCOperand :: createReg ( MO . getReg ( ) ) ; case MachineOperand :: MO_Immediate : return MCOperand :: createImm ( MO . getImm ( ) ) ; case MachineOperand :: MO_GlobalAddress : return LowerSymbolOperand ( MO , GetGlobalAddressSymbol ( MO ) ) ; case MachineOperand :: MO_ExternalSymbol : return LowerSymbolOperand ( MO , GetExternalSymbolSymbol ( MO ) ) ; case MachineOperand :: MO_MachineBasicBlock : return MCOperand :: createExpr ( MCSymbolRefExpr :: create ( MO . getMBB ( ) -> getSymbol ( ) , Ctx ) ) ; case MachineOperand :: MO_ConstantPoolIndex : return LowerSymbolOperand ( MO , Printer . GetCPISymbol ( MO . getIndex ( ) ) ) ; }


<s> if ( MO . getOffset ( ) ) Expr = MCBinaryExpr :: createAdd ( Expr , MCConstantExpr :: create ( MO . getOffset ( ) , Printer . OutContext ) , Printer . OutContext ) ; return MCOperand :: createExpr ( Expr ) ;


<s> static MCTargetStreamer * create<ISA_LIT>AsmTargetStreamer ( MCStreamer & S , formatted_raw_ostream & OS , MCInstPrinter * InstPrint , bool isVerboseAsm ) {

return new <ISA_LIT>TargetAsmStreamer ( S ) ;


<s> MCInstrInfo * X = new MCInstrInfo ( ) ;


<s> Init<ISA_LIT>MCRegisterInfo ( X , <STR_LIT> ) ; return X ;


<s> MCRegisterInfo * X = new MCRegisterInfo ( ) ;

Init<ISA_LIT>MCRegisterInfo ( X , <STR_LIT> ) ;


<s> static MCSubtargetInfo * create<ISA_LIT>MCSubtargetInfo ( const Triple & TT , StringRef CPU , StringRef FS ) {


<s> static MCTargetStreamer * create<ISA_LIT>ObjectTargetStreamer ( MCStreamer & S , const MCSubtargetInfo & STI ) {

return new <ISA_LIT>TargetELFStreamer ( S ) ;


<s> TargetRegistry :: RegisterMCInstrInfo ( * T , create<ISA_LIT>MCInstrInfo ) ; RegisterMCAsmInfoFn X ( * T , create<ISA_LIT>MCAsmInfo ) ; TargetRegistry :: RegisterAsmTargetStreamer ( * T , create<ISA_LIT>AsmTargetStreamer ) ; TargetRegistry :: RegisterObjectTargetStreamer ( * T , create<ISA_LIT>ObjectTargetStreamer ) ; TargetRegistry :: RegisterMCInstPrinter ( * T , create<ISA_LIT>MCInstPrinter ) ; TargetRegistry :: RegisterMCSubtargetInfo ( * T , create<ISA_LIT>MCSubtargetInfo ) ; TargetRegistry :: RegisterMCAsmBackend ( * T , create<ISA_LIT>AsmBackend ) ; TargetRegistry :: RegisterMCCodeEmitter ( * T , create<ISA_LIT>MCCodeEmitter ) ;


<s> if ( CPU . empty ( ) || CPU == <STR_LIT> ) { CPU = <STR_LIT> ;


<s> StringRef <STR_LIT> ( const Triple & TT , StringRef CPU ) {

if ( CPU . empty ( ) || CPU == <STR_LIT> ) {


<s> DebugLoc DL = MI . getDebugLoc ( ) ; int FrameIdx = MI . getOperand ( FIOperandNum ) . getIndex ( ) ;

auto isCalleeSaved = isCalleeSavedIndex ( FrameIdx , MF . getFrameInfo ( ) ) ;


<s> const MCPhysReg * <ISA_LIT>RegisterInfo :: getCalleeSavedRegs ( const MachineFunction * MF ) const {


<s> <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> , <STR_LIT> } ; BitVector Reserved ( getNumRegs ( ) ) ;

for ( auto Reg : ReservedRegs ) Reserved . set ( Reg ) ;


<s> return FrameIdx >= CSI . front ( ) . getFrameIdx ( ) && FrameIdx <= CSI . back ( ) . getFrameIdx ( ) ;


<s> if ( CSI . empty ( ) ) return false ; return FrameIdx >= CSI . front ( ) . getFrameIdx ( ) && FrameIdx <= CSI . back ( ) . getFrameIdx ( ) ;


<s> <ISA_LIT>RegisterInfo :: <ISA_LIT>RegisterInfo ( ) : <ISA_LIT>GenRegisterInfo ( <STR_LIT> ) {


<s> const <ISA_LIT>FrameLowering * getFrameLowering ( ) const override { return & FrameLowering ;


<s> const <ISA_LIT>RegisterInfo * getRegisterInfo ( ) const override { return & RegisterInfo ;


<s> Target & getThe<ISA_LIT>Target ( ) { static Target The<ISA_LIT>Target ; return The<ISA_LIT>Target ;


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

TargetRegistry :: RegisterTarget ( getThe<ISA_LIT>Target ( ) , <STR_LIT> , <STR_LIT> , <STR_LIT> , [ ] ( Triple :: ArchType ) { return false ; } , false ) ;


<s> TargetRegistry :: RegisterTarget ( getThe<ISA_LIT>Target ( ) , <STR_LIT> , <STR_LIT> , <STR_LIT> , [ ] ( Triple :: ArchType ) { return false ; } , false ) ;

RegisterTarget < Triple :: j2 , false > X ( getThe<ISA_LIT>Target ( ) , <STR_LIT> , <STR_LIT> , <STR_LIT> ) ;


<s> bool addInstSelector ( ) override { addPass ( new <ISA_LIT>DAGToDAGISel ( get<ISA_LIT>TargetMachine ( ) ) ) ; return false ;


<s> addPass ( create<ISA_LIT>ConstantIslandPass ( ) ) ;


<s> static std :: string computeDataLayout ( const Triple & TT ) {


<s> addPass ( new <ISA_LIT>DAGToDAGISel ( get<ISA_LIT>TargetMachine ( ) ) ) ; return false ; } void addPreEmitPass ( ) override { addPass ( create<ISA_LIT>DelaySlotFillerPass ( get<ISA_LIT>TargetMachine ( ) ) ) ; addPass ( create<ISA_LIT>ConstantIslandPass ( ) ) ; } } ;

return new <ISA_LIT>PassConfig ( this , PM ) ;


<s> if ( ! RM . hasValue ( ) ) return Reloc :: Static ; return * RM ;


<s> <ISA_LIT>TargetMachine & get<ISA_LIT>TargetMachine ( ) const {

return getTM < <ISA_LIT>TargetMachine > ( ) ;


<s> const <ISA_LIT>Subtarget * getSubtargetImpl ( const Function & F ) const override {


<s> <ISA_LIT>PassConfig ( <ISA_LIT>TargetMachine * TM , PassManagerBase & PM ) : TargetPassConfig ( * TM , PM ) {


<s> <ISA_LIT>TargetMachine :: <ISA_LIT>TargetMachine ( const Target & T , const Triple & TT , StringRef CPU , StringRef FS , const TargetOptions & Options , Optional < Reloc :: Model > RM , Optional < CodeModel :: Model > CM , CodeGenOpt :: Level OL , bool JIT ) : LLVMTargetMachine ( T , computeDataLayout ( TT ) , TT , CPU , FS , Options , getEffectiveRelocModel ( RM ) , getEffectiveCodeModel ( CM ) , OL ) , TLOF ( make_unique < <ISA_LIT>TargetObjectFile > ( ) ) , Subtarget ( TT , CPU , FS , * this ) {


<s> <ISA_LIT>TargetMachine :: <ISA_LIT>TargetMachine ( const Target & T , const Triple & TT , StringRef CPU , StringRef FS , const TargetOptions & Options , Optional < Reloc :: Model > RM , Optional < CodeModel :: Model > CM , CodeGenOpt :: Level OL , bool JIT ) : LLVMTargetMachine ( T , computeDataLayout ( TT ) , TT , CPU , FS , Options , getEffectiveRelocModel ( RM ) , getEffectiveCodeModel ( CM ) , OL ) , TLOF ( make_unique < <ISA_LIT>TargetObjectFile > ( ) ) , Subtarget ( TT , CPU , FS , * this ) { initAsmInfo ( ) ;


<s> RegisterTargetMachine < <ISA_LIT>TargetMachine > X ( getThe<ISA_LIT>Target ( ) ) ;


<s> void LLVMInitialize<ISA_LIT>Target ( ) { RegisterTargetMachine < <ISA_LIT>TargetMachine > X ( getThe<ISA_LIT>Target ( ) ) ;