forked from brson/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Fix a specific bug when certain conversion functions are called in a program compiled as mips16 with hard float and the program is linked as c++. There are two libraries that are reversed in the link order with gcc/g++ and clang/clang++ for mips16 in this case and the proper stubs will then not be called. These stubs are normally handled in the Mips16HardFloat pass but in this case we don't know at that time that we need to generate the stubs. This must all be handled later in code generation and we have moved this functionality to MipsAsmPrinter. When linked as C (gcc or clang) the proper stubs are linked in from libc. 2) Set up the infrastructure to handle 90% of what is in the Mips16HardFloat pass in this new area of MipsAsmPrinter. This is a more logical place to handle this and we have known for some time that we needed to move the code later and not implement it using inline asm as we do now but it was not clear exactly where to do this and what mechanism should be used. Now it's clear to us how to do this and this patch contains the infrastructure to move most of this to MipsAsmPrinter but the actual moving will be done in a follow on patch. The same infrastructure is used to fix this current bug as described in brson#1. This change was requested by the list during the original putback of the Mips16HardFloat pass but was not practical for us do at that time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201426 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Reed Kotler
committed
Feb 14, 2014
1 parent
034b8f9
commit fba2a76
Showing
10 changed files
with
567 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//===---- Mips16HardFloatInfo.cpp for Mips16 Hard Float -----===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains the Mips16 implementation of Mips16HardFloatInfo | ||
// namespace. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <string.h> | ||
#include "Mips16HardFloatInfo.h" | ||
|
||
namespace llvm { | ||
|
||
namespace Mips16HardFloatInfo { | ||
|
||
const FuncNameSignature PredefinedFuncs[] = { | ||
{ "__floatdidf", { NoSig, DRet } }, | ||
{ "__floatdisf", { NoSig, FRet } }, | ||
{ "__floatundidf", { NoSig, DRet } }, | ||
{ "__fixsfdi", { FSig, NoFPRet } }, | ||
{ "__fixunsdfsi", { DSig, NoFPRet } }, | ||
{ "__fixunsdfdi", { DSig, NoFPRet } }, | ||
{ "__fixdfdi", { DSig, NoFPRet } }, | ||
{ "__fixunssfsi", { FSig, NoFPRet } }, | ||
{ "__fixunssfdi", { FSig, NoFPRet } }, | ||
{ "__floatundisf", { NoSig, FRet } }, | ||
{ 0, { NoSig, NoFPRet } } | ||
}; | ||
|
||
// just do a search for now. there are very few of these special cases. | ||
// | ||
extern FuncSignature const *findFuncSignature(const char *name) { | ||
const char *name_; | ||
int i = 0; | ||
while (PredefinedFuncs[i].Name) { | ||
name_ = PredefinedFuncs[i].Name; | ||
if (strcmp(name, name_) == 0) | ||
return &PredefinedFuncs[i].Signature; | ||
i++; | ||
} | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//===---- Mips16HardFloatInfo.h for Mips16 Hard Float --------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file defines some data structures relevant to the implementation of | ||
// Mips16 hard float. | ||
// | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MIPS16HARDFLOATINFO_H | ||
#define MIPS16HARDFLOATINFO_H | ||
|
||
namespace llvm { | ||
|
||
namespace Mips16HardFloatInfo { | ||
|
||
// Return types that matter for hard float are: | ||
// float, double, complex float, and complex double | ||
// | ||
enum FPReturnVariant { FRet, DRet, CFRet, CDRet, NoFPRet }; | ||
|
||
// | ||
// Parameter type that matter are float, (float, float), (float, double), | ||
// double, (double, double), (double, float) | ||
// | ||
enum FPParamVariant { FSig, FFSig, FDSig, DSig, DDSig, DFSig, NoSig }; | ||
|
||
struct FuncSignature { | ||
FPParamVariant ParamSig; | ||
FPReturnVariant RetSig; | ||
}; | ||
|
||
struct FuncNameSignature { | ||
const char *Name; | ||
FuncSignature Signature; | ||
}; | ||
|
||
extern const FuncNameSignature PredefinedFuncs[]; | ||
|
||
extern FuncSignature const *findFuncSignature(const char *name); | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.