aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2010-05-11 06:17:44 +0000
committerDouglas Gregor <doug.gregor@gmail.com>2010-05-11 06:17:44 +0000
commit491363c2ba41b17b9e3698918beaea8f5bf9d024 (patch)
treea4571e1049d2174868e79f76d46f5c73da97654e /utils
parent66c2c93df8e6f2b2926dd3ce8b087eb4355ded8b (diff)
downloadexternal_llvm-491363c2ba41b17b9e3698918beaea8f5bf9d024.zip
external_llvm-491363c2ba41b17b9e3698918beaea8f5bf9d024.tar.gz
external_llvm-491363c2ba41b17b9e3698918beaea8f5bf9d024.tar.bz2
Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/IntrinsicEmitter.cpp19
-rw-r--r--utils/TableGen/IntrinsicEmitter.h3
2 files changed, 22 insertions, 0 deletions
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp
index 417aca7..d7a9051 100644
--- a/utils/TableGen/IntrinsicEmitter.cpp
+++ b/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/utils/TableGen/IntrinsicEmitter.h b/utils/TableGen/IntrinsicEmitter.h
index c3c92bc..b1efecb 100644
--- a/utils/TableGen/IntrinsicEmitter.h
+++ b/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