15 #define DEBUG_TYPE "x86-emitter"
39 STATISTIC(NumEmitted,
"Number of machine instructions emitted");
42 template<
class CodeEmitter>
56 MCE(mce), PICBaseOffset(0), Is64BitMode(
false),
57 IsPIC(
TM.getRelocationModel() == Reloc::
PIC_) {}
61 virtual const char *getPassName()
const {
62 return "X86 Machine Code Emitter";
65 void emitOpcodePrefix(uint64_t TSFlags,
int MemOperand,
69 void emitVEXOpcodePrefix(uint64_t TSFlags,
int MemOperand,
73 void emitSegmentOverridePrefix(uint64_t TSFlags,
87 void emitGlobalAddress(
const GlobalValue *GV,
unsigned Reloc,
89 bool Indirect =
false);
90 void emitExternalSymbolAddress(
const char *ES,
unsigned Reloc);
91 void emitConstPoolAddress(
unsigned CPI,
unsigned Reloc,
intptr_t Disp = 0,
93 void emitJumpTableAddress(
unsigned JTI,
unsigned Reloc,
96 void emitDisplacementField(
const MachineOperand *RelocOp,
int DispVal,
97 intptr_t Adj = 0,
bool IsPCRel =
true);
99 void emitRegModRMByte(
unsigned ModRMReg,
unsigned RegOpcodeField);
100 void emitRegModRMByte(
unsigned RegOpcodeField);
101 void emitSIBByte(
unsigned SS,
unsigned Index,
unsigned Base);
102 void emitConstant(uint64_t Val,
unsigned Size);
105 unsigned Op,
unsigned RegOpcodeField,
108 unsigned getX86RegNum(
unsigned RegNo)
const {
114 unsigned OpNum)
const;
117 template<
class CodeEmitter>
125 return new Emitter<JITCodeEmitter>(
TM, JCE);
128 template<
class CodeEmitter>
130 MMI = &getAnalysis<MachineModuleInfo>();
131 MCE.setModuleInfo(MMI);
133 II =
TM.getInstrInfo();
134 TD =
TM.getDataLayout();
140 MCE.startFunction(MF);
143 MCE.StartMachineBasicBlock(MBB);
147 emitInstruction(*
I, &Desc);
150 emitInstruction(*
I, &II->get(X86::POP32r));
154 }
while (MCE.finishFunction(MF));
174 bool isTwoAddr = NumOps > 1 &&
178 unsigned i = isTwoAddr ? 1 : 0;
179 for (
unsigned e = NumOps; i != e; ++i) {
191 REX |= (1 << 0) | (1 << 2);
196 i = isTwoAddr ? 2 : 1;
197 for (
unsigned e = NumOps; i != e; ++i) {
208 i = isTwoAddr ? 2 : 1;
209 for (; i != NumOps; ++i) {
225 i = isTwoAddr ? 1 : 0;
229 for (; i != e; ++i) {
242 i = isTwoAddr ? 2 : 1;
243 for (
unsigned e = NumOps; i != e; ++i) {
260 template<
class CodeEmitter>
272 template<
class CodeEmitter>
273 void Emitter<CodeEmitter>::emitGlobalAddress(
const GlobalValue *GV,
280 RelocCST = PICBaseOffset;
289 MCE.addRelocation(MR);
292 MCE.emitDWordLE(Disp);
294 MCE.emitWordLE((int32_t)Disp);
300 template<
class CodeEmitter>
301 void Emitter<CodeEmitter>::emitExternalSymbolAddress(
const char *ES,
309 bool NeedStub =
false;
322 template<
class CodeEmitter>
323 void Emitter<CodeEmitter>::emitConstPoolAddress(
unsigned CPI,
unsigned Reloc,
328 RelocCST = PICBaseOffset;
332 Reloc, CPI, RelocCST));
335 MCE.emitDWordLE(Disp);
337 MCE.emitWordLE((int32_t)Disp);
343 template<
class CodeEmitter>
344 void Emitter<CodeEmitter>::emitJumpTableAddress(
unsigned JTI,
unsigned Reloc,
348 RelocCST = PICBaseOffset;
352 Reloc, JTI, RelocCST));
360 inline static unsigned char ModRMByte(
unsigned Mod,
unsigned RegOpcode,
362 assert(Mod < 4 && RegOpcode < 8 && RM < 8 &&
"ModRM Fields out of range!");
363 return RM | (RegOpcode << 3) | (Mod << 6);
366 template<
class CodeEmitter>
367 void Emitter<CodeEmitter>::emitRegModRMByte(
unsigned ModRMReg,
368 unsigned RegOpcodeFld){
369 MCE.emitByte(
ModRMByte(3, RegOpcodeFld, getX86RegNum(ModRMReg)));
372 template<
class CodeEmitter>
373 void Emitter<CodeEmitter>::emitRegModRMByte(
unsigned RegOpcodeFld) {
374 MCE.emitByte(
ModRMByte(3, RegOpcodeFld, 0));
377 template<
class CodeEmitter>
378 void Emitter<CodeEmitter>::emitSIBByte(
unsigned SS,
382 MCE.emitByte(
ModRMByte(SS, Index, Base));
385 template<
class CodeEmitter>
386 void Emitter<CodeEmitter>::emitConstant(uint64_t Val,
unsigned Size) {
388 for (
unsigned i = 0; i != Size; ++i) {
389 MCE.emitByte(Val & 255);
397 return Value == (
signed char)Value;
413 template<
class CodeEmitter>
414 void Emitter<CodeEmitter>::emitDisplacementField(
const MachineOperand *RelocOp,
421 emitConstant(DispVal, 4);
427 unsigned RelocType = Is64BitMode ?
440 emitExternalSymbolAddress(RelocOp->
getSymbolName(), RelocType);
441 }
else if (RelocOp->
isCPI()) {
442 emitConstPoolAddress(RelocOp->
getIndex(), RelocType,
445 assert(RelocOp->
isJTI() &&
"Unexpected machine operand!");
446 emitJumpTableAddress(RelocOp->
getIndex(), RelocType, Adj);
450 template<
class CodeEmitter>
451 void Emitter<CodeEmitter>::emitMemModRMByte(
const MachineInstr &
MI,
452 unsigned Op,
unsigned RegOpcodeField,
463 }
else if (Op3.
isCPI()) {
464 if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) {
467 DispVal += MCE.getConstantPoolEntryAddress(Op3.
getIndex());
470 }
else if (Op3.
isJTI()) {
471 if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) {
474 DispVal += MCE.getJumpTableEntryAddress(Op3.
getIndex());
484 unsigned BaseReg = Base.
getReg();
487 if (BaseReg == X86::RIP ||
488 (Is64BitMode && DispForReloc)) {
489 assert(IndexReg.
getReg() == 0 && Is64BitMode &&
490 "Invalid rip-relative address");
491 MCE.emitByte(
ModRMByte(0, RegOpcodeField, 5));
492 emitDisplacementField(DispForReloc, DispVal, PCAdj,
true);
499 bool IsPCRel = MCE.earlyResolveAddresses() ?
true :
false;
505 unsigned BaseRegNo = -1U;
506 if (BaseReg != 0 && BaseReg != X86::RIP)
507 BaseRegNo = getX86RegNum(BaseReg);
517 (!Is64BitMode || BaseReg != 0)) {
519 BaseReg == X86::RIP) {
520 MCE.emitByte(
ModRMByte(0, RegOpcodeField, 5));
521 emitDisplacementField(DispForReloc, DispVal, PCAdj,
true);
529 if (!DispForReloc && DispVal == 0 && BaseRegNo !=
N86::EBP) {
530 MCE.emitByte(
ModRMByte(0, RegOpcodeField, BaseRegNo));
535 if (!DispForReloc &&
isDisp8(DispVal)) {
536 MCE.emitByte(
ModRMByte(1, RegOpcodeField, BaseRegNo));
537 emitConstant(DispVal, 1);
542 MCE.emitByte(
ModRMByte(2, RegOpcodeField, BaseRegNo));
543 emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel);
549 IndexReg.
getReg() != X86::RSP &&
"Cannot use ESP as index reg!");
551 bool ForceDisp32 =
false;
552 bool ForceDisp8 =
false;
556 MCE.emitByte(
ModRMByte(0, RegOpcodeField, 4));
558 }
else if (DispForReloc) {
560 MCE.emitByte(
ModRMByte(2, RegOpcodeField, 4));
562 }
else if (DispVal == 0 && BaseRegNo !=
N86::EBP) {
564 MCE.emitByte(
ModRMByte(0, RegOpcodeField, 4));
567 MCE.emitByte(
ModRMByte(1, RegOpcodeField, 4));
571 MCE.emitByte(
ModRMByte(2, RegOpcodeField, 4));
575 static const unsigned SSTable[] = { ~0U, 0, 1, ~0U, 2, ~0U, ~0U, ~0U, 3 };
576 unsigned SS = SSTable[Scale.
getImm()];
583 IndexRegNo = getX86RegNum(IndexReg.
getReg());
586 emitSIBByte(SS, IndexRegNo, 5);
588 unsigned BaseRegNo = getX86RegNum(BaseReg);
591 IndexRegNo = getX86RegNum(IndexReg.
getReg());
594 emitSIBByte(SS, IndexRegNo, BaseRegNo);
599 emitConstant(DispVal, 1);
600 }
else if (DispVal != 0 || ForceDisp32) {
601 emitDisplacementField(DispForReloc, DispVal, PCAdj, IsPCRel);
618 if ((BaseReg.
getReg() != 0 &&
619 X86MCRegisterClasses[X86::GR16RegClassID].contains(BaseReg.
getReg())) ||
620 (IndexReg.
getReg() != 0 &&
621 X86MCRegisterClasses[X86::GR16RegClassID].contains(IndexReg.
getReg())))
632 if ((BaseReg.
getReg() != 0 &&
633 X86MCRegisterClasses[X86::GR32RegClassID].contains(BaseReg.
getReg())) ||
634 (IndexReg.
getReg() != 0 &&
635 X86MCRegisterClasses[X86::GR32RegClassID].contains(IndexReg.
getReg())))
647 if ((BaseReg.
getReg() != 0 &&
648 X86MCRegisterClasses[X86::GR64RegClassID].contains(BaseReg.
getReg())) ||
649 (IndexReg.
getReg() != 0 &&
650 X86MCRegisterClasses[X86::GR64RegClassID].contains(IndexReg.
getReg())))
656 template<
class CodeEmitter>
657 void Emitter<CodeEmitter>::emitOpcodePrefix(uint64_t TSFlags,
666 emitSegmentOverridePrefix(TSFlags, MemOperand, MI);
673 bool need_address_override;
675 need_address_override =
true;
676 }
else if (MemOperand == -1) {
677 need_address_override =
false;
678 }
else if (Is64BitMode) {
686 if (need_address_override)
693 bool Need0FPrefix =
false;
727 MCE.emitByte(0x40 | REX);
762 template<
class CodeEmitter>
764 Emitter<CodeEmitter>::getVEXRegisterEncoding(
const MachineInstr &MI,
765 unsigned OpNum)
const {
773 return (~SrcRegNum) & 0xf;
777 template<
class CodeEmitter>
778 void Emitter<CodeEmitter>::emitSegmentOverridePrefix(uint64_t TSFlags,
785 if (MemOperand != -1) {
789 case X86::CS: MCE.emitByte(0x2E);
break;
790 case X86::SS: MCE.emitByte(0x36);
break;
791 case X86::DS: MCE.emitByte(0x3E);
break;
792 case X86::ES: MCE.emitByte(0x26);
break;
793 case X86::FS: MCE.emitByte(0x64);
break;
794 case X86::GS: MCE.emitByte(0x65);
break;
807 template<
class CodeEmitter>
808 void Emitter<CodeEmitter>::emitVEXOpcodePrefix(uint64_t TSFlags,
822 unsigned char VEX_R = 0x1;
829 unsigned char VEX_X = 0x1;
836 unsigned char VEX_B = 0x1;
840 unsigned char VEX_W = 0;
855 unsigned char VEX_5M = 0x1;
859 unsigned char VEX_4V = 0xf;
866 unsigned char VEX_L = 0;
876 unsigned char VEX_PP = 0;
879 if (TSFlags & X86II::OpSize)
950 VEX_4V = getVEXRegisterEncoding(MI, CurOp);
954 VEX_4V = getVEXRegisterEncoding(MI, CurOp);
969 VEX_4V = getVEXRegisterEncoding(MI, CurOp++);
991 VEX_4V = getVEXRegisterEncoding(MI, CurOp);
1013 VEX_4V = getVEXRegisterEncoding(MI, CurOp++);
1034 VEX_4V = getVEXRegisterEncoding(MI, CurOp++);
1043 VEX_4V = getVEXRegisterEncoding(MI, CurOp);
1055 VEX_4V = getVEXRegisterEncoding(MI, CurOp++);
1066 VEX_4V = getVEXRegisterEncoding(MI, CurOp);
1077 emitSegmentOverridePrefix(TSFlags, MemOperand, MI);
1090 unsigned char LastByte = VEX_PP | (VEX_L << 2) | (VEX_4V << 3);
1092 if (VEX_B && VEX_X && !VEX_W && !XOP && (VEX_5M == 1)) {
1094 MCE.emitByte(LastByte | (VEX_R << 7));
1099 MCE.emitByte(XOP ? 0x8F : 0xC4);
1100 MCE.emitByte(VEX_R << 7 | VEX_X << 6 | VEX_B << 5 | VEX_5M);
1101 MCE.emitByte(LastByte | (VEX_W << 7));
1104 template<
class CodeEmitter>
1105 void Emitter<CodeEmitter>::emitInstruction(
MachineInstr &MI,
1111 case X86::ADD16rr_DB: Desc =
UpdateOp(MI, II, X86::OR16rr);
break;
1112 case X86::ADD32rr_DB: Desc =
UpdateOp(MI, II, X86::OR32rr);
break;
1113 case X86::ADD64rr_DB: Desc =
UpdateOp(MI, II, X86::OR64rr);
break;
1114 case X86::ADD16ri_DB: Desc =
UpdateOp(MI, II, X86::OR16ri);
break;
1115 case X86::ADD32ri_DB: Desc =
UpdateOp(MI, II, X86::OR32ri);
break;
1116 case X86::ADD64ri32_DB: Desc =
UpdateOp(MI, II, X86::OR64ri32);
break;
1117 case X86::ADD16ri8_DB: Desc =
UpdateOp(MI, II, X86::OR16ri8);
break;
1118 case X86::ADD32ri8_DB: Desc =
UpdateOp(MI, II, X86::OR32ri8);
break;
1119 case X86::ADD64ri8_DB: Desc =
UpdateOp(MI, II, X86::OR64ri8);
break;
1120 case X86::ACQUIRE_MOV8rm: Desc =
UpdateOp(MI, II, X86::MOV8rm);
break;
1121 case X86::ACQUIRE_MOV16rm: Desc =
UpdateOp(MI, II, X86::MOV16rm);
break;
1122 case X86::ACQUIRE_MOV32rm: Desc =
UpdateOp(MI, II, X86::MOV32rm);
break;
1123 case X86::ACQUIRE_MOV64rm: Desc =
UpdateOp(MI, II, X86::MOV64rm);
break;
1124 case X86::RELEASE_MOV8mr: Desc =
UpdateOp(MI, II, X86::MOV8mr);
break;
1125 case X86::RELEASE_MOV16mr: Desc =
UpdateOp(MI, II, X86::MOV16mr);
break;
1126 case X86::RELEASE_MOV32mr: Desc =
UpdateOp(MI, II, X86::MOV32mr);
break;
1127 case X86::RELEASE_MOV64mr: Desc =
UpdateOp(MI, II, X86::MOV64mr);
break;
1133 unsigned Opcode = Desc->
Opcode;
1147 uint64_t TSFlags = Desc->
TSFlags;
1155 const unsigned MemOp4_I8IMMOperand = 2;
1159 if (MemoryOperand != -1) MemoryOperand += CurOp;
1162 emitOpcodePrefix(TSFlags, MemoryOperand, MI, Desc);
1164 emitVEXOpcodePrefix(TSFlags, MemoryOperand, MI, Desc);
1167 switch (TSFlags & X86II::FormMask) {
1179 case X86::Int_MemBarrier:
1198 case X86::MOVPC32r: {
1200 MCE.emitByte(BaseOpcode);
1203 PICBaseOffset = (
intptr_t) MCE.getCurrentPCOffset();
1212 MCE.emitByte(BaseOpcode);
1214 if (CurOp == NumOps)
1219 DEBUG(
dbgs() <<
"RawFrm CurOp " << CurOp <<
"\n");
1226 emitPCRelativeBlockAddress(MO.
getMBB());
1247 assert(MO.
isImm() &&
"Unknown RawFrm operand!");
1248 if (Opcode == X86::CALLpcrel32 || Opcode == X86::CALL64pcrel32) {
1251 Imm = Imm - MCE.getCurrentPCValue() - 4;
1259 MCE.emitByte(BaseOpcode +
1262 if (CurOp == NumOps)
1268 emitConstant(MO1.
getImm(), Size);
1274 if (Opcode == X86::MOV32ri64)
1277 if (Opcode == X86::MOV64ri)
1285 else if (MO1.
isCPI())
1286 emitConstPoolAddress(MO1.
getIndex(), rt);
1287 else if (MO1.
isJTI())
1288 emitJumpTableAddress(MO1.
getIndex(), rt);
1293 MCE.emitByte(BaseOpcode);
1295 unsigned SrcRegNum = CurOp+1;
1301 CurOp = SrcRegNum + 1;
1305 MCE.emitByte(BaseOpcode);
1310 emitMemModRMByte(MI, CurOp,
1312 CurOp = SrcRegNum + 1;
1317 MCE.emitByte(BaseOpcode);
1319 unsigned SrcRegNum = CurOp+1;
1329 CurOp = HasMemOp4 ? SrcRegNum : SrcRegNum + 1;
1336 unsigned FirstMemOp = CurOp+1;
1344 MCE.emitByte(BaseOpcode);
1346 intptr_t PCAdj = (CurOp + AddrOperands + 1 != NumOps) ?
1348 emitMemModRMByte(MI, FirstMemOp,
1350 CurOp += AddrOperands + 1;
1362 MCE.emitByte(BaseOpcode);
1366 if (CurOp == NumOps)
1372 emitConstant(MO1.
getImm(), Size);
1378 if (Opcode == X86::MOV64ri32)
1386 else if (MO1.
isCPI())
1387 emitConstPoolAddress(MO1.
getIndex(), rt);
1388 else if (MO1.
isJTI())
1389 emitJumpTableAddress(MO1.
getIndex(), rt);
1399 intptr_t PCAdj = (CurOp + X86::AddrNumOperands != NumOps) ?
1403 MCE.emitByte(BaseOpcode);
1408 if (CurOp == NumOps)
1414 emitConstant(MO.
getImm(), Size);
1420 if (Opcode == X86::MOV64mi32)
1428 else if (MO.
isCPI())
1429 emitConstPoolAddress(MO.
getIndex(), rt);
1430 else if (MO.
isJTI())
1431 emitJumpTableAddress(MO.
getIndex(), rt);
1436 MCE.emitByte(BaseOpcode);
1444 MCE.emitByte(BaseOpcode);
1448 MCE.emitByte(BaseOpcode);
1452 MCE.emitByte(BaseOpcode);
1456 MCE.emitByte(BaseOpcode);
1460 MCE.emitByte(BaseOpcode);
1464 MCE.emitByte(BaseOpcode);
1468 MCE.emitByte(BaseOpcode);
1473 while (CurOp != NumOps && NumOps - CurOp <= 2) {
1480 unsigned RegNum = getX86RegNum(MO.
getReg()) << 4;
1485 if (CurOp != NumOps) {
1488 unsigned Val = MIMM.
getImm();
1489 assert(Val < 16 &&
"Immediate operand value out of range");
1493 emitConstant(RegNum, 1);
1502 dbgs() <<
"Cannot encode all operands of: " << MI <<
"\n";
AddrSegmentReg - The operand # of the segment in the memory operand.
const GlobalValue * getGlobal() const
FunctionPass * createX86JITCodeEmitterPass(X86TargetMachine &TM, JITCodeEmitter &JCE)
bool isX86_64NonExtLowByteReg(unsigned reg)
MachineBasicBlock * getMBB() const
const MCInstrDesc & getDesc() const
const char * getSymbolName() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
AnalysisUsage & addRequired()
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
#define llvm_unreachable(msg)
static unsigned determineREX(const MachineInstr &MI)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static bool isGlobalStubReference(unsigned char TargetFlag)
static MachineRelocation getIndirectSymbol(uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool MayNeedFarStub=0, bool GOTrelative=0)
ID
LLVM Calling Convention Representation.
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
static bool Is64BitMemOperand(const MachineInstr &MI, unsigned Op)
static MachineRelocation getBB(uintptr_t offset, unsigned RelocationType, MachineBasicBlock *MBB, intptr_t cst=0)
bool isX86_64ExtendedReg(unsigned RegNo)
bundle_iterator< MachineInstr, instr_iterator > iterator
unsigned getTargetFlags() const
const MachineOperand & getOperand(unsigned i) const
static bool isX86_64ExtendedReg(const MachineOperand &MO)
void setPICBase(uintptr_t Base)
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isVariadic(QueryType Type=IgnoreBundle) const
int64_t getOffset() const
AddrNumOperands - Total number of operands in a memory reference.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set. Returns -1 if it is not set...
unsigned getOpcode() const
Return the opcode number for this descriptor.
static bool gvNeedsNonLazyPtr(const MachineOperand &GVOp, const TargetMachine &TM)
void setDesc(const MCInstrDesc &tid)
const STC & getSubtarget() const
static bool isDisp8(int Value)
static bool Is32BitMemOperand(const MachineInstr &MI, unsigned Op)
unsigned char getBaseOpcodeFor(uint64_t TSFlags)
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
static bool Is16BitMemOperand(const MachineInstr &MI, unsigned Op)
VEX - The opcode prefix used by AVX instructions.
static unsigned char ModRMByte(unsigned Mod, unsigned RegOpcode, unsigned RM)
virtual void getAnalysisUsage(AnalysisUsage &AU) const
unsigned getSizeOfImm(uint64_t TSFlags)
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
MCSymbol * getMCSymbol() const
static const MCInstrDesc * UpdateOp(MachineInstr &MI, const X86InstrInfo *II, unsigned Opcode)
static MachineRelocation getJumpTable(uintptr_t offset, unsigned RelocationType, unsigned JTI, intptr_t cst=0, bool letTargetResolve=false)
unsigned getReg() const
getReg - Returns the register number.
static MachineRelocation getConstPool(uintptr_t offset, unsigned RelocationType, unsigned CPI, intptr_t cst=0, bool letTargetResolve=false)
int getMemoryOperandNo(uint64_t TSFlags, unsigned Opcode)
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
LLVM Value Representation.
XOP - Opcode prefix used by XOP instructions.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction. Note that variadic (isVari...
BasicBlockListType::iterator iterator
StringRef getName() const
static MachineRelocation getExtSym(uintptr_t offset, unsigned RelocationType, const char *ES, intptr_t cst=0, bool GOTrelative=0, bool NeedStub=true)
STATISTIC(NumEmitted,"Number of machine instructions emitted")
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
DebugLoc getDebugLoc() const