diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-28 19:29:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-28 19:29:46 +0000 |
commit | 33e9d29b3b95408067dbe5e0502117c88472c207 (patch) | |
tree | 6325f93e926066c1848466427a599fe687a410ce /lib/Target/CBackend | |
parent | edac2d1a80c34ccc4dddd33c775f840bd45705de (diff) | |
download | external_llvm-33e9d29b3b95408067dbe5e0502117c88472c207.zip external_llvm-33e9d29b3b95408067dbe5e0502117c88472c207.tar.gz external_llvm-33e9d29b3b95408067dbe5e0502117c88472c207.tar.bz2 |
Add support to the C backend for llvm.prefetch. Patch contributed by
Justin Wick!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 13 | ||||
-rw-r--r-- | lib/Target/CBackend/Writer.cpp | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 46f0335..e2431a2 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -807,6 +807,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) { << "#define LLVM_NANSF(NanStr) __builtin_nansf(NanStr) /* Float */\n" << "#define LLVM_INF __builtin_inf() /* Double */\n" << "#define LLVM_INFF __builtin_inff() /* Float */\n" + << "#define LLVM_PREFETCH(addr,rw,locality) __builtin_prefetch(addr,rw,locality)\n" << "#else\n" << "#define LLVM_NAN(NanStr) ((double)0.0) /* Double */\n" << "#define LLVM_NANF(NanStr) 0.0F /* Float */\n" @@ -814,6 +815,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) { << "#define LLVM_NANSF(NanStr) 0.0F /* Float */\n" << "#define LLVM_INF ((double)0.0) /* Double */\n" << "#define LLVM_INFF 0.0F /* Float */\n" + << "#define LLVM_PREFETCH(addr,rw,locality) \n" << "#endif\n"; } @@ -1430,6 +1432,7 @@ void CWriter::lowerIntrinsics(Function &F) { case Intrinsic::frameaddress: case Intrinsic::setjmp: case Intrinsic::longjmp: + case Intrinsic::prefetch: // We directly implement these intrinsics break; default: @@ -1504,6 +1507,16 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(I.getOperand(2)); Out << ')'; return; + case Intrinsic::prefetch: + // This is only supported on GCC for now... + Out << "LLVM_PREFETCH((const void *)"; + writeOperand(I.getOperand(1)); + Out << ", "; + writeOperand(I.getOperand(2)); + Out << ", "; + writeOperand(I.getOperand(3)); + Out << ")"; + return; } } diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 46f0335..e2431a2 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -807,6 +807,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) { << "#define LLVM_NANSF(NanStr) __builtin_nansf(NanStr) /* Float */\n" << "#define LLVM_INF __builtin_inf() /* Double */\n" << "#define LLVM_INFF __builtin_inff() /* Float */\n" + << "#define LLVM_PREFETCH(addr,rw,locality) __builtin_prefetch(addr,rw,locality)\n" << "#else\n" << "#define LLVM_NAN(NanStr) ((double)0.0) /* Double */\n" << "#define LLVM_NANF(NanStr) 0.0F /* Float */\n" @@ -814,6 +815,7 @@ static void generateCompilerSpecificCode(std::ostream& Out) { << "#define LLVM_NANSF(NanStr) 0.0F /* Float */\n" << "#define LLVM_INF ((double)0.0) /* Double */\n" << "#define LLVM_INFF 0.0F /* Float */\n" + << "#define LLVM_PREFETCH(addr,rw,locality) \n" << "#endif\n"; } @@ -1430,6 +1432,7 @@ void CWriter::lowerIntrinsics(Function &F) { case Intrinsic::frameaddress: case Intrinsic::setjmp: case Intrinsic::longjmp: + case Intrinsic::prefetch: // We directly implement these intrinsics break; default: @@ -1504,6 +1507,16 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(I.getOperand(2)); Out << ')'; return; + case Intrinsic::prefetch: + // This is only supported on GCC for now... + Out << "LLVM_PREFETCH((const void *)"; + writeOperand(I.getOperand(1)); + Out << ", "; + writeOperand(I.getOperand(2)); + Out << ", "; + writeOperand(I.getOperand(3)); + Out << ")"; + return; } } |