summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-03-26 07:42:43 +0000
committerdim <dim@FreeBSD.org>2014-03-26 07:42:43 +0000
commit45ae227ed48f53447b0000be4c2f1cb142fa5237 (patch)
tree2c3d1790f54e2af0e10eeb88cb26a0d91f029053 /contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff
parentfb422e6d310915f9e2641190198698d922f7ef58 (diff)
downloadFreeBSD-src-45ae227ed48f53447b0000be4c2f1cb142fa5237.zip
FreeBSD-src-45ae227ed48f53447b0000be4c2f1cb142fa5237.tar.gz
MFC r263312:
Pull in r196939 from upstream llvm trunk (by Reid Kleckner): Reland "Fix miscompile of MS inline assembly with stack realignment" This re-lands commit r196876, which was reverted in r196879. The tests have been fixed to pass on platforms with a stack alignment larger than 4. Update to clang side tests will land shortly. Pull in r196986 from upstream llvm trunk (by Reid Kleckner): Revert the backend fatal error from r196939 The combination of inline asm, stack realignment, and dynamic allocas turns out to be too common to reject out of hand. ASan inserts empy inline asm fragments and uses aligned allocas. Compiling any trivial function containing a dynamic alloca with ASan is enough to trigger the check. XFAIL the test cases that would be miscompiled and add one that uses the relevant functionality. Pull in r202930 from upstream llvm trunk (by Hans Wennborg): Check for dynamic allocas and inline asm that clobbers sp before building selection dag (PR19012) In X86SelectionDagInfo::EmitTargetCodeForMemcpy we check with MachineFrameInfo to make sure that ESI isn't used as a base pointer register before we choose to emit rep movs (which clobbers esi). The problem is that MachineFrameInfo wouldn't know about dynamic allocas or inline asm that clobbers the stack pointer until SelectionDAGBuilder has encountered them. This patch fixes the problem by checking for such things when building the FunctionLoweringInfo. Differential Revision: http://llvm-reviews.chandlerc.com/D2954 Together, these commits fix the problem encountered in the devel/emacs port on the i386 architecture, where a combination of stack realignment, alloca() and memcpy() could incidentally clobber the %esi register, leading to segfaults in the temacs build-time utility. See also: http://llvm.org/PR18171 and http://llvm.org/PR19012 Reported by: ashish PR: ports/183064 MFC r263313: Pull in r203311 from upstream llvm trunk (by Arnold Schwaighofer): ISel: Make VSELECT selection terminate in cases where the condition type has to be split and the result type widened. When the condition of a vselect has to be split it makes no sense widening the vselect and thereby widening the condition. We end up in an endless loop of widening (vselect result type) and splitting (condition mask type) doing this. Instead, split both the condition and the vselect and widen the result. I ran this over the test suite with i686 and mattr=+sse and saw no regressions. Fixes PR18036. With this fix the original problem case from the graphics/rawtherapee port (posted in http://llvm.org/PR18036 ) now compiles within ~97MB RSS. Reported by: mandree MFC r263320: Add separate patch files for all the customizations we have currently applied to our copy of llvm/clang. These can be applied in alphabetical order to a pristine llvm/clang 3.4 release source tree, to result in the same version used in FreeBSD. This is intended to clearly document all the changes until now, which mostly consist of cherry pickings from the respective upstream trunks, plus a number of hand-written FreeBSD-specific ones. Hopefully those can eventually be cleaned up and sent upstream too.
Diffstat (limited to 'contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff')
-rw-r--r--contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff210
1 files changed, 210 insertions, 0 deletions
diff --git a/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff b/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff
new file mode 100644
index 0000000..6656bce
--- /dev/null
+++ b/contrib/llvm/patches/patch-r262261-llvm-r198029-sparc.diff
@@ -0,0 +1,210 @@
+Pull in r198029 from upstream llvm trunk (by Venkatraman Govindaraju):
+
+ [Sparc] Add target specific MCExpr class to handle sparc specific modifiers like %hi, %lo, etc.,
+
+Introduced here: http://svn.freebsd.org/changeset/base/262261
+
+Index: lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
+===================================================================
+--- lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
++++ lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
+@@ -0,0 +1,84 @@
++//===-- SparcMCExpr.cpp - Sparc specific MC expression classes --------===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file contains the implementation of the assembly expression modifiers
++// accepted by the Sparc architecture (e.g. "%hi", "%lo", ...).
++//
++//===----------------------------------------------------------------------===//
++
++#define DEBUG_TYPE "sparcmcexpr"
++#include "SparcMCExpr.h"
++#include "llvm/MC/MCContext.h"
++#include "llvm/MC/MCAssembler.h"
++#include "llvm/MC/MCELF.h"
++#include "llvm/Object/ELF.h"
++
++
++using namespace llvm;
++
++const SparcMCExpr*
++SparcMCExpr::Create(VariantKind Kind, const MCExpr *Expr,
++ MCContext &Ctx) {
++ return new (Ctx) SparcMCExpr(Kind, Expr);
++}
++
++
++void SparcMCExpr::PrintImpl(raw_ostream &OS) const
++{
++ bool closeParen = true;
++ switch (Kind) {
++ case VK_Sparc_None: closeParen = false; break;
++ case VK_Sparc_LO: OS << "%lo("; break;
++ case VK_Sparc_HI: OS << "%hi("; break;
++ case VK_Sparc_H44: OS << "%h44("; break;
++ case VK_Sparc_M44: OS << "%m44("; break;
++ case VK_Sparc_L44: OS << "%l44("; break;
++ case VK_Sparc_HH: OS << "%hh("; break;
++ case VK_Sparc_HM: OS << "%hm("; break;
++ case VK_Sparc_TLS_GD_HI22: OS << "%tgd_hi22("; break;
++ case VK_Sparc_TLS_GD_LO10: OS << "%tgd_lo10("; break;
++ case VK_Sparc_TLS_GD_ADD: OS << "%tgd_add("; break;
++ case VK_Sparc_TLS_GD_CALL: OS << "%tgd_call("; break;
++ case VK_Sparc_TLS_LDM_HI22: OS << "%tldm_hi22("; break;
++ case VK_Sparc_TLS_LDM_LO10: OS << "%tldm_lo10("; break;
++ case VK_Sparc_TLS_LDM_ADD: OS << "%tldm_add("; break;
++ case VK_Sparc_TLS_LDM_CALL: OS << "%tldm_call("; break;
++ case VK_Sparc_TLS_LDO_HIX22: OS << "%tldo_hix22("; break;
++ case VK_Sparc_TLS_LDO_LOX10: OS << "%tldo_lox10("; break;
++ case VK_Sparc_TLS_LDO_ADD: OS << "%tldo_add("; break;
++ case VK_Sparc_TLS_IE_HI22: OS << "%tie_hi22("; break;
++ case VK_Sparc_TLS_IE_LO10: OS << "%tie_lo10("; break;
++ case VK_Sparc_TLS_IE_LD: OS << "%tie_ld("; break;
++ case VK_Sparc_TLS_IE_LDX: OS << "%tie_ldx("; break;
++ case VK_Sparc_TLS_IE_ADD: OS << "%tie_add("; break;
++ case VK_Sparc_TLS_LE_HIX22: OS << "%tle_hix22("; break;
++ case VK_Sparc_TLS_LE_LOX10: OS << "%tle_lox10("; break;
++ }
++
++ const MCExpr *Expr = getSubExpr();
++ Expr->print(OS);
++ if (closeParen)
++ OS << ')';
++}
++
++bool
++SparcMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
++ const MCAsmLayout *Layout) const {
++ assert(0 && "FIXME: Implement SparcMCExpr::EvaluateAsRelocatableImpl");
++ return getSubExpr()->EvaluateAsRelocatable(Res, *Layout);
++}
++
++
++void SparcMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {
++ assert(0 && "FIXME: Implement SparcMCExpr::fixELFSymbolsInTLSFixups");
++}
++
++void SparcMCExpr::AddValueSymbols(MCAssembler *Asm) const {
++ assert(0 && "FIXME: Implement SparcMCExpr::AddValueSymbols");
++}
+Index: lib/Target/Sparc/MCTargetDesc/CMakeLists.txt
+===================================================================
+--- lib/Target/Sparc/MCTargetDesc/CMakeLists.txt
++++ lib/Target/Sparc/MCTargetDesc/CMakeLists.txt
+@@ -1,6 +1,7 @@
+ add_llvm_library(LLVMSparcDesc
+ SparcMCTargetDesc.cpp
+ SparcMCAsmInfo.cpp
++ SparcMCExpr.cpp
+ )
+
+ add_dependencies(LLVMSparcDesc SparcCommonTableGen)
+Index: lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
+===================================================================
+--- lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
++++ lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
+@@ -0,0 +1,98 @@
++//====- SparcMCExpr.h - Sparc specific MC expression classes --*- C++ -*-=====//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file describes Sparc-specific MCExprs, used for modifiers like
++// "%hi" or "%lo" etc.,
++//
++//===----------------------------------------------------------------------===//
++
++#ifndef LLVM_SPARCMCEXPR_H
++#define LLVM_SPARCMCEXPR_H
++
++#include "llvm/MC/MCExpr.h"
++
++namespace llvm {
++
++class SparcMCExpr : public MCTargetExpr {
++public:
++ enum VariantKind {
++ VK_Sparc_None,
++ VK_Sparc_LO,
++ VK_Sparc_HI,
++ VK_Sparc_H44,
++ VK_Sparc_M44,
++ VK_Sparc_L44,
++ VK_Sparc_HH,
++ VK_Sparc_HM,
++ VK_Sparc_TLS_GD_HI22,
++ VK_Sparc_TLS_GD_LO10,
++ VK_Sparc_TLS_GD_ADD,
++ VK_Sparc_TLS_GD_CALL,
++ VK_Sparc_TLS_LDM_HI22,
++ VK_Sparc_TLS_LDM_LO10,
++ VK_Sparc_TLS_LDM_ADD,
++ VK_Sparc_TLS_LDM_CALL,
++ VK_Sparc_TLS_LDO_HIX22,
++ VK_Sparc_TLS_LDO_LOX10,
++ VK_Sparc_TLS_LDO_ADD,
++ VK_Sparc_TLS_IE_HI22,
++ VK_Sparc_TLS_IE_LO10,
++ VK_Sparc_TLS_IE_LD,
++ VK_Sparc_TLS_IE_LDX,
++ VK_Sparc_TLS_IE_ADD,
++ VK_Sparc_TLS_LE_HIX22,
++ VK_Sparc_TLS_LE_LOX10
++ };
++
++private:
++ const VariantKind Kind;
++ const MCExpr *Expr;
++
++ explicit SparcMCExpr(VariantKind _Kind, const MCExpr *_Expr)
++ : Kind(_Kind), Expr(_Expr) {}
++
++public:
++ /// @name Construction
++ /// @{
++
++ static const SparcMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
++ MCContext &Ctx);
++ /// @}
++ /// @name Accessors
++ /// @{
++
++ /// getOpcode - Get the kind of this expression.
++ VariantKind getKind() const { return Kind; }
++
++ /// getSubExpr - Get the child of this expression.
++ const MCExpr *getSubExpr() const { return Expr; }
++
++ /// @}
++ void PrintImpl(raw_ostream &OS) const;
++ bool EvaluateAsRelocatableImpl(MCValue &Res,
++ const MCAsmLayout *Layout) const;
++ void AddValueSymbols(MCAssembler *) const;
++ const MCSection *FindAssociatedSection() const {
++ return getSubExpr()->FindAssociatedSection();
++ }
++
++ void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const;
++
++ static bool classof(const MCExpr *E) {
++ return E->getKind() == MCExpr::Target;
++ }
++
++ static bool classof(const SparcMCExpr *) { return true; }
++
++
++};
++
++} // end namespace llvm.
++
++#endif
OpenPOWER on IntegriCloud