This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1053,21 +1053,23 @@ std::string JSWriter::getPtrUse(const Value* Ptr) {
1053
1053
Type *t = cast<PointerType>(Ptr ->getType ())->getElementType ();
1054
1054
unsigned Bytes = DL->getTypeAllocSize (t);
1055
1055
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr )) {
1056
- std::string text = " " ;
1057
1056
unsigned Addr = getGlobalAddress (GV->getName ().str ());
1057
+ if (Relocatable) {
1058
+ return getHeapAccess (relocateGlobal (utostr (Addr)), Bytes, t->isIntegerTy () || t->isPointerTy ());
1059
+ }
1058
1060
switch (Bytes) {
1059
1061
default : llvm_unreachable (" Unsupported type" );
1060
- case 8 : return " HEAPF64[" + relocateGlobal ( utostr (Addr >> 3 ) ) + " ]" ;
1062
+ case 8 : return " HEAPF64[" + utostr (Addr >> 3 ) + " ]" ;
1061
1063
case 4 : {
1062
1064
if (t->isIntegerTy () || t->isPointerTy ()) {
1063
- return " HEAP32[" + relocateGlobal ( utostr (Addr >> 2 ) ) + " ]" ;
1065
+ return " HEAP32[" + utostr (Addr >> 2 ) + " ]" ;
1064
1066
} else {
1065
1067
assert (t->isFloatingPointTy ());
1066
- return " HEAPF32[" + relocateGlobal ( utostr (Addr >> 2 ) ) + " ]" ;
1068
+ return " HEAPF32[" + utostr (Addr >> 2 ) + " ]" ;
1067
1069
}
1068
1070
}
1069
- case 2 : return " HEAP16[" + relocateGlobal ( utostr (Addr >> 1 ) ) + " ]" ;
1070
- case 1 : return " HEAP8[" + relocateGlobal ( utostr (Addr) ) + " ]" ;
1071
+ case 2 : return " HEAP16[" + utostr (Addr >> 1 ) + " ]" ;
1072
+ case 1 : return " HEAP8[" + utostr (Addr) + " ]" ;
1071
1073
}
1072
1074
}
1073
1075
return getHeapAccess (getValueAsStr (Ptr ), Bytes, t->isIntegerTy () || t->isPointerTy ());
You can’t perform that action at this time.
0 commit comments