Upgrade LLVM to svn revision 145779

This pulls in commits 145765 & 145766, which are required for split stacks.
This commit is contained in:
Brian Anderson 2011-11-26 22:38:36 -08:00
parent 96b0881a68
commit a92218e630
7 changed files with 34 additions and 66 deletions

View File

@ -202,6 +202,9 @@ COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
# LLVM macros
######################################################################
# FIXME: x86-ism
LLVM_COMPONENTS=x86 ipo bitreader bitwriter linker asmparser
define DEF_LLVM_VARS
# The configure script defines these variables with the target triples
# separated by Z. This defines new ones with the expected format.
@ -214,7 +217,7 @@ LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs)
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
LLVM_CXXFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags)
LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)

View File

@ -4,6 +4,14 @@
define DEF_RUSTLLVM_TARGETS
# FIXME: Lately, on windows, llvm-config --includedir is not enough
# to find the llvm includes (probably because we're not actually installing
# llvm, but using it straight out of the build directory)
ifdef CFG_WINDOWSY
LLVM_EXTRA_INCDIRS_$(1)= -iquote $(S)src/llvm/include \
-iquote llvm/$(1)/include
endif
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustGCMetadataPrinter.cpp \
RustGCStrategy.cpp RustWrapper.cpp)
@ -14,7 +22,8 @@ endif
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$$(CFG_DEF_SUFFIX)
RUSTLLVM_INCS_$(1) = -iquote $$(LLVM_INCDIR_$(1)) \
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
-iquote $$(LLVM_INCDIR_$(1)) \
-iquote $$(S)src/rustllvm/include
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o)

View File

@ -125,7 +125,6 @@ mod write {
fn run_passes(sess: session::session, llmod: ModuleRef, output: str) {
let opts = sess.get_opts();
if opts.time_llvm_passes { llvm::LLVMRustEnableTimePasses(); }
if opts.stack_growth { llvm::LLVMRustEnableSegmentedStacks(); }
link_intrinsics(sess, llmod);
let pm = mk_pass_manager();
let td = mk_target_data(
@ -244,7 +243,8 @@ mod write {
buf_t,
buf_o,
LLVMAssemblyFile,
CodeGenOptLevel)})});
CodeGenOptLevel,
opts.stack_growth)})});
}
@ -263,7 +263,8 @@ mod write {
buf_t,
buf_o,
LLVMObjectFile,
CodeGenOptLevel)})});
CodeGenOptLevel,
opts.stack_growth)})});
}
} else {
// If we aren't saving temps then just output the file
@ -280,7 +281,8 @@ mod write {
buf_t,
buf_o,
FileType,
CodeGenOptLevel)})});
CodeGenOptLevel,
opts.stack_growth)})});
}
// Clean up and return

View File

@ -852,15 +852,13 @@ native mod llvm {
/* FIXME: The FileType is an enum.*/
fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef, Triple: sbuf,
Output: sbuf, FileType: int, OptLevel: int);
Output: sbuf, FileType: int, OptLevel: int,
EnableSegmentedStacks: bool);
/** Returns a string describing the last error caused by an LLVMRust*
call. */
fn LLVMRustGetLastError() -> sbuf;
/** Returns a string describing the hosts triple */
fn LLVMRustGetHostTriple() -> sbuf;
/** Parses the bitcode in the given memory buffer. */
fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
@ -876,8 +874,6 @@ native mod llvm {
/** Turn on LLVM pass-timing. */
fn LLVMRustEnableTimePasses();
/** Turn on LLVM segmented stacks. */
fn LLVMRustEnableSegmentedStacks();
/** Print the pass timings since static dtors aren't picking them up. */
fn LLVMRustPrintPassTimings();

@ -1 +1 @@
Subproject commit 566f233ba64c0bb2773b5717cb18753c7564f4b7
Subproject commit 80b1ae92922202c197078038c4229045cb1e295f

View File

@ -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) {

View File

@ -2,13 +2,11 @@ LLVMRustCreateMemoryBufferWithContentsOfFile
LLVMRustEnableTimePasses
LLVMRustWriteOutputFile
LLVMRustGetLastError
LLVMRustGetHostTriple
LLVMRustConstSmallInt
LLVMRustConstInt
LLVMRustParseBitcode
LLVMRustParseAssemblyFile
LLVMRustPrintPassTimings
LLVMRustEnableSegmentedStacks
LLVMLinkModules
LLVMCreateObjectFile
LLVMDisposeObjectFile
@ -46,7 +44,6 @@ LLVMAddGVNPass
LLVMAddGlobal
LLVMAddGlobalDCEPass
LLVMAddGlobalInAddressSpace
LLVMAddGlobalMapping
LLVMAddGlobalOptimizerPass
LLVMAddIPConstantPropagationPass
LLVMAddIPSCCPPass
@ -63,8 +60,6 @@ LLVMAddLoopRotatePass
LLVMAddLoopUnrollPass
LLVMAddLoopUnswitchPass
LLVMAddMemCpyOptPass
LLVMAddModule
LLVMAddModuleProvider
LLVMAddPromoteMemoryToRegisterPass
LLVMAddPruneEHPass
LLVMAddReassociatePass
@ -262,17 +257,8 @@ LLVMCountParams
LLVMCountStructElementTypes
LLVMCreateBuilder
LLVMCreateBuilderInContext
LLVMCreateExecutionEngine
LLVMCreateExecutionEngineForModule
LLVMCreateFunctionPassManager
LLVMCreateFunctionPassManagerForModule
LLVMCreateGenericValueOfFloat
LLVMCreateGenericValueOfInt
LLVMCreateGenericValueOfPointer
LLVMCreateInterpreter
LLVMCreateInterpreterForModule
LLVMCreateJITCompiler
LLVMCreateJITCompilerForModule
LLVMCreateMemoryBufferWithContentsOfFile
LLVMCreateMemoryBufferWithSTDIN
LLVMCreateModuleProviderForExistingModule
@ -283,8 +269,6 @@ LLVMDeleteBasicBlock
LLVMDeleteFunction
LLVMDeleteGlobal
LLVMDisposeBuilder
LLVMDisposeExecutionEngine
LLVMDisposeGenericValue
LLVMDisposeMemoryBuffer
LLVMDisposeMessage
LLVMDisposeModule
@ -301,15 +285,9 @@ LLVMElementAtOffset
LLVMFP128Type
LLVMFP128TypeInContext
LLVMFinalizeFunctionPassManager
LLVMFindFunction
LLVMFloatType
LLVMFloatTypeInContext
LLVMFreeMachineCodeForFunction
LLVMFunctionType
LLVMGenericValueIntWidth
LLVMGenericValueToFloat
LLVMGenericValueToInt
LLVMGenericValueToPointer
LLVMGetAlignment
LLVMGetArrayLength
LLVMGetAttribute
@ -324,7 +302,6 @@ LLVMGetCurrentDebugLocation
LLVMGetDataLayout
LLVMGetElementType
LLVMGetEntryBasicBlock
LLVMGetExecutionEngineTargetData
LLVMGetFirstBasicBlock
LLVMGetFirstFunction
LLVMGetFirstGlobal
@ -372,7 +349,6 @@ LLVMGetParamParent
LLVMGetParamTypes
LLVMGetParams
LLVMGetPointerAddressSpace
LLVMGetPointerToGlobal
LLVMGetPreviousBasicBlock
LLVMGetPreviousFunction
LLVMGetPreviousGlobal
@ -399,7 +375,6 @@ LLVMInitializeCodeGen
LLVMInitializeFunctionPassManager
LLVMInitializeIPA
LLVMInitializeInstCombine
LLVMInitializeInstrumentation
LLVMInitializeScalarOpts
LLVMInitializeTarget
LLVMInitializeTransformUtils
@ -508,9 +483,6 @@ LLVMIsThreadLocal
LLVMIsUndef
LLVMLabelType
LLVMLabelTypeInContext
LLVMLinkInInterpreter
LLVMLinkInJIT
LLVMLinkInMCJIT
LLVMMDNode
LLVMMDNodeInContext
LLVMMDString
@ -542,19 +514,12 @@ LLVMPositionBuilderAtEnd
LLVMPositionBuilderBefore
LLVMPreferredAlignmentOfGlobal
LLVMPreferredAlignmentOfType
LLVMRecompileAndRelinkFunction
LLVMRemoveAttribute
LLVMRemoveFunctionAttr
LLVMRemoveInstrAttribute
LLVMRemoveModule
LLVMRemoveModuleProvider
LLVMReplaceAllUsesWith
LLVMRunFunction
LLVMRunFunctionAsMain
LLVMRunFunctionPassManager
LLVMRunPassManager
LLVMRunStaticConstructors
LLVMRunStaticDestructors
LLVMSetAlignment
LLVMSetCleanup
LLVMSetCurrentDebugLocation