You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2021. It is now read-only.
create a legalizer stub for imported methods with float32 params/return values that go in tables (#168)
* create a legalizer stub for imported methods with float32 params/return values that go in tables, as due to asm.js overloading of float/double, we can't legalize them later - we don't know the type of the indirect calls
Copy file name to clipboardexpand all lines: lib/Target/JSBackend/JSBackend.cpp
+74-2
Original file line number
Diff line number
Diff line change
@@ -233,6 +233,7 @@ namespace {
233
233
BlockAddressMap BlockAddresses;
234
234
std::map<std::string, AsmConstInfo> AsmConsts; // code => { index, list of seen sigs }
235
235
NameSet FuncRelocatableExterns; // which externals are accessed in this function; we load them once at the beginning (avoids a potential call in a heap access, and might be faster)
236
+
std::vector<std::string> ExtraFunctions;
236
237
std::set<const Function*> DeclaresNeedingTypeDeclarations; // list of declared funcs whose type we must declare asm.js-style with a usage, as they may not have another usage
237
238
238
239
struct {
@@ -409,6 +410,55 @@ namespace {
409
410
while (Table.size() < MinSize) Table.push_back("0");
410
411
return Table;
411
412
}
413
+
boolusesFloat32(FunctionType* F) {
414
+
if (F->getReturnType()->isFloatTy()) returntrue;
415
+
for (FunctionType::param_iterator AI = F->param_begin(),
416
+
AE = F->param_end(); AI != AE; ++AI) {
417
+
if ((*AI)->isFloatTy()) returntrue;
418
+
}
419
+
returnfalse;
420
+
}
421
+
// create a lettered argument name (a, b, c, etc.)
422
+
std::string getArgLetter(int Index) {
423
+
std::string Ret = "";
424
+
while (1) {
425
+
auto Curr = Index % 26;
426
+
Ret += char('a' + Curr);
427
+
Index = Index / 26;
428
+
if (Index == 0) return Ret;
429
+
}
430
+
}
431
+
std::string makeFloat32Legalizer(const Function *F) {
0 commit comments