diff options
author | John Criswell <criswell@uiuc.edu> | 2003-12-10 18:17:57 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2003-12-10 18:17:57 +0000 |
commit | 0284a42fd310d1e8ec2b06f66b7c9d1bc5b79857 (patch) | |
tree | e61e1aa27e0544661e3b1e737829384c3fbfa758 /lib | |
parent | ba4f3f6a419326df190599421fa149c90235cb72 (diff) | |
download | external_llvm-0284a42fd310d1e8ec2b06f66b7c9d1bc5b79857.zip external_llvm-0284a42fd310d1e8ec2b06f66b7c9d1bc5b79857.tar.gz external_llvm-0284a42fd310d1e8ec2b06f66b7c9d1bc5b79857.tar.bz2 |
Upon Chris's suggestion, moved the #ifdef's to the generated C code.
This makes LLVM and the generated C code more portable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 13 | ||||
-rw-r--r-- | lib/Target/CBackend/Writer.cpp | 13 |
2 files changed, 10 insertions, 16 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index faa9b92..63a5ec8 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1087,20 +1087,17 @@ void CWriter::visitInvokeInst(InvokeInst &II) { void CWriter::visitUnwindInst(UnwindInst &I) { - // Determine the return size of write() based on the data model. -#ifdef _LP64 - const char * writedecl = " extern signed long long write();\n"; -#else - const char * writedecl = " extern write();\n"; -#endif - // The unwind instructions causes a control flow transfer out of the current // function, unwinding the stack until a caller who used the invoke // instruction is found. In this context, we code generated the invoke // instruction to add an entry to the top of the jmpbuf_list. Thus, here we // just have to longjmp to the specified handler. Out << " if (__llvm_jmpbuf_list == 0) { /* unwind */\n" - << writedecl + << "#ifdef _LP64\n" + << " extern signed long long write();\n" + << "#else\n" + << " extern write();\n" + << "#endif\n" << " ((void (*)(int, void*, unsigned))write)(2,\n" << " \"throw found with no handler!\\n\", 31); abort();\n" << " }\n" diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index faa9b92..63a5ec8 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -1087,20 +1087,17 @@ void CWriter::visitInvokeInst(InvokeInst &II) { void CWriter::visitUnwindInst(UnwindInst &I) { - // Determine the return size of write() based on the data model. -#ifdef _LP64 - const char * writedecl = " extern signed long long write();\n"; -#else - const char * writedecl = " extern write();\n"; -#endif - // The unwind instructions causes a control flow transfer out of the current // function, unwinding the stack until a caller who used the invoke // instruction is found. In this context, we code generated the invoke // instruction to add an entry to the top of the jmpbuf_list. Thus, here we // just have to longjmp to the specified handler. Out << " if (__llvm_jmpbuf_list == 0) { /* unwind */\n" - << writedecl + << "#ifdef _LP64\n" + << " extern signed long long write();\n" + << "#else\n" + << " extern write();\n" + << "#endif\n" << " ((void (*)(int, void*, unsigned))write)(2,\n" << " \"throw found with no handler!\\n\", 31); abort();\n" << " }\n" |