aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PIC16
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-31 07:35:57 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-31 07:35:57 +0000
commitaa93917a5ef20ad35757685c2de2c8b15695cb1d (patch)
tree49f5275513b092b9610fff76c74b6c8a791333cf /lib/Target/PIC16
parentb6804e91267381427866dfc1ae3d88abd02ddf14 (diff)
downloadexternal_llvm-aa93917a5ef20ad35757685c2de2c8b15695cb1d.zip
external_llvm-aa93917a5ef20ad35757685c2de2c8b15695cb1d.tar.gz
external_llvm-aa93917a5ef20ad35757685c2de2c8b15695cb1d.tar.bz2
define target names for std libcalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16')
-rw-r--r--lib/Target/PIC16/PIC16.h9
-rw-r--r--lib/Target/PIC16/PIC16ISelLowering.cpp37
2 files changed, 34 insertions, 12 deletions
diff --git a/lib/Target/PIC16/PIC16.h b/lib/Target/PIC16/PIC16.h
index 09453fb..ec2d1f6 100644
--- a/lib/Target/PIC16/PIC16.h
+++ b/lib/Target/PIC16/PIC16.h
@@ -255,14 +255,9 @@ namespace PIC16CC {
return false;
}
- // FIXME: currently we track both @memcpy and memcpy, as
- // the first one is generated by clang, and the second one by codegen
- // while lowering intrinsics. One we fix codegen to use RTLIB, we can
- // have only @memcpy here.
inline static bool isMemIntrinsic (const std::string &Name) {
- if (Name.compare("@memcpy") == 0 || Name.compare("memcpy") == 0 ||
- Name.compare("@memset") == 0 || Name.compare("memset") == 0 ||
- Name.compare("@memmove") == 0 || Name.compare("memmove") == 0) {
+ if (Name.compare("@memcpy") == 0 || Name.compare("@memset") == 0 ||
+ Name.compare("@memmove") == 0) {
return true;
}
diff --git a/lib/Target/PIC16/PIC16ISelLowering.cpp b/lib/Target/PIC16/PIC16ISelLowering.cpp
index 7dc96d1..811bb1e 100644
--- a/lib/Target/PIC16/PIC16ISelLowering.cpp
+++ b/lib/Target/PIC16/PIC16ISelLowering.cpp
@@ -31,7 +31,7 @@ using namespace llvm;
static const char *getIntrinsicName(unsigned opcode) {
std::string Basename;
switch(opcode) {
- default: assert (0 && "do not know intrinsic name");
+ default: llvm_unreachable("do not know intrinsic name");
// Arithmetic Right shift for integer types.
case PIC16ISD::SRA_I8: Basename = "sra.i8"; break;
case RTLIB::SRA_I16: Basename = "sra.i16"; break;
@@ -115,10 +115,30 @@ static const char *getIntrinsicName(unsigned opcode) {
std::string Fullname = prefix + tagname + Basename;
// The name has to live through program life.
- char *tmp = new char[Fullname.size() + 1];
- strcpy (tmp, Fullname.c_str());
-
- return tmp;
+ return createESName(Fullname);
+}
+
+// getStdLibCallName - Get the name for the standard library function.
+static const char *getStdLibCallName(unsigned opcode) {
+ std::string BaseName;
+ switch(opcode) {
+ case RTLIB::COS_F32: BaseName = "cos";
+ break;
+ case RTLIB::SIN_F32: BaseName = "sin";
+ break;
+ case RTLIB::MEMCPY: BaseName = "memcpy";
+ break;
+ case RTLIB::MEMSET: BaseName = "memset";
+ break;
+ case RTLIB::MEMMOVE: BaseName = "memmove";
+ break;
+ default: llvm_unreachable("do not know std lib call name");
+ }
+ std::string prefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
+ std::string LibCallName = prefix + BaseName;
+
+ // The name has to live through program life.
+ return createESName(LibCallName);
}
// PIC16TargetLowering Constructor.
@@ -130,6 +150,13 @@ PIC16TargetLowering::PIC16TargetLowering(PIC16TargetMachine &TM)
addRegisterClass(MVT::i8, PIC16::GPRRegisterClass);
setShiftAmountType(MVT::i8);
+
+ // Std lib call names
+ setLibcallName(RTLIB::COS_F32, getStdLibCallName(RTLIB::COS_F32));
+ setLibcallName(RTLIB::SIN_F32, getStdLibCallName(RTLIB::SIN_F32));
+ setLibcallName(RTLIB::MEMCPY, getStdLibCallName(RTLIB::MEMCPY));
+ setLibcallName(RTLIB::MEMSET, getStdLibCallName(RTLIB::MEMSET));
+ setLibcallName(RTLIB::MEMMOVE, getStdLibCallName(RTLIB::MEMMOVE));
// SRA library call names
setPIC16LibcallName(PIC16ISD::SRA_I8, getIntrinsicName(PIC16ISD::SRA_I8));