about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-11-26 22:38:36 -0800
committerBrian Anderson <banderson@mozilla.com>2011-12-04 14:59:56 -0800
commita92218e630742368cf21fb734aedc5cfdf635a75 (patch)
treeadfb2be04d73874ffdf22623abfdd4d7fba3bd5a /src/rustllvm/RustWrapper.cpp
parent96b0881a685e4960439f56cc5ffdcff112894d3d (diff)
downloadrust-a92218e630742368cf21fb734aedc5cfdf635a75.tar.gz
rust-a92218e630742368cf21fb734aedc5cfdf635a75.zip
Upgrade LLVM to svn revision 145779
This pulls in commits 145765 & 145766, which are required for split stacks.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index edb87e99538..d50cc527dfd 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -81,22 +81,27 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
                         const char *triple,
                         const char *path,
                         TargetMachine::CodeGenFileType FileType,
-                        CodeGenOpt::Level OptLevel) {
-
-  // Set compilation options.
-  llvm::NoFramePointerElim = true;
+                        CodeGenOpt::Level OptLevel,
+			bool EnableSegmentedStacks) {
 
   InitializeAllTargets();
   InitializeAllTargetMCs();
   InitializeAllAsmPrinters();
   InitializeAllAsmParsers();
+
+  TargetOptions Options;
+  Options.NoFramePointerElim = true;
+  Options.EnableSegmentedStacks = EnableSegmentedStacks;
+
   std::string Err;
   const Target *TheTarget = TargetRegistry::lookupTarget(triple, Err);
   std::string FeaturesStr;
   std::string Trip(triple);
   std::string CPUStr = llvm::sys::getHostCPUName();
   TargetMachine *Target =
-    TheTarget->createTargetMachine(Trip, CPUStr, FeaturesStr, Reloc::PIC_);
+    TheTarget->createTargetMachine(Trip, CPUStr, FeaturesStr,
+				   Options, Reloc::PIC_,
+				   CodeModel::Default, OptLevel);
   bool NoVerify = false;
   PassManager *PM = unwrap<PassManager>(PMR);
   std::string ErrorInfo;
@@ -104,8 +109,7 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
                     raw_fd_ostream::F_Binary);
   formatted_raw_ostream FOS(OS);
 
-  bool foo = Target->addPassesToEmitFile(*PM, FOS, FileType, OptLevel,
-                                         NoVerify);
+  bool foo = Target->addPassesToEmitFile(*PM, FOS, FileType, NoVerify);
   assert(!foo);
   (void)foo;
   PM->run(*unwrap(M));
@@ -130,12 +134,6 @@ extern "C" LLVMModuleRef LLVMRustParseBitcode(LLVMMemoryBufferRef MemBuf) {
          ? NULL : M;
 }
 
-extern "C" const char *LLVMRustGetHostTriple(void)
-{
-  static std::string str = llvm::sys::getHostTriple();
-  return str.c_str();
-}
-
 extern "C" LLVMValueRef LLVMRustConstSmallInt(LLVMTypeRef IntTy, unsigned N,
                                               LLVMBool SignExtend) {
   return LLVMConstInt(IntTy, (unsigned long long)N, SignExtend);
@@ -161,11 +159,6 @@ extern "C" void LLVMRustPrintPassTimings() {
   TimerGroup::printAll(OS);
 }
 
-extern bool llvm::EnableSegmentedStacks;
-extern "C" void LLVMRustEnableSegmentedStacks() {
-  EnableSegmentedStacks = true;
-}
-
 extern "C" LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M,
                                                 const char* Name,
                                                 LLVMTypeRef FunctionTy) {