static name *GetNTTLSDataRef( instruction *ins, name *op, type_class_def tipe ) /********************************************************************************** Emit instructions to load allow a reference to op (a piece of TLS data) and return the resulting index name. */ { name *tls_index; name *tls_array; name *t1; name *t2; name *t3; name *temp_index; name *result_index; instruction *new_ins; tls_index = RTMemRef( RT_TLS_INDEX ); tls_array = RTMemRef( RT_TLS_ARRAY ); t1 = AllocTemp( WD ); t2 = AllocTemp( WD ); t3 = AllocTemp( WD ); new_ins = MakeMove( tls_array, t1, WD ); AddSegOverride( new_ins, HW_FS ); PrefixIns( ins, new_ins ); new_ins = MakeMove( tls_index, t2, WD ); PrefixIns( ins, new_ins ); new_ins = MakeBinary( OP_MUL, t2, AllocS32Const( 4 ), t2, WD ); PrefixIns( ins, new_ins ); new_ins = MakeBinary( OP_ADD, t1, t2, t1, WD ); PrefixIns( ins, new_ins ); temp_index = AllocIndex( t1, NULL, 0, WD ); new_ins = MakeMove( temp_index, t3, WD ); PrefixIns( ins, new_ins ); result_index = ScaleIndex( t3, op, op->v.offset, tipe, TypeClassSize[ tipe ], 0, 0 ); return( result_index ); }
static name *DisplayField( int level ) /****************************************/ { name *reg; reg = AllocRegName( DisplayReg() ); return( AllocIndex( reg, NULL, (-2) * level, reg->n.name_class ) ); }
extern bool AskIsFrameIndex( name *op ) { /*********************************************/ name *bp; bp = AllocRegName( DisplayReg() ); return( op == AllocIndex( bp, NULL, -1, bp->n.name_class ) ); }
extern name *MakeDisplay( name *op, int level ) /*************************************************/ { name *temp; name *reg; reg = AllocRegName( DisplayReg() ); temp = AllocTemp( U2 ); AddIns( MakeMove( DisplayField( level ), temp, reg->n.name_class ) ); op = AllocIndex( temp, NULL, op->t.location, op->n.name_class ); return( op ); }
extern void BigLabel( void ) /******************************/ { instruction *ins; name *bp; name *sp; if( CurrProc->lex_level != 0 ) { bp = AllocRegName( DisplayReg() ); sp = AllocRegName( StackReg() ); ins = MakeUnary( OP_LA, AllocIndex( bp, NULL, -1, bp->n.name_class ), sp, sp->n.name_class ); } else { ins = MakeNop(); } ins->zap = (register_name *) AllocRegName( AllCacheRegs() ); ins->flags.nop_flags |= NOP_ZAP_INFO; AddIns( ins ); }