diff --git a/CMakeLists.txt b/CMakeLists.txt index 995ec33d798..2bbd2da2c24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,12 +167,12 @@ set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) -# TODO Add CppBackend back once it's restored. XXX Emscripten set(LLVM_ALL_TARGETS AArch64 ARM JSBackend Hexagon + CppBackend JSBackend # @LOCALMOD Mips MSP430 diff --git a/emscripten-version.txt b/emscripten-version.txt index d8c0559525c..f22efa6b701 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -1.30.4 +1.30.5 diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h index 5ce93e65146..582ffc7ac7b 100644 --- a/include/llvm/InitializePasses.h +++ b/include/llvm/InitializePasses.h @@ -335,12 +335,6 @@ void initializeSimplifyAllocasPass(PassRegistry&); void initializeSimplifyStructRegSignaturesPass(PassRegistry&); void initializeStripAttributesPass(PassRegistry&); void initializeStripMetadataPass(PassRegistry&); -void initializeExpandI64Pass(PassRegistry&); // XXX EMSCRIPTEN -void initializeExpandInsertExtractElementPass(PassRegistry&); // XXX EMSCRIPTEN -void initializeLowerEmExceptionsPass(PassRegistry&); // XXX EMSCRIPTEN -void initializeLowerEmSetjmpPass(PassRegistry&); // XXX EMSCRIPTEN -void initializeLowerEmAsyncifyPass(PassRegistry&); // XXX EMSCRIPTEN -void initializeNoExitRuntimePass(PassRegistry&); // XXX EMSCRIPTEN void initializeStripModuleFlagsPass(PassRegistry&); void initializeStripTlsPass(PassRegistry&); void initializeSubstituteUndefsPass(PassRegistry&); diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 446881a4f5e..b026084ef38 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -215,7 +215,6 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) { .Case("nvptx", nvptx) .Case("nvptx64", nvptx64) .Case("le32", le32) - .Case("asmjs", asmjs) .Case("le64", le64) .Case("asmjs", asmjs) // @LOCALMOD Emscripten .Case("amdil", amdil) @@ -300,7 +299,6 @@ static Triple::ArchType parseArch(StringRef ArchName) { .Case("nvptx", Triple::nvptx) .Case("nvptx64", Triple::nvptx64) .Case("le32", Triple::le32) - .Case("asmjs", Triple::asmjs) .Case("le64", Triple::le64) .Case("asmjs", Triple::asmjs) // @LOCALMOD Emscripten .Case("amdil", Triple::amdil) @@ -352,7 +350,6 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("cnk", Triple::CNK) .StartsWith("bitrig", Triple::Bitrig) .StartsWith("aix", Triple::AIX) - .StartsWith("emscripten", Triple::Emscripten) .StartsWith("cuda", Triple::CUDA) .StartsWith("nvcl", Triple::NVCL) .Default(Triple::UnknownOS); diff --git a/lib/Target/CppBackend/CMakeLists.txt b/lib/Target/CppBackend/CMakeLists.txt new file mode 100644 index 00000000000..515e1dd7e39 --- /dev/null +++ b/lib/Target/CppBackend/CMakeLists.txt @@ -0,0 +1,5 @@ +add_llvm_target(CppBackendCodeGen + CPPBackend.cpp + ) + +add_subdirectory(TargetInfo) diff --git a/lib/Target/CppBackend/LLVMBuild.txt b/lib/Target/CppBackend/LLVMBuild.txt index 139597f9cb0..122b5e7502f 100644 --- a/lib/Target/CppBackend/LLVMBuild.txt +++ b/lib/Target/CppBackend/LLVMBuild.txt @@ -1,2 +1,31 @@ +;===- ./lib/Target/CppBackend/LLVMBuild.txt --------------------*- Conf -*--===; +; +; The LLVM Compiler Infrastructure +; +; This file is distributed under the University of Illinois Open Source +; License. See LICENSE.TXT for details. +; +;===------------------------------------------------------------------------===; +; +; This is an LLVMBuild description file for the components in this subdirectory. +; +; For more information on the LLVMBuild system, please see: +; +; http://llvm.org/docs/LLVMBuild.html +; +;===------------------------------------------------------------------------===; +[common] +subdirectories = TargetInfo +[component_0] +type = TargetGroup +name = CppBackend +parent = Target + +[component_1] +type = Library +name = CppBackendCodeGen +parent = CppBackend +required_libraries = Core CppBackendInfo Support Target +add_to_library_groups = CppBackend diff --git a/lib/Target/CppBackend/Makefile b/lib/Target/CppBackend/Makefile new file mode 100644 index 00000000000..efc7463fda3 --- /dev/null +++ b/lib/Target/CppBackend/Makefile @@ -0,0 +1,16 @@ +##===- lib/Target/CppBackend/Makefile --- ------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../../.. +LIBRARYNAME = LLVMCppBackendCodeGen +DIRS = TargetInfo + +include $(LEVEL)/Makefile.common + +CompileCommonOpts += -Wno-format diff --git a/lib/Target/CppBackend/TargetInfo/CMakeLists.txt b/lib/Target/CppBackend/TargetInfo/CMakeLists.txt new file mode 100644 index 00000000000..d86446f6bc0 --- /dev/null +++ b/lib/Target/CppBackend/TargetInfo/CMakeLists.txt @@ -0,0 +1,3 @@ +add_llvm_library(LLVMCppBackendInfo + CppBackendTargetInfo.cpp + ) diff --git a/lib/Target/CppBackend/TargetInfo/LLVMBuild.txt b/lib/Target/CppBackend/TargetInfo/LLVMBuild.txt new file mode 100644 index 00000000000..9c186a52f4f --- /dev/null +++ b/lib/Target/CppBackend/TargetInfo/LLVMBuild.txt @@ -0,0 +1,23 @@ +;===- ./lib/Target/CppBackend/TargetInfo/LLVMBuild.txt ---------*- Conf -*--===; +; +; The LLVM Compiler Infrastructure +; +; This file is distributed under the University of Illinois Open Source +; License. See LICENSE.TXT for details. +; +;===------------------------------------------------------------------------===; +; +; This is an LLVMBuild description file for the components in this subdirectory. +; +; For more information on the LLVMBuild system, please see: +; +; http://llvm.org/docs/LLVMBuild.html +; +;===------------------------------------------------------------------------===; + +[component_0] +type = Library +name = CppBackendInfo +parent = CppBackend +required_libraries = Support +add_to_library_groups = CppBackend diff --git a/lib/Target/CppBackend/TargetInfo/Makefile b/lib/Target/CppBackend/TargetInfo/Makefile new file mode 100644 index 00000000000..6e682838dae --- /dev/null +++ b/lib/Target/CppBackend/TargetInfo/Makefile @@ -0,0 +1,15 @@ +##===- lib/Target/CppBackend/TargetInfo/Makefile -----------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../../.. +LIBRARYNAME = LLVMCppBackendInfo + +# Hack: we need to include 'main' target directory to grab private headers +CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. + +include $(LEVEL)/Makefile.common diff --git a/lib/Target/CppBackend/readme.txt b/lib/Target/CppBackend/readme.txt deleted file mode 100644 index aa482b2fd4e..00000000000 --- a/lib/Target/CppBackend/readme.txt +++ /dev/null @@ -1 +0,0 @@ -TODO: restore old cpp backend to here diff --git a/lib/Target/LLVMBuild.txt b/lib/Target/LLVMBuild.txt index 63c8bbc9954..59cbe58ee36 100644 --- a/lib/Target/LLVMBuild.txt +++ b/lib/Target/LLVMBuild.txt @@ -15,8 +15,6 @@ ; ;===------------------------------------------------------------------------===; -; TODO Add CppBackend back once it's restored. XXX Emscripten - [common] subdirectories = ARM AArch64 CppBackend JSBackend Hexagon MSP430 NVPTX Mips PowerPC R600 Sparc SystemZ X86 XCore diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp index c9ec5a5eb8e..0414caa61fc 100644 --- a/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -78,7 +78,6 @@ static cl::opt EnableMLSM("mlsm", cl::init(true), cl::Hidden, cl::desc("Enable motion of merged load and store")); - PassManagerBuilder::PassManagerBuilder() { OptLevel = 2; SizeLevel = 0; diff --git a/lib/Transforms/NaCl/ExpandByVal.cpp b/lib/Transforms/NaCl/ExpandByVal.cpp index fe1131fcc11..25d02dc6294 100644 --- a/lib/Transforms/NaCl/ExpandByVal.cpp +++ b/lib/Transforms/NaCl/ExpandByVal.cpp @@ -144,7 +144,6 @@ static bool ExpandCall(DataLayout *DL, InstType *Call) { // the alignment attribute specifies "the alignment of the stack // slot to form and the known alignment of the pointer specified // to the call site". - Instruction *MemCpy = Builder.CreateMemCpy(CopyBuf, ArgPtr, ArgSize, Alignment); MemCpy->setDebugLoc(Call->getDebugLoc()); diff --git a/lib/Transforms/NaCl/ExpandInsertExtractElement.cpp b/lib/Transforms/NaCl/ExpandInsertExtractElement.cpp index 66f4b03a31b..e1df41c2150 100644 --- a/lib/Transforms/NaCl/ExpandInsertExtractElement.cpp +++ b/lib/Transforms/NaCl/ExpandInsertExtractElement.cpp @@ -55,11 +55,6 @@ INITIALIZE_PASS(ExpandInsertExtractElement, "expand-insert-extract-elements", // Utilities -static Instruction *CopyDebug(Instruction *NewInst, Instruction *Original) { - NewInst->setDebugLoc(Original->getDebugLoc()); - return NewInst; -} - bool ExpandInsertExtractElement::runOnFunction(Function &F) { Changed = false; @@ -101,11 +96,6 @@ bool ExpandInsertExtractElement::runOnFunction(Function &F) { return Changed; } -namespace llvm { - -FunctionPass *createExpandInsertExtractElementPass() { +FunctionPass *llvm::createExpandInsertExtractElementPass() { return new ExpandInsertExtractElement(); } - -} - diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp index f2df45a0e16..36b56ac73a6 100644 --- a/lib/Transforms/NaCl/PNaClABISimplify.cpp +++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp @@ -225,6 +225,7 @@ void llvm::PNaClABISimplifyAddPostOptPasses(Triple *T, PassManagerBase &PM) { if (!isEmscripten) // Dead prototypes ignored by JSBackend. PM.add(createStripDeadPrototypesPass()); + // Eliminate simple dead code that the post-opt passes could have created. PM.add(createDeadCodeEliminationPass()); // This should be the last step before PNaCl ABI validation. diff --git a/lib/Transforms/NaCl/PromoteIntegers.cpp b/lib/Transforms/NaCl/PromoteIntegers.cpp index 657f6f72100..1a995102716 100644 --- a/lib/Transforms/NaCl/PromoteIntegers.cpp +++ b/lib/Transforms/NaCl/PromoteIntegers.cpp @@ -40,8 +40,6 @@ using namespace llvm; namespace { -class ConversionState; - class PromoteIntegers : public FunctionPass { public: static char ID; @@ -49,10 +47,6 @@ class PromoteIntegers : public FunctionPass { initializePromoteIntegersPass(*PassRegistry::getPassRegistry()); } virtual bool runOnFunction(Function &F); - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); - return FunctionPass::getAnalysisUsage(AU); - } }; } // anonymous namespace diff --git a/test/Transforms/NaCl/promote-integer-align.ll b/test/Transforms/NaCl/promote-integer-align.ll deleted file mode 100644 index 0866d99a723..00000000000 --- a/test/Transforms/NaCl/promote-integer-align.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt -S -nacl-promote-ints < %s | FileCheck %s - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" - -; CHECK: define void @aligned_copy(i24* %p, i24* %q) { -; CHECK-NEXT: %p.loty = bitcast i24* %p to i16* -; CHECK-NEXT: %t.lo = load i16* %p.loty, align 64 -; CHECK-NEXT: %t.lo.ext = zext i16 %t.lo to i32 -; CHECK-NEXT: %p.hi = getelementptr i16* %p.loty, i32 1 -; CHECK-NEXT: %p.hity = bitcast i16* %p.hi to i8* -; CHECK-NEXT: %t.hi = load i8* %p.hity, align 1 -; CHECK-NEXT: %t.hi.ext = zext i8 %t.hi to i32 -; CHECK-NEXT: %t.hi.ext.sh = shl i32 %t.hi.ext, 16 -; CHECK-NEXT: %t = or i32 %t.lo.ext, %t.hi.ext.sh -; CHECK-NEXT: %q.loty = bitcast i24* %q to i16* -; CHECK-NEXT: %t.lo1 = trunc i32 %t to i16 -; CHECK-NEXT: store i16 %t.lo1, i16* %q.loty, align 64 -; CHECK-NEXT: %t.hi.sh = lshr i32 %t, 16 -; CHECK-NEXT: %q.hi = getelementptr i16* %q.loty, i32 1 -; CHECK-NEXT: %t.hi2 = trunc i32 %t.hi.sh to i8 -; CHECK-NEXT: %q.hity = bitcast i16* %q.hi to i8* -; CHECK-NEXT: store i8 %t.hi2, i8* %q.hity, align 1 -; CHECK-NEXT: ret void -; CHECK-NEXT:} -define void @aligned_copy(i24* %p, i24* %q) { - %t = load i24* %p, align 64 - store i24 %t, i24* %q, align 64 - ret void -} diff --git a/test/Transforms/NaCl/promote-integers.ll b/test/Transforms/NaCl/promote-integers.ll index 312a022ff23..b9936d62263 100644 --- a/test/Transforms/NaCl/promote-integers.ll +++ b/test/Transforms/NaCl/promote-integers.ll @@ -528,54 +528,6 @@ define void @pointer_to_array([2 x i40]* %ptr) { ret void } -; CHECK: @bigger_integers -; CHECK-NEXT: %q = bitcast i8* %p to i128* -; CHECK-NEXT: %q.loty = bitcast i128* %q to i64* -; CHECK-NEXT: %x.lo = load i64* %q.loty -; CHECK-NEXT: %x.lo.ext = zext i64 %x.lo to i128 -; CHECK-NEXT: %q.hi = getelementptr i64* %q.loty, i32 1 -; CHECK-NEXT: %q.hity.loty = bitcast i64* %q.hi to i32* -; CHECK-NEXT: %x.hi.lo = load i32* %q.hity.loty -; CHECK-NEXT: %x.hi.lo.ext = zext i32 %x.hi.lo to i64 -; CHECK-NEXT: %q.hity.hi = getelementptr i32* %q.hity.loty, i32 1 -; CHECK-NEXT: %q.hity.hity.loty = bitcast i32* %q.hity.hi to i16* -; CHECK-NEXT: %x.hi.hi.lo = load i16* %q.hity.hity.loty -; CHECK-NEXT: %x.hi.hi.lo.ext = zext i16 %x.hi.hi.lo to i32 -; CHECK-NEXT: %q.hity.hity.hi = getelementptr i16* %q.hity.hity.loty, i32 1 -; CHECK-NEXT: %q.hity.hity.hity = bitcast i16* %q.hity.hity.hi to i8* -; CHECK-NEXT: %x.hi.hi.hi = load i8* %q.hity.hity.hity -; CHECK-NEXT: %x.hi.hi.hi.ext = zext i8 %x.hi.hi.hi to i32 -; CHECK-NEXT: %x.hi.hi.hi.ext.sh = shl i32 %x.hi.hi.hi.ext, 16 -; CHECK-NEXT: %x.hi.hi = or i32 %x.hi.hi.lo.ext, %x.hi.hi.hi.ext.sh -; CHECK-NEXT: %x.hi.hi.ext = zext i32 %x.hi.hi to i64 -; CHECK-NEXT: %x.hi.hi.ext.sh = shl i64 %x.hi.hi.ext, 32 -; CHECK-NEXT: %x.hi = or i64 %x.hi.lo.ext, %x.hi.hi.ext.sh -; CHECK-NEXT: %x.hi.ext = zext i64 %x.hi to i128 -; CHECK-NEXT: %x.hi.ext.sh = shl i128 %x.hi.ext, 64 -; CHECK-NEXT: %x = or i128 %x.lo.ext, %x.hi.ext.sh -; CHECK-NEXT: %q.loty1 = bitcast i128* %q to i64* -; CHECK-NEXT: store i64 -5076944270305263616, i64* %q.loty1 -; CHECK-NEXT: %q.hi2 = getelementptr i64* %q.loty1, i32 1 -; CHECK-NEXT: %q.hity3.loty = bitcast i64* %q.hi2 to i32* -; CHECK-NEXT: store i32 1624466223, i32* %q.hity3.loty, align 1 -; CHECK-NEXT: %q.hity3.hi = getelementptr i32* %q.hity3.loty, i32 1 -; CHECK-NEXT: %q.hity3.hity.loty = bitcast i32* %q.hity3.hi to i16* -; CHECK-NEXT: store i16 3, i16* %q.hity3.hity.loty, align 1 -; CHECK-NEXT: %q.hity3.hity.hi = getelementptr i16* %q.hity3.hity.loty, i32 1 -; CHECK-NEXT: %q.hity3.hity.hity = bitcast i16* %q.hity3.hity.hi to i8* -; CHECK-NEXT: store i8 0, i8* %q.hity3.hity.hity -; CHECK-NEXT: %z = add i128 %x, 3 -; CHECK-NEXT: %y = trunc i128 %z to i32 -; CHECK-NEXT: ret i32 %y -define i32 @bigger_integers(i8* %p) { - %q = bitcast i8* %p to i120* - %x = load i120* %q - store i120 267650600228229401496703205376, i120* %q - %z = add i120 %x, 3 - %y = trunc i120 %z to i32 - ret i32 %y -} - ; Store 0x1222277777777 and make sure it's split up into 3 stores of each part. ; CHECK-LABEL: @constants( ; CHECK: store i32 2004318071, i32* %{{.*}}, align 4 diff --git a/test/Transforms/NaCl/promote-load-of-bc.ll b/test/Transforms/NaCl/promote-load-of-bc.ll deleted file mode 100644 index 9c02e9e6e33..00000000000 --- a/test/Transforms/NaCl/promote-load-of-bc.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt -S -nacl-promote-ints < %s | FileCheck %s - -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" - -@from = external global [300 x i8] -@to = external global [300 x i8] - -; CHECK: define void @load_bc_to_i80() { -; CHECK-NEXT: %loaded.short.lo = load i64* bitcast ([300 x i8]* @from to i64*), align 4 -; CHECK-NEXT: %loaded.short.lo.ext = zext i64 %loaded.short.lo to i128 -; CHECK-NEXT: %loaded.short.hi = load i16* bitcast (i64* getelementptr (i64* bitcast ([300 x i8]* @from to i64*), i32 1) to i16*) -; CHECK-NEXT: %loaded.short.hi.ext = zext i16 %loaded.short.hi to i128 -; CHECK-NEXT: %loaded.short.hi.ext.sh = shl i128 %loaded.short.hi.ext, 64 -; CHECK-NEXT: %loaded.short = or i128 %loaded.short.lo.ext, %loaded.short.hi.ext.sh -; CHECK-NEXT: %loaded.short.lo1 = trunc i128 %loaded.short to i64 -; CHECK-NEXT: store i64 %loaded.short.lo1, i64* bitcast ([300 x i8]* @to to i64*), align 4 -; CHECK-NEXT: %loaded.short.hi.sh = lshr i128 %loaded.short, 64 -; CHECK-NEXT: %loaded.short.hi2 = trunc i128 %loaded.short.hi.sh to i16 -; CHECK-NEXT: store i16 %loaded.short.hi2, i16* bitcast (i64* getelementptr (i64* bitcast ([300 x i8]* @to to i64*), i32 1) to i16*) -; CHECK-NEXT: ret void -; CHECK-NEXT: } -define void @load_bc_to_i80() { - %loaded.short = load i80* bitcast ([300 x i8]* @from to i80*), align 4 - store i80 %loaded.short, i80* bitcast ([300 x i8]* @to to i80*), align 4 - ret void -} diff --git a/tools/bugpoint/LLVMBuild.txt b/tools/bugpoint/LLVMBuild.txt index 3f9ee932bf3..6c121b02b62 100644 --- a/tools/bugpoint/LLVMBuild.txt +++ b/tools/bugpoint/LLVMBuild.txt @@ -20,4 +20,3 @@ type = Tool name = bugpoint parent = Tools required_libraries = AsmParser BitReader BitWriter IRReader IPO Instrumentation Linker Scalar ObjCARC CodeGen NaClTransforms NaClAnalysis MinSFITransforms NaClBitReader JSBackend - diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt index 559b22b2c13..01bd3730963 100644 --- a/tools/lto/CMakeLists.txt +++ b/tools/lto/CMakeLists.txt @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS LTO MC MCDisassembler + NaClTransforms Support ) diff --git a/tools/lto/Makefile b/tools/lto/Makefile index 652d37a528c..2fb36aebddd 100644 --- a/tools/lto/Makefile +++ b/tools/lto/Makefile @@ -9,7 +9,7 @@ LEVEL := ../.. LIBRARYNAME := LTO -LINK_COMPONENTS := all-targets core lto mc mcdisassembler support +LINK_COMPONENTS := all-targets core lto mc mcdisassembler nacltransforms support LINK_LIBS_IN_SHARED := 1 SHARED_LIBRARY := 1 diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index c633e1e3147..ef472f91012 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -413,8 +413,6 @@ int main(int argc, char **argv) { initializeSimplifyStructRegSignaturesPass(Registry); initializeStripAttributesPass(Registry); initializeStripMetadataPass(Registry); - initializeExpandI64Pass(Registry); - initializeNoExitRuntimePass(Registry); initializeStripModuleFlagsPass(Registry); initializeStripTlsPass(Registry); initializeSubstituteUndefsPass(Registry);