diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-05-11 06:17:44 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-05-11 06:17:44 +0000 |
| commit | 6739a891173474b3f295234b2a55c65d7f05e868 (patch) | |
| tree | c782e759e5291476ba6572f45ef19ba3ca551973 /llvm/utils/TableGen | |
| parent | ea31737fefd6d8bbbc54573e6b3957c1a64dc65d (diff) | |
| download | bcm5719-llvm-6739a891173474b3f295234b2a55c65d7f05e868.tar.gz bcm5719-llvm-6739a891173474b3f295234b2a55c65d7f05e868.zip | |
Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
llvm-svn: 103457
Diffstat (limited to 'llvm/utils/TableGen')
| -rw-r--r-- | llvm/utils/TableGen/IntrinsicEmitter.cpp | 19 | ||||
| -rw-r--r-- | llvm/utils/TableGen/IntrinsicEmitter.h | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp index 417aca7cb37..d7a90513df3 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.cpp +++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp @@ -30,6 +30,8 @@ void IntrinsicEmitter::run(raw_ostream &OS) { if (TargetOnly && !Ints.empty()) TargetPrefix = Ints[0].TargetPrefix; + EmitPrefix(OS); + // Emit the enum information. EmitEnumInfo(Ints, OS); @@ -59,6 +61,23 @@ void IntrinsicEmitter::run(raw_ostream &OS) { // Emit code to translate GCC builtins into LLVM intrinsics. EmitIntrinsicToGCCBuiltinMap(Ints, OS); + + EmitSuffix(OS); +} + +void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) { + OS << "// VisualStudio defines setjmp as _setjmp\n" + "#if defined(_MSC_VER) && defined(setjmp)\n" + "#define setjmp_undefined_for_visual_studio\n" + "#undef setjmp\n" + "#endif\n\n"; +} + +void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) { + OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_visual_studio)\n" + "// let's return it to _setjmp state\n" + "#define setjmp _setjmp\n" + "#endif\n\n"; } void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, diff --git a/llvm/utils/TableGen/IntrinsicEmitter.h b/llvm/utils/TableGen/IntrinsicEmitter.h index c3c92bcc569..b1efecb92ee 100644 --- a/llvm/utils/TableGen/IntrinsicEmitter.h +++ b/llvm/utils/TableGen/IntrinsicEmitter.h @@ -28,6 +28,8 @@ namespace llvm { : Records(R), TargetOnly(T) {} void run(raw_ostream &OS); + + void EmitPrefix(raw_ostream &OS); void EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS); @@ -50,6 +52,7 @@ namespace llvm { raw_ostream &OS); void EmitIntrinsicToGCCBuiltinMap(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS); + void EmitSuffix(raw_ostream &OS); }; } // End llvm namespace |

