Importing rustc-1.38.0
Bug: 146571186
Change-Id: Idd23b6282b5f216d22a897103cac97284f84b416
diff --git a/src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp b/src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp
index 39245d2..c882736 100644
--- a/src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp
+++ b/src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp
@@ -1,9 +1,8 @@
//===- FileCheck.cpp - Check that File's Contents match what is expected --===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -22,6 +21,7 @@
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/FileCheck.h"
+#include <cmath>
using namespace llvm;
static cl::opt<std::string>
@@ -80,13 +80,16 @@
"provided for convenience as old tests are migrated to the new\n"
"non-overlapping CHECK-DAG implementation.\n"));
-static cl::opt<bool> Verbose("v", cl::init(false),
- cl::desc("Print directive pattern matches.\n"));
+static cl::opt<bool> Verbose(
+ "v", cl::init(false),
+ cl::desc("Print directive pattern matches, or add them to the input dump\n"
+ "if enabled.\n"));
static cl::opt<bool> VerboseVerbose(
"vv", cl::init(false),
cl::desc("Print information helpful in diagnosing internal FileCheck\n"
- "issues. Implies -v.\n"));
+ "issues, or add it to the input dump if enabled. Implies\n"
+ "-v.\n"));
static const char * DumpInputEnv = "FILECHECK_DUMP_INPUT_ON_FAILURE";
static cl::opt<bool> DumpInputOnFailure(
@@ -403,7 +406,7 @@
unsigned LineCount = InputFileText.count('\n');
if (InputFileEnd[-1] != '\n')
++LineCount;
- unsigned LineNoWidth = log10(LineCount) + 1;
+ unsigned LineNoWidth = std::log10(LineCount) + 1;
// +3 below adds spaces (1) to the left of the (right-aligned) line numbers
// on input lines and (2) to the right of the (left-aligned) labels on
// annotation lines so that input lines and annotation lines are more
@@ -534,8 +537,8 @@
continue;
}
if (EqIdx == 0) {
- errs() << "Missing pattern variable name in command-line definition '-D"
- << G << "'\n";
+ errs() << "Missing variable name in command-line definition '-D" << G
+ << "'\n";
GlobalDefineError = true;
continue;
}
diff --git a/src/llvm-project/llvm/utils/GenLibDeps.pl b/src/llvm-project/llvm/utils/GenLibDeps.pl
index 9b65e90..42afa6a 100755
--- a/src/llvm-project/llvm/utils/GenLibDeps.pl
+++ b/src/llvm-project/llvm/utils/GenLibDeps.pl
@@ -96,6 +96,8 @@
$libpath =~ s/^AsmPrinter/CodeGen\/AsmPrinter/;
$libpath =~ s/^BitReader/Bitcode\/Reader/;
$libpath =~ s/^BitWriter/Bitcode\/Writer/;
+ $libpath =~ s/^BitstreamReader/Bitstream\/Reader/;
+ $libpath =~ s/^BitstreamWriter/Bitstream\/Writer/;
$libpath =~ s/^MSIL/Target\/MSIL/;
$libpath =~ s/^Core/IR/;
$libpath =~ s/^Instrumentation/Transforms\/Instrumentation/;
@@ -136,6 +138,8 @@
$libpath =~ s/^AsmPrinter/CodeGen\/AsmPrinter/;
$libpath =~ s/^BitReader/Bitcode\/Reader/;
$libpath =~ s/^BitWriter/Bitcode\/Writer/;
+ $libpath =~ s/^BitstreamReader/Bitstream\/Reader/;
+ $libpath =~ s/^BitstreamWriter/Bitstream\/Writer/;
$libpath =~ s/^MSIL/Target\/MSIL/;
$libpath =~ s/^Core/VMCore/;
$libpath =~ s/^Instrumentation/Transforms\/Instrumentation/;
diff --git a/src/llvm-project/llvm/utils/KillTheDoctor/KillTheDoctor.cpp b/src/llvm-project/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
index c9def83..358ef16 100644
--- a/src/llvm-project/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
+++ b/src/llvm-project/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
@@ -1,9 +1,8 @@
//===- KillTheDoctor - Prevent Dr. Watson from stopping tests ---*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/LLVMBuild.txt b/src/llvm-project/llvm/utils/LLVMBuild.txt
index 382bfd3..2bf8797 100644
--- a/src/llvm-project/llvm/utils/LLVMBuild.txt
+++ b/src/llvm-project/llvm/utils/LLVMBuild.txt
@@ -1,9 +1,8 @@
;===- ./utils/LLVMBuild.txt ------------------------------------*- Conf -*--===;
;
-; The LLVM Compiler Infrastructure
-;
-; This file is distributed under the University of Illinois Open Source
-; License. See LICENSE.TXT for details.
+; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+; See https://llvm.org/LICENSE.txt for license information.
+; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
;===------------------------------------------------------------------------===;
;
diff --git a/src/llvm-project/llvm/utils/LLVMVisualizers/llvm.natvis b/src/llvm-project/llvm/utils/LLVMVisualizers/llvm.natvis
index 42d3a12..0000519 100644
--- a/src/llvm-project/llvm/utils/LLVMVisualizers/llvm.natvis
+++ b/src/llvm-project/llvm/utils/LLVMVisualizers/llvm.natvis
@@ -8,20 +8,6 @@
For later versions of Visual Studio, no setup is required.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
- <!-- VS2013 -->
- <Type Name="llvm::SmallVectorImpl<*>" Priority="MediumLow">
- <DisplayString Condition="Size == 0">empty</DisplayString>
- <DisplayString Condition="Size != 0">{{ size={Size} }}</DisplayString>
- <Expand>
- <Item Name="[size]">Size</Item>
- <Item Name="[capacity]">Capacity</Item>
- <ArrayItems>
- <Size>Size</Size>
- <ValuePointer>($T1*)BeginX</ValuePointer>
- </ArrayItems>
- </Expand>
- </Type>
- <!-- VS2015 and up -->
<Type Name="llvm::SmallVectorImpl<*>">
<DisplayString IncludeView ="elt0" Condition="Size == 0"></DisplayString>
<DisplayString IncludeView ="elt0">{(($T1*)BeginX)[0]}{*this,view(elt1)}</DisplayString>
@@ -45,6 +31,11 @@
</ArrayItems>
</Expand>
</Type>
+ <Type Name="llvm::APInt">
+ <!-- For now, only handle up to 64-bit unsigned ints -->
+ <DisplayString Condition="BitWidth <= 64">{U.VAL}</DisplayString>
+ <DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString>
+ </Type>
<Type Name="llvm::ArrayRef<*>">
<DisplayString Condition="Length == 0">empty</DisplayString>
<DisplayString Condition="Length != 0">{{ size={Length} }}</DisplayString>
@@ -85,98 +76,52 @@
</Expand>
</Type>
- <Type Name="llvm::PointerIntPair<*,*,*,*>">
+ <!-- PointerIntPair. In addition to the regular view, it is possible to view just the pointer or just the int
+ The same code is duplicated from the regular viewer to improve the performance of the common case -->
+ <Type Name="llvm::PointerIntPair<*>">
+ <DisplayString IncludeView="ptr">{($T1)(Value & $T5::PointerBitMask)}</DisplayString>
+ <DisplayString IncludeView="int">{($T3)((Value >> $T5::IntShift) & $T5::IntMask)}</DisplayString>
<DisplayString>{$T5::IntMask}: {($T1)(Value & $T5::PointerBitMask)} [{($T3)((Value >> $T5::IntShift) & $T5::IntMask)}]</DisplayString>
<Expand>
<Item Name="[ptr]">($T1)(Value & $T5::PointerBitMask)</Item>
<Item Name="[int]">($T3)((Value >> $T5::IntShift) & $T5::IntMask)</Item>
</Expand>
</Type>
-
- <!-- PointerUnion types - In addition to the regular view, which displays the pointer, there is a "deref" view that
- displays the pointed to object, which is often needed by other visualizers -->
- <Type Name="llvm::PointerUnion<*,*>">
- <DisplayString Optional="true" IncludeView="deref" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) == 0">{*($T1)(Val.Value & ValTy::InfoTy::PointerBitMask)}</DisplayString>
- <DisplayString Optional="true" IncludeView="deref" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) != 0">{*($T2)(Val.Value & ValTy::InfoTy::PointerBitMask)}</DisplayString>
- <DisplayString Optional="true" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value & ValTy::InfoTy::PointerBitMask)}</DisplayString>
- <DisplayString Optional="true" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value & ValTy::InfoTy::PointerBitMask)}</DisplayString>
+ <!-- PointerUnion types -->
+ <Type Name="llvm::pointer_union_detail::PointerUnionMembers<*>">
+ <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
+ {($T4)(Val.Value & $T2::InfoTy::PointerBitMask)}
+ </DisplayString>
+ <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
+ {($T5)(Val.Value & $T2::InfoTy::PointerBitMask)}
+ </DisplayString>
+ <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">
+ {($T6)(Val.Value & $T2::InfoTy::PointerBitMask)}
+ </DisplayString>
+ <DisplayString Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">
+ {($T7)(Val.Value & $T2::InfoTy::PointerBitMask)}
+ </DisplayString>
+ <DisplayString>Unexpected index in PointerUnion: {(Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask}</DisplayString>
<Expand>
- <Item Name="[Holds]" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) == 0">"$T1", s8b</Item>
- <Item Name="[Ptr]" Optional="true" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) == 0">($T1)(Val.Value & ValTy::InfoTy::PointerBitMask)</Item>
- <Item Name="[Holds]" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) != 0">"$T2", s8b</Item>
- <Item Name="[Ptr]" Optional="true" Condition="((Val.Value >> ValTy::InfoTy::IntShift) & ValTy::InfoTy::IntMask) != 0">($T2)(Val.Value & ValTy::InfoTy::PointerBitMask)</Item>
- </Expand>
- </Type>
-
- <Type Name="llvm::PointerUnion3<*,*,*>">
- <DisplayString Optional="true" IncludeView="deref" Condition="(Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1">{Val,view(deref)}</DisplayString>
- <DisplayString Optional="true" IncludeView="deref">{*(InnerUnion*)&Val.Val.Value,view(deref)}</DisplayString>
- <DisplayString Condition="(Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1">{Val}</DisplayString>
- <DisplayString>{*(InnerUnion*)&Val.Val.Value}</DisplayString>
- <Expand>
- <Item Name="[Holds]" Condition="(Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1">"$T3", s8b</Item>
- <Item Name="[Ptr]" Condition="(Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1">($T3)(Val.Val.Value & ValTy::ValTy::InfoTy::PointerBitMask)</Item>
- <ExpandedItem Condition="!((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1)">*(InnerUnion*)&Val.Val.Value</ExpandedItem>
- </Expand>
- </Type>
-
- <Type Name="llvm::PointerUnion4<*,*,*,*>">
- <DisplayString Optional="true" IncludeView="deref"
- Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 0">
- {*($T1)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Optional="true" IncludeView="deref"
- Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 1">
- {*($T2)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Optional="true" IncludeView="deref"
- Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 0">
- {*($T3)(Val.Val.Value & InnerUnion2::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Optional="true" IncludeView="deref"
- Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 1">
- {*($T4)(Val.Val.Value & InnerUnion2::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 0">
- {"$T1", s8b}: {($T1)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 1">
- {"$T2", s8b}: {($T2)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 0">
- {"$T3", s8b}: {($T3)(Val.Val.Value & InnerUnion2::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <DisplayString Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 1">
- {"$T4", s8b}: {($T4)(Val.Val.Value & InnerUnion2::ValTy::InfoTy::PointerBitMask)}
- </DisplayString>
- <Expand>
- <Item Name="[Holds]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 0">
- "$T1", s8b
+ <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">"$T4",s8b</Item>
+ <Item Name="[Ptr]" Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
+ ($T4)(Val.Value & $T2::InfoTy::PointerBitMask)
</Item>
- <Item Name="[Ptr]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 0">
- ($T1)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)
+ <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">"$T5",s8b</Item>
+ <Item Name="[Ptr]" Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
+ ($T5)(Val.Value & $T2::InfoTy::PointerBitMask)
</Item>
- <Item Name="[Holds]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 1">
- "$T2", s8b
+ <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">"$T6",s8b</Item>
+ <Item Name="[Ptr]" Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 2">
+ ($T6)(Val.Value & $T2::InfoTy::PointerBitMask)
</Item>
- <Item Name="[Ptr]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 0 && ((Val.Val.Value >> InnerUnion1::ValTy::InfoTy::IntShift) & 1) == 1">
- ($T2)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)
- </Item>
- <Item Name="[Holds]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 0">
- "$T3", s8b
- </Item>
- <Item Name="[Ptr]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 0">
- ($T3)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)
- </Item>
- <Item Name="[Holds]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 1">
- "$T4", s8b
- </Item>
- <Item Name="[Ptr]" Condition="((Val.Val.Value >> ValTy::ValTy::InfoTy::IntShift) & 1) == 1 && ((Val.Val.Value >> InnerUnion2::ValTy::InfoTy::IntShift) & 1) == 1">
- ($T4)(Val.Val.Value & InnerUnion1::ValTy::InfoTy::PointerBitMask)
+ <Item Name="[Holds]" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">"$T6",s8b</Item>
+ <Item Name="[Ptr]" Optional="true" Condition="((Val.Value>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 3">
+ ($T7)(Val.Value & $T2::InfoTy::PointerBitMask)
</Item>
</Expand>
</Type>
-
+
<Type Name="llvm::iplist<*,*>">
<DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
<DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
@@ -200,13 +145,13 @@
</Type>
<Type Name="llvm::SmallPtrSet<*,*>">
- <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
- <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString>
+ <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
+ <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
<Expand>
- <Item Name="[size]">NumElements</Item>
+ <Item Name="[size]">NumNonEmpty</Item>
<Item Name="[capacity]">CurArraySize</Item>
<ArrayItems>
- <Size>CurArraySize</Size>
+ <Size>NumNonEmpty</Size>
<ValuePointer>($T1*)CurArray</ValuePointer>
</ArrayItems>
</Expand>
diff --git a/src/llvm-project/llvm/utils/PerfectShuffle/PerfectShuffle.cpp b/src/llvm-project/llvm/utils/PerfectShuffle/PerfectShuffle.cpp
index 5c142a5..0f2e672 100644
--- a/src/llvm-project/llvm/utils/PerfectShuffle/PerfectShuffle.cpp
+++ b/src/llvm-project/llvm/utils/PerfectShuffle/PerfectShuffle.cpp
@@ -1,9 +1,8 @@
//===-- PerfectShuffle.cpp - Perfect Shuffle Generator --------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 5b4229e..146d108 100644
--- a/src/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1,9 +1,8 @@
//===- AsmMatcherEmitter.cpp - Generate an assembly matcher ---------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -1073,8 +1072,9 @@
// handle, the target should be refactored to use operands instead of
// modifiers.
//
- // Also, check for instructions which reference the operand multiple times;
- // this implies a constraint we would not honor.
+ // Also, check for instructions which reference the operand multiple times,
+ // if they don't define a custom AsmMatcher: this implies a constraint that
+ // the built-in matching code would not honor.
std::set<std::string> OperandNames;
for (const AsmOperand &Op : AsmOperands) {
StringRef Tok = Op.Token;
@@ -1084,7 +1084,8 @@
"' not supported by asm matcher. Mark isCodeGenOnly!");
// Verify that any operand is only mentioned once.
// We reject aliases and ignore instructions for now.
- if (!IsAlias && Tok[0] == '$' && !OperandNames.insert(Tok).second) {
+ if (!IsAlias && TheDef->getValueAsString("AsmMatchConverter").empty() &&
+ Tok[0] == '$' && !OperandNames.insert(Tok).second) {
LLVM_DEBUG({
errs() << "warning: '" << TheDef->getName() << "': "
<< "ignoring instruction with tied operand '"
@@ -1160,8 +1161,9 @@
// use it, else just fall back to the underlying register class.
const RecordVal *R = Rec->getValue("ParserMatchClass");
if (!R || !R->getValue())
- PrintFatalError("Record `" + Rec->getName() +
- "' does not have a ParserMatchClass!\n");
+ PrintFatalError(Rec->getLoc(),
+ "Record `" + Rec->getName() +
+ "' does not have a ParserMatchClass!\n");
if (DefInit *DI= dyn_cast<DefInit>(R->getValue())) {
Record *MatchClass = DI->getDef();
@@ -1473,7 +1475,6 @@
for (const auto &Pair : SubtargetFeatures)
LLVM_DEBUG(Pair.second.dump());
#endif // NDEBUG
- assert(SubtargetFeatures.size() <= 64 && "Too many subtarget features!");
bool HasMnemonicFirst = AsmParser->getValueAsBit("HasMnemonicFirst");
bool ReportMultipleNearMisses =
@@ -1928,10 +1929,11 @@
return ID;
}
-static void emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
- std::vector<std::unique_ptr<MatchableInfo>> &Infos,
- bool HasMnemonicFirst, bool HasOptionalOperands,
- raw_ostream &OS) {
+static unsigned
+emitConvertFuncs(CodeGenTarget &Target, StringRef ClassName,
+ std::vector<std::unique_ptr<MatchableInfo>> &Infos,
+ bool HasMnemonicFirst, bool HasOptionalOperands,
+ raw_ostream &OS) {
SmallSetVector<CachedHashString, 16> OperandConversionKinds;
SmallSetVector<CachedHashString, 16> InstructionConversionKinds;
std::vector<std::vector<uint8_t> > ConversionTable;
@@ -2337,6 +2339,8 @@
// Spit out the operand number lookup function.
OS << OpOS.str();
+
+ return ConversionTable.size();
}
/// emitMatchClassEnumeration - Emit the enumeration for match class kinds.
@@ -2675,7 +2679,7 @@
for (const auto &SF : Info.SubtargetFeatures) {
const SubtargetFeatureInfo &SFI = SF.second;
// FIXME: Totally just a placeholder name to get the algorithm working.
- OS << " case " << SFI.getEnumName() << ": return \""
+ OS << " case " << SFI.getEnumBitName() << ": return \""
<< SFI.TheDef->getValueAsString("PredicateName") << "\";\n";
}
OS << " default: return \"(unknown)\";\n";
@@ -2691,7 +2695,10 @@
const AsmMatcherInfo &Info) {
std::vector<Record*> ReqFeatures = R->getValueAsListOfDefs("Predicates");
std::string Result;
- unsigned NumFeatures = 0;
+
+ if (ReqFeatures.empty())
+ return Result;
+
for (unsigned i = 0, e = ReqFeatures.size(); i != e; ++i) {
const SubtargetFeatureInfo *F = Info.getSubtargetFeature(ReqFeatures[i]);
@@ -2699,15 +2706,12 @@
PrintFatalError(R->getLoc(), "Predicate '" + ReqFeatures[i]->getName() +
"' is not marked as an AssemblerPredicate!");
- if (NumFeatures)
- Result += '|';
+ if (i)
+ Result += " && ";
- Result += F->getEnumName();
- ++NumFeatures;
+ Result += "Features.test(" + F->getEnumBitName() + ')';
}
- if (NumFeatures > 1)
- Result = '(' + Result + ')';
return Result;
}
@@ -2763,7 +2767,7 @@
if (!MatchCode.empty())
MatchCode += "else ";
- MatchCode += "if ((Features & " + FeatureMask + ") == "+FeatureMask+")\n";
+ MatchCode += "if (" + FeatureMask + ")\n";
MatchCode += " Mnemonic = \"";
MatchCode += R->getValueAsString("ToMnemonic");
MatchCode += "\";\n";
@@ -2798,7 +2802,7 @@
if (Aliases.empty()) return false;
OS << "static void applyMnemonicAliases(StringRef &Mnemonic, "
- "uint64_t Features, unsigned VariantID) {\n";
+ "const FeatureBitset &Features, unsigned VariantID) {\n";
OS << " switch (VariantID) {\n";
unsigned VariantCount = Target.getAsmParserVariantCount();
for (unsigned VC = 0; VC != VariantCount; ++VC) {
@@ -2823,7 +2827,9 @@
static void emitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
const AsmMatcherInfo &Info, StringRef ClassName,
StringToOffsetTable &StringTable,
- unsigned MaxMnemonicIndex, bool HasMnemonicFirst) {
+ unsigned MaxMnemonicIndex,
+ unsigned MaxFeaturesIndex,
+ bool HasMnemonicFirst) {
unsigned MaxMask = 0;
for (const OperandMatchEntry &OMI : Info.OperandMatchInfo) {
MaxMask |= OMI.OperandMask;
@@ -2832,14 +2838,14 @@
// Emit the static custom operand parsing table;
OS << "namespace {\n";
OS << " struct OperandMatchEntry {\n";
- OS << " " << getMinimalTypeForEnumBitfield(Info.SubtargetFeatures.size())
- << " RequiredFeatures;\n";
OS << " " << getMinimalTypeForRange(MaxMnemonicIndex)
<< " Mnemonic;\n";
+ OS << " " << getMinimalTypeForRange(MaxMask)
+ << " OperandMask;\n";
OS << " " << getMinimalTypeForRange(std::distance(
Info.Classes.begin(), Info.Classes.end())) << " Class;\n";
- OS << " " << getMinimalTypeForRange(MaxMask)
- << " OperandMask;\n\n";
+ OS << " " << getMinimalTypeForRange(MaxFeaturesIndex)
+ << " RequiredFeaturesIdx;\n\n";
OS << " StringRef getMnemonic() const {\n";
OS << " return StringRef(MnemonicTable + Mnemonic + 1,\n";
OS << " MnemonicTable[Mnemonic]);\n";
@@ -2865,29 +2871,18 @@
OS << "static const OperandMatchEntry OperandMatchTable["
<< Info.OperandMatchInfo.size() << "] = {\n";
- OS << " /* Operand List Mask, Mnemonic, Operand Class, Features */\n";
+ OS << " /* Operand List Mnemonic, Mask, Operand Class, Features */\n";
for (const OperandMatchEntry &OMI : Info.OperandMatchInfo) {
const MatchableInfo &II = *OMI.MI;
OS << " { ";
- // Write the required features mask.
- if (!II.RequiredFeatures.empty()) {
- for (unsigned i = 0, e = II.RequiredFeatures.size(); i != e; ++i) {
- if (i) OS << "|";
- OS << II.RequiredFeatures[i]->getEnumName();
- }
- } else
- OS << "0";
-
// Store a pascal-style length byte in the mnemonic.
std::string LenMnemonic = char(II.Mnemonic.size()) + II.Mnemonic.str();
- OS << ", " << StringTable.GetOrAddStringOffset(LenMnemonic, false)
+ OS << StringTable.GetOrAddStringOffset(LenMnemonic, false)
<< " /* " << II.Mnemonic << " */, ";
- OS << OMI.CI->Name;
-
- OS << ", " << OMI.OperandMask;
+ OS << OMI.OperandMask;
OS << " /* ";
bool printComma = false;
for (int i = 0, e = 31; i !=e; ++i)
@@ -2897,7 +2892,17 @@
OS << i;
printComma = true;
}
- OS << " */";
+ OS << " */, ";
+
+ OS << OMI.CI->Name;
+
+ // Write the required features mask.
+ OS << ", AMFBS";
+ if (II.RequiredFeatures.empty())
+ OS << "_None";
+ else
+ for (unsigned i = 0, e = II.RequiredFeatures.size(); i != e; ++i)
+ OS << '_' << II.RequiredFeatures[i]->TheDef->getName();
OS << " },\n";
}
@@ -2933,7 +2938,7 @@
// Emit code to get the available features.
OS << " // Get the current feature set.\n";
- OS << " uint64_t AvailableFeatures = getAvailableFeatures();\n\n";
+ OS << " const FeatureBitset &AvailableFeatures = getAvailableFeatures();\n\n";
OS << " // Get the next operand index.\n";
OS << " unsigned NextOpNum = Operands.size()"
@@ -2967,8 +2972,10 @@
// Emit check that the required features are available.
OS << " // check if the available features match\n";
+ OS << " const FeatureBitset &RequiredFeatures = "
+ "FeatureBitsets[it->RequiredFeaturesIdx];\n";
OS << " if (!ParseForAllFeatures && (AvailableFeatures & "
- "it->RequiredFeatures) != it->RequiredFeatures)\n";
+ "RequiredFeatures) != RequiredFeatures)\n";
OS << " continue;\n\n";
// Emit check to ensure the operand number matches.
@@ -3034,7 +3041,8 @@
static void emitMnemonicSpellChecker(raw_ostream &OS, CodeGenTarget &Target,
unsigned VariantCount) {
OS << "static std::string " << Target.getName()
- << "MnemonicSpellCheck(StringRef S, uint64_t FBS, unsigned VariantID) {\n";
+ << "MnemonicSpellCheck(StringRef S, const FeatureBitset &FBS,"
+ << " unsigned VariantID) {\n";
if (!VariantCount)
OS << " return \"\";";
else {
@@ -3055,7 +3063,9 @@
OS << " }\n\n";
OS << " for (auto I = Start; I < End; I++) {\n";
OS << " // Ignore unsupported instructions.\n";
- OS << " if ((FBS & I->RequiredFeatures) != I->RequiredFeatures)\n";
+ OS << " const FeatureBitset &RequiredFeatures = "
+ "FeatureBitsets[I->RequiredFeaturesIdx];\n";
+ OS << " if ((FBS & RequiredFeatures) != RequiredFeatures)\n";
OS << " continue;\n";
OS << "\n";
OS << " StringRef T = I->getMnemonic();\n";
@@ -3103,6 +3113,14 @@
OS << "#endif // NDEBUG\n";
}
+static std::string
+getNameForFeatureBitset(const std::vector<Record *> &FeatureBitset) {
+ std::string Name = "AMFBS";
+ for (const auto &Feature : FeatureBitset)
+ Name += ("_" + Feature->getName()).str();
+ return Name;
+}
+
void AsmMatcherEmitter::run(raw_ostream &OS) {
CodeGenTarget Target(Records);
Record *AsmParser = Target.getAsmParser();
@@ -3115,10 +3133,10 @@
// Sort the instruction table using the partial order on classes. We use
// stable_sort to ensure that ambiguous instructions are still
// deterministically ordered.
- std::stable_sort(Info.Matchables.begin(), Info.Matchables.end(),
- [](const std::unique_ptr<MatchableInfo> &a,
- const std::unique_ptr<MatchableInfo> &b){
- return *a < *b;});
+ llvm::stable_sort(
+ Info.Matchables,
+ [](const std::unique_ptr<MatchableInfo> &a,
+ const std::unique_ptr<MatchableInfo> &b) { return *a < *b; });
#ifdef EXPENSIVE_CHECKS
// Verify that the table is sorted and operator < works transitively.
@@ -3174,7 +3192,7 @@
OS << "#undef GET_ASSEMBLER_HEADER\n";
OS << " // This should be included into the middle of the declaration of\n";
OS << " // your subclasses implementation of MCTargetAsmParser.\n";
- OS << " uint64_t ComputeAvailableFeatures(const FeatureBitset& FB) const;\n";
+ OS << " FeatureBitset ComputeAvailableFeatures(const FeatureBitset& FB) const;\n";
if (HasOptionalOperands) {
OS << " void convertToMCInst(unsigned Kind, MCInst &Inst, "
<< "unsigned Opcode,\n"
@@ -3192,9 +3210,21 @@
if (ReportMultipleNearMisses)
OS << " SmallVectorImpl<NearMissInfo> *NearMisses,\n";
else
- OS << " uint64_t &ErrorInfo,\n";
+ OS << " uint64_t &ErrorInfo,\n"
+ << " FeatureBitset &MissingFeatures,\n";
OS << " bool matchingInlineAsm,\n"
<< " unsigned VariantID = 0);\n";
+ if (!ReportMultipleNearMisses)
+ OS << " unsigned MatchInstructionImpl(const OperandVector &Operands,\n"
+ << " MCInst &Inst,\n"
+ << " uint64_t &ErrorInfo,\n"
+ << " bool matchingInlineAsm,\n"
+ << " unsigned VariantID = 0) {\n"
+ << " FeatureBitset MissingFeatures;\n"
+ << " return MatchInstructionImpl(Operands, Inst, ErrorInfo, MissingFeatures,\n"
+ << " matchingInlineAsm, VariantID);\n"
+ << " }\n\n";
+
if (!Info.OperandMatchInfo.empty()) {
OS << " OperandMatchResultTy MatchOperandParserImpl(\n";
@@ -3219,7 +3249,7 @@
OS << "#undef GET_REGISTER_MATCHER\n\n";
// Emit the subtarget feature enumeration.
- SubtargetFeatureInfo::emitSubtargetFeatureFlagEnumeration(
+ SubtargetFeatureInfo::emitSubtargetFeatureBitEnumeration(
Info.SubtargetFeatures, OS);
// Emit the function to match a register name to number.
@@ -3249,8 +3279,9 @@
// Generate the convertToMCInst function to convert operands into an MCInst.
// Also, generate the convertToMapAndConstraints function for MS-style inline
// assembly. The latter doesn't actually generate a MCInst.
- emitConvertFuncs(Target, ClassName, Info.Matchables, HasMnemonicFirst,
- HasOptionalOperands, OS);
+ unsigned NumConverters = emitConvertFuncs(Target, ClassName, Info.Matchables,
+ HasMnemonicFirst,
+ HasOptionalOperands, OS);
// Emit the enumeration for classes which participate in matching.
emitMatchClassEnumeration(Target, Info.Classes, OS);
@@ -3300,6 +3331,56 @@
StringTable.EmitString(OS);
OS << ";\n\n";
+ std::vector<std::vector<Record *>> FeatureBitsets;
+ for (const auto &MI : Info.Matchables) {
+ if (MI->RequiredFeatures.empty())
+ continue;
+ FeatureBitsets.emplace_back();
+ for (unsigned I = 0, E = MI->RequiredFeatures.size(); I != E; ++I)
+ FeatureBitsets.back().push_back(MI->RequiredFeatures[I]->TheDef);
+ }
+
+ llvm::sort(FeatureBitsets, [&](const std::vector<Record *> &A,
+ const std::vector<Record *> &B) {
+ if (A.size() < B.size())
+ return true;
+ if (A.size() > B.size())
+ return false;
+ for (const auto &Pair : zip(A, B)) {
+ if (std::get<0>(Pair)->getName() < std::get<1>(Pair)->getName())
+ return true;
+ if (std::get<0>(Pair)->getName() > std::get<1>(Pair)->getName())
+ return false;
+ }
+ return false;
+ });
+ FeatureBitsets.erase(
+ std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
+ FeatureBitsets.end());
+ OS << "// Feature bitsets.\n"
+ << "enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
+ << " AMFBS_None,\n";
+ for (const auto &FeatureBitset : FeatureBitsets) {
+ if (FeatureBitset.empty())
+ continue;
+ OS << " " << getNameForFeatureBitset(FeatureBitset) << ",\n";
+ }
+ OS << "};\n\n"
+ << "const static FeatureBitset FeatureBitsets[] {\n"
+ << " {}, // AMFBS_None\n";
+ for (const auto &FeatureBitset : FeatureBitsets) {
+ if (FeatureBitset.empty())
+ continue;
+ OS << " {";
+ for (const auto &Feature : FeatureBitset) {
+ const auto &I = Info.SubtargetFeatures.find(Feature);
+ assert(I != Info.SubtargetFeatures.end() && "Didn't import predicate?");
+ OS << I->second.getEnumBitName() << ", ";
+ }
+ OS << "},\n";
+ }
+ OS << "};\n\n";
+
// Emit the static match table; unused classes get initialized to 0 which is
// guaranteed to be InvalidMatchClass.
//
@@ -3315,10 +3396,10 @@
OS << " " << getMinimalTypeForRange(MaxMnemonicIndex)
<< " Mnemonic;\n";
OS << " uint16_t Opcode;\n";
- OS << " " << getMinimalTypeForRange(Info.Matchables.size())
+ OS << " " << getMinimalTypeForRange(NumConverters)
<< " ConvertFn;\n";
- OS << " " << getMinimalTypeForEnumBitfield(Info.SubtargetFeatures.size())
- << " RequiredFeatures;\n";
+ OS << " " << getMinimalTypeForRange(FeatureBitsets.size())
+ << " RequiredFeaturesIdx;\n";
OS << " " << getMinimalTypeForRange(
std::distance(Info.Classes.begin(), Info.Classes.end()))
<< " Classes[" << MaxNumOperands << "];\n";
@@ -3363,13 +3444,12 @@
<< MI->ConversionFnKind << ", ";
// Write the required features mask.
- if (!MI->RequiredFeatures.empty()) {
- for (unsigned i = 0, e = MI->RequiredFeatures.size(); i != e; ++i) {
- if (i) OS << "|";
- OS << MI->RequiredFeatures[i]->getEnumName();
- }
- } else
- OS << "0";
+ OS << "AMFBS";
+ if (MI->RequiredFeatures.empty())
+ OS << "_None";
+ else
+ for (unsigned i = 0, e = MI->RequiredFeatures.size(); i != e; ++i)
+ OS << '_' << MI->RequiredFeatures[i]->TheDef->getName();
OS << ", { ";
for (unsigned i = 0, e = MI->AsmOperands.size(); i != e; ++i) {
@@ -3394,7 +3474,8 @@
if (ReportMultipleNearMisses)
OS << " SmallVectorImpl<NearMissInfo> *NearMisses,\n";
else
- OS << " uint64_t &ErrorInfo,\n";
+ OS << " uint64_t &ErrorInfo,\n"
+ << " FeatureBitset &MissingFeatures,\n";
OS << " bool matchingInlineAsm, unsigned VariantID) {\n";
if (!ReportMultipleNearMisses) {
@@ -3409,7 +3490,7 @@
// Emit code to get the available features.
OS << " // Get the current feature set.\n";
- OS << " uint64_t AvailableFeatures = getAvailableFeatures();\n\n";
+ OS << " const FeatureBitset &AvailableFeatures = getAvailableFeatures();\n\n";
OS << " // Get the instruction mnemonic, which is the first token.\n";
if (HasMnemonicFirst) {
@@ -3433,7 +3514,7 @@
OS << " bool HadMatchOtherThanFeatures = false;\n";
OS << " bool HadMatchOtherThanPredicate = false;\n";
OS << " unsigned RetCode = Match_InvalidOperand;\n";
- OS << " uint64_t MissingFeatures = ~0ULL;\n";
+ OS << " MissingFeatures.set();\n";
OS << " // Set ErrorInfo to the operand that mismatches if it is\n";
OS << " // wrong for all instances of the instruction.\n";
OS << " ErrorInfo = ~0ULL;\n";
@@ -3479,9 +3560,10 @@
OS << " for (const MatchEntry *it = MnemonicRange.first, "
<< "*ie = MnemonicRange.second;\n";
OS << " it != ie; ++it) {\n";
+ OS << " const FeatureBitset &RequiredFeatures = "
+ "FeatureBitsets[it->RequiredFeaturesIdx];\n";
OS << " bool HasRequiredFeatures =\n";
- OS << " (AvailableFeatures & it->RequiredFeatures) == "
- "it->RequiredFeatures;\n";
+ OS << " (AvailableFeatures & RequiredFeatures) == RequiredFeatures;\n";
OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Trying to match opcode \"\n";
OS << " << MII.getName(it->Opcode) << \"\\n\");\n";
@@ -3640,16 +3722,18 @@
OS << " if (!HasRequiredFeatures) {\n";
if (!ReportMultipleNearMisses)
OS << " HadMatchOtherThanFeatures = true;\n";
- OS << " uint64_t NewMissingFeatures = it->RequiredFeatures & "
+ OS << " FeatureBitset NewMissingFeatures = RequiredFeatures & "
"~AvailableFeatures;\n";
- OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Missing target features: \"\n";
- OS << " << format_hex(NewMissingFeatures, 18)\n";
- OS << " << \"\\n\");\n";
+ OS << " DEBUG_WITH_TYPE(\"asm-matcher\", dbgs() << \"Missing target features:\";\n";
+ OS << " for (unsigned I = 0, E = NewMissingFeatures.size(); I != E; ++I)\n";
+ OS << " if (NewMissingFeatures[I])\n";
+ OS << " dbgs() << ' ' << I;\n";
+ OS << " dbgs() << \"\\n\");\n";
if (ReportMultipleNearMisses) {
OS << " FeaturesNearMiss = NearMissInfo::getMissedFeature(NewMissingFeatures);\n";
} else {
- OS << " if (countPopulation(NewMissingFeatures) <=\n"
- " countPopulation(MissingFeatures))\n";
+ OS << " if (NewMissingFeatures.count() <=\n"
+ " MissingFeatures.count())\n";
OS << " MissingFeatures = NewMissingFeatures;\n";
OS << " continue;\n";
}
@@ -3804,15 +3888,15 @@
OS << " // Okay, we had no match. Try to return a useful error code.\n";
OS << " if (HadMatchOtherThanPredicate || !HadMatchOtherThanFeatures)\n";
OS << " return RetCode;\n\n";
- OS << " // Missing feature matches return which features were missing\n";
- OS << " ErrorInfo = MissingFeatures;\n";
+ OS << " ErrorInfo = 0;\n";
OS << " return Match_MissingFeature;\n";
}
OS << "}\n\n";
if (!Info.OperandMatchInfo.empty())
emitCustomOperandParsing(OS, Target, Info, ClassName, StringTable,
- MaxMnemonicIndex, HasMnemonicFirst);
+ MaxMnemonicIndex, FeatureBitsets.size(),
+ HasMnemonicFirst);
OS << "#endif // GET_MATCHER_IMPLEMENTATION\n\n";
diff --git a/src/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
index a8f1911..05d81f1 100644
--- a/src/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -1,9 +1,8 @@
//===- AsmWriterEmitter.cpp - Generate an assembly writer -----------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -586,11 +585,20 @@
O << " case ";
if (!Namespace.empty())
O << Namespace << "::";
- O << AltName << ":\n"
- << " assert(*(AsmStrs" << AltName << "+RegAsmOffset" << AltName
- << "[RegNo-1]) &&\n"
- << " \"Invalid alt name index for register!\");\n"
- << " return AsmStrs" << AltName << "+RegAsmOffset" << AltName
+ O << AltName << ":\n";
+ if (R->isValueUnset("FallbackRegAltNameIndex"))
+ O << " assert(*(AsmStrs" << AltName << "+RegAsmOffset" << AltName
+ << "[RegNo-1]) &&\n"
+ << " \"Invalid alt name index for register!\");\n";
+ else {
+ O << " if (!*(AsmStrs" << AltName << "+RegAsmOffset" << AltName
+ << "[RegNo-1]))\n"
+ << " return getRegisterName(RegNo, ";
+ if (!Namespace.empty())
+ O << Namespace << "::";
+ O << R->getValueAsDef("FallbackRegAltNameIndex")->getName() << ");\n";
+ }
+ O << " return AsmStrs" << AltName << "+RegAsmOffset" << AltName
<< "[RegNo-1];\n";
}
O << " }\n";
diff --git a/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.cpp b/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.cpp
index 2c19e5d..c26e0e4 100644
--- a/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.cpp
@@ -1,9 +1,8 @@
//===- AsmWriterInst.h - Classes encapsulating a printable inst -----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -94,8 +93,10 @@
!= std::string::npos) {
AddLiteralString(std::string(1, AsmString[DollarPos+1]));
} else {
- PrintFatalError("Non-supported escaped character found in instruction '" +
- CGI.TheDef->getName() + "'!");
+ PrintFatalError(
+ CGI.TheDef->getLoc(),
+ "Non-supported escaped character found in instruction '" +
+ CGI.TheDef->getName() + "'!");
}
LastEmitted = DollarPos+2;
continue;
@@ -132,15 +133,19 @@
// brace.
if (hasCurlyBraces) {
if (VarEnd >= AsmString.size())
- PrintFatalError("Reached end of string before terminating curly brace in '"
- + CGI.TheDef->getName() + "'");
+ PrintFatalError(
+ CGI.TheDef->getLoc(),
+ "Reached end of string before terminating curly brace in '" +
+ CGI.TheDef->getName() + "'");
// Look for a modifier string.
if (AsmString[VarEnd] == ':') {
++VarEnd;
if (VarEnd >= AsmString.size())
- PrintFatalError("Reached end of string before terminating curly brace in '"
- + CGI.TheDef->getName() + "'");
+ PrintFatalError(
+ CGI.TheDef->getLoc(),
+ "Reached end of string before terminating curly brace in '" +
+ CGI.TheDef->getName() + "'");
std::string::size_type ModifierStart = VarEnd;
while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd]))
@@ -148,17 +153,22 @@
Modifier = std::string(AsmString.begin()+ModifierStart,
AsmString.begin()+VarEnd);
if (Modifier.empty())
- PrintFatalError("Bad operand modifier name in '"+ CGI.TheDef->getName() + "'");
+ PrintFatalError(CGI.TheDef->getLoc(),
+ "Bad operand modifier name in '" +
+ CGI.TheDef->getName() + "'");
}
if (AsmString[VarEnd] != '}')
- PrintFatalError("Variable name beginning with '{' did not end with '}' in '"
- + CGI.TheDef->getName() + "'");
+ PrintFatalError(
+ CGI.TheDef->getLoc(),
+ "Variable name beginning with '{' did not end with '}' in '" +
+ CGI.TheDef->getName() + "'");
++VarEnd;
}
if (VarName.empty() && Modifier.empty())
- PrintFatalError("Stray '$' in '" + CGI.TheDef->getName() +
- "' asm string, maybe you want $$?");
+ PrintFatalError(CGI.TheDef->getLoc(),
+ "Stray '$' in '" + CGI.TheDef->getName() +
+ "' asm string, maybe you want $$?");
if (VarName.empty()) {
// Just a modifier, pass this into PrintSpecial.
diff --git a/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.h b/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.h
index 708f23c..7d88e5a 100644
--- a/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.h
+++ b/src/llvm-project/llvm/utils/TableGen/AsmWriterInst.h
@@ -1,9 +1,8 @@
//===- AsmWriterInst.h - Classes encapsulating a printable inst -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/Attributes.cpp b/src/llvm-project/llvm/utils/TableGen/Attributes.cpp
index 6bfc0ab..6fbc595 100644
--- a/src/llvm-project/llvm/utils/TableGen/Attributes.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/Attributes.cpp
@@ -1,9 +1,8 @@
//===- Attributes.cpp - Generate attributes -------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/CTagsEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/CTagsEmitter.cpp
index bd596bc..ccb7f33 100644
--- a/src/llvm-project/llvm/utils/TableGen/CTagsEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CTagsEmitter.cpp
@@ -1,9 +1,8 @@
//===- CTagsEmitter.cpp - Generate ctags-compatible index ------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/CallingConvEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/CallingConvEmitter.cpp
index d452031..de5044e 100644
--- a/src/llvm-project/llvm/utils/TableGen/CallingConvEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CallingConvEmitter.cpp
@@ -1,9 +1,8 @@
//===- CallingConvEmitter.cpp - Generate calling conventions --------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -41,11 +40,17 @@
// each other.
for (Record *CC : CCs) {
if (!CC->getValueAsBit("Custom")) {
- O << "static bool " << CC->getName()
- << "(unsigned ValNo, MVT ValVT,\n"
- << std::string(CC->getName().size() + 13, ' ')
- << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
- << std::string(CC->getName().size() + 13, ' ')
+ unsigned Pad = CC->getName().size();
+ if (CC->getValueAsBit("Entry")) {
+ O << "bool llvm::";
+ Pad += 12;
+ } else {
+ O << "static bool ";
+ Pad += 13;
+ }
+ O << CC->getName() << "(unsigned ValNo, MVT ValVT,\n"
+ << std::string(Pad, ' ') << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
+ << std::string(Pad, ' ')
<< "ISD::ArgFlagsTy ArgFlags, CCState &State);\n";
}
}
@@ -62,12 +67,18 @@
ListInit *CCActions = CC->getValueAsListInit("Actions");
Counter = 0;
- O << "\n\nstatic bool " << CC->getName()
- << "(unsigned ValNo, MVT ValVT,\n"
- << std::string(CC->getName().size()+13, ' ')
- << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
- << std::string(CC->getName().size()+13, ' ')
- << "ISD::ArgFlagsTy ArgFlags, CCState &State) {\n";
+ O << "\n\n";
+ unsigned Pad = CC->getName().size();
+ if (CC->getValueAsBit("Entry")) {
+ O << "bool llvm::";
+ Pad += 12;
+ } else {
+ O << "static bool ";
+ Pad += 13;
+ }
+ O << CC->getName() << "(unsigned ValNo, MVT ValVT,\n"
+ << std::string(Pad, ' ') << "MVT LocVT, CCValAssign::LocInfo LocInfo,\n"
+ << std::string(Pad, ' ') << "ISD::ArgFlagsTy ArgFlags, CCState &State) {\n";
// Emit all of the actions, in order.
for (unsigned i = 0, e = CCActions->size(); i != e; ++i) {
O << "\n";
@@ -97,7 +108,7 @@
O << Action->getValueAsString("Predicate");
} else {
errs() << *Action;
- PrintFatalError("Unknown CCPredicateAction!");
+ PrintFatalError(Action->getLoc(), "Unknown CCPredicateAction!");
}
O << ") {\n";
@@ -134,7 +145,8 @@
ListInit *RegList = Action->getValueAsListInit("RegList");
ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
if (!ShadowRegList->empty() && ShadowRegList->size() != RegList->size())
- PrintFatalError("Invalid length of list of shadowed registers");
+ PrintFatalError(Action->getLoc(),
+ "Invalid length of list of shadowed registers");
if (RegList->size() == 1) {
O << IndentStr << "if (unsigned Reg = State.AllocateReg(";
@@ -237,7 +249,8 @@
MVT::SimpleValueType DestVT = getValueType(DestTy);
O << IndentStr << "LocVT = " << getEnumName(DestVT) << ";\n";
if (MVT(DestVT).isFloatingPoint()) {
- PrintFatalError("CCPromoteToUpperBitsInType does not handle floating "
+ PrintFatalError(Action->getLoc(),
+ "CCPromoteToUpperBitsInType does not handle floating "
"point");
} else {
O << IndentStr << "if (ArgFlags.isSExt())\n"
@@ -269,7 +282,7 @@
O << IndentStr << IndentStr << "return false;\n";
} else {
errs() << *Action;
- PrintFatalError("Unknown CCAction!");
+ PrintFatalError(Action->getLoc(), "Unknown CCAction!");
}
}
}
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeEmitterGen.cpp b/src/llvm-project/llvm/utils/TableGen/CodeEmitterGen.cpp
index 23751a2..da65763 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeEmitterGen.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeEmitterGen.cpp
@@ -1,9 +1,8 @@
//===- CodeEmitterGen.cpp - Code Emitter Generator ------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -16,6 +15,7 @@
#include "CodeGenInstruction.h"
#include "CodeGenTarget.h"
#include "SubtargetFeatureInfo.h"
+#include "Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
@@ -229,6 +229,14 @@
return Case;
}
+static std::string
+getNameForFeatureBitset(const std::vector<Record *> &FeatureBitset) {
+ std::string Name = "CEFBS";
+ for (const auto &Feature : FeatureBitset)
+ Name += ("_" + Feature->getName()).str();
+ return Name;
+}
+
void CodeEmitterGen::run(raw_ostream &o) {
CodeGenTarget Target(Records);
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
@@ -327,8 +335,8 @@
<< "#include <sstream>\n\n";
// Emit the subtarget feature enumeration.
- SubtargetFeatureInfo::emitSubtargetFeatureFlagEnumeration(SubtargetFeatures,
- o);
+ SubtargetFeatureInfo::emitSubtargetFeatureBitEnumeration(SubtargetFeatures,
+ o);
// Emit the name table for error messages.
o << "#ifndef NDEBUG\n";
@@ -340,35 +348,97 @@
Target.getName(), "MCCodeEmitter", "computeAvailableFeatures",
SubtargetFeatures, o);
- // Emit the predicate verifier.
- o << "void " << Target.getName()
- << "MCCodeEmitter::verifyInstructionPredicates(\n"
- << " const MCInst &Inst, uint64_t AvailableFeatures) const {\n"
- << "#ifndef NDEBUG\n"
- << " static uint64_t RequiredFeatures[] = {\n";
- unsigned InstIdx = 0;
+ std::vector<std::vector<Record *>> FeatureBitsets;
for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue()) {
- o << " ";
+ FeatureBitsets.emplace_back();
for (Record *Predicate : Inst->TheDef->getValueAsListOfDefs("Predicates")) {
const auto &I = SubtargetFeatures.find(Predicate);
if (I != SubtargetFeatures.end())
- o << I->second.getEnumName() << " | ";
+ FeatureBitsets.back().push_back(I->second.TheDef);
}
- o << "0, // " << Inst->TheDef->getName() << " = " << InstIdx << "\n";
+ }
+
+ llvm::sort(FeatureBitsets, [&](const std::vector<Record *> &A,
+ const std::vector<Record *> &B) {
+ if (A.size() < B.size())
+ return true;
+ if (A.size() > B.size())
+ return false;
+ for (const auto &Pair : zip(A, B)) {
+ if (std::get<0>(Pair)->getName() < std::get<1>(Pair)->getName())
+ return true;
+ if (std::get<0>(Pair)->getName() > std::get<1>(Pair)->getName())
+ return false;
+ }
+ return false;
+ });
+ FeatureBitsets.erase(
+ std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
+ FeatureBitsets.end());
+ o << "#ifndef NDEBUG\n"
+ << "// Feature bitsets.\n"
+ << "enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
+ << " CEFBS_None,\n";
+ for (const auto &FeatureBitset : FeatureBitsets) {
+ if (FeatureBitset.empty())
+ continue;
+ o << " " << getNameForFeatureBitset(FeatureBitset) << ",\n";
+ }
+ o << "};\n\n"
+ << "const static FeatureBitset FeatureBitsets[] {\n"
+ << " {}, // CEFBS_None\n";
+ for (const auto &FeatureBitset : FeatureBitsets) {
+ if (FeatureBitset.empty())
+ continue;
+ o << " {";
+ for (const auto &Feature : FeatureBitset) {
+ const auto &I = SubtargetFeatures.find(Feature);
+ assert(I != SubtargetFeatures.end() && "Didn't import predicate?");
+ o << I->second.getEnumBitName() << ", ";
+ }
+ o << "},\n";
+ }
+ o << "};\n"
+ << "#endif // NDEBUG\n\n";
+
+
+ // Emit the predicate verifier.
+ o << "void " << Target.getName()
+ << "MCCodeEmitter::verifyInstructionPredicates(\n"
+ << " const MCInst &Inst, const FeatureBitset &AvailableFeatures) const {\n"
+ << "#ifndef NDEBUG\n"
+ << " static " << getMinimalTypeForRange(FeatureBitsets.size())
+ << " RequiredFeaturesRefs[] = {\n";
+ unsigned InstIdx = 0;
+ for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue()) {
+ o << " CEFBS";
+ unsigned NumPredicates = 0;
+ for (Record *Predicate : Inst->TheDef->getValueAsListOfDefs("Predicates")) {
+ const auto &I = SubtargetFeatures.find(Predicate);
+ if (I != SubtargetFeatures.end()) {
+ o << '_' << I->second.TheDef->getName();
+ NumPredicates++;
+ }
+ }
+ if (!NumPredicates)
+ o << "_None";
+ o << ", // " << Inst->TheDef->getName() << " = " << InstIdx << "\n";
InstIdx++;
}
o << " };\n\n";
o << " assert(Inst.getOpcode() < " << InstIdx << ");\n";
- o << " uint64_t MissingFeatures =\n"
- << " (AvailableFeatures & RequiredFeatures[Inst.getOpcode()]) ^\n"
- << " RequiredFeatures[Inst.getOpcode()];\n"
- << " if (MissingFeatures) {\n"
+ o << " const FeatureBitset &RequiredFeatures = "
+ "FeatureBitsets[RequiredFeaturesRefs[Inst.getOpcode()]];\n";
+ o << " FeatureBitset MissingFeatures =\n"
+ << " (AvailableFeatures & RequiredFeatures) ^\n"
+ << " RequiredFeatures;\n"
+ << " if (MissingFeatures.any()) {\n"
<< " std::ostringstream Msg;\n"
<< " Msg << \"Attempting to emit \" << "
"MCII.getName(Inst.getOpcode()).str()\n"
<< " << \" instruction but the \";\n"
- << " for (unsigned i = 0; i < 8 * sizeof(MissingFeatures); ++i)\n"
- << " if (MissingFeatures & (1ULL << i))\n"
+ << " for (unsigned i = 0, e = MissingFeatures.size(); i != e; ++i)\n"
+ << " if (MissingFeatures.test(i))\n"
<< " Msg << SubtargetFeatureNames[i] << \" \";\n"
<< " Msg << \"predicate(s) are not met\";\n"
<< " report_fatal_error(Msg.str());\n"
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 96c90c9..c8f710d 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1,9 +1,8 @@
//===- CodeGenDAGPatterns.cpp - Read DAG patterns from .td file -----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -68,8 +67,10 @@
// inference will apply to each mode separately.
TypeSetByHwMode::TypeSetByHwMode(ArrayRef<ValueTypeByHwMode> VTList) {
- for (const ValueTypeByHwMode &VVT : VTList)
+ for (const ValueTypeByHwMode &VVT : VTList) {
insert(VVT);
+ AddrSpaces.push_back(VVT.PtrAddrSpace);
+ }
}
bool TypeSetByHwMode::isValueTypeByHwMode(bool AllowEmpty) const {
@@ -86,9 +87,13 @@
assert(isValueTypeByHwMode(true) &&
"The type set has multiple types for at least one HW mode");
ValueTypeByHwMode VVT;
+ auto ASI = AddrSpaces.begin();
+
for (const auto &I : *this) {
MVT T = I.second.empty() ? MVT::Other : *I.second.begin();
VVT.getOrCreateTypeForMode(I.first, T);
+ if (ASI != AddrSpaces.end())
+ VVT.PtrAddrSpace = *ASI++;
}
return VVT;
}
@@ -502,22 +507,14 @@
(A.getScalarSizeInBits() == B.getScalarSizeInBits() &&
A.getSizeInBits() < B.getSizeInBits());
};
- auto LE = [](MVT A, MVT B) -> bool {
+ auto LE = [<](MVT A, MVT B) -> bool {
// This function is used when removing elements: when a vector is compared
// to a non-vector, it should return false (to avoid removal).
if (A.isVector() != B.isVector())
return false;
- // Note on the < comparison below:
- // X86 has patterns like
- // (set VR128X:$dst, (v16i8 (X86vtrunc (v4i32 VR128X:$src1)))),
- // where the truncated vector is given a type v16i8, while the source
- // vector has type v4i32. They both have the same size in bits.
- // The minimal type in the result is obviously v16i8, and when we remove
- // all types from the source that are smaller-or-equal than v8i16, the
- // only source type would also be removed (since it's equal in size).
- return A.getScalarSizeInBits() <= B.getScalarSizeInBits() ||
- A.getSizeInBits() < B.getSizeInBits();
+ return LT(A, B) || (A.getScalarSizeInBits() == B.getScalarSizeInBits() &&
+ A.getSizeInBits() == B.getSizeInBits());
};
for (unsigned M : Modes) {
@@ -957,13 +954,33 @@
}
if (isLoad() || isStore() || isAtomic()) {
- StringRef SDNodeName =
- isLoad() ? "LoadSDNode" : isStore() ? "StoreSDNode" : "AtomicSDNode";
+ if (ListInit *AddressSpaces = getAddressSpaces()) {
+ Code += "unsigned AddrSpace = cast<MemSDNode>(N)->getAddressSpace();\n"
+ " if (";
+
+ bool First = true;
+ for (Init *Val : AddressSpaces->getValues()) {
+ if (First)
+ First = false;
+ else
+ Code += " && ";
+
+ IntInit *IntVal = dyn_cast<IntInit>(Val);
+ if (!IntVal) {
+ PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(),
+ "AddressSpaces element must be integer");
+ }
+
+ Code += "AddrSpace != " + utostr(IntVal->getValue());
+ }
+
+ Code += ")\nreturn false;\n";
+ }
Record *MemoryVT = getMemoryVT();
if (MemoryVT)
- Code += ("if (cast<" + SDNodeName + ">(N)->getMemoryVT() != MVT::" +
+ Code += ("if (cast<MemSDNode>(N)->getMemoryVT() != MVT::" +
MemoryVT->getName() + ") return false;\n")
.str();
}
@@ -1152,6 +1169,14 @@
return nullptr;
return R->getValueAsDef("MemoryVT");
}
+
+ListInit *TreePredicateFn::getAddressSpaces() const {
+ Record *R = getOrigPatFragRecord()->getRecord();
+ if (R->isValueUnset("AddressSpaces"))
+ return nullptr;
+ return R->getValueAsListInit("AddressSpaces");
+}
+
Record *TreePredicateFn::getScalarMemoryVT() const {
Record *R = getOrigPatFragRecord()->getRecord();
if (R->isValueUnset("ScalarMemoryVT"))
@@ -1276,6 +1301,17 @@
// PatternToMatch implementation
//
+static bool isImmAllOnesAllZerosMatch(const TreePatternNode *P) {
+ if (!P->isLeaf())
+ return false;
+ DefInit *DI = dyn_cast<DefInit>(P->getLeafValue());
+ if (!DI)
+ return false;
+
+ Record *R = DI->getDef();
+ return R->getName() == "immAllOnesV" || R->getName() == "immAllZerosV";
+}
+
/// getPatternSize - Return the 'size' of this pattern. We want to match large
/// patterns before small ones. This is used to determine the size of a
/// pattern.
@@ -1315,6 +1351,8 @@
Size += 5; // Matches a ConstantSDNode (+3) and a specific value (+2).
else if (Child->getComplexPatternInfo(CGP))
Size += getPatternSize(Child, CGP);
+ else if (isImmAllOnesAllZerosMatch(Child))
+ Size += 4; // Matches a build_vector(+3) and a predicate (+1).
else if (!Child->getPredicateCalls().empty())
++Size;
}
@@ -1408,7 +1446,8 @@
x.SDTCisSameSizeAs_Info.OtherOperandNum =
R->getValueAsInt("OtherOperandNum");
} else {
- PrintFatalError("Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
+ PrintFatalError(R->getLoc(),
+ "Unrecognized SDTypeConstraint '" + R->getName() + "'!\n");
}
}
@@ -2120,7 +2159,8 @@
}
if (R->getName() == "node" || R->getName() == "srcvalue" ||
- R->getName() == "zero_reg") {
+ R->getName() == "zero_reg" || R->getName() == "immAllOnesV" ||
+ R->getName() == "immAllZerosV" || R->getName() == "undef_tied_input") {
// Placeholder.
return TypeSetByHwMode(); // Unknown.
}
@@ -2425,18 +2465,32 @@
}
}
+ // If one or more operands with a default value appear at the end of the
+ // formal operand list for an instruction, we allow them to be overridden
+ // by optional operands provided in the pattern.
+ //
+ // But if an operand B without a default appears at any point after an
+ // operand A with a default, then we don't allow A to be overridden,
+ // because there would be no way to specify whether the next operand in
+ // the pattern was intended to override A or skip it.
+ unsigned NonOverridableOperands = Inst.getNumOperands();
+ while (NonOverridableOperands > 0 &&
+ CDP.operandHasDefault(Inst.getOperand(NonOverridableOperands-1)))
+ --NonOverridableOperands;
+
unsigned ChildNo = 0;
for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) {
Record *OperandNode = Inst.getOperand(i);
- // If the instruction expects a predicate or optional def operand, we
- // codegen this by setting the operand to it's default value if it has a
- // non-empty DefaultOps field.
- if (OperandNode->isSubClassOf("OperandWithDefaultOps") &&
- !CDP.getDefaultOperand(OperandNode).DefaultOps.empty())
+ // If the operand has a default value, do we use it? We must use the
+ // default if we've run out of children of the pattern DAG to consume,
+ // or if the operand is followed by a non-defaulted one.
+ if (CDP.operandHasDefault(OperandNode) &&
+ (i < NonOverridableOperands || ChildNo >= getNumChildren()))
continue;
- // Verify that we didn't run out of provided operands.
+ // If we have run out of child nodes and there _isn't_ a default
+ // value we can use for the next operand, give an error.
if (ChildNo >= getNumChildren()) {
emitTooFewOperandsError(TP, getOperator()->getName(), getNumChildren());
return false;
@@ -2753,7 +2807,7 @@
// chain.
if (Int.IS.RetVTs.empty())
Operator = getDAGPatterns().get_intrinsic_void_sdnode();
- else if (Int.ModRef != CodeGenIntrinsic::NoMem)
+ else if (Int.ModRef != CodeGenIntrinsic::NoMem || Int.hasSideEffects)
// Has side-effects, requires chain.
Operator = getDAGPatterns().get_intrinsic_w_chain_sdnode();
else // Otherwise, no chain.
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.h b/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.h
index 4be9afd..2b49a64 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -1,9 +1,8 @@
//===- CodeGenDAGPatterns.h - Read DAG patterns from .td file ---*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -191,6 +190,7 @@
struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> {
using SetType = MachineValueTypeSet;
+ std::vector<unsigned> AddrSpaces;
TypeSetByHwMode() = default;
TypeSetByHwMode(const TypeSetByHwMode &VTS) = default;
@@ -227,6 +227,15 @@
return Map.size() == 1 && Map.begin()->first == DefaultMode;
}
+ bool isPointer() const {
+ return getValueTypeByHwMode().isPointer();
+ }
+
+ unsigned getPtrAddrSpace() const {
+ assert(isPointer());
+ return getValueTypeByHwMode().PtrAddrSpace;
+ }
+
bool insert(const ValueTypeByHwMode &VVT);
bool constrain(const TypeSetByHwMode &VTS);
template <typename Predicate> bool constrain(Predicate P);
@@ -243,6 +252,7 @@
bool validate() const;
private:
+ unsigned PtrAddrSpace = std::numeric_limits<unsigned>::max();
/// Intersect two sets. Return true if anything has changed.
bool intersect(SetType &Out, const SetType &In);
};
@@ -583,6 +593,8 @@
/// ValueType record for the memory VT.
Record *getScalarMemoryVT() const;
+ ListInit *getAddressSpaces() const;
+
// If true, indicates that GlobalISel-based C++ code was supplied.
bool hasGISelPredicateCode() const;
std::string getGISelPredicateCode() const;
@@ -1272,6 +1284,11 @@
unsigned allocateScope() { return ++NumScopes; }
+ bool operandHasDefault(Record *Op) const {
+ return Op->isSubClassOf("OperandWithDefaultOps") &&
+ !getDefaultOperand(Op).DefaultOps.empty();
+ }
+
private:
void ParseNodeInfo();
void ParseNodeTransforms();
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.cpp
index 9f88d95..9052cdd 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.cpp
@@ -1,9 +1,8 @@
//===--- CodeGenHwModes.cpp -----------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Classes to parse and store HW mode information for instruction selection
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.h b/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.h
index 36df835..1ff2faa 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenHwModes.h
@@ -1,9 +1,8 @@
//===--- CodeGenHwModes.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Classes to parse and store HW mode information for instruction selection.
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.cpp
index 6d06ba2..2463824 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -1,9 +1,8 @@
//===- CodeGenInstruction.cpp - CodeGen Instruction Class Wrapper ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -34,18 +33,24 @@
if (DefInit *Init = dyn_cast<DefInit>(OutDI->getOperator())) {
if (Init->getDef()->getName() != "outs")
- PrintFatalError(R->getName() + ": invalid def name for output list: use 'outs'");
+ PrintFatalError(R->getLoc(),
+ R->getName() +
+ ": invalid def name for output list: use 'outs'");
} else
- PrintFatalError(R->getName() + ": invalid output list: use 'outs'");
+ PrintFatalError(R->getLoc(),
+ R->getName() + ": invalid output list: use 'outs'");
NumDefs = OutDI->getNumArgs();
DagInit *InDI = R->getValueAsDag("InOperandList");
if (DefInit *Init = dyn_cast<DefInit>(InDI->getOperator())) {
if (Init->getDef()->getName() != "ins")
- PrintFatalError(R->getName() + ": invalid def name for input list: use 'ins'");
+ PrintFatalError(R->getLoc(),
+ R->getName() +
+ ": invalid def name for input list: use 'ins'");
} else
- PrintFatalError(R->getName() + ": invalid input list: use 'ins'");
+ PrintFatalError(R->getLoc(),
+ R->getName() + ": invalid input list: use 'ins'");
unsigned MIOperandNo = 0;
std::set<std::string> OperandNames;
@@ -64,7 +69,8 @@
DefInit *Arg = dyn_cast<DefInit>(ArgInit);
if (!Arg)
- PrintFatalError("Illegal operand for the '" + R->getName() + "' instruction!");
+ PrintFatalError(R->getLoc(), "Illegal operand for the '" + R->getName() +
+ "' instruction!");
Record *Rec = Arg->getDef();
std::string PrintMethod = "printOperand";
@@ -89,8 +95,9 @@
// Verify that MIOpInfo has an 'ops' root value.
if (!isa<DefInit>(MIOpInfo->getOperator()) ||
cast<DefInit>(MIOpInfo->getOperator())->getDef()->getName() != "ops")
- PrintFatalError("Bad value for MIOperandInfo in operand '" + Rec->getName() +
- "'\n");
+ PrintFatalError(R->getLoc(),
+ "Bad value for MIOperandInfo in operand '" +
+ Rec->getName() + "'\n");
// If we have MIOpInfo, then we have #operands equal to number of entries
// in MIOperandInfo.
@@ -108,16 +115,20 @@
OperandType = "OPERAND_REGISTER";
} else if (!Rec->isSubClassOf("PointerLikeRegClass") &&
!Rec->isSubClassOf("unknown_class"))
- PrintFatalError("Unknown operand class '" + Rec->getName() +
- "' in '" + R->getName() + "' instruction!");
+ PrintFatalError(R->getLoc(), "Unknown operand class '" + Rec->getName() +
+ "' in '" + R->getName() +
+ "' instruction!");
// Check that the operand has a name and that it's unique.
if (ArgName.empty())
- PrintFatalError("In instruction '" + R->getName() + "', operand #" +
- Twine(i) + " has no name!");
+ PrintFatalError(R->getLoc(), "In instruction '" + R->getName() +
+ "', operand #" + Twine(i) +
+ " has no name!");
if (!OperandNames.insert(ArgName).second)
- PrintFatalError("In instruction '" + R->getName() + "', operand #" +
- Twine(i) + " has the same name as a previous operand!");
+ PrintFatalError(R->getLoc(),
+ "In instruction '" + R->getName() + "', operand #" +
+ Twine(i) +
+ " has the same name as a previous operand!");
OperandList.emplace_back(Rec, ArgName, PrintMethod, EncoderMethod,
OperandNamespace + "::" + OperandType, MIOperandNo,
@@ -139,9 +150,11 @@
///
unsigned CGIOperandList::getOperandNamed(StringRef Name) const {
unsigned OpIdx;
- if (hasOperandNamed(Name, OpIdx)) return OpIdx;
- PrintFatalError("'" + TheDef->getName() +
- "' does not have an operand named '$" + Name + "'!");
+ if (hasOperandNamed(Name, OpIdx))
+ return OpIdx;
+ PrintFatalError(TheDef->getLoc(), "'" + TheDef->getName() +
+ "' does not have an operand named '$" +
+ Name + "'!");
}
/// hasOperandNamed - Query whether the instruction has an operand of the
@@ -160,7 +173,8 @@
std::pair<unsigned,unsigned>
CGIOperandList::ParseOperandName(const std::string &Op, bool AllowWholeOp) {
if (Op.empty() || Op[0] != '$')
- PrintFatalError(TheDef->getName() + ": Illegal operand name: '" + Op + "'");
+ PrintFatalError(TheDef->getLoc(),
+ TheDef->getName() + ": Illegal operand name: '" + Op + "'");
std::string OpName = Op.substr(1);
std::string SubOpName;
@@ -170,7 +184,9 @@
if (DotIdx != std::string::npos) {
SubOpName = OpName.substr(DotIdx+1);
if (SubOpName.empty())
- PrintFatalError(TheDef->getName() + ": illegal empty suboperand name in '" +Op +"'");
+ PrintFatalError(TheDef->getLoc(),
+ TheDef->getName() +
+ ": illegal empty suboperand name in '" + Op + "'");
OpName = OpName.substr(0, DotIdx);
}
@@ -180,8 +196,11 @@
// If one was needed, throw.
if (OperandList[OpIdx].MINumOperands > 1 && !AllowWholeOp &&
SubOpName.empty())
- PrintFatalError(TheDef->getName() + ": Illegal to refer to"
- " whole operand part of complex operand '" + Op + "'");
+ PrintFatalError(TheDef->getLoc(),
+ TheDef->getName() +
+ ": Illegal to refer to"
+ " whole operand part of complex operand '" +
+ Op + "'");
// Otherwise, return the operand.
return std::make_pair(OpIdx, 0U);
@@ -190,7 +209,9 @@
// Find the suboperand number involved.
DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
if (!MIOpInfo)
- PrintFatalError(TheDef->getName() + ": unknown suboperand name in '" + Op + "'");
+ PrintFatalError(TheDef->getLoc(), TheDef->getName() +
+ ": unknown suboperand name in '" +
+ Op + "'");
// Find the operand with the right name.
for (unsigned i = 0, e = MIOpInfo->getNumArgs(); i != e; ++i)
@@ -198,7 +219,9 @@
return std::make_pair(OpIdx, i);
// Otherwise, didn't find it!
- PrintFatalError(TheDef->getName() + ": unknown suboperand name in '" + Op + "'");
+ PrintFatalError(TheDef->getLoc(), TheDef->getName() +
+ ": unknown suboperand name in '" + Op +
+ "'");
return std::make_pair(0U, 0U);
}
@@ -354,7 +377,8 @@
isAdd = R->getValueAsBit("isAdd");
isTrap = R->getValueAsBit("isTrap");
canFoldAsLoad = R->getValueAsBit("canFoldAsLoad");
- isPredicable = Operands.isPredicable || R->getValueAsBit("isPredicable");
+ isPredicable = !R->getValueAsBit("isUnpredicable") && (
+ Operands.isPredicable || R->getValueAsBit("isPredicable"));
isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress");
isCommutable = R->getValueAsBit("isCommutable");
isTerminator = R->getValueAsBit("isTerminator");
@@ -377,6 +401,7 @@
mayLoad_Unset = Unset;
mayStore = R->getValueAsBitOrUnset("mayStore", Unset);
mayStore_Unset = Unset;
+ mayRaiseFPException = R->getValueAsBit("mayRaiseFPException");
hasSideEffects = R->getValueAsBitOrUnset("hasSideEffects", Unset);
hasSideEffects_Unset = Unset;
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.h b/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.h
index 2e3d2f4..bb5b136 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenInstruction.h
@@ -1,9 +1,8 @@
//===- CodeGenInstruction.h - Instruction Class Wrapper ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -250,6 +249,7 @@
bool mayLoad_Unset : 1;
bool mayStore : 1;
bool mayStore_Unset : 1;
+ bool mayRaiseFPException : 1;
bool isPredicable : 1;
bool isConvertibleToThreeAddress : 1;
bool isCommutable : 1;
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenIntrinsics.h b/src/llvm-project/llvm/utils/TableGen/CodeGenIntrinsics.h
index 9487a79..7b74bb0 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenIntrinsics.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenIntrinsics.h
@@ -1,9 +1,8 @@
//===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -124,6 +123,9 @@
/// True if the intrinsic is no-return.
bool isNoReturn;
+ /// True if the intrinsic is will-return.
+ bool isWillReturn;
+
/// True if the intrinsic is cold.
bool isCold;
@@ -137,7 +139,15 @@
// True if the intrinsic is marked as speculatable.
bool isSpeculatable;
- enum ArgAttribute { NoCapture, Returned, ReadOnly, WriteOnly, ReadNone };
+ enum ArgAttribute {
+ NoCapture,
+ Returned,
+ ReadOnly,
+ WriteOnly,
+ ReadNone,
+ ImmArg
+ };
+
std::vector<std::pair<unsigned, ArgAttribute>> ArgumentAttributes;
bool hasProperty(enum SDNP Prop) const {
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenMapTable.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenMapTable.cpp
index e5b0426..b1774b0 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -1,9 +1,8 @@
//===- CodeGenMapTable.cpp - Instruction Mapping Table Generator ----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// CodeGenMapTable provides functionality for the TabelGen to create
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.cpp
index 74a2b07..f87c6d6 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -1,9 +1,8 @@
//===- CodeGenRegisters.cpp - Register and RegisterClass Info -------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -740,8 +739,9 @@
for (unsigned i = 0, e = TypeList.size(); i != e; ++i) {
Record *Type = TypeList[i];
if (!Type->isSubClassOf("ValueType"))
- PrintFatalError("RegTypes list member '" + Type->getName() +
- "' does not derive from the ValueType class!");
+ PrintFatalError(R->getLoc(),
+ "RegTypes list member '" + Type->getName() +
+ "' does not derive from the ValueType class!");
VTs.push_back(getValueTypeByHwMode(Type, RegBank.getHwModes()));
}
assert(!VTs.empty() && "RegisterClass must contain at least one ValueType!");
@@ -2101,8 +2101,7 @@
for (unsigned Idx = 0, EndIdx = RegUnitSets.size(); Idx != EndIdx; ++Idx)
RegUnitSetOrder.push_back(Idx);
- std::stable_sort(RegUnitSetOrder.begin(), RegUnitSetOrder.end(),
- [this](unsigned ID1, unsigned ID2) {
+ llvm::stable_sort(RegUnitSetOrder, [this](unsigned ID1, unsigned ID2) {
return getRegPressureSet(ID1).Units.size() <
getRegPressureSet(ID2).Units.size();
});
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h b/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h
index 0f7a025..f04a90f 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenRegisters.h
@@ -1,9 +1,8 @@
//===- CodeGenRegisters.h - Register and RegisterClass Info -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.cpp
index 6d259cb..fd00704 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -1,9 +1,8 @@
//===- CodeGenSchedule.cpp - Scheduling MachineModels ---------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -369,24 +368,22 @@
[&](const OpcodeMapPair &Lhs, const OpcodeMapPair &Rhs) {
unsigned LhsIdx = Opcode2Index[Lhs.first];
unsigned RhsIdx = Opcode2Index[Rhs.first];
- std::pair<APInt, APInt> &LhsMasks = OpcodeMasks[LhsIdx];
- std::pair<APInt, APInt> &RhsMasks = OpcodeMasks[RhsIdx];
+ const std::pair<APInt, APInt> &LhsMasks = OpcodeMasks[LhsIdx];
+ const std::pair<APInt, APInt> &RhsMasks = OpcodeMasks[RhsIdx];
- if (LhsMasks.first != RhsMasks.first) {
- if (LhsMasks.first.countPopulation() <
- RhsMasks.first.countPopulation())
- return true;
- return LhsMasks.first.countLeadingZeros() >
- RhsMasks.first.countLeadingZeros();
- }
+ auto LessThan = [](const APInt &Lhs, const APInt &Rhs) {
+ unsigned LhsCountPopulation = Lhs.countPopulation();
+ unsigned RhsCountPopulation = Rhs.countPopulation();
+ return ((LhsCountPopulation < RhsCountPopulation) ||
+ ((LhsCountPopulation == RhsCountPopulation) &&
+ (Lhs.countLeadingZeros() > Rhs.countLeadingZeros())));
+ };
- if (LhsMasks.second != RhsMasks.second) {
- if (LhsMasks.second.countPopulation() <
- RhsMasks.second.countPopulation())
- return true;
- return LhsMasks.second.countLeadingZeros() >
- RhsMasks.second.countLeadingZeros();
- }
+ if (LhsMasks.first != RhsMasks.first)
+ return LessThan(LhsMasks.first, RhsMasks.first);
+
+ if (LhsMasks.second != RhsMasks.second)
+ return LessThan(LhsMasks.second, RhsMasks.second);
return LhsIdx < RhsIdx;
});
@@ -1936,8 +1933,10 @@
unsigned SCIdx = getSchedClassIdx(*Inst);
if (!SCIdx) {
if (Inst->TheDef->isValueUnset("SchedRW") && !HadCompleteModel) {
- PrintError("No schedule information for instruction '"
- + Inst->TheDef->getName() + "'");
+ PrintError(Inst->TheDef->getLoc(),
+ "No schedule information for instruction '" +
+ Inst->TheDef->getName() + "' in SchedMachineModel '" +
+ ProcModel.ModelDef->getName() + "'");
Complete = false;
}
continue;
@@ -1955,8 +1954,9 @@
return R->getValueAsDef("SchedModel") == ProcModel.ModelDef;
});
if (I == InstRWs.end()) {
- PrintError("'" + ProcModel.ModelName + "' lacks information for '" +
- Inst->TheDef->getName() + "'");
+ PrintError(Inst->TheDef->getLoc(), "'" + ProcModel.ModelName +
+ "' lacks information for '" +
+ Inst->TheDef->getName() + "'");
Complete = false;
}
}
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.h b/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.h
index 87a051b..c26fb1f 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenSchedule.h
@@ -1,9 +1,8 @@
//===- CodeGenSchedule.h - Scheduling Machine Models ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.cpp b/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.cpp
index bcb6531..b65e1b6 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -1,9 +1,8 @@
//===- CodeGenTarget.cpp - CodeGen Target Class Wrapper -------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -21,8 +20,10 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Timer.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
#include <algorithm>
using namespace llvm;
@@ -105,11 +106,18 @@
case MVT::v128i16: return "MVT::v128i16";
case MVT::v1i32: return "MVT::v1i32";
case MVT::v2i32: return "MVT::v2i32";
+ case MVT::v3i32: return "MVT::v3i32";
case MVT::v4i32: return "MVT::v4i32";
+ case MVT::v5i32: return "MVT::v5i32";
case MVT::v8i32: return "MVT::v8i32";
case MVT::v16i32: return "MVT::v16i32";
case MVT::v32i32: return "MVT::v32i32";
case MVT::v64i32: return "MVT::v64i32";
+ case MVT::v128i32: return "MVT::v128i32";
+ case MVT::v256i32: return "MVT::v256i32";
+ case MVT::v512i32: return "MVT::v512i32";
+ case MVT::v1024i32: return "MVT::v1024i32";
+ case MVT::v2048i32: return "MVT::v2048i32";
case MVT::v1i64: return "MVT::v1i64";
case MVT::v2i64: return "MVT::v2i64";
case MVT::v4i64: return "MVT::v4i64";
@@ -122,9 +130,18 @@
case MVT::v8f16: return "MVT::v8f16";
case MVT::v1f32: return "MVT::v1f32";
case MVT::v2f32: return "MVT::v2f32";
+ case MVT::v3f32: return "MVT::v3f32";
case MVT::v4f32: return "MVT::v4f32";
+ case MVT::v5f32: return "MVT::v5f32";
case MVT::v8f32: return "MVT::v8f32";
case MVT::v16f32: return "MVT::v16f32";
+ case MVT::v32f32: return "MVT::v32f32";
+ case MVT::v64f32: return "MVT::v64f32";
+ case MVT::v128f32: return "MVT::v128f32";
+ case MVT::v256f32: return "MVT::v256f32";
+ case MVT::v512f32: return "MVT::v512f32";
+ case MVT::v1024f32: return "MVT::v1024f32";
+ case MVT::v2048f32: return "MVT::v2048f32";
case MVT::v1f64: return "MVT::v1f64";
case MVT::v2f64: return "MVT::v2f64";
case MVT::v4f64: return "MVT::v4f64";
@@ -174,7 +191,7 @@
case MVT::iPTR: return "MVT::iPTR";
case MVT::iPTRAny: return "MVT::iPTRAny";
case MVT::Untyped: return "MVT::Untyped";
- case MVT::ExceptRef: return "MVT::ExceptRef";
+ case MVT::exnref: return "MVT::exnref";
default: llvm_unreachable("ILLEGAL VALUE TYPE!");
}
}
@@ -327,6 +344,8 @@
}
void CodeGenTarget::ReadInstructions() const {
+ NamedRegionTimer T("Read Instructions", "Time spent reading instructions",
+ "CodeGenTarget", "CodeGenTarget", TimeRegions);
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
if (Insts.size() <= 2)
PrintFatalError("No 'Instruction' subclasses defined!");
@@ -492,9 +511,10 @@
} else if (PropList[i]->getName() == "SDNPWantParent") {
Properties |= 1 << SDNPWantParent;
} else {
- PrintFatalError("Unsupported SD Node property '" +
- PropList[i]->getName() + "' on ComplexPattern '" +
- R->getName() + "'!");
+ PrintFatalError(R->getLoc(), "Unsupported SD Node property '" +
+ PropList[i]->getName() +
+ "' on ComplexPattern '" + R->getName() +
+ "'!");
}
}
@@ -530,12 +550,14 @@
CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
TheDef = R;
std::string DefName = R->getName();
+ ArrayRef<SMLoc> DefLoc = R->getLoc();
ModRef = ReadWriteMem;
Properties = 0;
isOverloaded = false;
isCommutative = false;
canThrow = false;
isNoReturn = false;
+ isWillReturn = false;
isCold = false;
isNoDuplicate = false;
isConvergent = false;
@@ -544,7 +566,8 @@
if (DefName.size() <= 4 ||
std::string(DefName.begin(), DefName.begin() + 4) != "int_")
- PrintFatalError("Intrinsic '" + DefName + "' does not start with 'int_'!");
+ PrintFatalError(DefLoc,
+ "Intrinsic '" + DefName + "' does not start with 'int_'!");
EnumName = std::string(DefName.begin()+4, DefName.end());
@@ -566,7 +589,8 @@
// Verify it starts with "llvm.".
if (Name.size() <= 5 ||
std::string(Name.begin(), Name.begin() + 5) != "llvm.")
- PrintFatalError("Intrinsic '" + DefName + "'s name does not start with 'llvm.'!");
+ PrintFatalError(DefLoc, "Intrinsic '" + DefName +
+ "'s name does not start with 'llvm.'!");
}
// If TargetPrefix is specified, make sure that Name starts with
@@ -575,13 +599,34 @@
if (Name.size() < 6+TargetPrefix.size() ||
std::string(Name.begin() + 5, Name.begin() + 6 + TargetPrefix.size())
!= (TargetPrefix + "."))
- PrintFatalError("Intrinsic '" + DefName + "' does not start with 'llvm." +
- TargetPrefix + ".'!");
+ PrintFatalError(DefLoc, "Intrinsic '" + DefName +
+ "' does not start with 'llvm." +
+ TargetPrefix + ".'!");
+ }
+
+ ListInit *RetTypes = R->getValueAsListInit("RetTypes");
+ ListInit *ParamTypes = R->getValueAsListInit("ParamTypes");
+
+ // First collate a list of overloaded types.
+ std::vector<MVT::SimpleValueType> OverloadedVTs;
+ for (ListInit *TypeList : {RetTypes, ParamTypes}) {
+ for (unsigned i = 0, e = TypeList->size(); i != e; ++i) {
+ Record *TyEl = TypeList->getElementAsRecord(i);
+ assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
+
+ if (TyEl->isSubClassOf("LLVMMatchType"))
+ continue;
+
+ MVT::SimpleValueType VT = getValueType(TyEl->getValueAsDef("VT"));
+ if (MVT(VT).isOverloaded()) {
+ OverloadedVTs.push_back(VT);
+ isOverloaded = true;
+ }
+ }
}
// Parse the list of return types.
- std::vector<MVT::SimpleValueType> OverloadedVTs;
- ListInit *TypeList = R->getValueAsListInit("RetTypes");
+ ListInit *TypeList = RetTypes;
for (unsigned i = 0, e = TypeList->size(); i != e; ++i) {
Record *TyEl = TypeList->getElementAsRecord(i);
assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
@@ -601,21 +646,18 @@
} else {
VT = getValueType(TyEl->getValueAsDef("VT"));
}
- if (MVT(VT).isOverloaded()) {
- OverloadedVTs.push_back(VT);
- isOverloaded = true;
- }
// Reject invalid types.
if (VT == MVT::isVoid)
- PrintFatalError("Intrinsic '" + DefName + " has void in result type list!");
+ PrintFatalError(DefLoc, "Intrinsic '" + DefName +
+ " has void in result type list!");
IS.RetVTs.push_back(VT);
IS.RetTypeDefs.push_back(TyEl);
}
// Parse the list of parameter types.
- TypeList = R->getValueAsListInit("ParamTypes");
+ TypeList = ParamTypes;
for (unsigned i = 0, e = TypeList->size(); i != e; ++i) {
Record *TyEl = TypeList->getElementAsRecord(i);
assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
@@ -626,7 +668,8 @@
PrintError(R->getLoc(),
"Parameter #" + Twine(i) + " has out of bounds matching "
"number " + Twine(MatchTy));
- PrintFatalError(Twine("ParamTypes is ") + TypeList->getAsString());
+ PrintFatalError(DefLoc,
+ Twine("ParamTypes is ") + TypeList->getAsString());
}
VT = OverloadedVTs[MatchTy];
// It only makes sense to use the extended and truncated vector element
@@ -634,20 +677,16 @@
// overloaded, all the types can be specified directly.
assert(((!TyEl->isSubClassOf("LLVMExtendedType") &&
!TyEl->isSubClassOf("LLVMTruncatedType") &&
- !TyEl->isSubClassOf("LLVMVectorSameWidth")) ||
+ !TyEl->isSubClassOf("LLVMScalarOrSameVectorWidth")) ||
VT == MVT::iAny || VT == MVT::vAny) &&
"Expected iAny or vAny type");
} else
VT = getValueType(TyEl->getValueAsDef("VT"));
- if (MVT(VT).isOverloaded()) {
- OverloadedVTs.push_back(VT);
- isOverloaded = true;
- }
-
// Reject invalid types.
if (VT == MVT::isVoid && i != e-1 /*void at end means varargs*/)
- PrintFatalError("Intrinsic '" + DefName + " has void in result type list!");
+ PrintFatalError(DefLoc, "Intrinsic '" + DefName +
+ " has void in result type list!");
IS.ParamVTs.push_back(VT);
IS.ParamTypeDefs.push_back(TyEl);
@@ -683,6 +722,8 @@
isConvergent = true;
else if (Property->getName() == "IntrNoReturn")
isNoReturn = true;
+ else if (Property->getName() == "IntrWillReturn")
+ isWillReturn = true;
else if (Property->getName() == "IntrCold")
isCold = true;
else if (Property->getName() == "IntrSpeculatable")
@@ -704,6 +745,9 @@
} else if (Property->isSubClassOf("ReadNone")) {
unsigned ArgNo = Property->getValueAsInt("ArgNo");
ArgumentAttributes.push_back(std::make_pair(ArgNo, ReadNone));
+ } else if (Property->isSubClassOf("ImmArg")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.push_back(std::make_pair(ArgNo, ImmArg));
} else
llvm_unreachable("Unknown property!");
}
diff --git a/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.h b/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.h
index d2833d5..1ab2de2 100644
--- a/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.h
+++ b/src/llvm-project/llvm/utils/TableGen/CodeGenTarget.h
@@ -1,9 +1,8 @@
//===- CodeGenTarget.h - Target Class Wrapper -------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/DAGISelEmitter.cpp
index 62a0ff7..fb0c6fa 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -1,9 +1,8 @@
//===- DAGISelEmitter.cpp - Generate an instruction selector --------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.cpp b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.cpp
index c8e0057..bebd205 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.cpp
@@ -1,9 +1,8 @@
//===- DAGISelMatcher.cpp - Representation of DAG pattern matcher ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -212,6 +211,11 @@
OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
}
+void CheckChild2CondCodeMatcher::printImpl(raw_ostream &OS,
+ unsigned indent) const {
+ OS.indent(indent) << "CheckChild2CondCode ISD::" << CondCodeName << '\n';
+}
+
void CheckValueTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n';
}
@@ -233,6 +237,16 @@
OS.indent(indent) << "CheckFoldableChainNode\n";
}
+void CheckImmAllOnesVMatcher::printImpl(raw_ostream &OS,
+ unsigned indent) const {
+ OS.indent(indent) << "CheckAllOnesV\n";
+}
+
+void CheckImmAllZerosVMatcher::printImpl(raw_ostream &OS,
+ unsigned indent) const {
+ OS.indent(indent) << "CheckAllZerosV\n";
+}
+
void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitInteger " << Val << " VT=" << getEnumName(VT)
<< '\n';
@@ -398,3 +412,12 @@
return false;
}
+bool CheckImmAllOnesVMatcher::isContradictoryImpl(const Matcher *M) const {
+ // AllZeros is contradictory.
+ return isa<CheckImmAllZerosVMatcher>(M);
+}
+
+bool CheckImmAllZerosVMatcher::isContradictoryImpl(const Matcher *M) const {
+ // AllOnes is contradictory.
+ return isa<CheckImmAllOnesVMatcher>(M);
+}
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.h b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.h
index 9be7295..0a782e8 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.h
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcher.h
@@ -1,9 +1,8 @@
//===- DAGISelMatcher.h - Representation of DAG pattern matcher -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -67,10 +66,13 @@
CheckInteger, // Fail if wrong val.
CheckChildInteger, // Fail if child is wrong val.
CheckCondCode, // Fail if not condcode.
+ CheckChild2CondCode, // Fail if child is wrong condcode.
CheckValueType,
CheckComplexPat,
CheckAndImm,
CheckOrImm,
+ CheckImmAllOnesV,
+ CheckImmAllZerosV,
CheckFoldableChainNode,
// Node creation/emisssion.
@@ -122,9 +124,12 @@
case CheckInteger:
case CheckChildInteger:
case CheckCondCode:
+ case CheckChild2CondCode:
case CheckValueType:
case CheckAndImm:
case CheckOrImm:
+ case CheckImmAllOnesV:
+ case CheckImmAllZerosV:
case CheckFoldableChainNode:
return true;
}
@@ -626,6 +631,27 @@
}
};
+/// CheckChild2CondCodeMatcher - This checks to see if child 2 node is a
+/// CondCodeSDNode with the specified condition, if not it fails to match.
+class CheckChild2CondCodeMatcher : public Matcher {
+ StringRef CondCodeName;
+public:
+ CheckChild2CondCodeMatcher(StringRef condcodename)
+ : Matcher(CheckChild2CondCode), CondCodeName(condcodename) {}
+
+ StringRef getCondCodeName() const { return CondCodeName; }
+
+ static bool classof(const Matcher *N) {
+ return N->getKind() == CheckChild2CondCode;
+ }
+
+private:
+ void printImpl(raw_ostream &OS, unsigned indent) const override;
+ bool isEqualImpl(const Matcher *M) const override {
+ return cast<CheckChild2CondCodeMatcher>(M)->CondCodeName == CondCodeName;
+ }
+};
+
/// CheckValueTypeMatcher - This checks to see if the current node is a
/// VTSDNode with the specified type, if not it fails to match.
class CheckValueTypeMatcher : public Matcher {
@@ -731,6 +757,38 @@
}
};
+/// CheckImmAllOnesVMatcher - This check if the current node is an build vector
+/// of all ones.
+class CheckImmAllOnesVMatcher : public Matcher {
+public:
+ CheckImmAllOnesVMatcher() : Matcher(CheckImmAllOnesV) {}
+
+ static bool classof(const Matcher *N) {
+ return N->getKind() == CheckImmAllOnesV;
+ }
+
+private:
+ void printImpl(raw_ostream &OS, unsigned indent) const override;
+ bool isEqualImpl(const Matcher *M) const override { return true; }
+ bool isContradictoryImpl(const Matcher *M) const override;
+};
+
+/// CheckImmAllZerosVMatcher - This check if the current node is an build vector
+/// of all zeros.
+class CheckImmAllZerosVMatcher : public Matcher {
+public:
+ CheckImmAllZerosVMatcher() : Matcher(CheckImmAllZerosV) {}
+
+ static bool classof(const Matcher *N) {
+ return N->getKind() == CheckImmAllZerosV;
+ }
+
+private:
+ void printImpl(raw_ostream &OS, unsigned indent) const override;
+ bool isEqualImpl(const Matcher *M) const override { return true; }
+ bool isContradictoryImpl(const Matcher *M) const override;
+};
+
/// CheckFoldableChainNodeMatcher - This checks to see if the current node
/// (which defines a chain operand) is safe to fold into a larger pattern.
class CheckFoldableChainNodeMatcher : public Matcher {
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 90ca1bf..cecbc6cc 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -1,9 +1,8 @@
//===- DAGISelMatcherEmitter.cpp - Matcher Emitter ------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -259,7 +258,7 @@
OS << "\n};";
OS << "\nreturn StringRef(PATTERN_MATCH_TABLE[Index]);";
- OS << "\n}";
+ OS << "\n}\n";
EndEmitFunction(OS);
BeginEmitFunction(OS, "StringRef", "getIncludePathForIndex(unsigned Index)",
@@ -273,7 +272,7 @@
OS << "\n};";
OS << "\nreturn StringRef(INCLUDE_PATH_TABLE[Index]);";
- OS << "\n}";
+ OS << "\n}\n";
EndEmitFunction(OS);
}
@@ -555,6 +554,11 @@
<< cast<CheckCondCodeMatcher>(N)->getCondCodeName() << ",\n";
return 2;
+ case Matcher::CheckChild2CondCode:
+ OS << "OPC_CheckChild2CondCode, ISD::"
+ << cast<CheckChild2CondCodeMatcher>(N)->getCondCodeName() << ",\n";
+ return 2;
+
case Matcher::CheckValueType:
OS << "OPC_CheckValueType, MVT::"
<< cast<CheckValueTypeMatcher>(N)->getTypeName() << ",\n";
@@ -597,6 +601,14 @@
OS << "OPC_CheckFoldableChainNode,\n";
return 1;
+ case Matcher::CheckImmAllOnesV:
+ OS << "OPC_CheckImmAllOnesV,\n";
+ return 1;
+
+ case Matcher::CheckImmAllZerosV:
+ OS << "OPC_CheckImmAllZerosV,\n";
+ return 1;
+
case Matcher::EmitInteger: {
int64_t Val = cast<EmitIntegerMatcher>(N)->getValue();
OS << "OPC_EmitInteger, "
@@ -996,12 +1008,15 @@
case Matcher::CheckInteger: return "OPC_CheckInteger"; break;
case Matcher::CheckChildInteger: return "OPC_CheckChildInteger"; break;
case Matcher::CheckCondCode: return "OPC_CheckCondCode"; break;
+ case Matcher::CheckChild2CondCode: return "OPC_CheckChild2CondCode"; break;
case Matcher::CheckValueType: return "OPC_CheckValueType"; break;
case Matcher::CheckComplexPat: return "OPC_CheckComplexPat"; break;
case Matcher::CheckAndImm: return "OPC_CheckAndImm"; break;
case Matcher::CheckOrImm: return "OPC_CheckOrImm"; break;
case Matcher::CheckFoldableChainNode:
return "OPC_CheckFoldableChainNode"; break;
+ case Matcher::CheckImmAllOnesV: return "OPC_CheckImmAllOnesV"; break;
+ case Matcher::CheckImmAllZerosV: return "OPC_CheckImmAllZerosV"; break;
case Matcher::EmitInteger: return "OPC_EmitInteger"; break;
case Matcher::EmitStringInteger: return "OPC_EmitStringInteger"; break;
case Matcher::EmitRegister: return "OPC_EmitRegister"; break;
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherGen.cpp
index 612342d..8f54bee 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -1,9 +1,8 @@
//===- DAGISelMatcherGen.cpp - Matcher generator --------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -278,6 +277,27 @@
return;
}
+ if (LeafRec->getName() == "immAllOnesV") {
+ // If this is the root of the dag we're matching, we emit a redundant opcode
+ // check to ensure that this gets folded into the normal top-level
+ // OpcodeSwitch.
+ if (N == Pattern.getSrcPattern()) {
+ const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("build_vector"));
+ AddMatcher(new CheckOpcodeMatcher(NI));
+ }
+ return AddMatcher(new CheckImmAllOnesVMatcher());
+ }
+ if (LeafRec->getName() == "immAllZerosV") {
+ // If this is the root of the dag we're matching, we emit a redundant opcode
+ // check to ensure that this gets folded into the normal top-level
+ // OpcodeSwitch.
+ if (N == Pattern.getSrcPattern()) {
+ const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("build_vector"));
+ AddMatcher(new CheckOpcodeMatcher(NI));
+ }
+ return AddMatcher(new CheckImmAllZerosVMatcher());
+ }
+
errs() << "Unknown leaf kind: " << *N << "\n";
abort();
}
@@ -671,6 +691,17 @@
return;
}
+ if (Def->getName() == "undef_tied_input") {
+ std::array<MVT::SimpleValueType, 1> ResultVTs = {{ N->getSimpleType(0) }};
+ std::array<unsigned, 0> InstOps;
+ auto IDOperandNo = NextRecordedOperandNo++;
+ AddMatcher(new EmitNodeMatcher("TargetOpcode::IMPLICIT_DEF",
+ ResultVTs, InstOps, false, false, false,
+ false, -1, IDOperandNo));
+ ResultOps.push_back(IDOperandNo);
+ return;
+ }
+
// Handle a reference to a register class. This is used
// in COPY_TO_SUBREG instructions.
if (Def->isSubClassOf("RegisterOperand"))
@@ -763,14 +794,27 @@
// 'execute always' values. Match up the node operands to the instruction
// operands to do this.
unsigned ChildNo = 0;
+
+ // Similarly to the code in TreePatternNode::ApplyTypeConstraints, count the
+ // number of operands at the end of the list which have default values.
+ // Those can come from the pattern if it provides enough arguments, or be
+ // filled in with the default if the pattern hasn't provided them. But any
+ // operand with a default value _before_ the last mandatory one will be
+ // filled in with their defaults unconditionally.
+ unsigned NonOverridableOperands = NumFixedOperands;
+ while (NonOverridableOperands > NumResults &&
+ CGP.operandHasDefault(II.Operands[NonOverridableOperands-1].Rec))
+ --NonOverridableOperands;
+
for (unsigned InstOpNo = NumResults, e = NumFixedOperands;
InstOpNo != e; ++InstOpNo) {
// Determine what to emit for this operand.
Record *OperandNode = II.Operands[InstOpNo].Rec;
- if (OperandNode->isSubClassOf("OperandWithDefaultOps") &&
- !CGP.getDefaultOperand(OperandNode).DefaultOps.empty()) {
- // This is a predicate or optional def operand; emit the
- // 'default ops' operands.
+ if (CGP.operandHasDefault(OperandNode) &&
+ (InstOpNo < NonOverridableOperands || ChildNo >= N->getNumChildren())) {
+ // This is a predicate or optional def operand which the pattern has not
+ // overridden, or which we aren't letting it override; emit the 'default
+ // ops' operands.
const DAGDefaultOperand &DefaultOp
= CGP.getDefaultOperand(OperandNode);
for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i)
diff --git a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 554c743..7d51b07 100644
--- a/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -1,9 +1,8 @@
//===- DAGISelMatcherOpt.cpp - Optimize a DAG Matcher ---------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -56,9 +55,13 @@
if (MC->getChildNo() < 4) // Only have CheckChildSame0...3
New = new CheckChildSameMatcher(MC->getChildNo(), CS->getMatchNumber());
- if (CheckIntegerMatcher *CS = dyn_cast<CheckIntegerMatcher>(MC->getNext()))
+ if (CheckIntegerMatcher *CI = dyn_cast<CheckIntegerMatcher>(MC->getNext()))
if (MC->getChildNo() < 5) // Only have CheckChildInteger0...4
- New = new CheckChildIntegerMatcher(MC->getChildNo(), CS->getValue());
+ New = new CheckChildIntegerMatcher(MC->getChildNo(), CI->getValue());
+
+ if (auto *CCC = dyn_cast<CheckCondCodeMatcher>(MC->getNext()))
+ if (MC->getChildNo() == 2) // Only have CheckChild2CondCode
+ New = new CheckChild2CondCodeMatcher(CCC->getCondCodeName());
if (New) {
// Insert the new node.
diff --git a/src/llvm-project/llvm/utils/TableGen/DFAPacketizerEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
index 0db0f55..dabcc8f 100644
--- a/src/llvm-project/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
@@ -1,9 +1,8 @@
//===- DFAPacketizerEmitter.cpp - Packetization DFA for a VLIW machine ----===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/DisassemblerEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/DisassemblerEmitter.cpp
index b99a0a9..9e75c7f 100644
--- a/src/llvm-project/llvm/utils/TableGen/DisassemblerEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/DisassemblerEmitter.cpp
@@ -1,9 +1,8 @@
//===- DisassemblerEmitter.cpp - Generate a disassembler ------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/ExegesisEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/ExegesisEmitter.cpp
index 208237a..976d5f5 100644
--- a/src/llvm-project/llvm/utils/TableGen/ExegesisEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/ExegesisEmitter.cpp
@@ -1,9 +1,8 @@
//===- ExegesisEmitter.cpp - Generate exegesis target data ----------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/FastISelEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/FastISelEmitter.cpp
index 5134b68..b399568 100644
--- a/src/llvm-project/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -1,9 +1,8 @@
///===- FastISelEmitter.cpp - Generate an instruction selector -------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
index 5e621fc..f5e975d2 100644
--- a/src/llvm-project/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -1,9 +1,8 @@
//===------------ FixedLenDecoderEmitter.cpp - Decoder Generator ----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -17,9 +16,10 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/CachedHashString.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCFixedLenDisassembler.h"
@@ -48,6 +48,12 @@
namespace {
+STATISTIC(NumEncodings, "Number of encodings considered");
+STATISTIC(NumEncodingsLackingDisasm, "Number of encodings without disassembler info");
+STATISTIC(NumInstructions, "Number of instructions considered");
+STATISTIC(NumEncodingsSupported, "Number of encodings supported");
+STATISTIC(NumEncodingsOmitted, "Number of encodings omitted");
+
struct EncodingField {
unsigned Base, Width, Offset;
EncodingField(unsigned B, unsigned W, unsigned O)
@@ -95,6 +101,15 @@
: EncodingDef(EncodingDef), Inst(Inst) {}
};
+struct EncodingIDAndOpcode {
+ unsigned EncodingID;
+ unsigned Opcode;
+
+ EncodingIDAndOpcode() : EncodingID(0), Opcode(0) {}
+ EncodingIDAndOpcode(unsigned EncodingID, unsigned Opcode)
+ : EncodingID(EncodingID), Opcode(Opcode) {}
+};
+
raw_ostream &operator<<(raw_ostream &OS, const EncodingAndInst &Value) {
if (Value.EncodingDef != Value.Inst->TheDef)
OS << Value.EncodingDef->getName() << ":";
@@ -103,6 +118,7 @@
}
class FixedLenDecoderEmitter {
+ RecordKeeper &RK;
std::vector<EncodingAndInst> NumberedEncodings;
public:
@@ -114,7 +130,7 @@
std::string ROK = "MCDisassembler::Success",
std::string RFail = "MCDisassembler::Fail",
std::string L = "")
- : Target(R), PredicateNamespace(std::move(PredicateNamespace)),
+ : RK(R), Target(R), PredicateNamespace(std::move(PredicateNamespace)),
GuardPrefix(std::move(GPrefix)), GuardPostfix(std::move(GPostfix)),
ReturnOK(std::move(ROK)), ReturnFail(std::move(RFail)),
Locals(std::move(L)) {}
@@ -252,10 +268,11 @@
bool Mixed; // a mixed region contains both set and unset bits
// Map of well-known segment value to the set of uid's with that value.
- std::map<uint64_t, std::vector<unsigned>> FilteredInstructions;
+ std::map<uint64_t, std::vector<EncodingIDAndOpcode>>
+ FilteredInstructions;
// Set of uid's with non-constant segment values.
- std::vector<unsigned> VariableInstructions;
+ std::vector<EncodingIDAndOpcode> VariableInstructions;
// Map of well-known segment value to its delegate.
std::map<unsigned, std::unique_ptr<const FilterChooser>> FilterChooserMap;
@@ -264,7 +281,7 @@
unsigned NumFiltered;
// Keeps track of the last opcode in the filtered bucket.
- unsigned LastOpcFiltered;
+ EncodingIDAndOpcode LastOpcFiltered;
public:
Filter(Filter &&f);
@@ -274,7 +291,7 @@
unsigned getNumFiltered() const { return NumFiltered; }
- unsigned getSingletonOpc() const {
+ EncodingIDAndOpcode getSingletonOpc() const {
assert(NumFiltered == 1);
return LastOpcFiltered;
}
@@ -341,7 +358,9 @@
ArrayRef<EncodingAndInst> AllInstructions;
// Vector of uid's for this filter chooser to work on.
- const std::vector<unsigned> &Opcodes;
+ // The first member of the pair is the opcode id being decoded, the second is
+ // the opcode id that should be emitted.
+ const std::vector<EncodingIDAndOpcode> &Opcodes;
// Lookup table for the operand decoding of instructions.
const std::map<unsigned, std::vector<OperandInfo>> &Operands;
@@ -367,7 +386,7 @@
public:
FilterChooser(ArrayRef<EncodingAndInst> Insts,
- const std::vector<unsigned> &IDs,
+ const std::vector<EncodingIDAndOpcode> &IDs,
const std::map<unsigned, std::vector<OperandInfo>> &Ops,
unsigned BW, const FixedLenDecoderEmitter *E)
: AllInstructions(Insts), Opcodes(IDs), Operands(Ops),
@@ -377,7 +396,7 @@
}
FilterChooser(ArrayRef<EncodingAndInst> Insts,
- const std::vector<unsigned> &IDs,
+ const std::vector<EncodingIDAndOpcode> &IDs,
const std::map<unsigned, std::vector<OperandInfo>> &Ops,
const std::vector<bit_value_t> &ParentFilterBitValues,
const FilterChooser &parent)
@@ -413,6 +432,15 @@
}
}
+ // Emit the name of the encoding/instruction pair.
+ void emitNameWithID(raw_ostream &OS, unsigned Opcode) const {
+ const Record *EncodingDef = AllInstructions[Opcode].EncodingDef;
+ const Record *InstDef = AllInstructions[Opcode].Inst->TheDef;
+ if (EncodingDef != InstDef)
+ OS << EncodingDef->getName() << ":";
+ OS << InstDef->getName();
+ }
+
// Populates the field of the insn given the start position and the number of
// consecutive bits to scan for.
//
@@ -463,7 +491,7 @@
// Emits table entries to decode the singleton.
void emitSingletonTableEntry(DecoderTableInfo &TableInfo,
- unsigned Opc) const;
+ EncodingIDAndOpcode Opc) const;
// Emits code to decode the singleton, and then to decode the rest.
void emitSingletonTableEntry(DecoderTableInfo &TableInfo,
@@ -524,13 +552,13 @@
assert(StartBit + NumBits - 1 < Owner->BitWidth);
NumFiltered = 0;
- LastOpcFiltered = 0;
+ LastOpcFiltered = {0, 0};
for (unsigned i = 0, e = Owner->Opcodes.size(); i != e; ++i) {
insn_t Insn;
// Populates the insn given the uid.
- Owner->insnWithID(Insn, Owner->Opcodes[i]);
+ Owner->insnWithID(Insn, Owner->Opcodes[i].EncodingID);
uint64_t Field;
// Scans the segment for possibly well-specified encoding bits.
@@ -1026,7 +1054,7 @@
// 1: Water (the bit value does not affect decoding)
// 2: Island (well-known bit value needed for decoding)
int State = 0;
- int Val = -1;
+ int64_t Val = -1;
for (unsigned i = 0; i < BitWidth; ++i) {
Val = Value(Insn[i]);
@@ -1314,12 +1342,12 @@
// Emits table entries to decode the singleton.
void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo,
- unsigned Opc) const {
+ EncodingIDAndOpcode Opc) const {
std::vector<unsigned> StartBits;
std::vector<unsigned> EndBits;
std::vector<uint64_t> FieldVals;
insn_t Insn;
- insnWithID(Insn, Opc);
+ insnWithID(Insn, Opc.EncodingID);
// Look for islands of undecoded bits of the singleton.
getIslands(StartBits, EndBits, FieldVals, Insn);
@@ -1327,7 +1355,7 @@
unsigned Size = StartBits.size();
// Emit the predicate table entry if one is needed.
- emitPredicateTableEntry(TableInfo, Opc);
+ emitPredicateTableEntry(TableInfo, Opc.EncodingID);
// Check any additional encoding fields needed.
for (unsigned I = Size; I != 0; --I) {
@@ -1351,10 +1379,11 @@
}
// Check for soft failure of the match.
- emitSoftFailTableEntry(TableInfo, Opc);
+ emitSoftFailTableEntry(TableInfo, Opc.EncodingID);
bool HasCompleteDecoder;
- unsigned DIdx = getDecoderIndex(TableInfo.Decoders, Opc, HasCompleteDecoder);
+ unsigned DIdx =
+ getDecoderIndex(TableInfo.Decoders, Opc.EncodingID, HasCompleteDecoder);
// Produce OPC_Decode or OPC_TryDecode opcode based on the information
// whether the instruction decoder is complete or not. If it is complete
@@ -1367,8 +1396,9 @@
// can decode it.
TableInfo.Table.push_back(HasCompleteDecoder ? MCD::OPC_Decode :
MCD::OPC_TryDecode);
+ NumEncodingsSupported++;
uint8_t Buffer[16], *p;
- encodeULEB128(Opc, Buffer);
+ encodeULEB128(Opc.Opcode, Buffer);
for (p = Buffer; *p >= 128 ; ++p)
TableInfo.Table.push_back(*p);
TableInfo.Table.push_back(*p);
@@ -1394,7 +1424,7 @@
// Emits table entries to decode the singleton, and then to decode the rest.
void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo,
const Filter &Best) const {
- unsigned Opc = Best.getSingletonOpc();
+ EncodingIDAndOpcode Opc = Best.getSingletonOpc();
// complex singletons need predicate checks from the first singleton
// to refer forward to the variable filterchooser that follows.
@@ -1454,7 +1484,7 @@
std::vector<uint64_t> FieldVals;
insn_t Insn;
- insnWithID(Insn, Opcodes[i]);
+ insnWithID(Insn, Opcodes[i].EncodingID);
// Look for islands of undecoded bits of any instruction.
if (getIslands(StartBits, EndBits, FieldVals, Insn) > 0) {
@@ -1498,7 +1528,7 @@
for (unsigned InsnIndex = 0; InsnIndex < numInstructions; ++InsnIndex) {
insn_t insn;
- insnWithID(insn, Opcodes[InsnIndex]);
+ insnWithID(insn, Opcodes[InsnIndex].EncodingID);
for (BitIndex = 0; BitIndex < BitWidth; ++BitIndex) {
switch (bitAttrs[BitIndex]) {
@@ -1717,9 +1747,12 @@
dumpStack(errs(), "\t\t");
for (unsigned i = 0; i < Opcodes.size(); ++i) {
- errs() << '\t' << AllInstructions[Opcodes[i]] << " ";
- dumpBits(errs(),
- getBitsField(*AllInstructions[Opcodes[i]].EncodingDef, "Inst"));
+ errs() << '\t';
+ emitNameWithID(errs(), Opcodes[i].EncodingID);
+ errs() << " ";
+ dumpBits(
+ errs(),
+ getBitsField(*AllInstructions[Opcodes[i].EncodingID].EncodingDef, "Inst"));
errs() << '\n';
}
}
@@ -1751,24 +1784,25 @@
return Decoder;
}
-static bool populateInstruction(CodeGenTarget &Target,
- const CodeGenInstruction &CGI, unsigned Opc,
- std::map<unsigned, std::vector<OperandInfo>> &Operands){
+static bool
+populateInstruction(CodeGenTarget &Target, const Record &EncodingDef,
+ const CodeGenInstruction &CGI, unsigned Opc,
+ std::map<unsigned, std::vector<OperandInfo>> &Operands) {
const Record &Def = *CGI.TheDef;
// If all the bit positions are not specified; do not decode this instruction.
// We are bound to fail! For proper disassembly, the well-known encoding bits
// of the instruction must be fully specified.
- BitsInit &Bits = getBitsField(Def, "Inst");
+ BitsInit &Bits = getBitsField(EncodingDef, "Inst");
if (Bits.allInComplete()) return false;
std::vector<OperandInfo> InsnOperands;
// If the instruction has specified a custom decoding hook, use that instead
// of trying to auto-generate the decoder.
- StringRef InstDecoder = Def.getValueAsString("DecoderMethod");
+ StringRef InstDecoder = EncodingDef.getValueAsString("DecoderMethod");
if (InstDecoder != "") {
- bool HasCompleteInstDecoder = Def.getValueAsBit("hasCompleteDecoder");
+ bool HasCompleteInstDecoder = EncodingDef.getValueAsBit("hasCompleteDecoder");
InsnOperands.push_back(OperandInfo(InstDecoder, HasCompleteInstDecoder));
Operands[Opc] = InsnOperands;
return true;
@@ -2144,7 +2178,7 @@
<< " const FeatureBitset& Bits = STI.getFeatureBits();\n"
<< "\n"
<< " const uint8_t *Ptr = DecodeTable;\n"
- << " uint32_t CurFieldValue = 0;\n"
+ << " InsnType CurFieldValue = 0;\n"
<< " DecodeStatus S = MCDisassembler::Success;\n"
<< " while (true) {\n"
<< " ptrdiff_t Loc = Ptr - DecodeTable;\n"
@@ -2189,7 +2223,7 @@
<< " unsigned Len = *++Ptr;\n"
<< " InsnType FieldValue = fieldFromInstruction(insn, Start, Len);\n"
<< " // Decode the field value.\n"
- << " uint32_t ExpectedValue = decodeULEB128(++Ptr, &Len);\n"
+ << " InsnType ExpectedValue = decodeULEB128(++Ptr, &Len);\n"
<< " Ptr += Len;\n"
<< " // NumToSkip is a plain 24-bit integer.\n"
<< " unsigned NumToSkip = *Ptr++;\n"
@@ -2336,37 +2370,52 @@
// Parameterize the decoders based on namespace and instruction width.
const auto &NumberedInstructions = Target.getInstructionsByEnumValue();
NumberedEncodings.reserve(NumberedInstructions.size());
- for (const auto &NumberedInstruction : NumberedInstructions)
+ DenseMap<Record *, unsigned> IndexOfInstruction;
+ for (const auto &NumberedInstruction : NumberedInstructions) {
+ IndexOfInstruction[NumberedInstruction->TheDef] = NumberedEncodings.size();
NumberedEncodings.emplace_back(NumberedInstruction->TheDef, NumberedInstruction);
+ }
+ for (const auto &NumberedAlias : RK.getAllDerivedDefinitions("AdditionalEncoding"))
+ NumberedEncodings.emplace_back(
+ NumberedAlias,
+ &Target.getInstruction(NumberedAlias->getValueAsDef("AliasOf")));
- std::map<std::pair<std::string, unsigned>,
- std::vector<unsigned>> OpcMap;
+ std::map<std::pair<std::string, unsigned>, std::vector<EncodingIDAndOpcode>>
+ OpcMap;
std::map<unsigned, std::vector<OperandInfo>> Operands;
for (unsigned i = 0; i < NumberedEncodings.size(); ++i) {
+ const Record *EncodingDef = NumberedEncodings[i].EncodingDef;
const CodeGenInstruction *Inst = NumberedEncodings[i].Inst;
const Record *Def = Inst->TheDef;
- unsigned Size = Def->getValueAsInt("Size");
+ unsigned Size = EncodingDef->getValueAsInt("Size");
if (Def->getValueAsString("Namespace") == "TargetOpcode" ||
Def->getValueAsBit("isPseudo") ||
Def->getValueAsBit("isAsmParserOnly") ||
- Def->getValueAsBit("isCodeGenOnly"))
+ Def->getValueAsBit("isCodeGenOnly")) {
+ NumEncodingsLackingDisasm++;
continue;
+ }
- StringRef DecoderNamespace = Def->getValueAsString("DecoderNamespace");
+ if (i < NumberedInstructions.size())
+ NumInstructions++;
+ NumEncodings++;
+
+ StringRef DecoderNamespace = EncodingDef->getValueAsString("DecoderNamespace");
if (Size) {
- if (populateInstruction(Target, *Inst, i, Operands)) {
- OpcMap[std::make_pair(DecoderNamespace, Size)].push_back(i);
- }
+ if (populateInstruction(Target, *EncodingDef, *Inst, i, Operands)) {
+ OpcMap[std::make_pair(DecoderNamespace, Size)].emplace_back(i, IndexOfInstruction.find(Def)->second);
+ } else
+ NumEncodingsOmitted++;
}
}
DecoderTableInfo TableInfo;
for (const auto &Opc : OpcMap) {
// Emit the decoder for this namespace+width combination.
- ArrayRef<EncodingAndInst> NumberedEncodingsRef(NumberedEncodings.data(),
- NumberedEncodings.size());
+ ArrayRef<EncodingAndInst> NumberedEncodingsRef(
+ NumberedEncodings.data(), NumberedEncodings.size());
FilterChooser FC(NumberedEncodingsRef, Opc.second, Operands,
8 * Opc.first.second, this);
diff --git a/src/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 997ceb1..f1c0213 100644
--- a/src/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -1,9 +1,8 @@
//===- GlobalISelEmitter.cpp - Generate an instruction selector -----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -233,6 +232,23 @@
if (Record *VT = P.getScalarMemoryVT())
Explanation += (" ScalarVT(MemVT)=" + VT->getName()).str();
+ if (ListInit *AddrSpaces = P.getAddressSpaces()) {
+ raw_string_ostream OS(Explanation);
+ OS << " AddressSpaces=[";
+
+ StringRef AddrSpaceSeparator;
+ for (Init *Val : AddrSpaces->getValues()) {
+ IntInit *IntVal = dyn_cast<IntInit>(Val);
+ if (!IntVal)
+ continue;
+
+ OS << AddrSpaceSeparator << IntVal->getValue();
+ AddrSpaceSeparator = ", ";
+ }
+
+ OS << ']';
+ }
+
if (P.isAtomicOrderingMonotonic())
Explanation += " monotonic";
if (P.isAtomicOrderingAcquire())
@@ -298,7 +314,7 @@
Predicate.isSignExtLoad() || Predicate.isZeroExtLoad())
continue;
- if (Predicate.isNonTruncStore())
+ if (Predicate.isNonTruncStore() || Predicate.isTruncStore())
continue;
if (Predicate.isLoad() && Predicate.getMemoryVT())
@@ -309,6 +325,12 @@
continue;
}
+ if (Predicate.isLoad() || Predicate.isStore() || Predicate.isAtomic()) {
+ const ListInit *AddrSpaces = Predicate.getAddressSpaces();
+ if (AddrSpaces && !AddrSpaces->empty())
+ continue;
+ }
+
if (Predicate.isAtomic() && Predicate.getMemoryVT())
continue;
@@ -882,12 +904,19 @@
void defineOperand(StringRef SymbolicName, OperandMatcher &OM);
- void defineComplexSubOperand(StringRef SymbolicName, Record *ComplexPattern,
- unsigned RendererID, unsigned SubOperandID) {
- assert(ComplexSubOperands.count(SymbolicName) == 0 && "Already defined");
+ Error defineComplexSubOperand(StringRef SymbolicName, Record *ComplexPattern,
+ unsigned RendererID, unsigned SubOperandID) {
+ if (ComplexSubOperands.count(SymbolicName))
+ return failedImport(
+ "Complex suboperand referenced more than once (Operand: " +
+ SymbolicName + ")");
+
ComplexSubOperands[SymbolicName] =
std::make_tuple(ComplexPattern, RendererID, SubOperandID);
+
+ return Error::success();
}
+
Optional<DefinedComplexPatternSubOperand>
getComplexSubOperand(StringRef SymbolicName) const {
const auto &I = ComplexSubOperands.find(SymbolicName);
@@ -1022,6 +1051,7 @@
IPM_AtomicOrderingMMO,
IPM_MemoryLLTSize,
IPM_MemoryVsLLTSize,
+ IPM_MemoryAddressSpace,
IPM_GenericPredicate,
OPM_SameOperand,
OPM_ComplexPattern,
@@ -1507,6 +1537,9 @@
if (OperandIsAPointer)
addPredicate<PointerToAnyOperandMatcher>(OpTyOrNone->get().getSizeInBits());
+ else if (VTy.isPointer())
+ addPredicate<LLTOperandMatcher>(LLT::pointer(VTy.getPtrAddrSpace(),
+ OpTyOrNone->get().getSizeInBits()));
else
addPredicate<LLTOperandMatcher>(*OpTyOrNone);
return Error::success();
@@ -1780,6 +1813,42 @@
}
};
+class MemoryAddressSpacePredicateMatcher : public InstructionPredicateMatcher {
+protected:
+ unsigned MMOIdx;
+ SmallVector<unsigned, 4> AddrSpaces;
+
+public:
+ MemoryAddressSpacePredicateMatcher(unsigned InsnVarID, unsigned MMOIdx,
+ ArrayRef<unsigned> AddrSpaces)
+ : InstructionPredicateMatcher(IPM_MemoryAddressSpace, InsnVarID),
+ MMOIdx(MMOIdx), AddrSpaces(AddrSpaces.begin(), AddrSpaces.end()) {}
+
+ static bool classof(const PredicateMatcher *P) {
+ return P->getKind() == IPM_MemoryAddressSpace;
+ }
+ bool isIdentical(const PredicateMatcher &B) const override {
+ if (!InstructionPredicateMatcher::isIdentical(B))
+ return false;
+ auto *Other = cast<MemoryAddressSpacePredicateMatcher>(&B);
+ return MMOIdx == Other->MMOIdx && AddrSpaces == Other->AddrSpaces;
+ }
+
+ void emitPredicateOpcodes(MatchTable &Table,
+ RuleMatcher &Rule) const override {
+ Table << MatchTable::Opcode("GIM_CheckMemoryAddressSpace")
+ << MatchTable::Comment("MI") << MatchTable::IntValue(InsnVarID)
+ << MatchTable::Comment("MMO") << MatchTable::IntValue(MMOIdx)
+ // Encode number of address spaces to expect.
+ << MatchTable::Comment("NumAddrSpace")
+ << MatchTable::IntValue(AddrSpaces.size());
+ for (unsigned AS : AddrSpaces)
+ Table << MatchTable::Comment("AddrSpace") << MatchTable::IntValue(AS);
+
+ Table << MatchTable::LineBreak;
+ }
+};
+
/// Generates code to check that the size of an MMO is less-than, equal-to, or
/// greater than a given LLT.
class MemoryVsLLTSizePredicateMatcher : public InstructionPredicateMatcher {
@@ -3028,7 +3097,8 @@
importExplicitUseRenderer(action_iterator InsertPt, RuleMatcher &Rule,
BuildMIAction &DstMIBuilder,
TreePatternNode *DstChild);
- Error importDefaultOperandRenderers(BuildMIAction &DstMIBuilder,
+ Error importDefaultOperandRenderers(action_iterator InsertPt, RuleMatcher &M,
+ BuildMIAction &DstMIBuilder,
DagInit *DefaultOps) const;
Error
importImplicitDefRenderers(BuildMIAction &DstMIBuilder,
@@ -3200,7 +3270,26 @@
continue;
}
- // G_LOAD is used for both non-extending and any-extending loads.
+ // An address space check is needed in all contexts if there is one.
+ if (Predicate.isLoad() || Predicate.isStore() || Predicate.isAtomic()) {
+ if (const ListInit *AddrSpaces = Predicate.getAddressSpaces()) {
+ SmallVector<unsigned, 4> ParsedAddrSpaces;
+
+ for (Init *Val : AddrSpaces->getValues()) {
+ IntInit *IntVal = dyn_cast<IntInit>(Val);
+ if (!IntVal)
+ return failedImport("Address space is not an integer");
+ ParsedAddrSpaces.push_back(IntVal->getValue());
+ }
+
+ if (!ParsedAddrSpaces.empty()) {
+ InsnMatcher.addPredicate<MemoryAddressSpacePredicateMatcher>(
+ 0, ParsedAddrSpaces);
+ }
+ }
+ }
+
+ // G_LOAD is used for both non-extending and any-extending loads.
if (Predicate.isLoad() && Predicate.isNonExtLoad()) {
InsnMatcher.addPredicate<MemoryVsLLTSizePredicateMatcher>(
0, MemoryVsLLTSizePredicateMatcher::EqualTo, 0);
@@ -3212,6 +3301,13 @@
continue;
}
+ if (Predicate.isStore() && Predicate.isTruncStore()) {
+ // FIXME: If MemoryVT is set, we end up with 2 checks for the MMO size.
+ InsnMatcher.addPredicate<MemoryVsLLTSizePredicateMatcher>(
+ 0, MemoryVsLLTSizePredicateMatcher::LessThan, 0);
+ continue;
+ }
+
// No check required. We already did it by swapping the opcode.
if (!SrcGIEquivOrNull->isValueUnset("IfSignExtend") &&
Predicate.isSignExtLoad())
@@ -3422,9 +3518,12 @@
for (unsigned i = 0, e = SrcChild->getNumChildren(); i != e; ++i) {
auto *SubOperand = SrcChild->getChild(i);
- if (!SubOperand->getName().empty())
- Rule.defineComplexSubOperand(SubOperand->getName(),
- SrcChild->getOperator(), RendererID, i);
+ if (!SubOperand->getName().empty()) {
+ if (auto Error = Rule.defineComplexSubOperand(SubOperand->getName(),
+ SrcChild->getOperator(),
+ RendererID, i))
+ return Error;
+ }
}
return Error::success();
@@ -3765,7 +3864,8 @@
// end up with too many rendered operands.
if (DstIOperand.Rec->isSubClassOf("OperandWithDefaultOps")) {
DagInit *DefaultOps = DstIOperand.Rec->getValueAsDag("DefaultOps");
- if (auto Error = importDefaultOperandRenderers(DstMIBuilder, DefaultOps))
+ if (auto Error = importDefaultOperandRenderers(
+ InsertPt, M, DstMIBuilder, DefaultOps))
return std::move(Error);
++NumDefaultOps;
continue;
@@ -3790,19 +3890,39 @@
}
Error GlobalISelEmitter::importDefaultOperandRenderers(
- BuildMIAction &DstMIBuilder, DagInit *DefaultOps) const {
+ action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder,
+ DagInit *DefaultOps) const {
for (const auto *DefaultOp : DefaultOps->getArgs()) {
+ Optional<LLTCodeGen> OpTyOrNone = None;
+
// Look through ValueType operators.
if (const DagInit *DefaultDagOp = dyn_cast<DagInit>(DefaultOp)) {
if (const DefInit *DefaultDagOperator =
dyn_cast<DefInit>(DefaultDagOp->getOperator())) {
- if (DefaultDagOperator->getDef()->isSubClassOf("ValueType"))
+ if (DefaultDagOperator->getDef()->isSubClassOf("ValueType")) {
+ OpTyOrNone = MVTToLLT(getValueType(
+ DefaultDagOperator->getDef()));
DefaultOp = DefaultDagOp->getArg(0);
+ }
}
}
if (const DefInit *DefaultDefOp = dyn_cast<DefInit>(DefaultOp)) {
- DstMIBuilder.addRenderer<AddRegisterRenderer>(DefaultDefOp->getDef());
+ auto Def = DefaultDefOp->getDef();
+ if (Def->getName() == "undef_tied_input") {
+ unsigned TempRegID = M.allocateTempRegID();
+ M.insertAction<MakeTempRegisterAction>(
+ InsertPt, OpTyOrNone.getValue(), TempRegID);
+ InsertPt = M.insertAction<BuildMIAction>(
+ InsertPt, M.allocateOutputInsnID(),
+ &Target.getInstruction(RK.getDef("IMPLICIT_DEF")));
+ BuildMIAction &IDMIBuilder = *static_cast<BuildMIAction *>(
+ InsertPt->get());
+ IDMIBuilder.addRenderer<TempRegRenderer>(TempRegID);
+ DstMIBuilder.addRenderer<TempRegRenderer>(TempRegID);
+ } else {
+ DstMIBuilder.addRenderer<AddRegisterRenderer>(Def);
+ }
continue;
}
@@ -4489,8 +4609,7 @@
<< ", // " << Record->getName() << "\n";
OS << "};\n\n";
- std::stable_sort(Rules.begin(), Rules.end(), [&](const RuleMatcher &A,
- const RuleMatcher &B) {
+ llvm::stable_sort(Rules, [&](const RuleMatcher &A, const RuleMatcher &B) {
int ScoreA = RuleMatcherScores[A.getRuleID()];
int ScoreB = RuleMatcherScores[B.getRuleID()];
if (ScoreA > ScoreB)
diff --git a/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.cpp b/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.cpp
index 086e12d..d966288 100644
--- a/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.cpp
@@ -1,9 +1,8 @@
//===--- InfoByHwMode.cpp -------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Classes that implement data parameterized by HW modes for instruction
@@ -39,6 +38,11 @@
}
}
+ValueTypeByHwMode::ValueTypeByHwMode(Record *R, MVT T) : ValueTypeByHwMode(T) {
+ if (R->isSubClassOf("PtrValueType"))
+ PtrAddrSpace = R->getValueAsInt("AddrSpace");
+}
+
bool ValueTypeByHwMode::operator== (const ValueTypeByHwMode &T) const {
assert(isValid() && T.isValid() && "Invalid type in assignment");
bool Simple = isSimple();
@@ -112,7 +116,7 @@
"Record must be derived from ValueType");
if (Rec->isSubClassOf("HwModeSelect"))
return ValueTypeByHwMode(Rec, CGH);
- return ValueTypeByHwMode(llvm::getValueType(Rec));
+ return ValueTypeByHwMode(Rec, llvm::getValueType(Rec));
}
RegSizeInfo::RegSizeInfo(Record *R, const CodeGenHwModes &CGH) {
diff --git a/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.h b/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.h
index 7be4678..9e5cc3d 100644
--- a/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.h
+++ b/src/llvm-project/llvm/utils/TableGen/InfoByHwMode.h
@@ -1,9 +1,8 @@
//===--- InfoByHwMode.h -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Classes that implement data parameterized by HW modes for instruction
@@ -120,6 +119,7 @@
struct ValueTypeByHwMode : public InfoByHwMode<MVT> {
ValueTypeByHwMode(Record *R, const CodeGenHwModes &CGH);
+ ValueTypeByHwMode(Record *R, MVT T);
ValueTypeByHwMode(MVT T) { Map.insert({DefaultMode,T}); }
ValueTypeByHwMode() = default;
@@ -135,6 +135,11 @@
static StringRef getMVTName(MVT T);
void writeToStream(raw_ostream &OS) const;
void dump() const;
+
+ unsigned PtrAddrSpace = std::numeric_limits<unsigned>::max();
+ bool isPointer() const {
+ return PtrAddrSpace != std::numeric_limits<unsigned>::max();
+ }
};
ValueTypeByHwMode getValueTypeByHwMode(Record *Rec,
diff --git a/src/llvm-project/llvm/utils/TableGen/InstrDocsEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/InstrDocsEmitter.cpp
index 9d50351..91c457b 100644
--- a/src/llvm-project/llvm/utils/TableGen/InstrDocsEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/InstrDocsEmitter.cpp
@@ -1,9 +1,8 @@
//===- InstrDocsEmitter.cpp - Opcode Documentation Generator --------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/InstrInfoEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/InstrInfoEmitter.cpp
index 39d9e85..2d367f5 100644
--- a/src/llvm-project/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -1,9 +1,8 @@
//===- InstrInfoEmitter.cpp - Generate a Instruction Set Desc. --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -77,7 +76,9 @@
std::map<std::vector<Record*>, unsigned> &EL,
const OperandInfoMapTy &OpInfo,
raw_ostream &OS);
- void emitOperandTypesEnum(raw_ostream &OS, const CodeGenTarget &Target);
+ void emitOperandTypeMappings(
+ raw_ostream &OS, const CodeGenTarget &Target,
+ ArrayRef<const CodeGenInstruction *> NumberedInstructions);
void initOperandMapData(
ArrayRef<const CodeGenInstruction *> NumberedInstructions,
StringRef Namespace,
@@ -212,7 +213,7 @@
}
/// Initialize data structures for generating operand name mappings.
-///
+///
/// \param Operands [out] A map used to generate the OpName enum with operand
/// names as its keys and operand enum values as its values.
/// \param OperandMap [out] A map for representing the operand name mappings for
@@ -325,8 +326,9 @@
/// Generate an enum for all the operand types for this target, under the
/// llvm::TargetNamespace::OpTypes namespace.
/// Operand types are all definitions derived of the Operand Target.td class.
-void InstrInfoEmitter::emitOperandTypesEnum(raw_ostream &OS,
- const CodeGenTarget &Target) {
+void InstrInfoEmitter::emitOperandTypeMappings(
+ raw_ostream &OS, const CodeGenTarget &Target,
+ ArrayRef<const CodeGenInstruction *> NumberedInstructions) {
StringRef Namespace = Target.getInstNamespace();
std::vector<Record *> Operands = Records.getAllDerivedDefinitions("Operand");
@@ -350,6 +352,69 @@
OS << "} // end namespace " << Namespace << "\n";
OS << "} // end namespace llvm\n";
OS << "#endif // GET_INSTRINFO_OPERAND_TYPES_ENUM\n\n";
+
+ OS << "#ifdef GET_INSTRINFO_OPERAND_TYPE\n";
+ OS << "#undef GET_INSTRINFO_OPERAND_TYPE\n";
+ OS << "namespace llvm {\n";
+ OS << "namespace " << Namespace << " {\n";
+ OS << "LLVM_READONLY\n";
+ OS << "int getOperandType(uint16_t Opcode, uint16_t OpIdx) {\n";
+ if (!NumberedInstructions.empty()) {
+ std::vector<int> OperandOffsets;
+ std::vector<Record *> OperandRecords;
+ int CurrentOffset = 0;
+ for (const CodeGenInstruction *Inst : NumberedInstructions) {
+ OperandOffsets.push_back(CurrentOffset);
+ for (const auto &Op : Inst->Operands) {
+ const DagInit *MIOI = Op.MIOperandInfo;
+ if (!MIOI || MIOI->getNumArgs() == 0) {
+ // Single, anonymous, operand.
+ OperandRecords.push_back(Op.Rec);
+ ++CurrentOffset;
+ } else {
+ for (Init *Arg : make_range(MIOI->arg_begin(), MIOI->arg_end())) {
+ OperandRecords.push_back(cast<DefInit>(Arg)->getDef());
+ ++CurrentOffset;
+ }
+ }
+ }
+ }
+
+ // Emit the table of offsets for the opcode lookup.
+ OS << " const int Offsets[] = {\n";
+ for (int I = 0, E = OperandOffsets.size(); I != E; ++I)
+ OS << " " << OperandOffsets[I] << ",\n";
+ OS << " };\n";
+
+ // Add an entry for the end so that we don't need to special case it below.
+ OperandOffsets.push_back(OperandRecords.size());
+ // Emit the actual operand types in a flat table.
+ OS << " const int OpcodeOperandTypes[] = {\n ";
+ for (int I = 0, E = OperandRecords.size(), CurOffset = 1; I != E; ++I) {
+ // We print each Opcode's operands in its own row.
+ if (I == OperandOffsets[CurOffset]) {
+ OS << "\n ";
+ // If there are empty rows, mark them with an empty comment.
+ while (OperandOffsets[++CurOffset] == I)
+ OS << "/**/\n ";
+ }
+ Record *OpR = OperandRecords[I];
+ if (OpR->isSubClassOf("Operand") && !OpR->isAnonymous())
+ OS << "OpTypes::" << OpR->getName();
+ else
+ OS << -1;
+ OS << ", ";
+ }
+ OS << "\n };\n";
+
+ OS << " return OpcodeOperandTypes[Offsets[Opcode] + OpIdx];\n";
+ } else {
+ OS << " llvm_unreachable(\"No instructions defined\");\n";
+ }
+ OS << "}\n";
+ OS << "} // end namespace " << Namespace << "\n";
+ OS << "} // end namespace llvm\n";
+ OS << "#endif //GET_INSTRINFO_OPERAND_TYPE\n\n";
}
void InstrInfoEmitter::emitMCIIHelperMethods(raw_ostream &OS,
@@ -561,7 +626,7 @@
emitOperandNameMappings(OS, Target, NumberedInstructions);
- emitOperandTypesEnum(OS, Target);
+ emitOperandTypeMappings(OS, Target, NumberedInstructions);
emitMCIIHelperMethods(OS, TargetName);
}
@@ -604,6 +669,7 @@
if (Inst.canFoldAsLoad) OS << "|(1ULL<<MCID::FoldableAsLoad)";
if (Inst.mayLoad) OS << "|(1ULL<<MCID::MayLoad)";
if (Inst.mayStore) OS << "|(1ULL<<MCID::MayStore)";
+ if (Inst.mayRaiseFPException) OS << "|(1ULL<<MCID::MayRaiseFPException)";
if (Inst.isPredicable) OS << "|(1ULL<<MCID::Predicable)";
if (Inst.isConvertibleToThreeAddress) OS << "|(1ULL<<MCID::ConvertibleTo3Addr)";
if (Inst.isCommutable) OS << "|(1ULL<<MCID::Commutable)";
@@ -629,13 +695,14 @@
// Emit all of the target-specific flags...
BitsInit *TSF = Inst.TheDef->getValueAsBitsInit("TSFlags");
if (!TSF)
- PrintFatalError("no TSFlags?");
+ PrintFatalError(Inst.TheDef->getLoc(), "no TSFlags?");
uint64_t Value = 0;
for (unsigned i = 0, e = TSF->getNumBits(); i != e; ++i) {
if (const auto *Bit = dyn_cast<BitInit>(TSF->getBit(i)))
Value |= uint64_t(Bit->getValue()) << i;
else
- PrintFatalError("Invalid TSFlags bit in " + Inst.TheDef->getName());
+ PrintFatalError(Inst.TheDef->getLoc(),
+ "Invalid TSFlags bit in " + Inst.TheDef->getName());
}
OS << ", 0x";
OS.write_hex(Value);
diff --git a/src/llvm-project/llvm/utils/TableGen/IntrinsicEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/IntrinsicEmitter.cpp
index 049282e..979af98 100644
--- a/src/llvm-project/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -1,9 +1,8 @@
//===- IntrinsicEmitter.cpp - Generate intrinsic information --------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -220,7 +219,8 @@
IIT_STRUCT6 = 38,
IIT_STRUCT7 = 39,
IIT_STRUCT8 = 40,
- IIT_F128 = 41
+ IIT_F128 = 41,
+ IIT_VEC_ELEMENT = 42
};
static void EncodeFixedValueType(MVT::SimpleValueType VT,
@@ -259,10 +259,12 @@
#endif
static void EncodeFixedType(Record *R, std::vector<unsigned char> &ArgCodes,
- std::vector<unsigned char> &Sig) {
+ unsigned &NextArgCode,
+ std::vector<unsigned char> &Sig,
+ ArrayRef<unsigned char> Mapping) {
if (R->isSubClassOf("LLVMMatchType")) {
- unsigned Number = R->getValueAsInt("Number");
+ unsigned Number = Mapping[R->getValueAsInt("Number")];
assert(Number < ArgCodes.size() && "Invalid matching number!");
if (R->isSubClassOf("LLVMExtendedType"))
Sig.push_back(IIT_EXTEND_ARG);
@@ -270,7 +272,7 @@
Sig.push_back(IIT_TRUNC_ARG);
else if (R->isSubClassOf("LLVMHalfElementsVectorType"))
Sig.push_back(IIT_HALF_VEC_ARG);
- else if (R->isSubClassOf("LLVMVectorSameWidth")) {
+ else if (R->isSubClassOf("LLVMScalarOrSameVectorWidth")) {
Sig.push_back(IIT_SAME_VEC_WIDTH_ARG);
Sig.push_back((Number << 3) | ArgCodes[Number]);
MVT::SimpleValueType VT = getValueType(R->getValueAsDef("ElTy"));
@@ -281,18 +283,18 @@
Sig.push_back(IIT_PTR_TO_ARG);
else if (R->isSubClassOf("LLVMVectorOfAnyPointersToElt")) {
Sig.push_back(IIT_VEC_OF_ANYPTRS_TO_ELT);
- unsigned ArgNo = ArgCodes.size();
- ArgCodes.push_back(3 /*vAny*/);
// Encode overloaded ArgNo
- Sig.push_back(ArgNo);
+ Sig.push_back(NextArgCode++);
// Encode LLVMMatchType<Number> ArgNo
Sig.push_back(Number);
return;
} else if (R->isSubClassOf("LLVMPointerToElt"))
Sig.push_back(IIT_PTR_TO_ELT);
+ else if (R->isSubClassOf("LLVMVectorElementType"))
+ Sig.push_back(IIT_VEC_ELEMENT);
else
Sig.push_back(IIT_ARG);
- return Sig.push_back((Number << 3) | ArgCodes[Number]);
+ return Sig.push_back((Number << 3) | 7 /*IITDescriptor::AK_MatchType*/);
}
MVT::SimpleValueType VT = getValueType(R->getValueAsDef("VT"));
@@ -310,8 +312,9 @@
Sig.push_back(IIT_ARG);
// Figure out what arg # this is consuming, and remember what kind it was.
- unsigned ArgNo = ArgCodes.size();
- ArgCodes.push_back(Tmp);
+ assert(NextArgCode < ArgCodes.size() && ArgCodes[NextArgCode] == Tmp &&
+ "Invalid or no ArgCode associated with overloaded VT!");
+ unsigned ArgNo = NextArgCode++;
// Encode what sort of argument it must be in the low 3 bits of the ArgNo.
return Sig.push_back((ArgNo << 3) | Tmp);
@@ -329,7 +332,8 @@
} else {
Sig.push_back(IIT_PTR);
}
- return EncodeFixedType(R->getValueAsDef("ElTy"), ArgCodes, Sig);
+ return EncodeFixedType(R->getValueAsDef("ElTy"), ArgCodes, NextArgCode, Sig,
+ Mapping);
}
}
@@ -354,6 +358,45 @@
EncodeFixedValueType(VT, Sig);
}
+static void UpdateArgCodes(Record *R, std::vector<unsigned char> &ArgCodes,
+ unsigned int &NumInserted,
+ SmallVectorImpl<unsigned char> &Mapping) {
+ if (R->isSubClassOf("LLVMMatchType")) {
+ if (R->isSubClassOf("LLVMVectorOfAnyPointersToElt")) {
+ ArgCodes.push_back(3 /*vAny*/);
+ ++NumInserted;
+ }
+ return;
+ }
+
+ unsigned Tmp = 0;
+ switch (getValueType(R->getValueAsDef("VT"))) {
+ default: break;
+ case MVT::iPTR:
+ UpdateArgCodes(R->getValueAsDef("ElTy"), ArgCodes, NumInserted, Mapping);
+ break;
+ case MVT::iPTRAny:
+ ++Tmp;
+ LLVM_FALLTHROUGH;
+ case MVT::vAny:
+ ++Tmp;
+ LLVM_FALLTHROUGH;
+ case MVT::fAny:
+ ++Tmp;
+ LLVM_FALLTHROUGH;
+ case MVT::iAny:
+ ++Tmp;
+ LLVM_FALLTHROUGH;
+ case MVT::Any:
+ unsigned OriginalIdx = ArgCodes.size() - NumInserted;
+ assert(OriginalIdx >= Mapping.size());
+ Mapping.resize(OriginalIdx+1);
+ Mapping[OriginalIdx] = ArgCodes.size();
+ ArgCodes.push_back(Tmp);
+ break;
+ }
+}
+
#if defined(_MSC_VER) && !defined(__clang__)
#pragma optimize("",on)
#endif
@@ -364,6 +407,17 @@
std::vector<unsigned char> &TypeSig) {
std::vector<unsigned char> ArgCodes;
+ // Add codes for any overloaded result VTs.
+ unsigned int NumInserted = 0;
+ SmallVector<unsigned char, 8> ArgMapping;
+ for (unsigned i = 0, e = Int.IS.RetVTs.size(); i != e; ++i)
+ UpdateArgCodes(Int.IS.RetTypeDefs[i], ArgCodes, NumInserted, ArgMapping);
+
+ // Add codes for any overloaded operand VTs.
+ for (unsigned i = 0, e = Int.IS.ParamTypeDefs.size(); i != e; ++i)
+ UpdateArgCodes(Int.IS.ParamTypeDefs[i], ArgCodes, NumInserted, ArgMapping);
+
+ unsigned NextArgCode = 0;
if (Int.IS.RetVTs.empty())
TypeSig.push_back(IIT_Done);
else if (Int.IS.RetVTs.size() == 1 &&
@@ -383,11 +437,13 @@
}
for (unsigned i = 0, e = Int.IS.RetVTs.size(); i != e; ++i)
- EncodeFixedType(Int.IS.RetTypeDefs[i], ArgCodes, TypeSig);
+ EncodeFixedType(Int.IS.RetTypeDefs[i], ArgCodes, NextArgCode, TypeSig,
+ ArgMapping);
}
for (unsigned i = 0, e = Int.IS.ParamTypeDefs.size(); i != e; ++i)
- EncodeFixedType(Int.IS.ParamTypeDefs[i], ArgCodes, TypeSig);
+ EncodeFixedType(Int.IS.ParamTypeDefs[i], ArgCodes, NextArgCode, TypeSig,
+ ArgMapping);
}
static void printIITEntry(raw_ostream &OS, unsigned char X) {
@@ -489,6 +545,9 @@
if (L->isNoReturn != R->isNoReturn)
return R->isNoReturn;
+ if (L->isWillReturn != R->isWillReturn)
+ return R->isWillReturn;
+
if (L->isCold != R->isCold)
return R->isCold;
@@ -505,7 +564,6 @@
CodeGenIntrinsic::ModRefBehavior LK = L->ModRef;
CodeGenIntrinsic::ModRefBehavior RK = R->ModRef;
if (LK != RK) return (LK > RK);
-
// Order by argument attributes.
// This is reliable because each side is already sorted internally.
return (L->ArgumentAttributes < R->ArgumentAttributes);
@@ -613,6 +671,12 @@
OS << "Attribute::ReadNone";
addComma = true;
break;
+ case CodeGenIntrinsic::ImmArg:
+ if (addComma)
+ OS << ',';
+ OS << "Attribute::ImmArg";
+ addComma = true;
+ break;
}
++ai;
@@ -624,9 +688,10 @@
}
if (!intrinsic.canThrow ||
- intrinsic.ModRef != CodeGenIntrinsic::ReadWriteMem ||
- intrinsic.isNoReturn || intrinsic.isCold || intrinsic.isNoDuplicate ||
- intrinsic.isConvergent || intrinsic.isSpeculatable) {
+ (intrinsic.ModRef != CodeGenIntrinsic::ReadWriteMem && !intrinsic.hasSideEffects) ||
+ intrinsic.isNoReturn || intrinsic.isWillReturn || intrinsic.isCold ||
+ intrinsic.isNoDuplicate || intrinsic.isConvergent ||
+ intrinsic.isSpeculatable) {
OS << " const Attribute::AttrKind Atts[] = {";
bool addComma = false;
if (!intrinsic.canThrow) {
@@ -639,6 +704,12 @@
OS << "Attribute::NoReturn";
addComma = true;
}
+ if (intrinsic.isWillReturn) {
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::WillReturn";
+ addComma = true;
+ }
if (intrinsic.isCold) {
if (addComma)
OS << ",";
@@ -666,6 +737,8 @@
switch (intrinsic.ModRef) {
case CodeGenIntrinsic::NoMem:
+ if (intrinsic.hasSideEffects)
+ break;
if (addComma)
OS << ",";
OS << "Attribute::ReadNone";
@@ -771,8 +844,9 @@
BuiltinMap[Ints[i].TargetPrefix];
if (!BIM.insert(std::make_pair(BuiltinName, Ints[i].EnumName)).second)
- PrintFatalError("Intrinsic '" + Ints[i].TheDef->getName() +
- "': duplicate " + CompilerName + " builtin name!");
+ PrintFatalError(Ints[i].TheDef->getLoc(),
+ "Intrinsic '" + Ints[i].TheDef->getName() +
+ "': duplicate " + CompilerName + " builtin name!");
Table.GetOrAddStringOffset(BuiltinName);
}
}
diff --git a/src/llvm-project/llvm/utils/TableGen/LLVMBuild.txt b/src/llvm-project/llvm/utils/TableGen/LLVMBuild.txt
index 66387cf..5eec4e0 100644
--- a/src/llvm-project/llvm/utils/TableGen/LLVMBuild.txt
+++ b/src/llvm-project/llvm/utils/TableGen/LLVMBuild.txt
@@ -1,9 +1,8 @@
;===- ./utils/TableGen/LLVMBuild.txt ---------------------------*- Conf -*--===;
;
-; The LLVM Compiler Infrastructure
-;
-; This file is distributed under the University of Illinois Open Source
-; License. See LICENSE.TXT for details.
+; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+; See https://llvm.org/LICENSE.txt for license information.
+; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
;===------------------------------------------------------------------------===;
;
diff --git a/src/llvm-project/llvm/utils/TableGen/OptParserEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/OptParserEmitter.cpp
index 0358cf2..51b1cb0 100644
--- a/src/llvm-project/llvm/utils/TableGen/OptParserEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/OptParserEmitter.cpp
@@ -1,9 +1,8 @@
//===- OptParserEmitter.cpp - Table Driven Command Line Parsing -----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/PredicateExpander.cpp b/src/llvm-project/llvm/utils/TableGen/PredicateExpander.cpp
index 2e01b7c..9f7f40db 100644
--- a/src/llvm-project/llvm/utils/TableGen/PredicateExpander.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/PredicateExpander.cpp
@@ -1,9 +1,8 @@
//===--------------------- PredicateExpander.cpp --------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/src/llvm-project/llvm/utils/TableGen/PredicateExpander.h b/src/llvm-project/llvm/utils/TableGen/PredicateExpander.h
index 0f3ee68..115a81c 100644
--- a/src/llvm-project/llvm/utils/TableGen/PredicateExpander.h
+++ b/src/llvm-project/llvm/utils/TableGen/PredicateExpander.h
@@ -1,9 +1,8 @@
//===--------------------- PredicateExpander.h ----------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/src/llvm-project/llvm/utils/TableGen/PseudoLoweringEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
index a363015..3a80d8e 100644
--- a/src/llvm-project/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/PseudoLoweringEmitter.cpp
@@ -1,9 +1,8 @@
//===- PseudoLoweringEmitter.cpp - PseudoLowering Generator -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
index e03663b..e62f528 100644
--- a/src/llvm-project/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
@@ -1,9 +1,8 @@
//===- RISCVCompressInstEmitter.cpp - Generator for RISCV Compression -===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// RISCVCompressInstEmitter implements a tablegen-driven CompressPat based
// RISCV Instruction Compression mechanism.
@@ -65,6 +64,7 @@
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
+#include <set>
#include <vector>
using namespace llvm;
@@ -253,12 +253,14 @@
// Source instructions are non compressed instructions and don't have tied
// operands.
if (IsSource)
- PrintFatalError("Input operands for Inst '" + Inst.TheDef->getName() +
- "' and input Dag operand count mismatch");
+ PrintFatalError(Inst.TheDef->getLoc(),
+ "Input operands for Inst '" + Inst.TheDef->getName() +
+ "' and input Dag operand count mismatch");
// The Dag can't have more arguments than the Instruction.
if (Dag->getNumArgs() > Inst.Operands.size())
- PrintFatalError("Inst '" + Inst.TheDef->getName() +
- "' and Dag operand count mismatch");
+ PrintFatalError(Inst.TheDef->getLoc(),
+ "Inst '" + Inst.TheDef->getName() +
+ "' and Dag operand count mismatch");
// The Instruction might have tied operands so the Dag might have
// a fewer operand count.
@@ -268,8 +270,9 @@
--RealCount;
if (Dag->getNumArgs() != RealCount)
- PrintFatalError("Inst '" + Inst.TheDef->getName() +
- "' and Dag operand count mismatch");
+ PrintFatalError(Inst.TheDef->getLoc(),
+ "Inst '" + Inst.TheDef->getName() +
+ "' and Dag operand count mismatch");
return true;
}
@@ -472,7 +475,7 @@
SourceOperandMap, DestOperandMap));
}
-static void getReqFeatures(std::map<StringRef, int> &FeaturesMap,
+static void getReqFeatures(std::set<StringRef> &FeaturesSet,
const std::vector<Record *> &ReqFeatures) {
for (auto &R : ReqFeatures) {
StringRef AsmCondString = R->getValueAsString("AssemblerCondString");
@@ -481,11 +484,9 @@
SmallVector<StringRef, 4> Ops;
SplitString(AsmCondString, Ops, ",");
assert(!Ops.empty() && "AssemblerCondString cannot be empty");
-
for (auto &Op : Ops) {
assert(!Op.empty() && "Empty operator");
- if (FeaturesMap.find(Op) == FeaturesMap.end())
- FeaturesMap[Op] = FeaturesMap.size();
+ FeaturesSet.insert(Op);
}
}
}
@@ -530,7 +531,8 @@
bool Compress) {
Record *AsmWriter = Target.getAsmWriter();
if (!AsmWriter->getValueAsInt("PassSubtarget"))
- PrintFatalError("'PassSubtarget' is false. SubTargetInfo object is needed "
+ PrintFatalError(AsmWriter->getLoc(),
+ "'PassSubtarget' is false. SubTargetInfo object is needed "
"for target features.\n");
std::string Namespace = Target.getName();
@@ -540,15 +542,15 @@
// transformed to a C_ADD or a C_MV. When emitting 'uncompress()' function the
// source and destination are flipped and the sort key needs to change
// accordingly.
- std::stable_sort(CompressPatterns.begin(), CompressPatterns.end(),
- [Compress](const CompressPat &LHS, const CompressPat &RHS) {
- if (Compress)
- return (LHS.Source.TheDef->getName().str() <
- RHS.Source.TheDef->getName().str());
- else
- return (LHS.Dest.TheDef->getName().str() <
- RHS.Dest.TheDef->getName().str());
- });
+ llvm::stable_sort(CompressPatterns,
+ [Compress](const CompressPat &LHS, const CompressPat &RHS) {
+ if (Compress)
+ return (LHS.Source.TheDef->getName().str() <
+ RHS.Source.TheDef->getName().str());
+ else
+ return (LHS.Dest.TheDef->getName().str() <
+ RHS.Dest.TheDef->getName().str());
+ });
// A list of MCOperandPredicates for all operands in use, and the reverse map.
std::vector<const Record *> MCOpPredicates;
@@ -617,9 +619,9 @@
CaseStream.indent(4) << "case " + Namespace + "::" + CurOp + ": {\n";
}
- std::map<StringRef, int> FeaturesMap;
+ std::set<StringRef> FeaturesSet;
// Add CompressPat required features.
- getReqFeatures(FeaturesMap, CompressPat.PatReqFeatures);
+ getReqFeatures(FeaturesSet, CompressPat.PatReqFeatures);
// Add Dest instruction required features.
std::vector<Record *> ReqFeatures;
@@ -627,11 +629,10 @@
copy_if(RF, std::back_inserter(ReqFeatures), [](Record *R) {
return R->getValueAsBit("AssemblerMatcherPredicate");
});
- getReqFeatures(FeaturesMap, ReqFeatures);
+ getReqFeatures(FeaturesSet, ReqFeatures);
// Emit checks for all required features.
- for (auto &F : FeaturesMap) {
- StringRef Op = F.first;
+ for (auto &Op : FeaturesSet) {
if (Op[0] == '!')
CondStream.indent(6) << ("!STI.getFeatureBits()[" + Namespace +
"::" + Op.substr(1) + "]")
diff --git a/src/llvm-project/llvm/utils/TableGen/RegisterBankEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/RegisterBankEmitter.cpp
index 879b416..7f6b393 100644
--- a/src/llvm-project/llvm/utils/TableGen/RegisterBankEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/RegisterBankEmitter.cpp
@@ -1,9 +1,8 @@
//===- RegisterBankEmitter.cpp - Generate a Register Bank Desc. -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index ded54c8..1b61907 100644
--- a/src/llvm-project/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -1,9 +1,8 @@
//===- RegisterInfoEmitter.cpp - Generate a Register File Desc. -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.cpp b/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.cpp
index 343febc..1843a78 100644
--- a/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.cpp
@@ -1,9 +1,8 @@
//===- SDNodeProperties.cpp -----------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -39,9 +38,9 @@
} else if (Property->getName() == "SDNPVariadic") {
Properties |= 1 << SDNPVariadic;
} else {
- PrintFatalError("Unknown SD Node property '" +
- Property->getName() + "' on node '" +
- R->getName() + "'!");
+ PrintFatalError(R->getLoc(), "Unknown SD Node property '" +
+ Property->getName() + "' on node '" +
+ R->getName() + "'!");
}
}
diff --git a/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.h b/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.h
index a8d4efb..66a04e6 100644
--- a/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.h
+++ b/src/llvm-project/llvm/utils/TableGen/SDNodeProperties.h
@@ -1,9 +1,8 @@
//===- SDNodeProperties.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/SearchableTableEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/SearchableTableEmitter.cpp
index f98a7c7..954b63e 100644
--- a/src/llvm-project/llvm/utils/TableGen/SearchableTableEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/SearchableTableEmitter.cpp
@@ -1,9 +1,8 @@
//===- SearchableTableEmitter.cpp - Generate efficiently searchable tables -==//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -142,7 +141,7 @@
bool compareBy(Record *LHS, Record *RHS, const SearchIndex &Index);
bool isIntegral(Init *I) {
- return isa<BitsInit>(I) || isIntrinsic(I);
+ return isa<BitsInit>(I) || isa<CodeInit>(I) || isIntrinsic(I);
}
std::string searchableFieldType(const GenericField &Field, TypeContext Ctx) {
@@ -600,9 +599,10 @@
for (auto &Field : Table.Fields) {
auto TI = dyn_cast<TypedInit>(EntryRec->getValueInit(Field.Name));
if (!TI) {
- PrintFatalError(Twine("Record '") + EntryRec->getName() +
- "' in table '" + Table.Name + "' is missing field '" +
- Field.Name + "'");
+ PrintFatalError(EntryRec->getLoc(),
+ Twine("Record '") + EntryRec->getName() +
+ "' in table '" + Table.Name +
+ "' is missing field '" + Field.Name + "'");
}
if (!Field.RecType) {
Field.RecType = TI->getType();
@@ -611,7 +611,7 @@
if (!Ty)
PrintFatalError(Twine("Field '") + Field.Name + "' of table '" +
Table.Name + "' has incompatible type: " +
- Ty->getAsString() + " vs. " +
+ Field.RecType->getAsString() + " vs. " +
TI->getType()->getAsString());
Field.RecType = Ty;
}
@@ -654,8 +654,8 @@
StringRef FilterClass = EnumRec->getValueAsString("FilterClass");
Enum->Class = Records.getClass(FilterClass);
if (!Enum->Class)
- PrintFatalError(Twine("Enum FilterClass '") + FilterClass +
- "' does not exist");
+ PrintFatalError(EnumRec->getLoc(), Twine("Enum FilterClass '") +
+ FilterClass + "' does not exist");
collectEnumEntries(*Enum, NameField, ValueField,
Records.getAllDerivedDefinitions(FilterClass));
@@ -675,9 +675,10 @@
if (auto TypeOfVal = TableRec->getValue(("TypeOf_" + FieldName).str())) {
if (!parseFieldType(Table->Fields.back(), TypeOfVal->getValue())) {
- PrintFatalError(Twine("Table '") + Table->Name +
- "' has bad 'TypeOf_" + FieldName + "': " +
- TypeOfVal->getValue()->getAsString());
+ PrintFatalError(TableRec->getLoc(),
+ Twine("Table '") + Table->Name +
+ "' has bad 'TypeOf_" + FieldName +
+ "': " + TypeOfVal->getValue()->getAsString());
}
}
}
@@ -705,8 +706,10 @@
Record *TableRec = IndexRec->getValueAsDef("Table");
auto It = TableMap.find(TableRec);
if (It == TableMap.end())
- PrintFatalError(Twine("SearchIndex '") + IndexRec->getName() +
- "' refers to non-existing table '" + TableRec->getName());
+ PrintFatalError(IndexRec->getLoc(),
+ Twine("SearchIndex '") + IndexRec->getName() +
+ "' refers to non-existing table '" +
+ TableRec->getName());
GenericTable &Table = *It->second;
Table.Indices.push_back(parseSearchIndex(
diff --git a/src/llvm-project/llvm/utils/TableGen/SequenceToOffsetTable.h b/src/llvm-project/llvm/utils/TableGen/SequenceToOffsetTable.h
index 2b8f66a..8a826ef 100644
--- a/src/llvm-project/llvm/utils/TableGen/SequenceToOffsetTable.h
+++ b/src/llvm-project/llvm/utils/TableGen/SequenceToOffsetTable.h
@@ -1,9 +1,8 @@
//===-- SequenceToOffsetTable.h - Compress similar sequences ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/SubtargetEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/SubtargetEmitter.cpp
index 731c14b..9ce2b3b 100644
--- a/src/llvm-project/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -1,9 +1,8 @@
//===- SubtargetEmitter.cpp - Generate subtarget enumerations -------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -74,9 +73,11 @@
CodeGenSchedModels &SchedModels;
std::string Target;
- void Enumeration(raw_ostream &OS);
- unsigned FeatureKeyValues(raw_ostream &OS);
- unsigned CPUKeyValues(raw_ostream &OS);
+ void Enumeration(raw_ostream &OS, DenseMap<Record *, unsigned> &FeatureMap);
+ unsigned FeatureKeyValues(raw_ostream &OS,
+ const DenseMap<Record *, unsigned> &FeatureMap);
+ unsigned CPUKeyValues(raw_ostream &OS,
+ const DenseMap<Record *, unsigned> &FeatureMap);
void FormItineraryStageString(const std::string &Names,
Record *ItinData, std::string &ItinString,
unsigned &NStages);
@@ -138,7 +139,8 @@
//
// Enumeration - Emit the specified class as an enumeration.
//
-void SubtargetEmitter::Enumeration(raw_ostream &OS) {
+void SubtargetEmitter::Enumeration(raw_ostream &OS,
+ DenseMap<Record *, unsigned> &FeatureMap) {
// Get all records of class and sort
std::vector<Record*> DefList =
Records.getAllDerivedDefinitions("SubtargetFeature");
@@ -147,7 +149,7 @@
unsigned N = DefList.size();
if (N == 0)
return;
- if (N > MAX_SUBTARGET_FEATURES)
+ if (N + 1 > MAX_SUBTARGET_FEATURES)
PrintFatalError("Too many subtarget features! Bump MAX_SUBTARGET_FEATURES.");
OS << "namespace " << Target << " {\n";
@@ -162,18 +164,42 @@
// Get and emit name
OS << " " << Def->getName() << " = " << i << ",\n";
+
+ // Save the index for this feature.
+ FeatureMap[Def] = i;
}
+ OS << " "
+ << "NumSubtargetFeatures = " << N << "\n";
+
// Close enumeration and namespace
OS << "};\n";
OS << "} // end namespace " << Target << "\n";
}
+static void printFeatureMask(raw_ostream &OS, RecVec &FeatureList,
+ const DenseMap<Record *, unsigned> &FeatureMap) {
+ std::array<uint64_t, MAX_SUBTARGET_WORDS> Mask = {};
+ for (unsigned j = 0, M = FeatureList.size(); j < M; ++j) {
+ unsigned Bit = FeatureMap.lookup(FeatureList[j]);
+ Mask[Bit / 64] |= 1ULL << (Bit % 64);
+ }
+
+ OS << "{ { { ";
+ for (unsigned i = 0; i != Mask.size(); ++i) {
+ OS << "0x";
+ OS.write_hex(Mask[i]);
+ OS << "ULL, ";
+ }
+ OS << "} } }";
+}
+
//
// FeatureKeyValues - Emit data of all the subtarget features. Used by the
// command line.
//
-unsigned SubtargetEmitter::FeatureKeyValues(raw_ostream &OS) {
+unsigned SubtargetEmitter::FeatureKeyValues(
+ raw_ostream &OS, const DenseMap<Record *, unsigned> &FeatureMap) {
// Gather and sort all the features
std::vector<Record*> FeatureList =
Records.getAllDerivedDefinitions("SubtargetFeature");
@@ -204,16 +230,13 @@
OS << " { "
<< "\"" << CommandLineName << "\", "
<< "\"" << Desc << "\", "
- << "{ " << Target << "::" << Name << " }, ";
+ << Target << "::" << Name << ", ";
RecVec ImpliesList = Feature->getValueAsListOfDefs("Implies");
- OS << "{";
- for (unsigned j = 0, M = ImpliesList.size(); j < M;) {
- OS << " " << Target << "::" << ImpliesList[j]->getName();
- if (++j < M) OS << ",";
- }
- OS << " } },\n";
+ printFeatureMask(OS, ImpliesList, FeatureMap);
+
+ OS << " },\n";
++NumFeatures;
}
@@ -227,7 +250,9 @@
// CPUKeyValues - Emit data of all the subtarget processors. Used by command
// line.
//
-unsigned SubtargetEmitter::CPUKeyValues(raw_ostream &OS) {
+unsigned
+SubtargetEmitter::CPUKeyValues(raw_ostream &OS,
+ const DenseMap<Record *, unsigned> &FeatureMap) {
// Gather and sort processor information
std::vector<Record*> ProcessorList =
Records.getAllDerivedDefinitions("Processor");
@@ -235,7 +260,7 @@
// Begin processor table
OS << "// Sorted (by key) array of values for CPU subtype.\n"
- << "extern const llvm::SubtargetFeatureKV " << Target
+ << "extern const llvm::SubtargetSubTypeKV " << Target
<< "SubTypeKV[] = {\n";
// For each processor
@@ -243,18 +268,16 @@
StringRef Name = Processor->getValueAsString("Name");
RecVec FeatureList = Processor->getValueAsListOfDefs("Features");
- // Emit as { "cpu", "description", { f1 , f2 , ... fn } },
- OS << " { "
- << "\"" << Name << "\", "
- << "\"Select the " << Name << " processor\", ";
+ // Emit as { "cpu", "description", 0, { f1 , f2 , ... fn } },
+ OS << " { "
+ << "\"" << Name << "\", ";
- OS << "{";
- for (unsigned j = 0, M = FeatureList.size(); j < M;) {
- OS << " " << Target << "::" << FeatureList[j]->getName();
- if (++j < M) OS << ",";
- }
- // The { } is for the "implies" section of this data structure.
- OS << " }, { } },\n";
+ printFeatureMask(OS, FeatureList, FeatureMap);
+
+ // Emit the scheduler model pointer.
+ const std::string &ProcModelName =
+ SchedModels.getModelForProc(Processor).ModelName;
+ OS << ", &" << ProcModelName << " },\n";
}
// End processor table
@@ -1369,33 +1392,6 @@
}
//
-// EmitProcessorLookup - generate cpu name to sched model lookup tables.
-//
-void SubtargetEmitter::EmitProcessorLookup(raw_ostream &OS) {
- // Gather and sort processor information
- std::vector<Record*> ProcessorList =
- Records.getAllDerivedDefinitions("Processor");
- llvm::sort(ProcessorList, LessRecordFieldName());
-
- // Begin processor->sched model table
- OS << "\n";
- OS << "// Sorted (by key) array of sched model for CPU subtype.\n"
- << "extern const llvm::SubtargetInfoKV " << Target
- << "ProcSchedKV[] = {\n";
- // For each processor
- for (Record *Processor : ProcessorList) {
- StringRef Name = Processor->getValueAsString("Name");
- const std::string &ProcModelName =
- SchedModels.getModelForProc(Processor).ModelName;
-
- // Emit as { "cpu", procinit },
- OS << " { \"" << Name << "\", (const void *)&" << ProcModelName << " },\n";
- }
- // End processor->sched model table
- OS << "};\n";
-}
-
-//
// EmitSchedModel - Emits all scheduling model tables, folding common patterns.
//
void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) {
@@ -1423,12 +1419,10 @@
}
EmitSchedClassTables(SchedTables, OS);
+ OS << "\n#undef DBGFIELD\n";
+
// Emit the processor machine model
EmitProcessorModels(OS);
- // Emit the processor lookup data
- EmitProcessorLookup(OS);
-
- OS << "\n#undef DBGFIELD";
}
static void emitPredicateProlog(const RecordKeeper &Records, raw_ostream &OS) {
@@ -1740,13 +1734,12 @@
<< "GenMCSubtargetInfo : public MCSubtargetInfo {\n";
OS << " " << Target << "GenMCSubtargetInfo(const Triple &TT, \n"
<< " StringRef CPU, StringRef FS, ArrayRef<SubtargetFeatureKV> PF,\n"
- << " ArrayRef<SubtargetFeatureKV> PD,\n"
- << " const SubtargetInfoKV *ProcSched,\n"
+ << " ArrayRef<SubtargetSubTypeKV> PD,\n"
<< " const MCWriteProcResEntry *WPR,\n"
<< " const MCWriteLatencyEntry *WL,\n"
<< " const MCReadAdvanceEntry *RA, const InstrStage *IS,\n"
<< " const unsigned *OC, const unsigned *FP) :\n"
- << " MCSubtargetInfo(TT, CPU, FS, PF, PD, ProcSched,\n"
+ << " MCSubtargetInfo(TT, CPU, FS, PF, PD,\n"
<< " WPR, WL, RA, IS, OC, FP) { }\n\n"
<< " unsigned resolveVariantSchedClass(unsigned SchedClass,\n"
<< " const MCInst *MI, unsigned CPUID) const override {\n"
@@ -1790,8 +1783,10 @@
OS << "\n#ifdef GET_SUBTARGETINFO_ENUM\n";
OS << "#undef GET_SUBTARGETINFO_ENUM\n\n";
+ DenseMap<Record *, unsigned> FeatureMap;
+
OS << "namespace llvm {\n";
- Enumeration(OS);
+ Enumeration(OS, FeatureMap);
OS << "} // end namespace llvm\n\n";
OS << "#endif // GET_SUBTARGETINFO_ENUM\n\n";
@@ -1802,12 +1797,12 @@
#if 0
OS << "namespace {\n";
#endif
- unsigned NumFeatures = FeatureKeyValues(OS);
- OS << "\n";
- unsigned NumProcs = CPUKeyValues(OS);
+ unsigned NumFeatures = FeatureKeyValues(OS, FeatureMap);
OS << "\n";
EmitSchedModel(OS);
OS << "\n";
+ unsigned NumProcs = CPUKeyValues(OS, FeatureMap);
+ OS << "\n";
#if 0
OS << "} // end anonymous namespace\n\n";
#endif
@@ -1828,8 +1823,7 @@
else
OS << "None, ";
OS << '\n'; OS.indent(22);
- OS << Target << "ProcSchedKV, "
- << Target << "WriteProcResTable, "
+ OS << Target << "WriteProcResTable, "
<< Target << "WriteLatencyTable, "
<< Target << "ReadAdvanceTable, ";
OS << '\n'; OS.indent(22);
@@ -1895,8 +1889,7 @@
OS << "#include \"llvm/CodeGen/TargetSchedule.h\"\n\n";
OS << "namespace llvm {\n";
OS << "extern const llvm::SubtargetFeatureKV " << Target << "FeatureKV[];\n";
- OS << "extern const llvm::SubtargetFeatureKV " << Target << "SubTypeKV[];\n";
- OS << "extern const llvm::SubtargetInfoKV " << Target << "ProcSchedKV[];\n";
+ OS << "extern const llvm::SubtargetSubTypeKV " << Target << "SubTypeKV[];\n";
OS << "extern const llvm::MCWriteProcResEntry "
<< Target << "WriteProcResTable[];\n";
OS << "extern const llvm::MCWriteLatencyEntry "
@@ -1922,8 +1915,7 @@
else
OS << "None, ";
OS << '\n'; OS.indent(24);
- OS << Target << "ProcSchedKV, "
- << Target << "WriteProcResTable, "
+ OS << Target << "WriteProcResTable, "
<< Target << "WriteLatencyTable, "
<< Target << "ReadAdvanceTable, ";
OS << '\n'; OS.indent(24);
diff --git a/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.cpp b/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.cpp
index f9b8853..edf0b4a 100644
--- a/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.cpp
@@ -1,9 +1,8 @@
//===- SubtargetFeatureInfo.cpp - Helpers for subtarget features ----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -45,20 +44,6 @@
return SubtargetFeatures;
}
-void SubtargetFeatureInfo::emitSubtargetFeatureFlagEnumeration(
- SubtargetFeatureInfoMap &SubtargetFeatures, raw_ostream &OS) {
- OS << "// Flags for subtarget features that participate in "
- << "instruction matching.\n";
- OS << "enum SubtargetFeatureFlag : "
- << getMinimalTypeForEnumBitfield(SubtargetFeatures.size()) << " {\n";
- for (const auto &SF : SubtargetFeatures) {
- const SubtargetFeatureInfo &SFI = SF.second;
- OS << " " << SFI.getEnumName() << " = (1ULL << " << SFI.Index << "),\n";
- }
- OS << " Feature_None = 0\n";
- OS << "};\n\n";
-}
-
void SubtargetFeatureInfo::emitSubtargetFeatureBitEnumeration(
SubtargetFeatureInfoMap &SubtargetFeatures, raw_ostream &OS) {
OS << "// Bits for subtarget features that participate in "
@@ -121,9 +106,9 @@
void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
StringRef TargetName, StringRef ClassName, StringRef FuncName,
SubtargetFeatureInfoMap &SubtargetFeatures, raw_ostream &OS) {
- OS << "uint64_t " << TargetName << ClassName << "::\n"
+ OS << "FeatureBitset " << TargetName << ClassName << "::\n"
<< FuncName << "(const FeatureBitset& FB) const {\n";
- OS << " uint64_t Features = 0;\n";
+ OS << " FeatureBitset Features;\n";
for (const auto &SF : SubtargetFeatures) {
const SubtargetFeatureInfo &SFI = SF.second;
@@ -157,7 +142,7 @@
} while (true);
OS << ")\n";
- OS << " Features |= " << SFI.getEnumName() << ";\n";
+ OS << " Features[" << SFI.getEnumBitName() << "] = 1;\n";
}
OS << " return Features;\n";
OS << "}\n\n";
diff --git a/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.h b/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.h
index 71e6748..d72f8b9 100644
--- a/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.h
+++ b/src/llvm-project/llvm/utils/TableGen/SubtargetFeatureInfo.h
@@ -1,9 +1,8 @@
-//===- SubtargetFeatureInfo.h - Helpers for subtarget features ------------===//
+//===- SubtargetFeatureInfo.h - Helpers for subtarget features --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -56,13 +55,6 @@
/// Emit the subtarget feature flag definitions.
///
- /// This version emits the bit value for the feature and is therefore limited
- /// to 64 feature bits.
- static void emitSubtargetFeatureFlagEnumeration(
- SubtargetFeatureInfoMap &SubtargetFeatures, raw_ostream &OS);
-
- /// Emit the subtarget feature flag definitions.
- ///
/// This version emits the bit index for the feature and can therefore support
/// more than 64 feature bits.
static void
diff --git a/src/llvm-project/llvm/utils/TableGen/TableGen.cpp b/src/llvm-project/llvm/utils/TableGen/TableGen.cpp
index d5b6a3c..c485ed2 100644
--- a/src/llvm-project/llvm/utils/TableGen/TableGen.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/TableGen.cpp
@@ -1,9 +1,8 @@
//===- TableGen.cpp - Top-Level TableGen implementation for LLVM ----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -56,6 +55,12 @@
GenExegesis,
};
+namespace llvm {
+/// Storage for TimeRegionsOpt as a global so that backends aren't required to
+/// include CommandLine.h
+bool TimeRegions = false;
+} // end namespace llvm
+
namespace {
cl::opt<ActionType>
Action(cl::desc("Action to perform:"),
@@ -127,6 +132,11 @@
Class("class", cl::desc("Print Enum list for this class"),
cl::value_desc("class name"), cl::cat(PrintEnumsCat));
+cl::opt<bool, true>
+ TimeRegionsOpt("time-regions",
+ cl::desc("Time regions of tablegens execution"),
+ cl::location(TimeRegions));
+
bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
switch (Action) {
case PrintRecords:
diff --git a/src/llvm-project/llvm/utils/TableGen/TableGenBackends.h b/src/llvm-project/llvm/utils/TableGen/TableGenBackends.h
index f4f2909..135ec65 100644
--- a/src/llvm-project/llvm/utils/TableGen/TableGenBackends.h
+++ b/src/llvm-project/llvm/utils/TableGen/TableGenBackends.h
@@ -1,9 +1,8 @@
//===- TableGenBackends.h - Declarations for LLVM TableGen Backends -------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/Types.cpp b/src/llvm-project/llvm/utils/TableGen/Types.cpp
index 04d9e40..a6682da 100644
--- a/src/llvm-project/llvm/utils/TableGen/Types.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/Types.cpp
@@ -1,9 +1,8 @@
//===- Types.cpp - Helper for the selection of C++ data types. ------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/Types.h b/src/llvm-project/llvm/utils/TableGen/Types.h
index d511b7e..17c7742 100644
--- a/src/llvm-project/llvm/utils/TableGen/Types.h
+++ b/src/llvm-project/llvm/utils/TableGen/Types.h
@@ -1,9 +1,8 @@
//===- Types.h - Helper for the selection of C++ types. ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
index 788f142..365cba5 100644
--- a/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp
@@ -1,9 +1,8 @@
//===- WebAssemblyDisassemblerEmitter.cpp - Disassembler tables -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -51,12 +50,33 @@
auto IsStackBased =
StackString &&
reinterpret_cast<const StringInit *>(StackString)->getValue() == "true";
- if (IsStackBased && !CGIP.second) {
- // this picks the first of many typed variants, which is
- // currently the except_ref one, though this shouldn't matter for
- // disassembly purposes.
- CGIP = std::make_pair(I, &CGI);
+ if (!IsStackBased)
+ continue;
+ if (CGIP.second) {
+ // We already have an instruction for this slot, so decide which one
+ // should be the canonical one. This determines which variant gets
+ // printed in a disassembly. We want e.g. "call" not "i32.call", and
+ // "end" when we don't know if its "end_loop" or "end_block" etc.
+ auto IsCanonicalExisting = CGIP.second->TheDef->getValue("IsCanonical")
+ ->getValue()
+ ->getAsString() == "1";
+ // We already have one marked explicitly as canonical, so keep it.
+ if (IsCanonicalExisting)
+ continue;
+ auto IsCanonicalNew =
+ Def.getValue("IsCanonical")->getValue()->getAsString() == "1";
+ // If the new one is explicitly marked as canonical, take it.
+ if (!IsCanonicalNew) {
+ // Neither the existing or new instruction is canonical.
+ // Pick the one with the shortest name as heuristic.
+ // Though ideally IsCanonical is always defined for at least one
+ // variant so this never has to apply.
+ if (CGIP.second->AsmString.size() <= CGI.AsmString.size())
+ continue;
+ }
}
+ // Set this instruction as the one to use.
+ CGIP = std::make_pair(I, &CGI);
}
OS << "#include \"MCTargetDesc/WebAssemblyMCTargetDesc.h\"\n";
OS << "\n";
diff --git a/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.h b/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.h
index 91f820f..60d3d94 100644
--- a/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.h
+++ b/src/llvm-project/llvm/utils/TableGen/WebAssemblyDisassemblerEmitter.h
@@ -1,9 +1,8 @@
//===- WebAssemblyDisassemblerEmitter.h - Disassembler tables ---*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerShared.h b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerShared.h
index 220765f7..093f220 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerShared.h
+++ b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerShared.h
@@ -1,9 +1,8 @@
//===- X86DisassemblerShared.h - Emitter shared header ----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.cpp b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.cpp
index 2b5cc12..8036aec 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.cpp
@@ -1,9 +1,8 @@
//===- X86DisassemblerTables.cpp - Disassembler tables ----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -889,67 +888,44 @@
}
void DisassemblerTables::emitContextTable(raw_ostream &o, unsigned &i) const {
- const unsigned int tableSize = 16384;
o.indent(i * 2) << "static const uint8_t " CONTEXTS_STR
- "[" << tableSize << "] = {\n";
+ "[" << ATTR_max << "] = {\n";
i++;
- for (unsigned index = 0; index < tableSize; ++index) {
+ for (unsigned index = 0; index < ATTR_max; ++index) {
o.indent(i * 2);
- if (index & ATTR_EVEX) {
- o << "IC_EVEX";
- if (index & ATTR_EVEXL2)
+ if ((index & ATTR_EVEX) || (index & ATTR_VEX) || (index & ATTR_VEXL)) {
+ if (index & ATTR_EVEX)
+ o << "IC_EVEX";
+ else
+ o << "IC_VEX";
+
+ if ((index & ATTR_EVEX) && (index & ATTR_EVEXL2))
o << "_L2";
- else if (index & ATTR_EVEXL)
+ else if (index & ATTR_VEXL)
o << "_L";
+
if (index & ATTR_REXW)
o << "_W";
+
if (index & ATTR_OPSIZE)
o << "_OPSIZE";
else if (index & ATTR_XD)
o << "_XD";
else if (index & ATTR_XS)
o << "_XS";
- if (index & ATTR_EVEXKZ)
- o << "_KZ";
- else if (index & ATTR_EVEXK)
- o << "_K";
- if (index & ATTR_EVEXB)
- o << "_B";
+
+ if ((index & ATTR_EVEX)) {
+ if (index & ATTR_EVEXKZ)
+ o << "_KZ";
+ else if (index & ATTR_EVEXK)
+ o << "_K";
+
+ if (index & ATTR_EVEXB)
+ o << "_B";
+ }
}
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_OPSIZE))
- o << "IC_VEX_L_W_OPSIZE";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_XD))
- o << "IC_VEX_L_W_XD";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW) && (index & ATTR_XS))
- o << "IC_VEX_L_W_XS";
- else if ((index & ATTR_VEXL) && (index & ATTR_REXW))
- o << "IC_VEX_L_W";
- else if ((index & ATTR_VEXL) && (index & ATTR_OPSIZE))
- o << "IC_VEX_L_OPSIZE";
- else if ((index & ATTR_VEXL) && (index & ATTR_XD))
- o << "IC_VEX_L_XD";
- else if ((index & ATTR_VEXL) && (index & ATTR_XS))
- o << "IC_VEX_L_XS";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_OPSIZE))
- o << "IC_VEX_W_OPSIZE";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_XD))
- o << "IC_VEX_W_XD";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW) && (index & ATTR_XS))
- o << "IC_VEX_W_XS";
- else if (index & ATTR_VEXL)
- o << "IC_VEX_L";
- else if ((index & ATTR_VEX) && (index & ATTR_REXW))
- o << "IC_VEX_W";
- else if ((index & ATTR_VEX) && (index & ATTR_OPSIZE))
- o << "IC_VEX_OPSIZE";
- else if ((index & ATTR_VEX) && (index & ATTR_XD))
- o << "IC_VEX_XD";
- else if ((index & ATTR_VEX) && (index & ATTR_XS))
- o << "IC_VEX_XS";
- else if (index & ATTR_VEX)
- o << "IC_VEX";
else if ((index & ATTR_64BIT) && (index & ATTR_REXW) && (index & ATTR_XS))
o << "IC_64BIT_REXW_XS";
else if ((index & ATTR_64BIT) && (index & ATTR_REXW) && (index & ATTR_XD))
@@ -1004,12 +980,7 @@
else
o << "IC";
- if (index < tableSize - 1)
- o << ",";
- else
- o << " ";
-
- o << " /* " << index << " */";
+ o << ", /* " << index << " */";
o << "\n";
}
diff --git a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.h b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.h
index b0ea9c2..63af68b 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.h
+++ b/src/llvm-project/llvm/utils/TableGen/X86DisassemblerTables.h
@@ -1,9 +1,8 @@
//===- X86DisassemblerTables.h - Disassembler tables ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
index d5dc10e..3df14f4 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
@@ -1,9 +1,8 @@
//===- utils/TableGen/X86EVEX2VEXTablesEmitter.cpp - X86 backend-*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
@@ -69,23 +68,6 @@
}
// Return true if the 2 BitsInits are equal
-static inline bool equalBitsInits(const BitsInit *B1, const BitsInit *B2) {
- if (B1->getNumBits() != B2->getNumBits())
- PrintFatalError("Comparing two BitsInits with different sizes!");
-
- for (unsigned i = 0, e = B1->getNumBits(); i != e; ++i) {
- if (BitInit *Bit1 = dyn_cast<BitInit>(B1->getBit(i))) {
- if (BitInit *Bit2 = dyn_cast<BitInit>(B2->getBit(i))) {
- if (Bit1->getValue() != Bit2->getValue())
- return false;
- } else
- PrintFatalError("Invalid BitsInit bit");
- } else
- PrintFatalError("Invalid BitsInit bit");
- }
- return true;
-}
-
// Calculates the integer value residing BitsInit object
static inline uint64_t getValueFromBitsInit(const BitsInit *B) {
uint64_t Value = 0;
@@ -109,26 +91,25 @@
bool operator()(const CodeGenInstruction *VEXInst) {
Record *RecE = EVEXInst->TheDef;
Record *RecV = VEXInst->TheDef;
- uint64_t EVEX_W =
- getValueFromBitsInit(RecE->getValueAsBitsInit("VEX_WPrefix"));
- uint64_t VEX_W =
- getValueFromBitsInit(RecV->getValueAsBitsInit("VEX_WPrefix"));
+ bool EVEX_W = RecE->getValueAsBit("HasVEX_W");
+ bool VEX_W = RecV->getValueAsBit("HasVEX_W");
+ bool VEX_WIG = RecV->getValueAsBit("IgnoresVEX_W");
+ bool EVEX_WIG = RecE->getValueAsBit("IgnoresVEX_W");
+ bool EVEX_W1_VEX_W0 = RecE->getValueAsBit("EVEX_W1_VEX_W0");
if (RecV->getValueAsDef("OpEnc")->getName().str() != "EncVEX" ||
// VEX/EVEX fields
RecV->getValueAsDef("OpPrefix") != RecE->getValueAsDef("OpPrefix") ||
RecV->getValueAsDef("OpMap") != RecE->getValueAsDef("OpMap") ||
RecV->getValueAsBit("hasVEX_4V") != RecE->getValueAsBit("hasVEX_4V") ||
- !equalBitsInits(RecV->getValueAsBitsInit("EVEX_LL"),
- RecE->getValueAsBitsInit("EVEX_LL")) ||
+ RecV->getValueAsBit("hasEVEX_L2") != RecE->getValueAsBit("hasEVEX_L2") ||
+ RecV->getValueAsBit("hasVEX_L") != RecE->getValueAsBit("hasVEX_L") ||
// Match is allowed if either is VEX_WIG, or they match, or EVEX
// is VEX_W1X and VEX is VEX_W0.
- (!(EVEX_W == 2 || VEX_W == 2 || EVEX_W == VEX_W ||
- (EVEX_W == 3 && VEX_W == 0))) ||
+ (!(VEX_WIG || (!EVEX_WIG && EVEX_W == VEX_W) ||
+ (EVEX_W1_VEX_W0 && EVEX_W && !VEX_W))) ||
// Instruction's format
- RecV->getValueAsDef("Form") != RecE->getValueAsDef("Form") ||
- RecV->getValueAsBit("isAsmParserOnly") !=
- RecE->getValueAsBit("isAsmParserOnly"))
+ RecV->getValueAsDef("Form") != RecE->getValueAsDef("Form"))
return false;
// This is needed for instructions with intrinsic version (_Int).
@@ -150,8 +131,9 @@
} else if (isMemoryOperand(OpRec1) && isMemoryOperand(OpRec2)) {
return false;
} else if (isImmediateOperand(OpRec1) && isImmediateOperand(OpRec2)) {
- if (OpRec1->getValueAsDef("Type") != OpRec2->getValueAsDef("Type"))
+ if (OpRec1->getValueAsDef("Type") != OpRec2->getValueAsDef("Type")) {
return false;
+ }
} else
return false;
}
@@ -207,8 +189,7 @@
else if (Inst->TheDef->getValueAsDef("OpEnc")->getName() == "EncEVEX" &&
!Inst->TheDef->getValueAsBit("hasEVEX_K") &&
!Inst->TheDef->getValueAsBit("hasEVEX_B") &&
- getValueFromBitsInit(Inst->TheDef->
- getValueAsBitsInit("EVEX_LL")) != 2 &&
+ !Inst->TheDef->getValueAsBit("hasEVEX_L2") &&
!Inst->TheDef->getValueAsBit("notEVEX2VEXConvertible"))
EVEXInsts.push_back(Inst);
}
@@ -236,17 +217,10 @@
continue;
// In case a match is found add new entry to the appropriate table
- switch (getValueFromBitsInit(
- EVEXInst->TheDef->getValueAsBitsInit("EVEX_LL"))) {
- case 0:
- EVEX2VEX128.push_back(std::make_pair(EVEXInst, VEXInst)); // {0,0}
- break;
- case 1:
+ if (EVEXInst->TheDef->getValueAsBit("hasVEX_L"))
EVEX2VEX256.push_back(std::make_pair(EVEXInst, VEXInst)); // {0,1}
- break;
- default:
- llvm_unreachable("Instruction's size not fit for the mapping!");
- }
+ else
+ EVEX2VEX128.push_back(std::make_pair(EVEXInst, VEXInst)); // {0,0}
}
// Print both tables
diff --git a/src/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp b/src/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
index 1ea6686..2c15e35 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
@@ -1,9 +1,8 @@
//===- utils/TableGen/X86FoldTablesEmitter.cpp - X86 backend-*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -14,6 +13,7 @@
#include "CodeGenTarget.h"
#include "X86RecognizableInstr.h"
+#include "llvm/Support/FormattedStream.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/TableGenBackend.h"
@@ -62,9 +62,12 @@
{ "ADD64ri32_DB", "ADD64mi32", NO_UNFOLD },
{ "ADD64ri8_DB", "ADD64mi8", NO_UNFOLD },
{ "ADD64rr_DB", "ADD64mr", NO_UNFOLD },
+ { "ADD8ri_DB", "ADD8mi", NO_UNFOLD },
+ { "ADD8rr_DB", "ADD8mr", NO_UNFOLD },
{ "ADD16rr_DB", "ADD16rm", NO_UNFOLD },
{ "ADD32rr_DB", "ADD32rm", NO_UNFOLD },
{ "ADD64rr_DB", "ADD64rm", NO_UNFOLD },
+ { "ADD8rr_DB", "ADD8rm", NO_UNFOLD },
{ "PUSH16r", "PUSH16rmm", UNFOLD },
{ "PUSH32r", "PUSH32rmm", UNFOLD },
{ "PUSH64r", "PUSH64rmm", UNFOLD },
@@ -106,23 +109,23 @@
const CodeGenInstruction *MemInst)
: RegInst(RegInst), MemInst(MemInst) {}
- friend raw_ostream &operator<<(raw_ostream &OS,
- const X86FoldTableEntry &E) {
- OS << "{ X86::" << E.RegInst->TheDef->getName()
- << ", X86::" << E.MemInst->TheDef->getName() << ", ";
+ void print(formatted_raw_ostream &OS) const {
+ OS.indent(2);
+ OS << "{ X86::" << RegInst->TheDef->getName() << ",";
+ OS.PadToColumn(40);
+ OS << "X86::" << MemInst->TheDef->getName() << ",";
+ OS.PadToColumn(75);
- if (E.IsLoad)
+ if (IsLoad)
OS << "TB_FOLDED_LOAD | ";
- if (E.IsStore)
+ if (IsStore)
OS << "TB_FOLDED_STORE | ";
- if (E.CannotUnfold)
+ if (CannotUnfold)
OS << "TB_NO_REVERSE | ";
- if (E.IsAligned)
- OS << "TB_ALIGN_" << E.Alignment << " | ";
+ if (IsAligned)
+ OS << "TB_ALIGN_" << Alignment << " | ";
OS << "0 },\n";
-
- return OS;
}
};
@@ -142,7 +145,7 @@
X86FoldTablesEmitter(RecordKeeper &R) : Records(R), Target(R) {}
// run - Generate the 6 X86 memory fold tables.
- void run(raw_ostream &OS);
+ void run(formatted_raw_ostream &OS);
private:
// Decides to which table to add the entry with the given instructions.
@@ -160,21 +163,21 @@
// Print the given table as a static const C++ array of type
// X86MemoryFoldTableEntry.
void printTable(const FoldTable &Table, StringRef TableName,
- raw_ostream &OS) {
+ formatted_raw_ostream &OS) {
OS << "static const X86MemoryFoldTableEntry MemoryFold" << TableName
<< "[] = {\n";
for (const X86FoldTableEntry &E : Table)
- OS << E;
+ E.print(OS);
- OS << "};\n";
+ OS << "};\n\n";
}
};
// Return true if one of the instruction's operands is a RST register class
static bool hasRSTRegClass(const CodeGenInstruction *Inst) {
return any_of(Inst->Operands, [](const CGIOperandList::OperandInfo &OpIn) {
- return OpIn.Rec->getName() == "RST";
+ return OpIn.Rec->getName() == "RST" || OpIn.Rec->getName() == "RSTi";
});
}
@@ -345,10 +348,18 @@
MemRec->getValueAsBit("hasLockPrefix") ||
RegRec->getValueAsBit("hasNoTrackPrefix") !=
MemRec->getValueAsBit("hasNoTrackPrefix") ||
- !equalBitsInits(RegRec->getValueAsBitsInit("EVEX_LL"),
- MemRec->getValueAsBitsInit("EVEX_LL")) ||
- !equalBitsInits(RegRec->getValueAsBitsInit("VEX_WPrefix"),
- MemRec->getValueAsBitsInit("VEX_WPrefix")) ||
+ RegRec->getValueAsBit("hasVEX_L") !=
+ MemRec->getValueAsBit("hasVEX_L") ||
+ RegRec->getValueAsBit("hasEVEX_L2") !=
+ MemRec->getValueAsBit("hasEVEX_L2") ||
+ RegRec->getValueAsBit("ignoresVEX_L") !=
+ MemRec->getValueAsBit("ignoresVEX_L") ||
+ RegRec->getValueAsBit("HasVEX_W") !=
+ MemRec->getValueAsBit("HasVEX_W") ||
+ RegRec->getValueAsBit("IgnoresVEX_W") !=
+ MemRec->getValueAsBit("IgnoresVEX_W") ||
+ RegRec->getValueAsBit("EVEX_W1_VEX_W0") !=
+ MemRec->getValueAsBit("EVEX_W1_VEX_W0") ||
// Instruction's format - The register form's "Form" field should be
// the opposite of the memory form's "Form" field.
!areOppositeForms(RegRec->getValueAsBitsInit("FormBits"),
@@ -421,6 +432,7 @@
(MemFormNum == X86Local::MRM6m && RegFormNum == X86Local::MRM6r) ||
(MemFormNum == X86Local::MRM7m && RegFormNum == X86Local::MRM7r) ||
(MemFormNum == X86Local::MRMXm && RegFormNum == X86Local::MRMXr) ||
+ (MemFormNum == X86Local::MRMXmCC && RegFormNum == X86Local::MRMXrCC) ||
(MemFormNum == X86Local::MRMDestMem &&
RegFormNum == X86Local::MRMDestReg) ||
(MemFormNum == X86Local::MRMSrcMem &&
@@ -428,7 +440,9 @@
(MemFormNum == X86Local::MRMSrcMem4VOp3 &&
RegFormNum == X86Local::MRMSrcReg4VOp3) ||
(MemFormNum == X86Local::MRMSrcMemOp4 &&
- RegFormNum == X86Local::MRMSrcRegOp4))
+ RegFormNum == X86Local::MRMSrcRegOp4) ||
+ (MemFormNum == X86Local::MRMSrcMemCC &&
+ RegFormNum == X86Local::MRMSrcRegCC))
return true;
return false;
@@ -558,7 +572,7 @@
return;
}
-void X86FoldTablesEmitter::run(raw_ostream &OS) {
+void X86FoldTablesEmitter::run(formatted_raw_ostream &OS) {
emitSourceFileHeader("X86 fold tables", OS);
// Holds all memory instructions
@@ -639,7 +653,7 @@
&(Target.getInstruction(MemInstIter)), Entry.Strategy);
}
- // Print all tables to raw_ostream OS.
+ // Print all tables.
printTable(Table2Addr, "Table2Addr", OS);
printTable(Table0, "Table0", OS);
printTable(Table1, "Table1", OS);
@@ -650,7 +664,8 @@
namespace llvm {
-void EmitX86FoldTables(RecordKeeper &RK, raw_ostream &OS) {
+void EmitX86FoldTables(RecordKeeper &RK, raw_ostream &o) {
+ formatted_raw_ostream OS(o);
X86FoldTablesEmitter(RK).run(OS);
}
} // namespace llvm
diff --git a/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.cpp b/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.cpp
index 1641613..98e6fb6 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.cpp
@@ -1,9 +1,8 @@
//===- X86ModRMFilters.cpp - Disassembler ModR/M filterss -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.h b/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.h
index b0248e8..c77b4c2 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.h
+++ b/src/llvm-project/llvm/utils/TableGen/X86ModRMFilters.h
@@ -1,9 +1,8 @@
//===- X86ModRMFilters.h - Disassembler ModR/M filterss ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.cpp b/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.cpp
index 463609e..ab8a885 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.cpp
+++ b/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.cpp
@@ -1,9 +1,8 @@
//===- X86RecognizableInstr.cpp - Disassembler instruction spec --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -84,7 +83,8 @@
AdSize = byteFromRec(Rec, "AdSizeBits");
HasREX_WPrefix = Rec->getValueAsBit("hasREX_WPrefix");
HasVEX_4V = Rec->getValueAsBit("hasVEX_4V");
- VEX_WPrefix = byteFromRec(Rec,"VEX_WPrefix");
+ HasVEX_W = Rec->getValueAsBit("HasVEX_W");
+ IgnoresVEX_W = Rec->getValueAsBit("IgnoresVEX_W");
IgnoresVEX_L = Rec->getValueAsBit("ignoresVEX_L");
HasEVEX_L2Prefix = Rec->getValueAsBit("hasEVEX_L2");
HasEVEX_K = Rec->getValueAsBit("hasEVEX_K");
@@ -110,7 +110,7 @@
std::vector<Record*> Predicates = Rec->getValueAsListOfDefs("Predicates");
for (unsigned i = 0, e = Predicates.size(); i != e; ++i) {
if (Predicates[i]->getName().find("Not64Bit") != Name.npos ||
- Predicates[i]->getName().find("In32Bit") != Name.npos) {
+ Predicates[i]->getName().find("In32Bit") != Name.npos) {
Is32Bit = true;
break;
}
@@ -164,8 +164,7 @@
llvm_unreachable("Don't support VEX.L if EVEX_L2 is enabled");
}
// VEX_L & VEX_W
- if (!EncodeRC && HasVEX_LPrefix && (VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X)) {
+ if (!EncodeRC && HasVEX_LPrefix && HasVEX_W) {
if (OpPrefix == X86Local::PD)
insnContext = EVEX_KB(IC_EVEX_L_W_OPSIZE);
else if (OpPrefix == X86Local::XS)
@@ -192,9 +191,7 @@
errs() << "Instruction does not use a prefix: " << Name << "\n";
llvm_unreachable("Invalid prefix");
}
- } else if (!EncodeRC && HasEVEX_L2Prefix &&
- (VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X)) {
+ } else if (!EncodeRC && HasEVEX_L2Prefix && HasVEX_W) {
// EVEX_L2 & VEX_W
if (OpPrefix == X86Local::PD)
insnContext = EVEX_KB(IC_EVEX_L2_W_OPSIZE);
@@ -223,8 +220,7 @@
llvm_unreachable("Invalid prefix");
}
}
- else if (VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X) {
+ else if (HasVEX_W) {
// VEX_W
if (OpPrefix == X86Local::PD)
insnContext = EVEX_KB(IC_EVEX_W_OPSIZE);
@@ -254,8 +250,7 @@
}
/// eof EVEX
} else if (Encoding == X86Local::VEX || Encoding == X86Local::XOP) {
- if (HasVEX_LPrefix && (VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X)) {
+ if (HasVEX_LPrefix && HasVEX_W) {
if (OpPrefix == X86Local::PD)
insnContext = IC_VEX_L_W_OPSIZE;
else if (OpPrefix == X86Local::XS)
@@ -270,8 +265,7 @@
}
} else if (OpPrefix == X86Local::PD && HasVEX_LPrefix)
insnContext = IC_VEX_L_OPSIZE;
- else if (OpPrefix == X86Local::PD && (VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X))
+ else if (OpPrefix == X86Local::PD && HasVEX_W)
insnContext = IC_VEX_W_OPSIZE;
else if (OpPrefix == X86Local::PD)
insnContext = IC_VEX_OPSIZE;
@@ -279,14 +273,11 @@
insnContext = IC_VEX_L_XS;
else if (HasVEX_LPrefix && OpPrefix == X86Local::XD)
insnContext = IC_VEX_L_XD;
- else if ((VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X) && OpPrefix == X86Local::XS)
+ else if (HasVEX_W && OpPrefix == X86Local::XS)
insnContext = IC_VEX_W_XS;
- else if ((VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X) && OpPrefix == X86Local::XD)
+ else if (HasVEX_W && OpPrefix == X86Local::XD)
insnContext = IC_VEX_W_XD;
- else if ((VEX_WPrefix == X86Local::VEX_W1 ||
- VEX_WPrefix == X86Local::VEX_W1X) && OpPrefix == X86Local::PS)
+ else if (HasVEX_W && OpPrefix == X86Local::PS)
insnContext = IC_VEX_W;
else if (HasVEX_LPrefix && OpPrefix == X86Local::PS)
insnContext = IC_VEX_L;
@@ -496,6 +487,13 @@
HANDLE_OPERAND(opcodeModifier)
HANDLE_OPTIONAL(relocation)
break;
+ case X86Local::AddCCFrm:
+ // Operand 1 (optional) is an address or immediate.
+ assert(numPhysicalOperands == 2 &&
+ "Unexpected number of operands for AddCCFrm");
+ HANDLE_OPERAND(relocation)
+ HANDLE_OPERAND(opcodeModifier)
+ break;
case X86Local::MRMDestReg:
// Operand 1 is a register operand in the R/M field.
// - In AVX512 there may be a mask operand here -
@@ -581,6 +579,13 @@
HANDLE_OPERAND(rmRegister)
HANDLE_OPTIONAL(immediate)
break;
+ case X86Local::MRMSrcRegCC:
+ assert(numPhysicalOperands == 3 &&
+ "Unexpected number of operands for MRMSrcRegCC");
+ HANDLE_OPERAND(roRegister)
+ HANDLE_OPERAND(rmRegister)
+ HANDLE_OPERAND(opcodeModifier)
+ break;
case X86Local::MRMSrcMem:
// Operand 1 is a register operand in the Reg/Opcode field.
// Operand 2 is a memory operand (possibly SIB-extended)
@@ -621,6 +626,19 @@
HANDLE_OPERAND(memory)
HANDLE_OPTIONAL(immediate)
break;
+ case X86Local::MRMSrcMemCC:
+ assert(numPhysicalOperands == 3 &&
+ "Unexpected number of operands for MRMSrcMemCC");
+ HANDLE_OPERAND(roRegister)
+ HANDLE_OPERAND(memory)
+ HANDLE_OPERAND(opcodeModifier)
+ break;
+ case X86Local::MRMXrCC:
+ assert(numPhysicalOperands == 2 &&
+ "Unexpected number of operands for MRMXrCC");
+ HANDLE_OPERAND(rmRegister)
+ HANDLE_OPERAND(opcodeModifier)
+ break;
case X86Local::MRMXr:
case X86Local::MRM0r:
case X86Local::MRM1r:
@@ -646,6 +664,12 @@
HANDLE_OPTIONAL(relocation)
HANDLE_OPTIONAL(immediate)
break;
+ case X86Local::MRMXmCC:
+ assert(numPhysicalOperands == 2 &&
+ "Unexpected number of operands for MRMXm");
+ HANDLE_OPERAND(memory)
+ HANDLE_OPERAND(opcodeModifier)
+ break;
case X86Local::MRMXm:
case X86Local::MRM0m:
case X86Local::MRM1m:
@@ -724,12 +748,15 @@
case X86Local::RawFrmDstSrc:
case X86Local::RawFrmImm8:
case X86Local::RawFrmImm16:
+ case X86Local::AddCCFrm:
filter = llvm::make_unique<DumbFilter>();
break;
case X86Local::MRMDestReg:
case X86Local::MRMSrcReg:
case X86Local::MRMSrcReg4VOp3:
case X86Local::MRMSrcRegOp4:
+ case X86Local::MRMSrcRegCC:
+ case X86Local::MRMXrCC:
case X86Local::MRMXr:
filter = llvm::make_unique<ModFilter>(true);
break;
@@ -737,6 +764,8 @@
case X86Local::MRMSrcMem:
case X86Local::MRMSrcMem4VOp3:
case X86Local::MRMSrcMemOp4:
+ case X86Local::MRMSrcMemCC:
+ case X86Local::MRMXmCC:
case X86Local::MRMXm:
filter = llvm::make_unique<ModFilter>(false);
break;
@@ -769,23 +798,24 @@
assert(opcodeType && "Opcode type not set");
assert(filter && "Filter not set");
- if (Form == X86Local::AddRegFrm) {
- assert(((opcodeToSet & 7) == 0) &&
- "ADDREG_FRM opcode not aligned");
+ if (Form == X86Local::AddRegFrm || Form == X86Local::MRMSrcRegCC ||
+ Form == X86Local::MRMSrcMemCC || Form == X86Local::MRMXrCC ||
+ Form == X86Local::MRMXmCC || Form == X86Local::AddCCFrm) {
+ unsigned Count = Form == X86Local::AddRegFrm ? 8 : 16;
+ assert(((opcodeToSet % Count) == 0) && "ADDREG_FRM opcode not aligned");
uint8_t currentOpcode;
- for (currentOpcode = opcodeToSet;
- currentOpcode < opcodeToSet + 8;
+ for (currentOpcode = opcodeToSet; currentOpcode < opcodeToSet + Count;
++currentOpcode)
tables.setTableFields(*opcodeType, insnContext(), currentOpcode, *filter,
UID, Is32Bit, OpPrefix == 0,
IgnoresVEX_L || EncodeRC,
- VEX_WPrefix == X86Local::VEX_WIG, AddressSize);
+ IgnoresVEX_W, AddressSize);
} else {
tables.setTableFields(*opcodeType, insnContext(), opcodeToSet, *filter, UID,
Is32Bit, OpPrefix == 0, IgnoresVEX_L || EncodeRC,
- VEX_WPrefix == X86Local::VEX_WIG, AddressSize);
+ IgnoresVEX_W, AddressSize);
}
#undef MAP
@@ -825,7 +855,9 @@
TYPE("i8mem", TYPE_M)
TYPE("i8imm", TYPE_IMM)
TYPE("u8imm", TYPE_UIMM8)
+ TYPE("i16u8imm", TYPE_UIMM8)
TYPE("i32u8imm", TYPE_UIMM8)
+ TYPE("i64u8imm", TYPE_UIMM8)
TYPE("GR8", TYPE_R8)
TYPE("VR128", TYPE_XMM)
TYPE("VR128X", TYPE_XMM)
@@ -849,10 +881,7 @@
TYPE("i64i32imm_pcrel", TYPE_REL)
TYPE("i16imm_pcrel", TYPE_REL)
TYPE("i32imm_pcrel", TYPE_REL)
- TYPE("SSECC", TYPE_IMM3)
- TYPE("XOPCC", TYPE_IMM3)
- TYPE("AVXCC", TYPE_IMM5)
- TYPE("AVX512ICC", TYPE_AVX512ICC)
+ TYPE("ccode", TYPE_IMM)
TYPE("AVX512RC", TYPE_IMM)
TYPE("brtarget32", TYPE_REL)
TYPE("brtarget16", TYPE_REL)
@@ -903,6 +932,11 @@
TYPE("VK32WM", TYPE_VK)
TYPE("VK64", TYPE_VK)
TYPE("VK64WM", TYPE_VK)
+ TYPE("VK1Pair", TYPE_VK_PAIR)
+ TYPE("VK2Pair", TYPE_VK_PAIR)
+ TYPE("VK4Pair", TYPE_VK_PAIR)
+ TYPE("VK8Pair", TYPE_VK_PAIR)
+ TYPE("VK16Pair", TYPE_VK_PAIR)
TYPE("vx64mem", TYPE_MVSIBX)
TYPE("vx128mem", TYPE_MVSIBX)
TYPE("vx256mem", TYPE_MVSIBX)
@@ -932,10 +966,6 @@
ENCODING("i16imm", ENCODING_IW)
}
ENCODING("i32i8imm", ENCODING_IB)
- ENCODING("SSECC", ENCODING_IB)
- ENCODING("XOPCC", ENCODING_IB)
- ENCODING("AVXCC", ENCODING_IB)
- ENCODING("AVX512ICC", ENCODING_IB)
ENCODING("AVX512RC", ENCODING_IRC)
ENCODING("i16imm", ENCODING_Iv)
ENCODING("i16i8imm", ENCODING_IB)
@@ -944,7 +974,9 @@
ENCODING("i64i8imm", ENCODING_IB)
ENCODING("i8imm", ENCODING_IB)
ENCODING("u8imm", ENCODING_IB)
+ ENCODING("i16u8imm", ENCODING_IB)
ENCODING("i32u8imm", ENCODING_IB)
+ ENCODING("i64u8imm", ENCODING_IB)
// This is not a typo. Instructions like BLENDVPD put
// register IDs in 8-bit immediates nowadays.
ENCODING("FR32", ENCODING_IB)
@@ -989,6 +1021,11 @@
ENCODING("VK16", ENCODING_RM)
ENCODING("VK32", ENCODING_RM)
ENCODING("VK64", ENCODING_RM)
+ ENCODING("VK1PAIR", ENCODING_RM)
+ ENCODING("VK2PAIR", ENCODING_RM)
+ ENCODING("VK4PAIR", ENCODING_RM)
+ ENCODING("VK8PAIR", ENCODING_RM)
+ ENCODING("VK16PAIR", ENCODING_RM)
ENCODING("BNDR", ENCODING_RM)
errs() << "Unhandled R/M register encoding " << s << "\n";
llvm_unreachable("Unhandled R/M register encoding");
@@ -1023,6 +1060,11 @@
ENCODING("VK16", ENCODING_REG)
ENCODING("VK32", ENCODING_REG)
ENCODING("VK64", ENCODING_REG)
+ ENCODING("VK1Pair", ENCODING_REG)
+ ENCODING("VK2Pair", ENCODING_REG)
+ ENCODING("VK4Pair", ENCODING_REG)
+ ENCODING("VK8Pair", ENCODING_REG)
+ ENCODING("VK16Pair", ENCODING_REG)
ENCODING("VK1WM", ENCODING_REG)
ENCODING("VK2WM", ENCODING_REG)
ENCODING("VK4WM", ENCODING_REG)
@@ -1057,6 +1099,11 @@
ENCODING("VK16", ENCODING_VVVV)
ENCODING("VK32", ENCODING_VVVV)
ENCODING("VK64", ENCODING_VVVV)
+ ENCODING("VK1PAIR", ENCODING_VVVV)
+ ENCODING("VK2PAIR", ENCODING_VVVV)
+ ENCODING("VK4PAIR", ENCODING_VVVV)
+ ENCODING("VK8PAIR", ENCODING_VVVV)
+ ENCODING("VK16PAIR", ENCODING_VVVV)
errs() << "Unhandled VEX.vvvv register encoding " << s << "\n";
llvm_unreachable("Unhandled VEX.vvvv register encoding");
}
@@ -1130,7 +1177,9 @@
ENCODING("i64i8imm", ENCODING_IB)
ENCODING("i8imm", ENCODING_IB)
ENCODING("u8imm", ENCODING_IB)
+ ENCODING("i16u8imm", ENCODING_IB)
ENCODING("i32u8imm", ENCODING_IB)
+ ENCODING("i64u8imm", ENCODING_IB)
ENCODING("i64i32imm_pcrel", ENCODING_ID)
ENCODING("i16imm_pcrel", ENCODING_IW)
ENCODING("i32imm_pcrel", ENCODING_ID)
@@ -1168,6 +1217,7 @@
ENCODING("GR64", ENCODING_RO)
ENCODING("GR16", ENCODING_Rv)
ENCODING("GR8", ENCODING_RB)
+ ENCODING("ccode", ENCODING_CC)
errs() << "Unhandled opcode modifier encoding " << s << "\n";
llvm_unreachable("Unhandled opcode modifier encoding");
}
diff --git a/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.h b/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.h
index c4d34ee..b15bef4 100644
--- a/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.h
+++ b/src/llvm-project/llvm/utils/TableGen/X86RecognizableInstr.h
@@ -1,9 +1,8 @@
//===- X86RecognizableInstr.h - Disassembler instruction spec ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -102,18 +101,21 @@
RawFrmDstSrc = 6,
RawFrmImm8 = 7,
RawFrmImm16 = 8,
+ AddCCFrm = 9,
MRMDestMem = 32,
MRMSrcMem = 33,
MRMSrcMem4VOp3 = 34,
MRMSrcMemOp4 = 35,
- MRMXm = 39,
+ MRMSrcMemCC = 36,
+ MRMXmCC = 38, MRMXm = 39,
MRM0m = 40, MRM1m = 41, MRM2m = 42, MRM3m = 43,
MRM4m = 44, MRM5m = 45, MRM6m = 46, MRM7m = 47,
MRMDestReg = 48,
MRMSrcReg = 49,
MRMSrcReg4VOp3 = 50,
MRMSrcRegOp4 = 51,
- MRMXr = 55,
+ MRMSrcRegCC = 52,
+ MRMXrCC = 54, MRMXr = 55,
MRM0r = 56, MRM1r = 57, MRM2r = 58, MRM3r = 59,
MRM4r = 60, MRM5r = 61, MRM6r = 62, MRM7r = 63,
#define MAP(from, to) MRM_##from = to,
@@ -140,10 +142,6 @@
enum {
AdSize16 = 1, AdSize32 = 2, AdSize64 = 3
};
-
- enum {
- VEX_W0 = 0, VEX_W1 = 1, VEX_WIG = 2, VEX_W1X = 3
- };
}
namespace X86Disassembler {
@@ -177,8 +175,10 @@
bool HasREX_WPrefix;
/// The hasVEX_4V field from the record
bool HasVEX_4V;
- /// The VEX_WPrefix field from the record
- uint8_t VEX_WPrefix;
+ /// The HasVEX_WPrefix field from the record
+ bool HasVEX_W;
+ /// The IgnoresVEX_W field from the record
+ bool IgnoresVEX_W;
/// Inferred from the operands; indicates whether the L bit in the VEX prefix is set
bool HasVEX_LPrefix;
/// The ignoreVEX_L field from the record
diff --git a/src/llvm-project/llvm/utils/TableGen/tdtags b/src/llvm-project/llvm/utils/TableGen/tdtags
index 5214485..a3fb080 100644
--- a/src/llvm-project/llvm/utils/TableGen/tdtags
+++ b/src/llvm-project/llvm/utils/TableGen/tdtags
@@ -3,10 +3,9 @@
# vim:set sts=2 sw=2 et:
#===----------------------------------------------------------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/UpdateTestChecks/asm.py b/src/llvm-project/llvm/utils/UpdateTestChecks/asm.py
index 923efd5..9c250cd 100644
--- a/src/llvm-project/llvm/utils/UpdateTestChecks/asm.py
+++ b/src/llvm-project/llvm/utils/UpdateTestChecks/asm.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import re
import sys
@@ -14,7 +15,7 @@
##### Assembly parser
ASM_FUNCTION_X86_RE = re.compile(
- r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*.Lfunc_begin[^:\n]*:\n)?[^:]*?'
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|#+ -- End function)',
flags=(re.M | re.S))
@@ -28,7 +29,7 @@
ASM_FUNCTION_AARCH64_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*\/\/[ \t]*@(?P=func)\n'
- r'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
+ r'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
r'(?P<body>.*?)\n'
# This list is incomplete
r'.Lfunc_end[0-9]+:\n',
@@ -38,6 +39,13 @@
r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
r'(?P<body>.*?)\n' # (body of the function)
# This list is incomplete
+ r'^\s*(\.Lfunc_end[0-9]+:\n|\.section)',
+ flags=(re.M | re.S))
+
+ASM_FUNCTION_HEXAGON_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*//[ \t]*@(?P=func)\n[^:]*?'
+ r'(?P<body>.*?)\n' # (body of the function)
+ # This list is incomplete
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
@@ -63,11 +71,18 @@
flags=(re.M | re.S))
ASM_FUNCTION_RISCV_RE = re.compile(
- r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?'
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_LANAI_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@(?P=func)\n'
+ r'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
+ r'(?P<body>.*?)\s*'
+ r'.Lfunc_end[0-9]+:\n',
+ flags=(re.M | re.S))
+
ASM_FUNCTION_SPARC_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@(?P=func)\n'
r'(?P<body>.*?)\s*'
@@ -81,6 +96,43 @@
r'.Lfunc_end[0-9]+:\n',
flags=(re.M | re.S))
+ASM_FUNCTION_AARCH64_DARWIN_RE = re.compile(
+ r'^_(?P<func>[^:]+):[ \t]*;[ \t]@(?P=func)\n'
+ r'([ \t]*.cfi_startproc\n[\s]*)?'
+ r'(?P<body>.*?)'
+ r'([ \t]*.cfi_endproc\n[\s]*)?'
+ r'^[ \t]*;[ \t]--[ \t]End[ \t]function',
+ flags=(re.M | re.S))
+
+ASM_FUNCTION_ARM_DARWIN_RE = re.compile(
+ r'^[ \t]*\.globl[ \t]*_(?P<func>[^ \t])[ \t]*@[ \t]--[ \t]Begin[ \t]function[ \t](?P=func)'
+ r'(?P<directives>.*?)'
+ r'^_(?P=func):\n[ \t]*'
+ r'(?P<body>.*?)'
+ r'^[ \t]*@[ \t]--[ \t]End[ \t]function',
+ flags=(re.M | re.S ))
+
+ASM_FUNCTION_ARM_MACHO_RE = re.compile(
+ r'^_(?P<func>[^:]+):[ \t]*\n'
+ r'([ \t]*.cfi_startproc\n[ \t]*)?'
+ r'(?P<body>.*?)\n'
+ r'[ \t]*\.cfi_endproc\n',
+ flags=(re.M | re.S))
+
+ASM_FUNCTION_ARM_IOS_RE = re.compile(
+ r'^_(?P<func>[^:]+):[ \t]*\n'
+ r'^Lfunc_begin(?P<id>[0-9][1-9]*):\n'
+ r'(?P<body>.*?)'
+ r'^Lfunc_end(?P=id):\n'
+ r'^[ \t]*@[ \t]--[ \t]End[ \t]function',
+ flags=(re.M | re.S))
+
+ASM_FUNCTION_WASM32_RE = re.compile(
+ r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+ r'(?P<body>.*?)\n'
+ r'.Lfunc_end[0-9]+:\n',
+ flags=(re.M | re.S))
+
SCRUB_LOOP_COMMENT_RE = re.compile(
r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M)
@@ -147,14 +199,24 @@
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
-def scrub_asm_powerpc64(asm, args):
+def scrub_asm_hexagon(asm, args):
# Scrub runs of whitespace out of the assembly, but leave the leading
# whitespace in place.
asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
# Expand the tabs used for indentation.
asm = string.expandtabs(asm, 2)
- # Stripe unimportant comments
- asm = SCRUB_LOOP_COMMENT_RE.sub(r'', asm)
+ # Strip trailing whitespace.
+ asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+ return asm
+
+def scrub_asm_powerpc(asm, args):
+ # Scrub runs of whitespace out of the assembly, but leave the leading
+ # whitespace in place.
+ asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+ # Expand the tabs used for indentation.
+ asm = string.expandtabs(asm, 2)
+ # Stripe unimportant comments, but leave the token '#' in place.
+ asm = SCRUB_LOOP_COMMENT_RE.sub(r'#', asm)
# Strip trailing whitespace.
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
@@ -179,6 +241,16 @@
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_lanai(asm, args):
+ # Scrub runs of whitespace out of the assembly, but leave the leading
+ # whitespace in place.
+ asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+ # Expand the tabs used for indentation.
+ asm = string.expandtabs(asm, 2)
+ # Strip trailing whitespace.
+ asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+ return asm
+
def scrub_asm_sparc(asm, args):
# Scrub runs of whitespace out of the assembly, but leave the leading
# whitespace in place.
@@ -199,55 +271,70 @@
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
+def scrub_asm_wasm32(asm, args):
+ # Scrub runs of whitespace out of the assembly, but leave the leading
+ # whitespace in place.
+ asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
+ # Expand the tabs used for indentation.
+ asm = string.expandtabs(asm, 2)
+ # Strip trailing whitespace.
+ asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
+ return asm
+
+def get_triple_from_march(march):
+ triples = {
+ 'amdgcn': 'amdgcn',
+ 'r600': 'r600',
+ 'mips': 'mips',
+ 'sparc': 'sparc',
+ 'hexagon': 'hexagon',
+ }
+ for prefix, triple in triples.items():
+ if march.startswith(prefix):
+ return triple
+ print("Cannot find a triple. Assume 'x86'", file=sys.stderr)
+ return 'x86'
def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, prefixes, func_dict):
target_handlers = {
- 'x86_64': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'i386': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
'aarch64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
+ 'aarch64-apple-darwin': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_DARWIN_RE),
+ 'hexagon': (scrub_asm_hexagon, ASM_FUNCTION_HEXAGON_RE),
'r600': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
'amdgcn': (scrub_asm_amdgpu, ASM_FUNCTION_AMDGPU_RE),
- 'arm-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6t2': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6t2-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6m': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv6m-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv7': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv7-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv7m': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv7m-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv8-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv8m.base': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'thumbv8m.main': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armv6': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armv7': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armv7-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armv7eb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
- 'armv7eb': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
+ 'arm': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
+ 'arm64': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_RE),
+ 'arm64-apple-ios': (scrub_asm_arm_eabi, ASM_FUNCTION_AARCH64_DARWIN_RE),
+ 'armv7-apple-ios' : (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_IOS_RE),
+ 'armv7-apple-darwin': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_DARWIN_RE),
+ 'thumb': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
+ 'thumb-macho': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_MACHO_RE),
+ 'thumbv5-macho': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_MACHO_RE),
+ 'thumbv7-apple-ios' : (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_IOS_RE),
'mips': (scrub_asm_mips, ASM_FUNCTION_MIPS_RE),
- 'powerpc64': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
- 'powerpc64le': (scrub_asm_powerpc64, ASM_FUNCTION_PPC_RE),
+ 'ppc32': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
+ 'powerpc': (scrub_asm_powerpc, ASM_FUNCTION_PPC_RE),
'riscv32': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
'riscv64': (scrub_asm_riscv, ASM_FUNCTION_RISCV_RE),
+ 'lanai': (scrub_asm_lanai, ASM_FUNCTION_LANAI_RE),
'sparc': (scrub_asm_sparc, ASM_FUNCTION_SPARC_RE),
- 'sparcv9': (scrub_asm_sparc, ASM_FUNCTION_SPARC_RE),
's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
+ 'wasm32': (scrub_asm_wasm32, ASM_FUNCTION_WASM32_RE),
}
- handlers = None
+ handler = None
+ best_prefix = ''
for prefix, s in target_handlers.items():
- if triple.startswith(prefix):
- handlers = s
- break
- else:
+ if triple.startswith(prefix) and len(prefix) > len(best_prefix):
+ handler = s
+ best_prefix = prefix
+
+ if handler is None:
raise KeyError('Triple %r is not supported' % (triple))
- scrubber, function_re = handlers
+ scrubber, function_re = handler
common.build_function_body_dictionary(
function_re, scrubber, [args], raw_tool_output, prefixes,
func_dict, args.verbose)
diff --git a/src/llvm-project/llvm/utils/benchmark/CMakeLists.txt b/src/llvm-project/llvm/utils/benchmark/CMakeLists.txt
index 788ad48..38bc8c6 100644
--- a/src/llvm-project/llvm/utils/benchmark/CMakeLists.txt
+++ b/src/llvm-project/llvm/utils/benchmark/CMakeLists.txt
@@ -76,8 +76,11 @@
# Read the git tags to determine the project version
-include(GetGitVersion)
-get_git_version(GIT_VERSION)
+# WARNING: This is meaningless for when the benchmark library is being built in-tree,
+# so disable it and hardcode a null version.
+# include(GetGitVersion)
+# get_git_version(GIT_VERSION)
+set(GIT_VERSION "v0.0.0")
# Tell the user what versions we are using
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
diff --git a/src/llvm-project/llvm/utils/benchmark/README.LLVM b/src/llvm-project/llvm/utils/benchmark/README.LLVM
index 5a20ec6..d2aa87e 100644
--- a/src/llvm-project/llvm/utils/benchmark/README.LLVM
+++ b/src/llvm-project/llvm/utils/benchmark/README.LLVM
@@ -21,3 +21,7 @@
is applied to fix building with MinGW headers for ARM
* https://github.com/google/benchmark/commit/a9b31c51b1ee7ec7b31438c647123c2cbac5d956
is applied to disable exceptions in Microsoft STL when exceptions are disabled
+* Disabled CMake get_git_version as it is meaningless for this in-tree build,
+ and hardcoded a null version
+* https://github.com/google/benchmark/commit/4abdfbb802d1b514703223f5f852ce4a507d32d2
+ is applied on top of v1.4.1 to add RISC-V timer support.
diff --git a/src/llvm-project/llvm/utils/benchmark/src/cycleclock.h b/src/llvm-project/llvm/utils/benchmark/src/cycleclock.h
index e1f18cc..7b54b25 100644
--- a/src/llvm-project/llvm/utils/benchmark/src/cycleclock.h
+++ b/src/llvm-project/llvm/utils/benchmark/src/cycleclock.h
@@ -164,6 +164,21 @@
uint64_t tsc;
asm("stck %0" : "=Q" (tsc) : : "cc");
return tsc;
+#elif defined(__riscv) // RISC-V
+ // Use RDCYCLE (and RDCYCLEH on riscv32)
+#if __riscv_xlen == 32
+ uint64_t cycles_low, cycles_hi0, cycles_hi1;
+ asm("rdcycleh %0" : "=r"(cycles_hi0));
+ asm("rdcycle %0" : "=r"(cycles_lo));
+ asm("rdcycleh %0" : "=r"(cycles_hi1));
+ // This matches the PowerPC overflow detection, above
+ cycles_lo &= -static_cast<int64_t>(cycles_hi0 == cycles_hi1);
+ return (cycles_hi1 << 32) | cycles_lo;
+#else
+ uint64_t cycles;
+ asm("rdcycle %0" : "=r"(cycles));
+ return cycles;
+#endif
#else
// The soft failover to a generic implementation is automatic only for ARM.
// For other platforms the developer is expected to make an attempt to create
diff --git a/src/llvm-project/llvm/utils/chunk-print-before-all.py b/src/llvm-project/llvm/utils/chunk-print-before-all.py
new file mode 100644
index 0000000..ce17c68
--- /dev/null
+++ b/src/llvm-project/llvm/utils/chunk-print-before-all.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# Given a -print-before-all -print-module-scope log from an opt invocation,
+# chunk it into a series of individual IR files, one for each pass invocation.
+# If the log ends with an obvious stack trace, try to split off a separate
+# "crashinfo.txt" file leaving only the valid input IR in the last chunk.
+# Files are written to current working directory.
+
+import sys
+
+basename = "chunk-"
+chunk_id = 0
+
+def print_chunk(lines):
+ global chunk_id
+ global basename
+ fname = basename + str(chunk_id) + ".ll"
+ chunk_id = chunk_id + 1
+ print "writing chunk " + fname + " (" + str(len(lines)) + " lines)"
+ with open(fname, "w") as f:
+ f.writelines(lines)
+
+is_dump = False
+cur = []
+for line in sys.stdin:
+ if line.startswith("*** IR Dump Before ") and len(cur) != 0:
+ print_chunk(cur);
+ cur = []
+ cur.append("; " + line)
+ elif line.startswith("Stack dump:"):
+ print_chunk(cur);
+ cur = []
+ cur.append(line)
+ is_dump = True
+ else:
+ cur.append(line)
+
+if is_dump:
+ print "writing crashinfo.txt (" + str(len(cur)) + " lines)"
+ with open("crashinfo.txt", "w") as f:
+ f.writelines(cur)
+else:
+ print_chunk(cur);
diff --git a/src/llvm-project/llvm/utils/count/count.c b/src/llvm-project/llvm/utils/count/count.c
index ae96791..0aacafe 100644
--- a/src/llvm-project/llvm/utils/count/count.c
+++ b/src/llvm-project/llvm/utils/count/count.c
@@ -1,9 +1,8 @@
/*===- count.c - The 'count' testing tool ---------------------------------===*\
*
- * The LLVM Compiler Infrastructure
- *
- * This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
\*===----------------------------------------------------------------------===*/
diff --git a/src/llvm-project/llvm/utils/countloc.sh b/src/llvm-project/llvm/utils/countloc.sh
index 4d1b775..497fab0 100755
--- a/src/llvm-project/llvm/utils/countloc.sh
+++ b/src/llvm-project/llvm/utils/countloc.sh
@@ -1,10 +1,9 @@
#!/bin/sh
##===- utils/countloc.sh - Counts Lines Of Code --------------*- Script -*-===##
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
##===----------------------------------------------------------------------===##
#
diff --git a/src/llvm-project/llvm/utils/docker/build_docker_image.sh b/src/llvm-project/llvm/utils/docker/build_docker_image.sh
index 820a5f7..295fa51 100755
--- a/src/llvm-project/llvm/utils/docker/build_docker_image.sh
+++ b/src/llvm-project/llvm/utils/docker/build_docker_image.sh
@@ -1,10 +1,9 @@
#!/bin/bash
#===- llvm/utils/docker/build_docker_image.sh ----------------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===//
set -e
@@ -56,7 +55,7 @@
For example, running:
$ build_docker_image.sh -s debian8 -d mydocker/debian8-clang -t latest \
- -p clang -i install-clang -i install-clang-headers
+ -p clang -i install-clang -i install-clang-resource-headers
will produce two docker images:
mydocker/debian8-clang-build:latest - an intermediate image used to compile
clang.
@@ -67,12 +66,12 @@
To get a 2-stage clang build, you could use this command:
$ ./build_docker_image.sh -s debian8 -d mydocker/clang-debian8 -t "latest" \
- -p clang -i stage2-install-clang -i stage2-install-clang-headers \
+ -p clang -i stage2-install-clang -i stage2-install-clang-resource-headers \
-- \
-DLLVM_TARGETS_TO_BUILD=Native -DCMAKE_BUILD_TYPE=Release \
-DBOOTSTRAP_CMAKE_BUILD_TYPE=Release \
-DCLANG_ENABLE_BOOTSTRAP=ON \
- -DCLANG_BOOTSTRAP_TARGETS="install-clang;install-clang-headers"
+ -DCLANG_BOOTSTRAP_TARGETS="install-clang;install-clang-resource-headers"
EOF
}
diff --git a/src/llvm-project/llvm/utils/docker/debian8/Dockerfile b/src/llvm-project/llvm/utils/docker/debian8/Dockerfile
index fe12ec5..9d0e2b8 100644
--- a/src/llvm-project/llvm/utils/docker/debian8/Dockerfile
+++ b/src/llvm-project/llvm/utils/docker/debian8/Dockerfile
@@ -1,9 +1,8 @@
#===- llvm/utils/docker/debian8/build/Dockerfile -------------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===//
# Stage 1. Check out LLVM source code and run the build.
diff --git a/src/llvm-project/llvm/utils/docker/example/Dockerfile b/src/llvm-project/llvm/utils/docker/example/Dockerfile
index d875ed9..ebfb0e4 100644
--- a/src/llvm-project/llvm/utils/docker/example/Dockerfile
+++ b/src/llvm-project/llvm/utils/docker/example/Dockerfile
@@ -1,9 +1,8 @@
#===- llvm/utils/docker/example/build/Dockerfile -------------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===//
# This is an example Dockerfile to build an image that compiles clang.
diff --git a/src/llvm-project/llvm/utils/docker/nvidia-cuda/Dockerfile b/src/llvm-project/llvm/utils/docker/nvidia-cuda/Dockerfile
index 32804d7..5878259 100644
--- a/src/llvm-project/llvm/utils/docker/nvidia-cuda/Dockerfile
+++ b/src/llvm-project/llvm/utils/docker/nvidia-cuda/Dockerfile
@@ -1,9 +1,8 @@
#===- llvm/utils/docker/nvidia-cuda/build/Dockerfile ---------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===//
# Stage 1. Check out LLVM source code and run the build.
diff --git a/src/llvm-project/llvm/utils/docker/scripts/build_install_llvm.sh b/src/llvm-project/llvm/utils/docker/scripts/build_install_llvm.sh
index 0b9c083..3a52e41 100755
--- a/src/llvm-project/llvm/utils/docker/scripts/build_install_llvm.sh
+++ b/src/llvm-project/llvm/utils/docker/scripts/build_install_llvm.sh
@@ -1,10 +1,9 @@
#!/usr/bin/env bash
#===- llvm/utils/docker/scripts/build_install_llvm.sh ---------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===-----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/docker/scripts/checkout.sh b/src/llvm-project/llvm/utils/docker/scripts/checkout.sh
index 1bd034d..c5e7cc7 100755
--- a/src/llvm-project/llvm/utils/docker/scripts/checkout.sh
+++ b/src/llvm-project/llvm/utils/docker/scripts/checkout.sh
@@ -1,10 +1,9 @@
#!/usr/bin/env bash
#===- llvm/utils/docker/scripts/checkout.sh ---------------------===//
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===-----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/emacs/llvm-mode.el b/src/llvm-project/llvm/utils/emacs/llvm-mode.el
index cde66d1..73b0276 100644
--- a/src/llvm-project/llvm/utils/emacs/llvm-mode.el
+++ b/src/llvm-project/llvm/utils/emacs/llvm-mode.el
@@ -26,8 +26,8 @@
"inaccessiblemem_or_argmemonly" "inlinehint" "jumptable" "minsize" "naked" "nobuiltin"
"noduplicate" "noimplicitfloat" "noinline" "nonlazybind" "noredzone" "noreturn"
"norecurse" "nounwind" "optnone" "optsize" "readnone" "readonly" "returns_twice"
- "speculatable" "ssp" "sspreq" "sspstrong" "safestack" "sanitize_address" "sanitize_hwaddress"
- "sanitize_thread" "sanitize_memory" "strictfp" "uwtable" "writeonly") 'symbols) . font-lock-constant-face)
+ "speculatable" "ssp" "sspreq" "sspstrong" "safestack" "sanitize_address" "sanitize_hwaddress" "sanitize_memtag"
+ "sanitize_thread" "sanitize_memory" "strictfp" "uwtable" "writeonly" "immarg") 'symbols) . font-lock-constant-face)
;; Variables
'("%[-a-zA-Z$._][-a-zA-Z$._0-9]*" . font-lock-variable-name-face)
;; Labels
diff --git a/src/llvm-project/llvm/utils/fpcmp/fpcmp.cpp b/src/llvm-project/llvm/utils/fpcmp/fpcmp.cpp
index bbe7276..52bddee 100644
--- a/src/llvm-project/llvm/utils/fpcmp/fpcmp.cpp
+++ b/src/llvm-project/llvm/utils/fpcmp/fpcmp.cpp
@@ -1,9 +1,8 @@
//===- fpcmp.cpp - A fuzzy "cmp" that permits floating point noise --------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/src/llvm-project/llvm/utils/gdb-scripts/prettyprinters.py b/src/llvm-project/llvm/utils/gdb-scripts/prettyprinters.py
index 7ddc33a..55f2b36 100644
--- a/src/llvm-project/llvm/utils/gdb-scripts/prettyprinters.py
+++ b/src/llvm-project/llvm/utils/gdb-scripts/prettyprinters.py
@@ -129,8 +129,7 @@
self.val = None
if not val['Storage']['hasVal']:
raise StopIteration
- return ('value', val['Storage']['storage']['buffer'].address.cast(
- val.type.template_argument(0).pointer()).dereference())
+ return ('value', val['Storage']['value'])
def to_string(self):
return 'llvm::Optional{}'.format('' if self.val['Storage']['hasVal'] else ' is not initialized')
diff --git a/src/llvm-project/llvm/utils/getsrcs.sh b/src/llvm-project/llvm/utils/getsrcs.sh
index c8bff8c..ef0ad72 100755
--- a/src/llvm-project/llvm/utils/getsrcs.sh
+++ b/src/llvm-project/llvm/utils/getsrcs.sh
@@ -1,10 +1,9 @@
#!/bin/sh
##===- utils/getsrcs.sh - Counts Lines Of Code ---------------*- Script -*-===##
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# details.
#
##===----------------------------------------------------------------------===##
diff --git a/src/llvm-project/llvm/utils/git-svn/git-llvm b/src/llvm-project/llvm/utils/git-svn/git-llvm
index 53c0b24..289898d 100755
--- a/src/llvm-project/llvm/utils/git-svn/git-llvm
+++ b/src/llvm-project/llvm/utils/git-svn/git-llvm
@@ -2,10 +2,9 @@
#
# ======- git-llvm - LLVM Git Help Integration ---------*- python -*--========#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ==------------------------------------------------------------------------==#
@@ -19,13 +18,11 @@
from __future__ import print_function
import argparse
import collections
-import contextlib
-import errno
import os
import re
+import shutil
import subprocess
import sys
-import tempfile
import time
assert sys.version_info >= (2, 7)
@@ -40,8 +37,15 @@
def iteritems(d):
return d.iteritems()
+try:
+ # Python 3
+ from shlex import quote
+except ImportError:
+ # Python 2
+ from pipes import quote
+
# It's *almost* a straightforward mapping from the monorepo to svn...
-GIT_TO_SVN_DIR = {
+LLVM_MONOREPO_SVN_MAPPING = {
d: (d + '/trunk')
for d in [
'clang-tools-extra',
@@ -63,8 +67,11 @@
'pstl',
]
}
-GIT_TO_SVN_DIR.update({'clang': 'cfe/trunk'})
-GIT_TO_SVN_DIR.update({'': 'monorepo-root/trunk'})
+LLVM_MONOREPO_SVN_MAPPING.update({'clang': 'cfe/trunk'})
+LLVM_MONOREPO_SVN_MAPPING.update({'': 'monorepo-root/trunk'})
+
+SPLIT_REPO_NAMES = {'llvm-' + d: d + '/trunk'
+ for d in ['www', 'zorg', 'test-suite', 'lnt']}
VERBOSE = False
QUIET = False
@@ -110,7 +117,9 @@
def shell(cmd, strip=True, cwd=None, stdin=None, die_on_failure=True,
ignore_errors=False, text=True):
- log_verbose('Running in %s: %s' % (cwd, ' '.join(cmd)))
+ # Escape args when logging for easy repro.
+ quoted_cmd = [quote(arg) for arg in cmd]
+ log_verbose('Running in %s: %s' % (cwd, ' '.join(quoted_cmd)))
err_pipe = subprocess.PIPE
if ignore_errors:
@@ -128,7 +137,7 @@
if p.returncode == 0 or ignore_errors:
if stderr and not ignore_errors:
- eprint('`%s` printed to stderr:' % ' '.join(cmd))
+ eprint('`%s` printed to stderr:' % ' '.join(quoted_cmd))
eprint(stderr.rstrip())
if strip:
if text:
@@ -139,7 +148,7 @@
for l in stdout.splitlines():
log_verbose("STDOUT: %s" % l)
return stdout
- err_msg = '`%s` returned %s' % (' '.join(cmd), p.returncode)
+ err_msg = '`%s` returned %s' % (' '.join(quoted_cmd), p.returncode)
eprint(err_msg)
if stderr:
eprint(stderr.rstrip())
@@ -155,6 +164,7 @@
def svn(cwd, *cmd, **kwargs):
return shell(['svn'] + list(cmd), cwd=cwd, **kwargs)
+
def program_exists(cmd):
if sys.platform == 'win32' and not cmd.endswith('.exe'):
cmd += '.exe'
@@ -163,6 +173,7 @@
return True
return False
+
def get_default_rev_range():
# Get the branch tracked by the current branch, as set by
# git branch --set-upstream-to See http://serverfault.com/a/352236/38694.
@@ -199,7 +210,18 @@
if not line.startswith('?'):
continue
filename = line[1:].strip()
- os.remove(os.path.join(svn_repo, filename))
+ filepath = os.path.abspath(os.path.join(svn_repo, filename))
+ abs_svn_repo = os.path.abspath(svn_repo)
+ # Safety check that the directory we are about to delete is
+ # actually within our svn staging dir.
+ if not filepath.startswith(abs_svn_repo):
+ die("Path to clean (%s) is not in svn staging dir (%s)"
+ % (filepath, abs_svn_repo))
+
+ if os.path.isdir(filepath):
+ shutil.rmtree(filepath)
+ else:
+ os.remove(filepath)
def svn_init(svn_root):
@@ -254,17 +276,19 @@
# just the diff, and not a mass line ending change.
shell(['dos2unix'] + crlf_files, ignore_errors=True, cwd=svn_sr_path)
-def split_subrepo(f):
+
+def split_subrepo(f, git_to_svn_mapping):
# Given a path, splits it into (subproject, rest-of-path). If the path is
# not in a subproject, returns ('', full-path).
subproject, remainder = split_first_path_component(f)
- if subproject in GIT_TO_SVN_DIR:
+ if subproject in git_to_svn_mapping:
return subproject, remainder
else:
return '', f
+
def get_all_parent_dirs(name):
parts = []
head, tail = os.path.split(name)
@@ -273,7 +297,8 @@
head, tail = os.path.split(head)
return parts
-def svn_push_one_rev(svn_repo, rev, dry_run):
+
+def svn_push_one_rev(svn_repo, rev, git_to_svn_mapping, dry_run):
files = git('diff-tree', '--no-commit-id', '--name-only', '-r',
rev).split('\n')
if not files:
@@ -282,7 +307,7 @@
# Split files by subrepo
subrepo_files = collections.defaultdict(list)
for f in files:
- subrepo, remainder = split_subrepo(f)
+ subrepo, remainder = split_subrepo(f, git_to_svn_mapping)
subrepo_files[subrepo].append(remainder)
status = svn(svn_repo, 'status', '--no-ignore')
@@ -292,12 +317,13 @@
svn_dirs_to_update = set()
for sr, files in iteritems(subrepo_files):
- svn_sr_path = GIT_TO_SVN_DIR[sr]
+ svn_sr_path = git_to_svn_mapping[sr]
for f in files:
svn_dirs_to_update.add(
os.path.dirname(os.path.join(svn_sr_path, f)))
- # We also need to svn update any parent directories which are not yet present
+ # We also need to svn update any parent directories which are not yet
+ # present
parent_dirs = set()
for dir in svn_dirs_to_update:
parent_dirs.update(get_all_parent_dirs(dir))
@@ -313,7 +339,7 @@
svn(svn_repo, 'update', '--depth=files', *sorted_dirs_to_update)
for sr, files in iteritems(subrepo_files):
- svn_sr_path = os.path.join(svn_repo, GIT_TO_SVN_DIR[sr])
+ svn_sr_path = os.path.join(svn_repo, git_to_svn_mapping[sr])
if os.name == 'nt':
fix_eol_style_native(rev, svn_sr_path, files)
# We use text=False (and pass '--binary') so that we can get an exact
@@ -346,7 +372,10 @@
# Now we're ready to commit.
commit_msg = git('show', '--pretty=%B', '--quiet', rev)
if not dry_run:
- log(svn(svn_repo, 'commit', '-m', commit_msg, '--force-interactive'))
+ commit_args = ['commit', '-m', commit_msg]
+ if '--force-interactive' in svn(svn_repo, 'commit', '--help'):
+ commit_args.append('--force-interactive')
+ log(svn(svn_repo, *commit_args))
log('Committed %s to svn.' % rev)
else:
log("Would have committed %s to svn, if this weren't a dry run." % rev)
@@ -367,21 +396,158 @@
# Push from the root of the git repo
os.chdir(git_root)
+ # Get the remote URL, and check if it's one of the standalone repos.
+ git_remote_url = git('remote', 'get-url', 'origin')
+ git_remote_url = git_remote_url.rstrip('.git').rstrip('/')
+ git_remote_repo_name = git_remote_url.rsplit('/', 1)[-1]
+ split_repo_path = SPLIT_REPO_NAMES.get(git_remote_repo_name)
+ if split_repo_path:
+ git_to_svn_mapping = {'': split_repo_path}
+ else:
+ # Default to the monorepo mapping
+ git_to_svn_mapping = LLVM_MONOREPO_SVN_MAPPING
+
# We need a staging area for SVN, let's hide it in the .git directory.
dot_git_dir = git('rev-parse', '--git-common-dir')
+ # Not all versions of git support --git-common-dir and just print the
+ # unknown command back. If this happens, fall back to --git-dir
+ if dot_git_dir == '--git-common-dir':
+ dot_git_dir = git('rev-parse', '--git-dir')
+
svn_root = os.path.join(dot_git_dir, 'llvm-upstream-svn')
svn_init(svn_root)
rev_range = args.rev_range
dry_run = args.dry_run
revs = get_revs_to_push(rev_range)
- log('Pushing %d commit%s:\n%s' %
- (len(revs), 's' if len(revs) != 1
- else '', '\n'.join(' ' + git('show', '--oneline', '--quiet', c)
- for c in revs)))
+ log('%sPushing %d %s commit%s:\n%s' %
+ ('[DryRun] ' if dry_run else '', len(revs),
+ 'split-repo (%s)' % split_repo_path
+ if split_repo_path else 'monorepo',
+ 's' if len(revs) != 1 else '',
+ '\n'.join(' ' + git('show', '--oneline', '--quiet', c)
+ for c in revs)))
for r in revs:
clean_svn(svn_root)
- svn_push_one_rev(svn_root, r, dry_run)
+ svn_push_one_rev(svn_root, r, git_to_svn_mapping, dry_run)
+
+
+def lookup_llvm_svn_id(git_commit_hash):
+ # Use --format=%b to get the raw commit message, without any extra
+ # whitespace.
+ commit_msg = git('log', '-1', '--format=%b', git_commit_hash,
+ ignore_errors=True)
+ if len(commit_msg) == 0:
+ die("Can't find git commit " + git_commit_hash)
+ # If a commit has multiple "llvm-svn:" lines (e.g. if the commit is
+ # reverting/quoting a previous commit), choose the last one, which should
+ # be the authoritative one.
+ svn_match_iter = re.finditer('^llvm-svn: (\d{5,7})$', commit_msg,
+ re.MULTILINE)
+ svn_match = None
+ for m in svn_match_iter:
+ svn_match = m.group(1)
+ if svn_match:
+ return int(svn_match)
+ die("Can't find svn revision in git commit " + git_commit_hash)
+
+
+def cmd_svn_lookup(args):
+ '''Find the SVN revision id for a given git commit hash.
+
+ This is identified by 'llvm-svn: NNNNNN' in the git commit message.'''
+ # Get the git root
+ git_root = git('rev-parse', '--show-toplevel')
+ if not os.path.isdir(git_root):
+ die("Can't find git root dir")
+
+ # Run commands from the root
+ os.chdir(git_root)
+
+ log('r' + str(lookup_llvm_svn_id(args.git_commit_hash)))
+
+
+def git_hash_by_svn_rev(svn_rev):
+ '''Find the git hash for a given svn revision.
+
+ This check is paranoid: 'llvm-svn: NNNNNN' could exist on its own line
+ somewhere else in the commit message. Look in the full log message to see
+ if it's actually on the last line.
+
+ Since this check is expensive (we're searching every single commit), limit
+ to the past 10k commits (about 5 months).
+ '''
+ possible_hashes = git(
+ 'log', '--format=%H', '--grep', '^llvm-svn: %d$' % svn_rev,
+ 'HEAD~10000...HEAD').split('\n')
+ matching_hashes = [h for h in possible_hashes
+ if lookup_llvm_svn_id(h) == svn_rev]
+ if len(matching_hashes) > 1:
+ die("svn revision r%d has ambiguous commits: %s" % (
+ svn_rev, ', '.join(matching_hashes)))
+ elif len(matching_hashes) < 1:
+ die("svn revision r%d matches no commits" % svn_rev)
+ return matching_hashes[0]
+
+
+def cmd_revert(args):
+ '''Revert a commit by either SVN id (rNNNNNN) or git hash. This also
+ populates the git commit message with both the SVN revision and git hash of
+ the change being reverted.'''
+
+ # Get the git root
+ git_root = git('rev-parse', '--show-toplevel')
+ if not os.path.isdir(git_root):
+ die("Can't find git root dir")
+
+ # Run commands from the root
+ os.chdir(git_root)
+
+ # Check for a client branch first.
+ open_files = git('status', '-uno', '-s', '--porcelain')
+ if len(open_files) > 0:
+ die("Found open files. Please stash and then revert.\n" + open_files)
+
+ # If the revision looks like rNNNNNN, use that. Otherwise, look for it in
+ # the git commit.
+ svn_match = re.match('^r(\d{5,7})$', args.revision)
+ if svn_match:
+ # If the revision looks like rNNNNNN, use that as the svn revision, and
+ # grep through git commits to find which one corresponds to that svn
+ # revision.
+ svn_rev = int(svn_match.group(1))
+ git_hash = git_hash_by_svn_rev(svn_rev)
+ else:
+ # Otherwise, this looks like a git hash, so we just need to grab the
+ # svn revision from the end of the commit message. Get the actual git
+ # hash in case the revision is something like "HEAD~1"
+ git_hash = git('rev-parse', '--verify', args.revision + '^{commit}')
+ svn_rev = lookup_llvm_svn_id(git_hash)
+
+ msg = git('log', '-1', '--format=%s', git_hash)
+
+ log_verbose('Ready to revert r%d (%s): "%s"' % (svn_rev, git_hash, msg))
+
+ revert_args = ['revert', '--no-commit', git_hash]
+ # TODO: Running --edit doesn't seem to work, with errors that stdin is not
+ # a tty.
+ commit_args = [
+ 'commit', '-m', 'Revert ' + msg,
+ '-m', 'This reverts r%d (git commit %s)' % (svn_rev, git_hash)]
+ if args.dry_run:
+ log("Would have run the following commands, if this weren't a"
+ "dry run:\n"
+ '1) git %s\n2) git %s' % (
+ ' '.join(quote(arg) for arg in revert_args),
+ ' '.join(quote(arg) for arg in commit_args)))
+ return
+
+ git(*revert_args)
+ commit_log = git(*commit_args)
+
+ log('Created revert of r%d: %s' % (svn_rev, commit_log))
+ log("Run 'git llvm push -n' to inspect your changes and "
+ "run 'git llvm push' when ready")
if __name__ == '__main__':
@@ -421,6 +587,32 @@
'upstream, or not in origin/master if the branch lacks '
'an explicit upstream)')
parser_push.set_defaults(func=cmd_push)
+
+ parser_revert = subcommands.add_parser(
+ 'revert', description=cmd_revert.__doc__,
+ help='Revert a commit locally.')
+ parser_revert.add_argument(
+ 'revision',
+ help='Revision to revert. Can either be an SVN revision number '
+ "(rNNNNNN) or a git commit hash (anything that doesn't look "
+ 'like an SVN revision number).')
+ parser_revert.add_argument(
+ '-n',
+ '--dry-run',
+ dest='dry_run',
+ action='store_true',
+ help='Do everything other than perform a revert. Prints the git '
+ 'revert command it would have run.')
+ parser_revert.set_defaults(func=cmd_revert)
+
+ parser_svn_lookup = subcommands.add_parser(
+ 'svn-lookup', description=cmd_svn_lookup.__doc__,
+ help='Find the llvm-svn revision for a given commit.')
+ parser_svn_lookup.add_argument(
+ 'git_commit_hash',
+ help='git_commit_hash for which we will look up the svn revision id.')
+ parser_svn_lookup.set_defaults(func=cmd_svn_lookup)
+
args = p.parse_args(argv)
VERBOSE = args.verbose
QUIET = args.quiet
diff --git a/src/llvm-project/llvm/utils/gn/README.rst b/src/llvm-project/llvm/utils/gn/README.rst
index 4d8051f..bb0e0c7 100644
--- a/src/llvm-project/llvm/utils/gn/README.rst
+++ b/src/llvm-project/llvm/utils/gn/README.rst
@@ -22,16 +22,10 @@
creates ninja files, but it can create some IDE projects (MSVC, Xcode, ...)
which then shell out to ninja for the actual build.
-Its main features are that GN is very fast (it currently produces ninja files
-for LLVM's build in 35ms on the author's laptop, compared to 66s for CMake) --
-a 2000x difference), and since it's so fast it doesn't aggressively cache,
-making it possible to switch e.g. between release and debug builds in one build
-directory.
-
The main motivation behind the GN build is that some people find it more
convenient for day-to-day hacking on LLVM than CMake. Distribution, building
-just parts of LLVM, and embedding the LLVM GN build from other builds are a
-non-goal for the GN build.
+just parts of LLVM, and embedding the LLVM GN build from other builds are
+non-goals for the GN build.
This is a `good overview of GN <https://docs.google.com/presentation/d/15Zwb53JcncHfEwHpnG_PoIbbzQ3GQi_cpujYwbpcbZo/edit#slide=id.g119d702868_0_12>`_.
@@ -42,35 +36,44 @@
GN only works in the monorepo layout.
-#. Obtain a `gn binary <https://gn.googlesource.com/gn/#getting-started>`_.
+#. ``git clone https://github.com/llvm/llvm-project.git; cd llvm-project`` if
+ you don't have a monorepo checkout yet.
-#. In the root of the monorepo, run `llvm/utils/gn/gn.py gen out/gn`.
- `out/gn` is the build directory, it can have any name, and you can have as
- many as you want, each with different build settings. (The `gn.py` script
- adds `--dotfile=llvm/utils/gn/.gn --root=.` and just runs regular `gn`;
+#. ``llvm/utils/gn/get.py`` to download a prebuilt gn binary if you're on a
+ 64-bit X86 system running Linux, macOS, or Windows. `Build gn yourself
+ <https://gn.googlesource.com/gn/#getting-started>`_ if you're on a different
+ platform or don't want to trust prebuilt binaries.
+
+#. ``llvm/utils/gn/gn.py gen out/gn`` to run GN and create build files.
+ ``out/gn`` is the build directory, it can have any name, and you can have as
+ many as you want, each with different build settings. (The ``gn.py`` script
+ adds ``--dotfile=llvm/utils/gn/.gn --root=.`` and just runs regular ``gn``;
you can manually pass these parameters and not use the wrapper if you
prefer.)
-#. Run e.g. `ninja -C out/gn check-lld` to build all prerequisites for and
- run the LLD tests.
+#. ``echo out >> .git/info/exclude`` to tell git to ignore files below ``out``.
+
+#. ``ninja -C out/gn check-lld`` to build all prerequisites for and run the LLD
+ tests.
By default, you get a release build with assertions enabled that targets
-the host arch. You can set various build options by editing `out/gn/args.gn`,
-for example putting `is_debug = true` in there gives you a debug build. Run
-`llvm/utils/gn/gn.py args --list out/gn` to see a list of all possible
-options. After touching `out/gn/args.gn`, just run ninja, it will re-invoke gn
+the host arch. You can set build options by editing ``out/gn/args.gn``, for
+example putting ``is_debug = true`` in there gives you a debug build. Run
+``llvm/utils/gn/gn.py args --list out/gn`` to see a list of all possible
+options. After touching ``out/gn/args.gn`` just run ninja: it will re-invoke gn
before starting the build.
-GN has extensive built-in help; try e.g. `gn help gen` to see the help
-for the `gen` command. The full GN reference is also `available online
-<https://gn.googlesource.com/gn/+/master/docs/reference.md>`_.
+GN has extensive built-in help; try e.g. ``llvm/utils/gn/gn.py help gen`` to see
+the help for the ``gen`` command. The full GN reference is also `available
+online <https://gn.googlesource.com/gn/+/master/docs/reference.md>`_.
-GN has an autoformatter: `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format`
+GN has an autoformatter:
+``git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format``
after making GN build changes is your friend.
-To not put `BUILD.gn` into the main tree, they are all below
-`utils/gn/secondary`. For example, the build file for `llvm/lib/Support` is in
-`utils/gn/secondary/llvm/lib/Support`.
+To not put ``BUILD.gn`` files into the main tree, they are all below
+``utils/gn/secondary``. For example, the build file for ``llvm/lib/Support``
+is in ``utils/gn/secondary/llvm/lib/Support``.
.. _Syncing GN files from CMake files:
@@ -79,15 +82,15 @@
Sometimes after pulling in the latest changes, the GN build doesn't work.
Most of the time this is due to someone adding a file to CMakeLists.txt file.
-Run `llvm/utils/gn/build/sync_source_lists_from_cmake.py` to print a report
-of which files need to be added to or removed from `BUILD.gn` files to
-match the corresponding `CMakeLists.txt`. You have to manually read the output
+Run ``llvm/utils/gn/build/sync_source_lists_from_cmake.py`` to print a report
+of which files need to be added to or removed from ``BUILD.gn`` files to
+match the corresponding ``CMakeLists.txt``. You have to manually read the output
of the script and implement its suggestions.
-If new `CMakeLists.txt` files have been added, you have to manually create
-a new corresponding `BUILD.gn` file below `llvm/utils/gn/secondary/`.
+If new ``CMakeLists.txt`` files have been added, you have to manually create
+a new corresponding ``BUILD.gn`` file below ``llvm/utils/gn/secondary/``.
-If the dependencies in a `CMakeLists.txt` file have been changed, you have to
+If the dependencies in a ``CMakeLists.txt`` file have been changed, you have to
manually analyze and fix.
.. _Philosophy:
@@ -129,9 +132,9 @@
config.h in a build step).
For the last two points, it would be nice if LLVM didn't have a single
-`config.h` header, but one header per toggle. That way, when e.g.
-`llvm_enable_terminfo` is toggled, only the 3 files caring about that setting
-would need to be rebuilt, instead of everything including `config.h`.
+``config.h`` header, but one header per toggle. That way, when e.g.
+``llvm_enable_terminfo`` is toggled, only the 3 files caring about that setting
+would need to be rebuilt, instead of everything including ``config.h``.
GN doesn't believe in users setting arbitrary cflags from an environment
variable, it wants the build to be controlled by .gn files.
diff --git a/src/llvm-project/llvm/utils/gn/TODO.txt b/src/llvm-project/llvm/utils/gn/TODO.txt
index 1588470..58f2ab9 100644
--- a/src/llvm-project/llvm/utils/gn/TODO.txt
+++ b/src/llvm-project/llvm/utils/gn/TODO.txt
@@ -1,11 +1,10 @@
Ideas for things to do:
-- more projects (compiler-rt libcxx libcxxabi libunwind clang-tools-extra lldb)
- - phosek expressed interest in compiler-rt libcxx libcxxabi libunwind
+- more projects (compiler-rt's asan/ubsan/msan/tsan, lldb)
- once there are more projects, have an llvm_enable_projects arg, modeled
after llvm_targets_to_build in the GN build
- a check-all build target that runs test of all projects
-- more targets (AVR MIPS RISCV SystemZ etc)
+- more targets (AMDGPU ARC AVR MSP430 XCore)
- example: https://reviews.llvm.org/D56416
- investigate feasibility of working `gn check`
@@ -14,14 +13,11 @@
- or use opt toolchain and build tablegen twice in debug builds, like cmake
- cross builds using GN's toolchain feature
-- one-build-dir bootstrap builds using GN's toolchain feature
- move clang_tablegen into lib/ for private files
- add dead code stripping
- move run_tablegen.py from build to tablegen folder
- figure out why -Iclang/Support gets added so often
-- make LLVM_LIBXML2_ENABLED use llvm_canonicalize_cmake_boolean (cf D28294),
- clean up both GN and CMake builds
- plugin() template with working rpath, exports thingers
- then port clang_build_examples and enable by default so that clang
plugin tests run by default
diff --git a/src/llvm-project/llvm/utils/gn/build/BUILD.gn b/src/llvm-project/llvm/utils/gn/build/BUILD.gn
index e5c8d2a6..a20cdb1 100644
--- a/src/llvm-project/llvm/utils/gn/build/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/build/BUILD.gn
@@ -3,6 +3,19 @@
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/toolchain/target_flags.gni")
+declare_args() {
+ # Whether to build everything with coverage information.
+ # After building with this, run tests and then run
+ # llvm/utils/prepare-code-coverage-artifact.py \
+ # .../llvm-profdata .../llvm-cov out/gn/profiles/ report/ \
+ # out/gn/bin/llvm-undname ...`
+ # to generate a HTML report for the binaries passed in the last line.
+ llvm_build_instrumented_coverage = false
+}
+
+assert(!llvm_build_instrumented_coverage || is_clang,
+ "llvm_build_instrumented_coverage requires clang as host compiler")
+
config("compiler_defaults") {
defines = []
@@ -10,7 +23,8 @@
defines += [ "NDEBUG" ]
}
- cflags = target_flags + target_cflags
+ asmflags = target_flags
+ cflags = target_flags
ldflags = target_flags + target_ldflags
if (host_os == "mac" && clang_base_path != "") {
@@ -23,23 +37,32 @@
if (host_os != "win") {
if (is_debug) {
cflags += [ "-g" ]
- } else {
+ }
+ if (is_optimized) {
cflags += [ "-O3" ]
}
cflags += [ "-fdiagnostics-color" ]
cflags_cc = [
"-std=c++11",
- "-fno-exceptions",
"-fvisibility-inlines-hidden",
]
} else {
if (is_debug) {
- cflags += [ "/Zi" ]
- } else {
+ cflags += [
+ "/Zi",
+ "/FS",
+ ]
+ ldflags += [ "/DEBUG" ]
+ }
+ if (is_optimized) {
cflags += [
"/O2",
"/Zc:inline",
]
+ ldflags += [
+ "/OPT:REF",
+ "/OPT:ICF",
+ ]
}
defines += [
"_CRT_SECURE_NO_DEPRECATE",
@@ -57,7 +80,7 @@
# The MSVC default value (1 MB) is not enough for parsing recursive C++
# templates in Clang.
- ldflags = [ "/STACK:10000000" ]
+ ldflags += [ "/STACK:10000000" ]
}
# Warning setup.
@@ -93,12 +116,27 @@
"-Wextra",
]
}
- cflags += [
- "-Wno-unused-parameter",
- "-Wstring-conversion",
- ]
+ cflags += [ "-Wno-unused-parameter" ]
if (is_clang) {
- cflags += [ "-Wdelete-non-virtual-dtor" ]
+ cflags += [
+ "-Wdelete-non-virtual-dtor",
+ "-Wstring-conversion",
+ ]
+ } else {
+ cflags += [
+ # GCC's -Wcomment complains about // comments ending with '\' if the
+ # next line is also a // comment.
+ "-Wno-comment",
+
+ # Disable gcc's potentially uninitialized use analysis as it presents
+ # lots of false positives.
+ "-Wno-maybe-uninitialized",
+ ]
+ cflags_cc += [
+ # The LLVM libraries have no stable C++ API, so -Wnoexcept-type is not
+ # useful.
+ "-Wno-noexcept-type",
+ ]
}
if (is_clang && use_goma) {
# goma converts all paths to lowercase on the server, breaking this
@@ -107,9 +145,31 @@
}
}
- if (use_lld) {
+ # On Windows, the linker is not invoked through the compiler driver.
+ if (use_lld && host_os != "win") {
ldflags += [ "-fuse-ld=lld" ]
}
+
+ if (llvm_build_instrumented_coverage) {
+ cflags += [
+ "-fcoverage-mapping",
+
+ # Using an absolute path here is lame, but it's used at test execution
+ # time to generate the profiles, and lit doesn't specify a fixed folder
+ # for test execution -- so this is the only way to get all profiles into
+ # a single folder like llvm/utils/prepare-code-coverage-artifact.py
+ # expects.
+ "-fprofile-instr-generate=" +
+ rebase_path("$root_build_dir/profiles/%4m.profraw"),
+ ]
+ ldflags += [ "-fprofile-instr-generate" ]
+ }
+}
+
+config("no_exceptions") {
+ if (host_os != "win") {
+ cflags_cc = [ "-fno-exceptions" ]
+ }
}
config("no_rtti") {
@@ -120,6 +180,14 @@
}
}
+# To make an archive that can be distributed, you need to remove this config and
+# set complete_static_lib.
+config("thin_archive") {
+ if (current_os != "win" && current_os != "mac") {
+ arflags = [ "-T" ]
+ }
+}
+
config("llvm_code") {
include_dirs = [
"//llvm/include",
@@ -135,6 +203,9 @@
}
config("clang_code") {
+ if (host_os != "win") {
+ cflags = [ "-fno-strict-aliasing" ]
+ }
include_dirs = [
"//clang/include",
"$root_gen_dir/clang/include",
diff --git a/src/llvm-project/llvm/utils/gn/build/BUILDCONFIG.gn b/src/llvm-project/llvm/utils/gn/build/BUILDCONFIG.gn
index cec736f..1d876be 100644
--- a/src/llvm-project/llvm/utils/gn/build/BUILDCONFIG.gn
+++ b/src/llvm-project/llvm/utils/gn/build/BUILDCONFIG.gn
@@ -5,7 +5,9 @@
shared_binary_target_configs = [
"//llvm/utils/gn/build:compiler_defaults",
"//llvm/utils/gn/build:llvm_code",
+ "//llvm/utils/gn/build:no_exceptions",
"//llvm/utils/gn/build:no_rtti",
+ "//llvm/utils/gn/build:thin_archive",
"//llvm/utils/gn/build:warn_covered_switch_default",
]
diff --git a/src/llvm-project/llvm/utils/gn/build/buildflags.gni b/src/llvm-project/llvm/utils/gn/build/buildflags.gni
index a28b788..4dcdc96 100644
--- a/src/llvm-project/llvm/utils/gn/build/buildflags.gni
+++ b/src/llvm-project/llvm/utils/gn/build/buildflags.gni
@@ -1,10 +1,13 @@
declare_args() {
- # Whether to build with debug information and without optimizations.
+ # Whether to build with debug information.
is_debug = false
}
# args that depend on other args must live in a later declare_args() block.
declare_args() {
+ # Whether to build with optimizations.
+ is_optimized = !is_debug
+
# Whether to enable assertions.
llvm_enable_assertions = true
}
diff --git a/src/llvm-project/llvm/utils/gn/build/libs/atomic/BUILD.gn b/src/llvm-project/llvm/utils/gn/build/libs/atomic/BUILD.gn
new file mode 100644
index 0000000..c777f74
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/build/libs/atomic/BUILD.gn
@@ -0,0 +1,14 @@
+config("atomic_config") {
+ visibility = [ ":atomic" ]
+ libs = [ "atomic" ]
+}
+
+group("atomic") {
+ # Needed on platforms that have no native support for 64-bit atomics.
+ # FIXME: Check which platforms need this; certainly needs to be false on
+ # macOS and Windows, and doesn't seem to be needed on Linux either.
+ needs_explicit_lib_atomic = false
+ if (needs_explicit_lib_atomic) {
+ public_configs = [ ":atomic_config" ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/build/libs/xml/BUILD.gn b/src/llvm-project/llvm/utils/gn/build/libs/xml/BUILD.gn
index f3590f4..3af3c85 100644
--- a/src/llvm-project/llvm/utils/gn/build/libs/xml/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/build/libs/xml/BUILD.gn
@@ -3,7 +3,6 @@
config("xml_config") {
visibility = [ ":xml" ]
- defines = [ "LLVM_LIBXML2_ENABLED" ]
libs = [ "xml2" ]
if (host_os == "mac") {
include_dirs = [ "$mac_sdk_path/usr/include/libxml2" ]
diff --git a/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.gni b/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.gni
index 499d2e8..f4f45fd 100644
--- a/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.gni
+++ b/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.gni
@@ -16,9 +16,9 @@
script = "//llvm/utils/gn/build/symlink_or_copy.py"
args = [
"--stamp",
- rebase_path(stamp, root_out_dir),
+ rebase_path(stamp, root_build_dir),
invoker.source,
- rebase_path(invoker.output, root_out_dir),
+ rebase_path(invoker.output, root_build_dir),
]
}
}
diff --git a/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.py b/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.py
index 9841dc9..a8f6c1b 100644
--- a/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.py
+++ b/src/llvm-project/llvm/utils/gn/build/symlink_or_copy.py
@@ -23,6 +23,11 @@
# (which needs to be passed in as an arg), for cross builds.
if sys.platform != 'win32':
try:
+ os.makedirs(os.path.dirname(args.output))
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ try:
os.symlink(args.source, args.output)
except OSError as e:
if e.errno == errno.EEXIST:
diff --git a/src/llvm-project/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/src/llvm-project/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index 21abe7e..fd1e695 100755
--- a/src/llvm-project/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/src/llvm-project/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -15,18 +15,21 @@
import os
import re
import subprocess
+import sys
def sync_source_lists():
- gn_files = subprocess.check_output(
- ['git', 'ls-files', '*BUILD.gn']).splitlines()
+ # Use shell=True on Windows in case git is a bat file.
+ gn_files = subprocess.check_output(['git', 'ls-files', '*BUILD.gn'],
+ shell=os.name == 'nt').splitlines()
# Matches e.g. | "foo.cpp",|, captures |foo| in group 1.
- gn_cpp_re = re.compile(r'^\s*"([^"]+\.(?:cpp|h))",$', re.MULTILINE)
+ gn_cpp_re = re.compile(r'^\s*"([^"]+\.(?:cpp|c|h|S))",$', re.MULTILINE)
# Matches e.g. | foo.cpp|, captures |foo| in group 1.
- cmake_cpp_re = re.compile(r'^\s*([A-Za-z_0-9/-]+\.(?:cpp|h))$',
+ cmake_cpp_re = re.compile(r'^\s*([A-Za-z_0-9./-]+\.(?:cpp|c|h|S))$',
re.MULTILINE)
+ changed = False
for gn_file in gn_files:
# The CMakeLists.txt for llvm/utils/gn/secondary/foo/BUILD.gn is
# directly at foo/CMakeLists.txt.
@@ -46,21 +49,24 @@
if gn_cpp == cmake_cpp:
continue
+ changed = True
print(gn_file)
- add = cmake_cpp - gn_cpp
+ add = sorted(cmake_cpp - gn_cpp)
if add:
print('add:\n' + '\n'.join(' "%s",' % a for a in add))
- remove = gn_cpp - cmake_cpp
+ remove = sorted(gn_cpp - cmake_cpp)
if remove:
print('remove:\n' + '\n'.join(remove))
print()
+ return changed
def sync_unittests():
# Matches e.g. |add_llvm_unittest_with_input_files|.
unittest_re = re.compile(r'^add_\S+_unittest', re.MULTILINE)
- checked = [ 'clang', 'lld', 'llvm' ]
+ checked = [ 'clang', 'clang-tools-extra', 'lld', 'llvm' ]
+ changed = False
for c in checked:
for root, _, _ in os.walk(os.path.join(c, 'unittests')):
cmake_file = os.path.join(root, 'CMakeLists.txt')
@@ -70,13 +76,18 @@
continue # Skip CMake files that just add subdirectories.
gn_file = os.path.join('llvm/utils/gn/secondary', root, 'BUILD.gn')
if not os.path.exists(gn_file):
+ changed = True
print('missing GN file %s for unittest CMake file %s' %
(gn_file, cmake_file))
+ return changed
def main():
- sync_source_lists()
- sync_unittests()
+ src = sync_source_lists()
+ tests = sync_unittests()
+ if src or tests:
+ sys.exit(1)
+
if __name__ == '__main__':
diff --git a/src/llvm-project/llvm/utils/gn/build/toolchain/BUILD.gn b/src/llvm-project/llvm/utils/gn/build/toolchain/BUILD.gn
index 97c64ff..33cde23 100644
--- a/src/llvm-project/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -19,7 +19,7 @@
depsformat = "gcc"
description = "CC {{output}}"
outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o",
]
}
@@ -29,7 +29,7 @@
depsformat = "gcc"
description = "CXX {{output}}"
outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o",
]
}
@@ -39,7 +39,7 @@
depsformat = "gcc"
description = "ASM {{output}}"
outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o",
]
}
@@ -50,7 +50,7 @@
# Remove the output file first so that ar doesn't try to modify the
# existing file.
command =
- "rm -f {{output}} && $ar rcsDT {{arflags}} {{output}} {{inputs}}"
+ "rm -f {{output}} && $ar rcsD {{arflags}} {{output}} {{inputs}}"
}
description = "AR {{output}}"
outputs = [
@@ -113,11 +113,27 @@
default_output_dir = "{{root_out_dir}}/bin"
}
+ copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
tool("copy") {
- command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
+ command = copy_command
description = "COPY {{source}} {{output}}"
}
+ if (current_os == "mac") {
+ tool("copy_bundle_data") {
+ # http://serverfault.com/q/209888/43689
+ _copydir = "mkdir -p {{output}} && cd {{source}} && " +
+ "pax -rwl . \"\$OLDPWD\"/{{output}}"
+ command = "rm -rf {{output}} && if [[ -d {{source}} ]]; then " +
+ _copydir + "; else " + copy_command + "; fi"
+ description = "COPY_BUNDLE_DATA {{source}} {{output}}"
+ }
+ tool("compile_xcassets") {
+ command = "false"
+ description = "The LLVM build doesn't use any xcasset files"
+ }
+ }
+
tool("stamp") {
command = "touch {{output}}"
description = "STAMP {{output}}"
@@ -157,13 +173,17 @@
cc = "bin/clang"
cxx = "bin/clang++"
ld = cxx
- ar = "bin/llvm-ar"
+ if (current_os != "mac") {
+ ar = "bin/llvm-ar"
+ }
deps = [
"//:clang($host_toolchain)",
"//:lld($host_toolchain)",
- "//:llvm-ar($host_toolchain)",
]
+ if (current_os != "mac") {
+ deps += [ "//:llvm-ar($host_toolchain)" ]
+ }
}
}
@@ -171,6 +191,7 @@
toolchain_args = {
current_os = host_os
current_cpu = host_cpu
+ is_clang = true
use_lld = host_os != "mac"
}
}
@@ -180,6 +201,7 @@
toolchain_args = {
current_os = "android"
current_cpu = "arm64"
+ is_clang = true
use_lld = true
}
}
@@ -191,7 +213,9 @@
if (clang_base_path != "") {
cl = "$clang_base_path/bin/clang-cl"
- link = "$clang_base_path/bin/lld-link"
+ if (use_lld) {
+ link = "$clang_base_path/bin/lld-link"
+ }
}
if (use_goma) {
@@ -203,7 +227,7 @@
depsformat = "msvc"
description = "CC {{output}}"
outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+ "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.obj",
]
}
@@ -212,12 +236,12 @@
depsformat = "msvc"
description = "CXX {{output}}"
outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+ "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.obj",
]
}
tool("alink") {
- command = "lib /nologo {{arflags}} /out:{{output}} {{inputs}}"
+ command = "$link /lib /nologo {{arflags}} /out:{{output}} {{inputs}}"
description = "LIB {{output}}"
outputs = [
"{{output_dir}}/{{target_output_name}}.lib",
@@ -226,9 +250,11 @@
}
tool("solink") {
- dllfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
- libfile = "$dllfile.lib"
- command = "$link /nologo /dll {{ldflags}} /out:$dllfile /implib:$libfile {{libs}} /pdb:$dllfile.pdb {{inputs}}"
+ outprefix = "{{output_dir}}/{{target_output_name}}"
+ dllfile = "$outprefix{{output_extension}}"
+ libfile = "$outprefix.lib"
+ pdbfile = "$outprefix.pdb"
+ command = "$link /nologo /dll {{ldflags}} /out:$dllfile /implib:$libfile /pdb:$pdbfile {{libs}} {{inputs}}"
description = "LINK $dllfile"
link_output = libfile
depend_output = libfile
@@ -251,8 +277,10 @@
# standalone loadable modules used for unit-testing LLVM's dynamic library
# loading code.
tool("solink_module") {
- dllfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
- command = "$link /nologo /dll {{ldflags}} /out:$dllfile {{libs}} /pdb:$dllfile.pdb {{inputs}}"
+ outprefix = "{{output_dir}}/{{target_output_name}}"
+ dllfile = "$outprefix{{output_extension}}"
+ pdbfile = "$outprefix.pdb"
+ command = "$link /nologo /dll {{ldflags}} /out:$dllfile /pdb:$pdbfile {{libs}} {{inputs}}"
description = "LINK_MODULE $dllfile"
outputs = [
dllfile,
@@ -264,8 +292,10 @@
}
tool("link") {
- outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
- command = "$link /nologo {{ldflags}} /out:$outfile {{libs}} /pdb:$outfile.pdb {{inputs}}"
+ outprefix = "{{output_dir}}/{{target_output_name}}"
+ outfile = "$outprefix{{output_extension}}"
+ pdbfile = "$outprefix.pdb"
+ command = "$link /nologo {{ldflags}} /out:$outfile /pdb:$pdbfile {{libs}} {{inputs}}"
description = "LINK $outfile"
outputs = [
outfile,
diff --git a/src/llvm-project/llvm/utils/gn/build/toolchain/compiler.gni b/src/llvm-project/llvm/utils/gn/build/toolchain/compiler.gni
index 3c419fb..37ad1f5 100644
--- a/src/llvm-project/llvm/utils/gn/build/toolchain/compiler.gni
+++ b/src/llvm-project/llvm/utils/gn/build/toolchain/compiler.gni
@@ -10,7 +10,7 @@
# Example value: getenv("HOME") + "/src/llvm-build/Release+Asserts"
clang_base_path = ""
- # Set this to the path to Android NDK r18b. If set, cross compilation targeting
+ # Set this to the path to Android NDK r19. If set, cross compilation targeting
# Android will be enabled.
android_ndk_path = ""
}
diff --git a/src/llvm-project/llvm/utils/gn/build/toolchain/target_flags.gni b/src/llvm-project/llvm/utils/gn/build/toolchain/target_flags.gni
index 6b6373a..e1c045f 100644
--- a/src/llvm-project/llvm/utils/gn/build/toolchain/target_flags.gni
+++ b/src/llvm-project/llvm/utils/gn/build/toolchain/target_flags.gni
@@ -2,33 +2,17 @@
import("//llvm/utils/gn/build/toolchain/compiler.gni")
target_flags = []
-target_cflags = []
target_ldflags = []
if (current_os == "android") {
- assert(current_cpu == "arm64", "current_cpu not supported")
-
- libcxx_path = "$android_ndk_path/sources/cxx-stl/llvm-libc++"
- platform_lib_path =
- "$android_ndk_path/platforms/android-21/arch-arm64/usr/lib"
- libgcc_path = "$android_ndk_path/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x"
-
target_flags += [
"--target=$llvm_current_triple",
- "--sysroot=$android_ndk_path/sysroot",
+ "--sysroot=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
+ "-B$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
]
- target_cflags += [
- "-isystem",
- "$libcxx_path/include",
- ]
- target_ldflags += [
- "-B$platform_lib_path",
- "-L$platform_lib_path",
- "-L$libgcc_path",
- ]
- target_ldflags += [
- "-nostdlib++",
- "-L$libcxx_path/libs/arm64-v8a",
- "-l:libc++.a.21",
- ]
+ target_ldflags += [ "-static-libstdc++" ]
+}
+
+if (current_cpu == "x86") {
+ target_flags = [ "-m32" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/build/write_cmake_config.py b/src/llvm-project/llvm/utils/gn/build/write_cmake_config.py
index eba6b4e..d574352 100755
--- a/src/llvm-project/llvm/utils/gn/build/write_cmake_config.py
+++ b/src/llvm-project/llvm/utils/gn/build/write_cmake_config.py
@@ -96,7 +96,10 @@
leftovers = var_re.findall(output)
if leftovers:
- print('unprocessed values:\n', '\n'.join(leftovers), file=sys.stderr)
+ print(
+ 'unprocessed values:\n',
+ '\n'.join([x[0] or x[1] for x in leftovers]),
+ file=sys.stderr)
return 1
if not os.path.exists(args.output) or open(args.output).read() != output:
diff --git a/src/llvm-project/llvm/utils/gn/build/write_vcsrevision.py b/src/llvm-project/llvm/utils/gn/build/write_vcsrevision.py
index 974004d..5bdca23 100755
--- a/src/llvm-project/llvm/utils/gn/build/write_vcsrevision.py
+++ b/src/llvm-project/llvm/utils/gn/build/write_vcsrevision.py
@@ -47,7 +47,7 @@
use_shell = True
git_dir = subprocess.check_output([git, 'rev-parse', '--git-dir'],
- cwd=LLVM_DIR, shell=use_shell).strip()
+ cwd=LLVM_DIR, shell=use_shell).decode().strip()
if not os.path.isdir(git_dir):
print('.git dir not found at "%s"' % git_dir, file=sys.stderr)
return 1
diff --git a/src/llvm-project/llvm/utils/gn/get.py b/src/llvm-project/llvm/utils/gn/get.py
new file mode 100755
index 0000000..c39649d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/get.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+"""Downloads a prebuilt gn binary to a place where gn.py can find it."""
+
+from __future__ import print_function
+
+import io
+import os
+import urllib2
+import sys
+import zipfile
+
+
+def download_and_unpack(url, output_dir, gn):
+ """Download an archive from url and extract gn from it into output_dir."""
+ print('downloading %s ...' % url, end='')
+ sys.stdout.flush()
+ data = urllib2.urlopen(url).read()
+ print(' done')
+ zipfile.ZipFile(io.BytesIO(data)).extract(gn, path=output_dir)
+
+
+def set_executable_bit(path):
+ mode = os.stat(path).st_mode
+ mode |= (mode & 0o444) >> 2 # Copy R bits to X.
+ os.chmod(path, mode) # No-op on Windows.
+
+
+def get_platform():
+ import platform
+ if platform.machine() not in ('AMD64', 'x86_64'):
+ return None
+ if sys.platform.startswith('linux'):
+ return 'linux-amd64'
+ if sys.platform == 'darwin':
+ return 'mac-amd64'
+ if sys.platform == 'win32':
+ return 'windows-amd64'
+
+
+def main():
+ platform = get_platform()
+ if not platform:
+ print('no prebuilt binary for', sys.platform)
+ return 1
+
+ dirname = os.path.join(os.path.dirname(__file__), 'bin', platform)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
+ url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/%s/+/latest'
+ gn = 'gn' + ('.exe' if sys.platform == 'win32' else '')
+ download_and_unpack(url % platform, dirname, gn)
+ set_executable_bit(os.path.join(dirname, gn))
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/src/llvm-project/llvm/utils/gn/gn.py b/src/llvm-project/llvm/utils/gn/gn.py
index f80873b..a6408ec 100755
--- a/src/llvm-project/llvm/utils/gn/gn.py
+++ b/src/llvm-project/llvm/utils/gn/gn.py
@@ -15,10 +15,40 @@
ROOT_DIR = os.path.join(THIS_DIR, '..', '..', '..')
+def get_platform():
+ import platform
+ if platform.machine() not in ('AMD64', 'x86_64'):
+ return None
+ if sys.platform.startswith('linux'):
+ return 'linux-amd64'
+ if sys.platform == 'darwin':
+ return 'mac-amd64'
+ if sys.platform == 'win32':
+ return 'windows-amd64'
+
+
+def print_no_gn(mention_get):
+ print('gn binary not found in PATH')
+ if mention_get:
+ print('run llvm/utils/gn/get.py to download a binary and try again, or')
+ print('follow https://gn.googlesource.com/gn/#getting-started')
+ return 1
+
+
def main():
- # Find real gn executable. For now, just assume it's on PATH.
- # FIXME: Probably need to append '.exe' on Windows.
+ # Find real gn executable.
gn = 'gn'
+ if subprocess.call('gn --version', stdout=open(os.devnull, 'w'),
+ stderr=subprocess.STDOUT,
+ shell=True) != 0:
+ # Not on path. See if get.py downloaded a prebuilt binary and run that
+ # if it's there, or suggest to run get.py if it isn't.
+ platform = get_platform()
+ if not platform:
+ return print_no_gn(mention_get=False)
+ gn = os.path.join(os.path.dirname(__file__), 'bin', platform, 'gn')
+ if not os.path.exists(gn + ('.exe' if sys.platform == 'win32' else '')):
+ return print_no_gn(mention_get=True)
# Compute --dotfile= and --root= args to add.
extra_args = []
diff --git a/src/llvm-project/llvm/utils/gn/secondary/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/BUILD.gn
index b8b748b..aa0c6b8 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/BUILD.gn
@@ -4,11 +4,23 @@
group("default") {
deps = [
+ "//clang-tools-extra/clangd/test",
+ "//clang-tools-extra/test",
"//clang/test",
- "//compiler-rt/test/hwasan",
"//lld/test",
"//llvm/test",
]
+ if (current_os == "linux") {
+ deps += [
+ "//compiler-rt",
+ "//libcxx",
+ "//libcxxabi",
+ "//libunwind",
+ ]
+ }
+ if (current_os == "linux" || current_os == "android") {
+ deps += [ "//compiler-rt/test/hwasan" ]
+ }
testonly = true
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/BUILD.gn
new file mode 100644
index 0000000..46dc488
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/BUILD.gn
@@ -0,0 +1,16 @@
+static_library("clang-apply-replacements") {
+ output_name = "clangApplyReplacements"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Refactoring",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "include" ]
+ sources = [
+ "lib/Tooling/ApplyReplacements.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/tool/BUILD.gn
new file mode 100644
index 0000000..06d2f39
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-apply-replacements/tool/BUILD.gn
@@ -0,0 +1,16 @@
+executable("clang-apply-replacements") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-apply-replacements",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Refactoring",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "../include" ]
+ sources = [
+ "ClangApplyReplacementsMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/BUILD.gn
new file mode 100644
index 0000000..70769f1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/BUILD.gn
@@ -0,0 +1,19 @@
+static_library("clang-change-namespace") {
+ output_name = "clangChangeNamespace"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ChangeNamespace.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/tool/BUILD.gn
new file mode 100644
index 0000000..5938e1a
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-change-namespace/tool/BUILD.gn
@@ -0,0 +1,19 @@
+executable("clang-change-namespace") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-change-namespace",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangChangeNamespace.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/BUILD.gn
new file mode 100644
index 0000000..d45155c2d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/BUILD.gn
@@ -0,0 +1,30 @@
+static_library("clang-doc") {
+ output_name = "clangDoc"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Bitcode/Reader",
+ "//llvm/lib/Bitcode/Writer",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "BitcodeReader.cpp",
+ "BitcodeWriter.cpp",
+ "ClangDoc.cpp",
+ "Generators.cpp",
+ "HTMLGenerator.cpp",
+ "MDGenerator.cpp",
+ "Mapper.cpp",
+ "Representation.cpp",
+ "Serialize.cpp",
+ "YAMLGenerator.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/tool/BUILD.gn
new file mode 100644
index 0000000..263f42f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-doc/tool/BUILD.gn
@@ -0,0 +1,16 @@
+executable("clang-doc") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-doc",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangDocMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/BUILD.gn
new file mode 100644
index 0000000..22be333
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/BUILD.gn
@@ -0,0 +1,26 @@
+static_library("clang-include-fixer") {
+ output_name = "clangIncludeFixer"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Parse",
+ "//clang/lib/Sema",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "FuzzySymbolIndex.cpp",
+ "InMemorySymbolIndex.cpp",
+ "IncludeFixer.cpp",
+ "IncludeFixerContext.cpp",
+ "SymbolIndexManager.cpp",
+ "YamlSymbolIndex.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/BUILD.gn
new file mode 100644
index 0000000..82aa2b1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/BUILD.gn
@@ -0,0 +1,23 @@
+static_library("find-all-symbols") {
+ output_name = "findAllSymbols"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "FindAllMacros.cpp",
+ "FindAllSymbols.cpp",
+ "FindAllSymbolsAction.cpp",
+ "HeaderMapCollector.cpp",
+ "PathConfig.cpp",
+ "PragmaCommentHandler.cpp",
+ "STLPostfixHeaderMap.cpp",
+ "SymbolInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/BUILD.gn
new file mode 100644
index 0000000..cca7116
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/BUILD.gn
@@ -0,0 +1,17 @@
+executable("find-all-symbols") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "FindAllSymbolsMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn
new file mode 100644
index 0000000..ce46175
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn
@@ -0,0 +1,18 @@
+static_library("plugin") {
+ output_name = "clangIncludeFixerPlugin"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Parse",
+ "//clang/lib/Sema",
+ "//clang/lib/Tooling",
+ "//llvm/utils/gn/build/libs/pthread",
+ ]
+
+ sources = [
+ "IncludeFixerPlugin.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/tool/BUILD.gn
new file mode 100644
index 0000000..01b0861
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/tool/BUILD.gn
@@ -0,0 +1,18 @@
+executable("clang-include-fixer") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer",
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangIncludeFixer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/BUILD.gn
new file mode 100644
index 0000000..65cc327
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/BUILD.gn
@@ -0,0 +1,21 @@
+static_library("clang-move") {
+ output_name = "clangMove"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "HelperDeclRefGraph.cpp",
+ "Move.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/tool/BUILD.gn
new file mode 100644
index 0000000..505462c
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-move/tool/BUILD.gn
@@ -0,0 +1,19 @@
+executable("clang-move") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-move",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangMove.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/BUILD.gn
new file mode 100644
index 0000000..45212b4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/BUILD.gn
@@ -0,0 +1,18 @@
+static_library("clang-query") {
+ output_name = "clangQuery"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/ASTMatchers/Dynamic",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Serialization",
+ "//llvm/lib/LineEditor",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "Query.cpp",
+ "QueryParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/tool/BUILD.gn
new file mode 100644
index 0000000..9d0497c
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-query/tool/BUILD.gn
@@ -0,0 +1,17 @@
+executable("clang-query") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-query",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/ASTMatchers/Dynamic",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangQuery.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/BUILD.gn
new file mode 100644
index 0000000..bb6e0ad
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/BUILD.gn
@@ -0,0 +1,17 @@
+static_library("clang-reorder-fields") {
+ output_name = "clangReorderFields"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ReorderFieldsAction.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/tool/BUILD.gn
new file mode 100644
index 0000000..405dcaa
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-reorder-fields/tool/BUILD.gn
@@ -0,0 +1,15 @@
+executable("clang-reorder-fields") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-reorder-fields",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ ]
+ sources = [
+ "ClangReorderFields.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/BUILD.gn
new file mode 100644
index 0000000..415e0fc
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/BUILD.gn
@@ -0,0 +1,38 @@
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+
+static_library("clang-tidy") {
+ output_name = "clangTidy"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/include/clang/StaticAnalyzer/Checkers",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Sema",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+
+ if (clang_enable_static_analyzer) {
+ deps += [
+ "//clang/lib/StaticAnalyzer/Core",
+ "//clang/lib/StaticAnalyzer/Frontend",
+ ]
+ }
+
+ sources = [
+ "ClangTidy.cpp",
+ "ClangTidyCheck.cpp",
+ "ClangTidyDiagnosticConsumer.cpp",
+ "ClangTidyModule.cpp",
+ "ClangTidyOptions.cpp",
+ "ClangTidyProfiling.cpp",
+ "ExpandModularHeadersPPCallbacks.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/abseil/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/abseil/BUILD.gn
new file mode 100644
index 0000000..febcc08
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/abseil/BUILD.gn
@@ -0,0 +1,35 @@
+static_library("abseil") {
+ output_name = "clangTidyAbseilModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AbseilTidyModule.cpp",
+ "DurationAdditionCheck.cpp",
+ "DurationComparisonCheck.cpp",
+ "DurationConversionCastCheck.cpp",
+ "DurationDivisionCheck.cpp",
+ "DurationFactoryFloatCheck.cpp",
+ "DurationFactoryScaleCheck.cpp",
+ "DurationRewriter.cpp",
+ "DurationSubtractionCheck.cpp",
+ "DurationUnnecessaryConversionCheck.cpp",
+ "FasterStrsplitDelimiterCheck.cpp",
+ "NoInternalDependenciesCheck.cpp",
+ "NoNamespaceCheck.cpp",
+ "RedundantStrcatCallsCheck.cpp",
+ "StrCatAppendCheck.cpp",
+ "StringFindStartswithCheck.cpp",
+ "TimeComparisonCheck.cpp",
+ "TimeSubtractionCheck.cpp",
+ "UpgradeDurationConversionsCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/android/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/android/BUILD.gn
new file mode 100644
index 0000000..5a29393
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/android/BUILD.gn
@@ -0,0 +1,32 @@
+static_library("android") {
+ output_name = "clangTidyAndroidModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AndroidTidyModule.cpp",
+ "CloexecAccept4Check.cpp",
+ "CloexecAcceptCheck.cpp",
+ "CloexecCheck.cpp",
+ "CloexecCreatCheck.cpp",
+ "CloexecDupCheck.cpp",
+ "CloexecEpollCreate1Check.cpp",
+ "CloexecEpollCreateCheck.cpp",
+ "CloexecFopenCheck.cpp",
+ "CloexecInotifyInit1Check.cpp",
+ "CloexecInotifyInitCheck.cpp",
+ "CloexecMemfdCreateCheck.cpp",
+ "CloexecOpenCheck.cpp",
+ "CloexecPipe2Check.cpp",
+ "CloexecPipeCheck.cpp",
+ "CloexecSocketCheck.cpp",
+ "ComparisonInTempFailureRetryCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/boost/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/boost/BUILD.gn
new file mode 100644
index 0000000..c7f9e04
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/boost/BUILD.gn
@@ -0,0 +1,17 @@
+static_library("boost") {
+ output_name = "clangTidyBoostModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "BoostTidyModule.cpp",
+ "UseToStringCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/bugprone/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/bugprone/BUILD.gn
new file mode 100644
index 0000000..a51645d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/bugprone/BUILD.gn
@@ -0,0 +1,62 @@
+static_library("bugprone") {
+ output_name = "clangTidyBugproneModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/cppcoreguidelines",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ArgumentCommentCheck.cpp",
+ "AssertSideEffectCheck.cpp",
+ "BoolPointerImplicitConversionCheck.cpp",
+ "BranchCloneCheck.cpp",
+ "BugproneTidyModule.cpp",
+ "CopyConstructorInitCheck.cpp",
+ "DanglingHandleCheck.cpp",
+ "ExceptionEscapeCheck.cpp",
+ "FoldInitTypeCheck.cpp",
+ "ForwardDeclarationNamespaceCheck.cpp",
+ "ForwardingReferenceOverloadCheck.cpp",
+ "InaccurateEraseCheck.cpp",
+ "IncorrectRoundingsCheck.cpp",
+ "IntegerDivisionCheck.cpp",
+ "LambdaFunctionNameCheck.cpp",
+ "MacroParenthesesCheck.cpp",
+ "MacroRepeatedSideEffectsCheck.cpp",
+ "MisplacedOperatorInStrlenInAllocCheck.cpp",
+ "MisplacedWideningCastCheck.cpp",
+ "MoveForwardingReferenceCheck.cpp",
+ "MultipleStatementMacroCheck.cpp",
+ "ParentVirtualCallCheck.cpp",
+ "PosixReturnCheck.cpp",
+ "SizeofContainerCheck.cpp",
+ "SizeofExpressionCheck.cpp",
+ "StringConstructorCheck.cpp",
+ "StringIntegerAssignmentCheck.cpp",
+ "StringLiteralWithEmbeddedNulCheck.cpp",
+ "SuspiciousEnumUsageCheck.cpp",
+ "SuspiciousMemsetUsageCheck.cpp",
+ "SuspiciousMissingCommaCheck.cpp",
+ "SuspiciousSemicolonCheck.cpp",
+ "SuspiciousStringCompareCheck.cpp",
+ "SwappedArgumentsCheck.cpp",
+ "TerminatingContinueCheck.cpp",
+ "ThrowKeywordMissingCheck.cpp",
+ "TooSmallLoopVariableCheck.cpp",
+ "UndefinedMemoryManipulationCheck.cpp",
+ "UndelegatedConstructorCheck.cpp",
+ "UnhandledSelfAssignmentCheck.cpp",
+ "UnusedRaiiCheck.cpp",
+ "UnusedReturnValueCheck.cpp",
+ "UseAfterMoveCheck.cpp",
+ "VirtualNearMissCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cert/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cert/BUILD.gn
new file mode 100644
index 0000000..bd2ac48
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cert/BUILD.gn
@@ -0,0 +1,31 @@
+static_library("cert") {
+ output_name = "clangTidyCERTModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/performance",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "CERTTidyModule.cpp",
+ "CommandProcessorCheck.cpp",
+ "DontModifyStdNamespaceCheck.cpp",
+ "FloatLoopCounter.cpp",
+ "LimitedRandomnessCheck.cpp",
+ "PostfixOperatorCheck.cpp",
+ "ProperlySeededRandomGeneratorCheck.cpp",
+ "SetLongJmpCheck.cpp",
+ "StaticObjectExceptionCheck.cpp",
+ "StrToNumCheck.cpp",
+ "ThrownExceptionTypeCheck.cpp",
+ "VariadicFunctionDefCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cppcoreguidelines/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cppcoreguidelines/BUILD.gn
new file mode 100644
index 0000000..a467d49
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/cppcoreguidelines/BUILD.gn
@@ -0,0 +1,39 @@
+static_library("cppcoreguidelines") {
+ output_name = "clangTidyCppCoreGuidelinesModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/modernize",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AvoidGotoCheck.cpp",
+ "CppCoreGuidelinesTidyModule.cpp",
+ "InterfacesGlobalInitCheck.cpp",
+ "MacroUsageCheck.cpp",
+ "NarrowingConversionsCheck.cpp",
+ "NoMallocCheck.cpp",
+ "OwningMemoryCheck.cpp",
+ "ProBoundsArrayToPointerDecayCheck.cpp",
+ "ProBoundsConstantArrayIndexCheck.cpp",
+ "ProBoundsPointerArithmeticCheck.cpp",
+ "ProTypeConstCastCheck.cpp",
+ "ProTypeCstyleCastCheck.cpp",
+ "ProTypeMemberInitCheck.cpp",
+ "ProTypeReinterpretCastCheck.cpp",
+ "ProTypeStaticCastDowncastCheck.cpp",
+ "ProTypeUnionAccessCheck.cpp",
+ "ProTypeVarargCheck.cpp",
+ "SlicingCheck.cpp",
+ "SpecialMemberFunctionsCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/fuchsia/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/fuchsia/BUILD.gn
new file mode 100644
index 0000000..e10b606
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/fuchsia/BUILD.gn
@@ -0,0 +1,25 @@
+static_library("fuchsia") {
+ output_name = "clangTidyFuchsiaModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "DefaultArgumentsCallsCheck.cpp",
+ "DefaultArgumentsDeclarationsCheck.cpp",
+ "FuchsiaTidyModule.cpp",
+ "MultipleInheritanceCheck.cpp",
+ "OverloadedOperatorCheck.cpp",
+ "RestrictSystemIncludesCheck.cpp",
+ "StaticallyConstructedObjectsCheck.cpp",
+ "TrailingReturnCheck.cpp",
+ "VirtualInheritanceCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/google/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/google/BUILD.gn
new file mode 100644
index 0000000..2efa42a
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/google/BUILD.gn
@@ -0,0 +1,33 @@
+static_library("google") {
+ output_name = "clangTidyGoogleModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AvoidCStyleCastsCheck.cpp",
+ "AvoidNSObjectNewCheck.cpp",
+ "AvoidThrowingObjCExceptionCheck.cpp",
+ "AvoidUnderscoreInGoogletestNameCheck.cpp",
+ "DefaultArgumentsCheck.cpp",
+ "ExplicitConstructorCheck.cpp",
+ "ExplicitMakePairCheck.cpp",
+ "FunctionNamingCheck.cpp",
+ "GlobalNamesInHeadersCheck.cpp",
+ "GlobalVariableDeclarationCheck.cpp",
+ "GoogleTidyModule.cpp",
+ "IntegerTypesCheck.cpp",
+ "NonConstReferences.cpp",
+ "OverloadedUnaryAndCheck.cpp",
+ "TodoCommentCheck.cpp",
+ "UnnamedNamespaceInHeaderCheck.cpp",
+ "UsingNamespaceDirectiveCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/hicpp/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/hicpp/BUILD.gn
new file mode 100644
index 0000000..cd886d8
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/hicpp/BUILD.gn
@@ -0,0 +1,28 @@
+static_library("hicpp") {
+ output_name = "clangTidyHICPPModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/bugprone",
+ "//clang-tools-extra/clang-tidy/cppcoreguidelines",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/modernize",
+ "//clang-tools-extra/clang-tidy/performance",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ExceptionBaseclassCheck.cpp",
+ "HICPPTidyModule.cpp",
+ "MultiwayPathsCoveredCheck.cpp",
+ "NoAssemblerCheck.cpp",
+ "SignedBitwiseCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/llvm/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/llvm/BUILD.gn
new file mode 100644
index 0000000..d2d24a5
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/llvm/BUILD.gn
@@ -0,0 +1,22 @@
+static_library("llvm") {
+ output_name = "clangTidyLLVMModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "HeaderGuardCheck.cpp",
+ "IncludeOrderCheck.cpp",
+ "LLVMTidyModule.cpp",
+ "PreferIsaOrDynCastInConditionalsCheck.cpp",
+ "TwineLocalCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/misc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/misc/BUILD.gn
new file mode 100644
index 0000000..a7a1abd
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/misc/BUILD.gn
@@ -0,0 +1,32 @@
+static_library("misc") {
+ output_name = "clangTidyMiscModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "DefinitionsInHeadersCheck.cpp",
+ "MiscTidyModule.cpp",
+ "MisplacedConstCheck.cpp",
+ "NewDeleteOverloadsCheck.cpp",
+ "NonCopyableObjects.cpp",
+ "NonPrivateMemberVariablesInClassesCheck.cpp",
+ "RedundantExpressionCheck.cpp",
+ "StaticAssertCheck.cpp",
+ "ThrowByValueCatchByReferenceCheck.cpp",
+ "UnconventionalAssignOperatorCheck.cpp",
+ "UniqueptrResetReleaseCheck.cpp",
+ "UnusedAliasDeclsCheck.cpp",
+ "UnusedParametersCheck.cpp",
+ "UnusedUsingDeclsCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/modernize/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/modernize/BUILD.gn
new file mode 100644
index 0000000..a145b52
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/modernize/BUILD.gn
@@ -0,0 +1,50 @@
+static_library("modernize") {
+ output_name = "clangTidyModernizeModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AvoidBindCheck.cpp",
+ "AvoidCArraysCheck.cpp",
+ "ConcatNestedNamespacesCheck.cpp",
+ "DeprecatedHeadersCheck.cpp",
+ "DeprecatedIosBaseAliasesCheck.cpp",
+ "LoopConvertCheck.cpp",
+ "LoopConvertUtils.cpp",
+ "MakeSharedCheck.cpp",
+ "MakeSmartPtrCheck.cpp",
+ "MakeUniqueCheck.cpp",
+ "ModernizeTidyModule.cpp",
+ "PassByValueCheck.cpp",
+ "RawStringLiteralCheck.cpp",
+ "RedundantVoidArgCheck.cpp",
+ "ReplaceAutoPtrCheck.cpp",
+ "ReplaceRandomShuffleCheck.cpp",
+ "ReturnBracedInitListCheck.cpp",
+ "ShrinkToFitCheck.cpp",
+ "UnaryStaticAssertCheck.cpp",
+ "UseAutoCheck.cpp",
+ "UseBoolLiteralsCheck.cpp",
+ "UseDefaultMemberInitCheck.cpp",
+ "UseEmplaceCheck.cpp",
+ "UseEqualsDefaultCheck.cpp",
+ "UseEqualsDeleteCheck.cpp",
+ "UseNodiscardCheck.cpp",
+ "UseNoexceptCheck.cpp",
+ "UseNullptrCheck.cpp",
+ "UseOverrideCheck.cpp",
+ "UseTrailingReturnTypeCheck.cpp",
+ "UseTransparentFunctorsCheck.cpp",
+ "UseUncaughtExceptionsCheck.cpp",
+ "UseUsingCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/mpi/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/mpi/BUILD.gn
new file mode 100644
index 0000000..876a537
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/mpi/BUILD.gn
@@ -0,0 +1,21 @@
+static_library("mpi") {
+ output_name = "clangTidyMPIModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/StaticAnalyzer/Checkers",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "BufferDerefCheck.cpp",
+ "MPITidyModule.cpp",
+ "TypeMismatchCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/objc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/objc/BUILD.gn
new file mode 100644
index 0000000..714a4a1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/objc/BUILD.gn
@@ -0,0 +1,21 @@
+static_library("objc") {
+ output_name = "clangTidyObjCModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AvoidNSErrorInitCheck.cpp",
+ "AvoidSpinlockCheck.cpp",
+ "ForbiddenSubclassingCheck.cpp",
+ "ObjCTidyModule.cpp",
+ "PropertyDeclarationCheck.cpp",
+ "SuperSelfCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/openmp/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/openmp/BUILD.gn
new file mode 100644
index 0000000..db93691
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/openmp/BUILD.gn
@@ -0,0 +1,18 @@
+static_library("openmp") {
+ output_name = "clangTidyOpenMPModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ExceptionEscapeCheck.cpp",
+ "OpenMPTidyModule.cpp",
+ "UseDefaultNoneCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/performance/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/performance/BUILD.gn
new file mode 100644
index 0000000..a8c7475
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/performance/BUILD.gn
@@ -0,0 +1,29 @@
+static_library("performance") {
+ output_name = "clangTidyPerformanceModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Analysis",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "FasterStringFindCheck.cpp",
+ "ForRangeCopyCheck.cpp",
+ "ImplicitConversionInLoopCheck.cpp",
+ "InefficientAlgorithmCheck.cpp",
+ "InefficientStringConcatenationCheck.cpp",
+ "InefficientVectorOperationCheck.cpp",
+ "MoveConstArgCheck.cpp",
+ "MoveConstructorInitCheck.cpp",
+ "NoexceptMoveConstructorCheck.cpp",
+ "PerformanceTidyModule.cpp",
+ "TypePromotionInMathFnCheck.cpp",
+ "UnnecessaryCopyInitialization.cpp",
+ "UnnecessaryValueParamCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn
new file mode 100644
index 0000000..ec6d4ce
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn
@@ -0,0 +1,41 @@
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+
+static_library("plugin") {
+ output_name = "clangTidyPlugin"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/abseil",
+ "//clang-tools-extra/clang-tidy/android",
+ "//clang-tools-extra/clang-tidy/boost",
+ "//clang-tools-extra/clang-tidy/bugprone",
+ "//clang-tools-extra/clang-tidy/cert",
+ "//clang-tools-extra/clang-tidy/cppcoreguidelines",
+ "//clang-tools-extra/clang-tidy/fuchsia",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/hicpp",
+ "//clang-tools-extra/clang-tidy/llvm",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/modernize",
+ "//clang-tools-extra/clang-tidy/objc",
+ "//clang-tools-extra/clang-tidy/openmp",
+ "//clang-tools-extra/clang-tidy/performance",
+ "//clang-tools-extra/clang-tidy/portability",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/zircon",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Sema",
+ "//clang/lib/Tooling",
+ ]
+
+ if (clang_enable_static_analyzer) {
+ deps += [ "//clang-tools-extra/clang-tidy/mpi" ]
+ }
+
+ sources = [
+ "ClangTidyPlugin.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/portability/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/portability/BUILD.gn
new file mode 100644
index 0000000..480b719
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/portability/BUILD.gn
@@ -0,0 +1,18 @@
+static_library("portability") {
+ output_name = "clangTidyPortabilityModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "PortabilityTidyModule.cpp",
+ "SIMDIntrinsicsCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/readability/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/readability/BUILD.gn
new file mode 100644
index 0000000..b82db70
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/readability/BUILD.gn
@@ -0,0 +1,51 @@
+static_library("readability") {
+ output_name = "clangTidyReadabilityModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "AvoidConstParamsInDecls.cpp",
+ "BracesAroundStatementsCheck.cpp",
+ "ConstReturnTypeCheck.cpp",
+ "ContainerSizeEmptyCheck.cpp",
+ "ConvertMemberFunctionsToStatic.cpp",
+ "DeleteNullPointerCheck.cpp",
+ "DeletedDefaultCheck.cpp",
+ "ElseAfterReturnCheck.cpp",
+ "FunctionSizeCheck.cpp",
+ "IdentifierNamingCheck.cpp",
+ "ImplicitBoolConversionCheck.cpp",
+ "InconsistentDeclarationParameterNameCheck.cpp",
+ "IsolateDeclarationCheck.cpp",
+ "MagicNumbersCheck.cpp",
+ "MisleadingIndentationCheck.cpp",
+ "MisplacedArrayIndexCheck.cpp",
+ "NamedParameterCheck.cpp",
+ "NamespaceCommentCheck.cpp",
+ "NonConstParameterCheck.cpp",
+ "ReadabilityTidyModule.cpp",
+ "RedundantControlFlowCheck.cpp",
+ "RedundantDeclarationCheck.cpp",
+ "RedundantFunctionPtrDereferenceCheck.cpp",
+ "RedundantMemberInitCheck.cpp",
+ "RedundantPreprocessorCheck.cpp",
+ "RedundantSmartptrGetCheck.cpp",
+ "RedundantStringCStrCheck.cpp",
+ "RedundantStringInitCheck.cpp",
+ "SimplifyBooleanExprCheck.cpp",
+ "SimplifySubscriptExprCheck.cpp",
+ "StaticAccessedThroughInstanceCheck.cpp",
+ "StaticDefinitionInAnonymousNamespaceCheck.cpp",
+ "StringCompareCheck.cpp",
+ "UniqueptrDeleteReleaseCheck.cpp",
+ "UppercaseLiteralSuffixCheck.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/tool/BUILD.gn
new file mode 100644
index 0000000..a5f7af4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/tool/BUILD.gn
@@ -0,0 +1,41 @@
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+
+executable("clang-tidy") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/abseil",
+ "//clang-tools-extra/clang-tidy/android",
+ "//clang-tools-extra/clang-tidy/boost",
+ "//clang-tools-extra/clang-tidy/bugprone",
+ "//clang-tools-extra/clang-tidy/cert",
+ "//clang-tools-extra/clang-tidy/cppcoreguidelines",
+ "//clang-tools-extra/clang-tidy/fuchsia",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/hicpp",
+ "//clang-tools-extra/clang-tidy/llvm",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/modernize",
+ "//clang-tools-extra/clang-tidy/objc",
+ "//clang-tools-extra/clang-tidy/openmp",
+ "//clang-tools-extra/clang-tidy/performance",
+ "//clang-tools-extra/clang-tidy/portability",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/zircon",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:AllTargetsAsmParsers",
+ "//llvm/lib/Target:AllTargetsDescs",
+ "//llvm/lib/Target:AllTargetsInfos",
+ ]
+ if (clang_enable_static_analyzer) {
+ deps += [ "//clang-tools-extra/clang-tidy/mpi" ]
+ }
+ sources = [
+ "ClangTidyMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/utils/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/utils/BUILD.gn
new file mode 100644
index 0000000..2deb475
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/utils/BUILD.gn
@@ -0,0 +1,30 @@
+static_library("utils") {
+ output_name = "clangTidyUtils"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling/Refactoring",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ASTUtils.cpp",
+ "DeclRefExprUtils.cpp",
+ "ExceptionAnalyzer.cpp",
+ "ExprSequence.cpp",
+ "FixItHintUtils.cpp",
+ "HeaderFileExtensionsUtils.cpp",
+ "HeaderGuard.cpp",
+ "IncludeInserter.cpp",
+ "IncludeSorter.cpp",
+ "LexerUtils.cpp",
+ "NamespaceAliaser.cpp",
+ "OptionsUtils.cpp",
+ "TransformerClangTidyCheck.cpp",
+ "TypeTraits.cpp",
+ "UsingInserter.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/zircon/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/zircon/BUILD.gn
new file mode 100644
index 0000000..c349414
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/zircon/BUILD.gn
@@ -0,0 +1,17 @@
+static_library("zircon") {
+ output_name = "clangTidyZirconModule"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "TemporaryObjectsCheck.cpp",
+ "ZirconTidyModule.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn
new file mode 100644
index 0000000..44ebf40
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn
@@ -0,0 +1,134 @@
+import("//clang-tools-extra/clangd/xpc/enable.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+
+config("features_config") {
+ # To pick up the generated inc files.
+ include_dirs = [ target_gen_dir ]
+ visibility = [ ":features" ]
+}
+
+write_cmake_config("features") {
+ input = "Features.inc.in"
+ output = "$target_gen_dir/Features.inc"
+ values = []
+ if (clangd_build_xpc) {
+ values += [ "CLANGD_BUILD_XPC=1" ]
+ } else {
+ values += [ "CLANGD_BUILD_XPC=0" ]
+ }
+ public_configs = [ ":features_config" ]
+}
+
+static_library("clangd") {
+ output_name = "clangDaemon"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ ":features",
+ "//clang-tools-extra/clang-tidy/abseil",
+ "//clang-tools-extra/clang-tidy/android",
+ "//clang-tools-extra/clang-tidy/boost",
+ "//clang-tools-extra/clang-tidy/bugprone",
+ "//clang-tools-extra/clang-tidy/cert",
+ "//clang-tools-extra/clang-tidy/cppcoreguidelines",
+ "//clang-tools-extra/clang-tidy/fuchsia",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/hicpp",
+ "//clang-tools-extra/clang-tidy/llvm",
+ "//clang-tools-extra/clang-tidy/misc",
+ "//clang-tools-extra/clang-tidy/modernize",
+ "//clang-tools-extra/clang-tidy/objc",
+ "//clang-tools-extra/clang-tidy/performance",
+ "//clang-tools-extra/clang-tidy/portability",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/zircon",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Driver",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Sema",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Inclusions",
+ "//clang/lib/Tooling/Refactoring",
+ "//clang/lib/Tooling/Syntax",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:AllTargetsInfos",
+ "//llvm/utils/gn/build/libs/atomic",
+ "//llvm/utils/gn/build/libs/pthread",
+ ]
+ include_dirs = [
+ ".",
+
+ # To pick up the generated inc files.
+ "$target_gen_dir/tool",
+ ]
+ sources = [
+ "AST.cpp",
+ "Cancellation.cpp",
+ "ClangdLSPServer.cpp",
+ "ClangdServer.cpp",
+ "ClangdUnit.cpp",
+ "CodeComplete.cpp",
+ "CodeCompletionStrings.cpp",
+ "Compiler.cpp",
+ "Context.cpp",
+ "Diagnostics.cpp",
+ "DraftStore.cpp",
+ "ExpectedTypes.cpp",
+ "FS.cpp",
+ "FSProvider.cpp",
+ "FileDistance.cpp",
+ "FindSymbols.cpp",
+ "Format.cpp",
+ "FormattedString.cpp",
+ "FuzzyMatch.cpp",
+ "GlobalCompilationDatabase.cpp",
+ "Headers.cpp",
+ "IncludeFixer.cpp",
+ "JSONTransport.cpp",
+ "Logger.cpp",
+ "Protocol.cpp",
+ "Quality.cpp",
+ "QueryDriverDatabase.cpp",
+ "RIFF.cpp",
+ "Selection.cpp",
+ "SemanticHighlighting.cpp",
+ "SourceCode.cpp",
+ "TUScheduler.cpp",
+ "Threading.cpp",
+ "Trace.cpp",
+ "URI.cpp",
+ "XRefs.cpp",
+ "index/Background.cpp",
+ "index/BackgroundIndexLoader.cpp",
+ "index/BackgroundIndexStorage.cpp",
+ "index/BackgroundQueue.cpp",
+ "index/BackgroundRebuild.cpp",
+ "index/CanonicalIncludes.cpp",
+ "index/FileIndex.cpp",
+ "index/Index.cpp",
+ "index/IndexAction.cpp",
+ "index/MemIndex.cpp",
+ "index/Merge.cpp",
+ "index/Ref.cpp",
+ "index/Relation.cpp",
+ "index/Serialization.cpp",
+ "index/Symbol.cpp",
+ "index/SymbolCollector.cpp",
+ "index/SymbolID.cpp",
+ "index/SymbolLocation.cpp",
+ "index/SymbolOrigin.cpp",
+ "index/YAMLSerialization.cpp",
+ "index/dex/Dex.cpp",
+ "index/dex/Iterator.cpp",
+ "index/dex/PostingList.cpp",
+ "index/dex/Trigram.cpp",
+ "refactor/Rename.cpp",
+ "refactor/Tweak.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/dex/dexp/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/dex/dexp/BUILD.gn
new file mode 100644
index 0000000..77f1ca4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/dex/dexp/BUILD.gn
@@ -0,0 +1,13 @@
+executable("dexp") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//clang/lib/Basic",
+ "//llvm/lib/LineEditor",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "../../.." ]
+ sources = [
+ "Dexp.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
new file mode 100644
index 0000000..52466ef
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
@@ -0,0 +1,17 @@
+executable("clangd-indexer") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "IndexerMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks/BUILD.gn
new file mode 100644
index 0000000..ad712ef
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks/BUILD.gn
@@ -0,0 +1,23 @@
+# A target containing all code tweaks (i.e. mini-refactorings) provided by
+# clangd.
+# Built as a source_set to make sure the linker does not remove global
+# constructors that register individual tweaks in a global registry.
+source_set("tweaks") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//clang/lib/AST",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "../.." ]
+ sources = [
+ "AnnotateHighlightings.cpp",
+ "DumpAST.cpp",
+ "ExpandAutoType.cpp",
+ "ExpandMacro.cpp",
+ "ExtractVariable.cpp",
+ "RawStringLiteral.cpp",
+ "SwapIfBranches.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
new file mode 100644
index 0000000..9cb43c8
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/BUILD.gn
@@ -0,0 +1,112 @@
+import("//clang-tools-extra/clangd/xpc/enable.gni")
+import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+import("clangd_lit_site_cfg_files.gni")
+
+template("write_lit_config") {
+ write_cmake_config(target_name) {
+ input = invoker.input
+ output = invoker.output
+ values = [
+ "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
+ "LLVM_LIBS_DIR=", # needed only for shared builds
+ ]
+ values += invoker.extra_values
+ }
+}
+
+write_lit_config("lit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/clangd/test/lit.site.cfg.py.in"
+ output = clangd_lit_site_cfg_file
+
+ extra_values = [
+ "CMAKE_CURRENT_BINARY_DIR=" + rebase_path(
+ get_label_info("//clang-tools-extra/clangd/test", "target_out_dir")),
+ "CMAKE_CURRENT_SOURCE_DIR=" +
+ rebase_path("//clang-tools-extra/clangd/test"),
+
+ "CLANG_LIBS_DIR=", # needed only for shared builds
+ "CLANG_TOOLS_DIR=",
+ "LLVM_HOST_TRIPLE=$llvm_current_triple",
+ "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
+ "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "TARGET_TRIPLE=$llvm_target_triple",
+ ]
+
+ if (clangd_build_xpc) {
+ extra_values += [ "CLANGD_BUILD_XPC=1" ]
+ } else {
+ extra_values += [ "CLANGD_BUILD_XPC=0" ]
+ }
+}
+
+write_lit_config("lit_unit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/clangd/unittests/lit.site.cfg.py.in"
+ output = clangd_lit_unit_site_cfg_file
+ extra_values = [
+ "CMAKE_CURRENT_BINARY_DIR=" +
+ rebase_path(get_label_info("//clang-tools-extra/clangd/unittests",
+ "target_out_dir")),
+ "CMAKE_CURRENT_SOURCE_DIR=" +
+ rebase_path("//clang-tools-extra/clangd/unittests"),
+ ]
+ if (host_os == "win") {
+ # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
+ extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
+ } else {
+ extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
+ }
+}
+
+# This target should contain all dependencies of check-clangd.
+# //:default depends on it, so that ninja's default target builds all
+# prerequisites for check-clang but doesn't run check-clang itself.
+group("test") {
+ deps = [
+ ":lit_site_cfg",
+ ":lit_unit_site_cfg",
+ "//clang-tools-extra/clangd/index/dex/dexp",
+ "//clang-tools-extra/clangd/indexer:clangd-indexer",
+ "//clang-tools-extra/clangd/tool:clangd",
+ "//clang-tools-extra/clangd/unittests:ClangdTests",
+ "//llvm/utils/FileCheck",
+ "//llvm/utils/llvm-lit",
+ "//llvm/utils/not",
+ ]
+ if (clangd_build_xpc) {
+ deps += [
+ "//clang-tools-extra/clangd/unittests/xpc:ClangdXpcTests",
+ "//clang-tools-extra/clangd/xpc/test-client:clangd-xpc-test-client",
+ ]
+ }
+ testonly = true
+}
+
+action("check-clangd") {
+ script = "$root_out_dir/bin/llvm-lit"
+ if (host_os == "win") {
+ script += ".py"
+ }
+ args = [
+ "-sv",
+ rebase_path(get_path_info(clangd_lit_site_cfg_file, "dir"), root_out_dir),
+ rebase_path(get_path_info(clangd_lit_unit_site_cfg_file, "dir"),
+ root_out_dir),
+ ]
+ outputs = [
+ "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time.
+ ]
+
+ # Since check-clangd is always dirty, //:default doesn't depend on it so
+ # that it's not part of the default ninja target. Hence, check-clangd
+ # shouldn't have any deps except :test. so that the default target is sure to
+ # build all the deps.
+ deps = [
+ ":test",
+ ]
+ testonly = true
+
+ pool = "//:console"
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/clangd_lit_site_cfg_files.gni b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/clangd_lit_site_cfg_files.gni
new file mode 100644
index 0000000..842b475
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/test/clangd_lit_site_cfg_files.gni
@@ -0,0 +1,4 @@
+clangd_lit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/clangd/test/lit.site.cfg.py"
+clangd_lit_unit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/clangd/unittests/lit.site.cfg.py"
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn
new file mode 100644
index 0000000..d1832b3
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn
@@ -0,0 +1,31 @@
+import("//clang-tools-extra/clangd/xpc/enable.gni")
+
+executable("clangd") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clangd",
+ "//clang-tools-extra/clangd:features",
+ "//clang-tools-extra/clangd/refactor/tweaks",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Headers",
+ "//clang/lib/Sema",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ if (clangd_build_xpc) {
+ deps += [
+ "//clang-tools-extra/clangd/xpc:conversions",
+ "//clang-tools-extra/clangd/xpc:transport",
+ ]
+ }
+
+ include_dirs = [ ".." ]
+ sources = [
+ "ClangdMain.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn
new file mode 100644
index 0000000..0d7c8c6
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn
@@ -0,0 +1,81 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangdTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clangd",
+ "//clang-tools-extra/clangd:features",
+ "//clang-tools-extra/clangd/refactor/tweaks",
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Index",
+ "//clang/lib/Lex",
+ "//clang/lib/Sema",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Inclusions",
+ "//clang/lib/Tooling/Syntax",
+ "//llvm/lib/Support",
+ "//llvm/lib/Testing/Support",
+ ]
+ include_dirs = [
+ "//clang-tools-extra/clangd",
+
+ # To pick up the generated inc files.
+ "$target_gen_dir/../../clangd/tool",
+ ]
+ sources = [
+ "ASTTests.cpp",
+ "Annotations.cpp",
+ "BackgroundIndexTests.cpp",
+ "CancellationTests.cpp",
+ "CanonicalIncludesTests.cpp",
+ "ClangdTests.cpp",
+ "ClangdUnitTests.cpp",
+ "CodeCompleteTests.cpp",
+ "CodeCompletionStringsTests.cpp",
+ "ContextTests.cpp",
+ "DexTests.cpp",
+ "DiagnosticsTests.cpp",
+ "DraftStoreTests.cpp",
+ "ExpectedTypeTest.cpp",
+ "FSTests.cpp",
+ "FileDistanceTests.cpp",
+ "FileIndexTests.cpp",
+ "FindSymbolsTests.cpp",
+ "FormatTests.cpp",
+ "FormattedStringTests.cpp",
+ "FunctionTests.cpp",
+ "FuzzyMatchTests.cpp",
+ "GlobalCompilationDatabaseTests.cpp",
+ "HeadersTests.cpp",
+ "IndexActionTests.cpp",
+ "IndexTests.cpp",
+ "JSONTransportTests.cpp",
+ "PrintASTTests.cpp",
+ "QualityTests.cpp",
+ "RIFFTests.cpp",
+ "RenameTests.cpp",
+ "SelectionTests.cpp",
+ "SemanticHighlightingTests.cpp",
+ "SerializationTests.cpp",
+ "SourceCodeTests.cpp",
+ "SymbolCollectorTests.cpp",
+ "SymbolInfoTests.cpp",
+ "SyncAPI.cpp",
+ "TUSchedulerTests.cpp",
+ "TestFS.cpp",
+ "TestIndex.cpp",
+ "TestTU.cpp",
+ "ThreadingTests.cpp",
+ "TraceTests.cpp",
+ "TweakTests.cpp",
+ "TypeHierarchyTests.cpp",
+ "URITests.cpp",
+ "XRefsTests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/xpc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/xpc/BUILD.gn
new file mode 100644
index 0000000..2d20e16
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/xpc/BUILD.gn
@@ -0,0 +1,15 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangdXpcTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//clang-tools-extra/clangd/xpc:conversions",
+ "//llvm/lib/Support",
+ "//llvm/lib/Testing/Support",
+ ]
+ include_dirs = [ "//clang-tools-extra/clangd" ]
+ sources = [
+ "ConversionTests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn
new file mode 100644
index 0000000..f8e1186
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn
@@ -0,0 +1,26 @@
+static_library("conversions") {
+ output_name = "clangdXpcJsonConversions"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "Conversion.cpp",
+ ]
+}
+
+static_library("transport") {
+ output_name = "clangdXpcTransport"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ ":conversions",
+ "//clang-tools-extra/clangd",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "XPCTransport.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni
new file mode 100644
index 0000000..843badb
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni
@@ -0,0 +1,4 @@
+declare_args() {
+ # Whether to build clangd's XPC components.
+ clangd_build_xpc = current_os == "mac"
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/framework/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/framework/BUILD.gn
new file mode 100644
index 0000000..9b11f26
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/framework/BUILD.gn
@@ -0,0 +1,154 @@
+import("//llvm/utils/gn/build/symlink_or_copy.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+
+# create_clangd_xpc_framework() in cmake creates both the ClangdXPC.framework
+# bundle and the clangd.xpc bundle within it in a single action.
+# Since GN has some native support for macOS bundles, it's more natural
+# to have one create_bundle() each for both ClangdXPC.framework and clangd.xpc.
+# See `llvm/utils/gn/gn.py help create_bundle` and ../cmake/modules.
+
+######################################################################
+# clangd.xpc bundle
+
+write_cmake_config("XPCServiceInfo.plist") {
+ input = "../cmake/XPCServiceInfo.plist.in"
+ output = "$target_gen_dir/XPCServiceInfo.plist"
+ service_name = "clangd"
+ values = [
+ "CLANGD_XPC_SERVICE_NAME=$service_name",
+ "CLANGD_XPC_SERVICE_BUNDLE_NAME=org.llvm.$service_name",
+ ]
+}
+
+bundle_data("clangxpc_bundle_xpc_service_info_plist") {
+ public_deps = [
+ ":XPCServiceInfo.plist",
+ ]
+ sources = [
+ "$target_gen_dir/XPCServiceInfo.plist",
+ ]
+ outputs = [
+ "{{bundle_contents_dir}}/Info.plist",
+ ]
+}
+
+bundle_data("clangxpc_bundle_xpc_service_executable") {
+ public_deps = [
+ "//clang-tools-extra/clangd/tool:clangd",
+ ]
+ sources = [
+ "$root_out_dir/bin/clangd",
+ ]
+ outputs = [
+ "{{bundle_executable_dir}}/{{source_file_part}}",
+ ]
+}
+
+create_bundle("clangd.xpc") {
+ # .app directory structure.
+ # Since this target only exists to be copied into ClangdXPC.framework,
+ # put it in $target_gen_dir, not $root_out_dir.
+ bundle_root_dir = "$target_gen_dir/$target_name"
+ bundle_contents_dir = "$bundle_root_dir/Contents"
+ bundle_executable_dir = "$bundle_contents_dir/MacOS"
+
+ deps = [
+ ":clangxpc_bundle_xpc_service_executable",
+ ":clangxpc_bundle_xpc_service_info_plist",
+ ]
+}
+
+######################################################################
+# ClangdXPC.framework
+
+write_cmake_config("Info.plist") {
+ input = "../cmake/Info.plist.in"
+ output = "$target_gen_dir/Info.plist"
+ values = [ "CLANGD_XPC_FRAMEWORK_NAME=ClangdXPC" ]
+}
+
+bundle_data("clangdxpc_bundle_info_plist") {
+ public_deps = [
+ ":Info.plist",
+ ]
+ sources = [
+ "$target_gen_dir/Info.plist",
+ ]
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
+}
+
+shared_library("ClangdXPCLib") {
+ deps = [
+ "//clang-tools-extra/clangd/tool:clangd",
+ ]
+ sources = [
+ "ClangdXPC.cpp",
+ ]
+}
+
+bundle_data("clangdxpc_bundle_executable") {
+ public_deps = [
+ ":ClangdXPCLib",
+ ]
+ sources = [
+ "$root_out_dir/lib/libClangdXPCLib.dylib",
+ ]
+ outputs = [
+ "{{bundle_executable_dir}}/ClangdXPC",
+ ]
+}
+
+bundle_data("clangdxpc_bundle_xpc") {
+ public_deps = [
+ ":clangd.xpc",
+ ]
+ sources = [
+ "$target_gen_dir/clangd.xpc",
+ ]
+ outputs = [
+ "{{bundle_contents_dir}}/XPCServices/{{source_file_part}}",
+ ]
+}
+
+# .framework bundle symlinks:
+# - ./ClangdXPC -> Versions/Current/ClangdXPC
+# - ./Resources -> Versions/Current/Resources
+# - ./XPCServices -> Versions/Current/XPCServices
+# - ./Versions/Current -> Versions/A
+# Since bundles are a mac thing, we know that symlink_or_copy() will symlink
+# and not copy, and hence creating the symlink before the target exists is safe.
+symlinks = [
+ "ClangdXPC",
+ "Resources",
+ "XPCServices",
+]
+foreach(target, symlinks) {
+ symlink_or_copy("clangdxpc_symlink_$target") {
+ source = "Versions/Current/$target"
+ output = "$root_out_dir/lib/ClangdXPC.framework/$target"
+ }
+}
+symlink_or_copy("clangdxpc_symlink_Versions_Current") {
+ source = "A"
+ output = "$root_out_dir/lib/ClangdXPC.framework/Versions/Current"
+}
+
+create_bundle("ClangdXPC.framework") {
+ # .framework directory structure.
+ bundle_root_dir = "$root_out_dir/lib/$target_name"
+ bundle_contents_dir = "$bundle_root_dir/Versions/A"
+ bundle_executable_dir = "$bundle_contents_dir"
+ bundle_resources_dir = "$bundle_contents_dir/Resources"
+
+ deps = [
+ ":clangdxpc_bundle_executable",
+ ":clangdxpc_bundle_info_plist",
+ ":clangdxpc_bundle_xpc",
+ ":clangdxpc_symlink_Versions_Current",
+ ]
+ foreach(target, symlinks) {
+ deps += [ ":clangdxpc_symlink_$target" ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/test-client/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/test-client/BUILD.gn
new file mode 100644
index 0000000..e800590
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/clangd/xpc/test-client/BUILD.gn
@@ -0,0 +1,20 @@
+executable("clangd-xpc-test-client") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clangd",
+ "//clang-tools-extra/clangd/xpc:conversions",
+ "//clang-tools-extra/clangd/xpc/framework:ClangdXPC.framework",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Sema",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+
+ include_dirs = [ "../.." ]
+ sources = [
+ "ClangdXPCTestClient.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/modularize/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/modularize/BUILD.gn
new file mode 100644
index 0000000..f3ed172
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/modularize/BUILD.gn
@@ -0,0 +1,21 @@
+executable("modularize") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Driver",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Option",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "CoverageChecker.cpp",
+ "Modularize.cpp",
+ "ModularizeUtilities.cpp",
+ "ModuleAssistant.cpp",
+ "PreprocessorTracker.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/pp-trace/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/pp-trace/BUILD.gn
new file mode 100644
index 0000000..2c0eac0
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/pp-trace/BUILD.gn
@@ -0,0 +1,16 @@
+executable("pp-trace") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "PPCallbacksTracker.cpp",
+ "PPTrace.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
new file mode 100644
index 0000000..dfc5b77
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
@@ -0,0 +1,115 @@
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+import("clang_tools_extra_lit_site_cfg_files.gni")
+
+template("write_lit_config") {
+ write_cmake_config(target_name) {
+ input = invoker.input
+ output = invoker.output
+ values = [
+ "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
+ "CLANG_TOOLS_BINARY_DIR=" +
+ rebase_path(get_label_info("//clang-tools-extra", "target_out_dir")),
+ "CLANG_TOOLS_SOURCE_DIR=" + rebase_path("//clang-tools-extra"),
+ "LLVM_LIBS_DIR=", # needed only for shared builds
+ "TARGET_TRIPLE=$llvm_target_triple",
+ ]
+ if (host_os == "win") {
+ # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
+ values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
+ } else {
+ values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
+ }
+ values += invoker.extra_values
+ }
+}
+
+write_lit_config("lit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/test/lit.site.cfg.py.in"
+ output = clang_tools_extra_lit_site_cfg_file
+
+ extra_values = [
+ "CLANG_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
+ "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "PYTHON_EXECUTABLE=$python_path",
+ ]
+
+ if (clang_enable_static_analyzer) {
+ extra_values += [ "CLANG_ENABLE_STATIC_ANALYZER=1" ]
+ } else {
+ extra_values += [ "CLANG_ENABLE_STATIC_ANALYZER=0" ]
+ }
+}
+
+write_lit_config("lit_unit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/test/Unit/lit.site.cfg.py.in"
+ output = clang_tools_extra_lit_unit_site_cfg_file
+ extra_values = []
+}
+
+# This target should contain all dependencies of check-clang-tools.
+# //:default depends on it, so that ninja's default target builds all
+# prerequisites for check-clang but doesn't run check-clang itself.
+group("test") {
+ deps = [
+ ":lit_site_cfg",
+ ":lit_unit_site_cfg",
+ "//clang-tools-extra/clang-apply-replacements/tool:clang-apply-replacements",
+ "//clang-tools-extra/clang-change-namespace/tool:clang-change-namespace",
+ "//clang-tools-extra/clang-doc/tool:clang-doc",
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols/tool:find-all-symbols",
+ "//clang-tools-extra/clang-include-fixer/tool:clang-include-fixer",
+ "//clang-tools-extra/clang-move/tool:clang-move",
+ "//clang-tools-extra/clang-query/tool:clang-query",
+ "//clang-tools-extra/clang-reorder-fields/tool:clang-reorder-fields",
+ "//clang-tools-extra/clang-tidy/tool:clang-tidy",
+ "//clang-tools-extra/modularize",
+ "//clang-tools-extra/pp-trace",
+ "//clang-tools-extra/unittests",
+ "//clang/lib/Headers",
+ "//clang/tools/c-index-test",
+ "//clang/tools/clang-rename",
+ "//clang/tools/driver:symlinks",
+ "//llvm/tools/llvm-bcanalyzer",
+ "//llvm/utils/FileCheck",
+ "//llvm/utils/count",
+ "//llvm/utils/llvm-lit",
+ "//llvm/utils/not",
+ ]
+ testonly = true
+}
+
+action("check-clang-tools") {
+ script = "$root_out_dir/bin/llvm-lit"
+ if (host_os == "win") {
+ script += ".py"
+ }
+ args = [
+ "-sv",
+ "--param",
+ "clang_site_config=" +
+ rebase_path(clang_tools_extra_lit_site_cfg_file, root_out_dir),
+ "--param",
+ "clang_unit_site_config=" +
+ rebase_path(clang_tools_extra_lit_unit_site_cfg_file, root_out_dir),
+ rebase_path(".", root_out_dir),
+ ]
+ outputs = [
+ "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time.
+ ]
+
+ # Since check-clang-tools is always dirty, //:default doesn't depend on it so
+ # that it's not part of the default ninja target. Hence, check-clang-tools
+ # shouldn't have any deps except :test. so that the default target is sure to
+ # build all the deps.
+ deps = [
+ ":test",
+ ]
+ testonly = true
+
+ pool = "//:console"
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/clang_tools_extra_lit_site_cfg_files.gni b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/clang_tools_extra_lit_site_cfg_files.gni
new file mode 100644
index 0000000..82a21f5
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/test/clang_tools_extra_lit_site_cfg_files.gni
@@ -0,0 +1,4 @@
+clang_tools_extra_lit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/test/lit.site.cfg.py"
+clang_tools_extra_lit_unit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/test/Unit/lit.site.cfg.py"
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn
new file mode 100644
index 0000000..ab8c48d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn
@@ -0,0 +1,15 @@
+import("//clang-tools-extra/clangd/xpc/enable.gni")
+
+group("unittests") {
+ deps = [
+ "clang-apply-replacements:ClangApplyReplacementsTests",
+ "clang-change-namespace:ClangChangeNamespaceTests",
+ "clang-doc:ClangDocTests",
+ "clang-include-fixer:ClangIncludeFixerTests",
+ "clang-include-fixer/find-all-symbols:FindAllSymbolsTests",
+ "clang-move:ClangMoveTests",
+ "clang-query:ClangQueryTests",
+ "clang-tidy:ClangTidyTests",
+ ]
+ testonly = true
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
new file mode 100644
index 0000000..4c0a4aa
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
@@ -0,0 +1,15 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangApplyReplacementsTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-apply-replacements",
+ "//clang/lib/Basic",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Refactoring",
+ ]
+ include_dirs = [ "//clang-tools-extra/clang-apply-replacements/include" ]
+ sources = [
+ "ApplyReplacementsTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-change-namespace/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-change-namespace/BUILD.gn
new file mode 100644
index 0000000..392ddf2
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-change-namespace/BUILD.gn
@@ -0,0 +1,27 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangChangeNamespaceTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-change-namespace",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [
+ "//clang-tools-extra/clang-change-namespace",
+
+ # We'd like clang/unittests/Tooling/RewriterTestContext.h in the test.
+ "//clang",
+ ]
+ sources = [
+ "ChangeNamespaceTests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
new file mode 100644
index 0000000..0ba03e9
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
@@ -0,0 +1,30 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangDocTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-doc",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Bitcode/Reader",
+ "//llvm/lib/Bitcode/Writer",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "//clang-tools-extra/clang-doc" ]
+ sources = [
+ "BitcodeTest.cpp",
+ "ClangDocTest.cpp",
+ "HTMLGeneratorTest.cpp",
+ "MDGeneratorTest.cpp",
+ "MergeTest.cpp",
+ "SerializeTest.cpp",
+ "YAMLGeneratorTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/BUILD.gn
new file mode 100644
index 0000000..ad0732d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/BUILD.gn
@@ -0,0 +1,27 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangIncludeFixerTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer",
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [
+ "//clang-tools-extra/clang-include-fixer",
+
+ # We'd like clang/unittests/Tooling/RewriterTestContext.h in the test.
+ "//clang",
+ ]
+ sources = [
+ "FuzzySymbolIndexTests.cpp",
+ "IncludeFixerTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/find-all-symbols/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/find-all-symbols/BUILD.gn
new file mode 100644
index 0000000..7960590
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/find-all-symbols/BUILD.gn
@@ -0,0 +1,20 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("FindAllSymbolsTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-include-fixer/find-all-symbols",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "//clang-tools-extra/clang-include-fixer/find-all-symbols" ]
+ sources = [
+ "FindAllSymbolsTests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-move/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-move/BUILD.gn
new file mode 100644
index 0000000..95246f4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-move/BUILD.gn
@@ -0,0 +1,27 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangMoveTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-move",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Format",
+ "//clang/lib/Frontend",
+ "//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [
+ "//clang-tools-extra/clang-move",
+
+ # We'd like clang/unittests/Tooling/RewriterTestContext.h in the test.
+ "//clang",
+ ]
+ sources = [
+ "ClangMoveTests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
new file mode 100644
index 0000000..7c5d774
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
@@ -0,0 +1,21 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangQueryTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-query",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/ASTMatchers/Dynamic",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "//clang-tools-extra/clang-query" ]
+ sources = [
+ "QueryEngineTest.cpp",
+ "QueryParserTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
new file mode 100644
index 0000000..7d1f256
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
@@ -0,0 +1,38 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangTidyTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang-tools-extra/clang-tidy",
+ "//clang-tools-extra/clang-tidy/android",
+ "//clang-tools-extra/clang-tidy/google",
+ "//clang-tools-extra/clang-tidy/llvm",
+ "//clang-tools-extra/clang-tidy/objc",
+ "//clang-tools-extra/clang-tidy/readability",
+ "//clang-tools-extra/clang-tidy/utils",
+ "//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Core",
+ "//clang/lib/Tooling/Refactoring",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ "//clang-tools-extra/clang-tidy" ]
+ sources = [
+ "ClangTidyDiagnosticConsumerTest.cpp",
+ "ClangTidyOptionsTest.cpp",
+ "GoogleModuleTest.cpp",
+ "IncludeInserterTest.cpp",
+ "LLVMModuleTest.cpp",
+ "NamespaceAliaserTest.cpp",
+ "ObjCModuleTest.cpp",
+ "OverlappingReplacementsTest.cpp",
+ "ReadabilityModuleTest.cpp",
+ "TransformerClangTidyCheckTest.cpp",
+ "UsingInserterTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
index a3c0d5a..61b8887 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -21,6 +21,7 @@
"CLANG_DEFAULT_RTLIB=",
"CLANG_DEFAULT_OBJCOPY=objcopy",
"CLANG_DEFAULT_OPENMP_RUNTIME=libomp",
+ "CLANG_DEFAULT_UNWINDLIB=",
"CLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_35",
"CLANG_LIBDIR_SUFFIX=",
"CLANG_RESOURCE_DIR=",
@@ -29,7 +30,6 @@
"CLANG_CONFIG_FILE_USER_DIR=",
"DEFAULT_SYSROOT=",
"GCC_INSTALL_PREFIX=",
- "CLANG_ANALYZER_WITH_Z3=",
"BACKEND_PACKAGE_STRING=LLVM ${llvm_version}svn",
"ENABLE_LINKER_BUILD_ID=",
"ENABLE_X86_RELAX_RELOCATIONS=",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/ARCMigrate/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/ARCMigrate/BUILD.gn
index d78a559..923ff66 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/ARCMigrate/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/ARCMigrate/BUILD.gn
@@ -11,7 +11,6 @@
"//clang/lib/Rewrite",
"//clang/lib/Sema",
"//clang/lib/Serialization",
- "//clang/lib/StaticAnalyzer/Checkers",
"//llvm/lib/Support",
]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/AST/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/AST/BUILD.gn
index fc3b0b9..9d72b38 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/AST/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/AST/BUILD.gn
@@ -66,6 +66,7 @@
"InheritViz.cpp",
"ItaniumCXXABI.cpp",
"ItaniumMangle.cpp",
+ "JSONNodeDumper.cpp",
"Mangle.cpp",
"MicrosoftCXXABI.cpp",
"MicrosoftMangle.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
index b084d75..1d45693 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
@@ -4,6 +4,7 @@
deps = [
"//clang/include/clang/AST:StmtDataCollectors",
"//clang/lib/AST",
+ "//clang/lib/ASTMatchers",
"//clang/lib/Basic",
"//clang/lib/Lex",
"//llvm/lib/Support",
@@ -27,6 +28,7 @@
"PostOrderCFGView.cpp",
"ProgramPoint.cpp",
"ReachableCode.cpp",
+ "RetainSummaryManager.cpp",
"ThreadSafety.cpp",
"ThreadSafetyCommon.cpp",
"ThreadSafetyLogical.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
index 4d0578b..dd7ae77 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn
@@ -34,7 +34,6 @@
"FixedPoint.cpp",
"IdentifierTable.cpp",
"LangOptions.cpp",
- "MemoryBufferCache.cpp",
"Module.cpp",
"ObjCRuntime.cpp",
"OpenMPKinds.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
index c245489..0d63baf 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
@@ -80,6 +80,7 @@
"MicrosoftCXXABI.cpp",
"ModuleBuilder.cpp",
"ObjectFilePCHContainerOperations.cpp",
+ "PatternInit.cpp",
"SanitizerMetadata.cpp",
"SwiftCallingConv.cpp",
"TargetInfo.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
index 1f07a62..66d2097 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
@@ -77,6 +77,7 @@
"ToolChains/NaCl.cpp",
"ToolChains/NetBSD.cpp",
"ToolChains/OpenBSD.cpp",
+ "ToolChains/PPCLinux.cpp",
"ToolChains/PS4CPU.cpp",
"ToolChains/RISCVToolchain.cpp",
"ToolChains/Solaris.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
index 0f80aa6..f9659d0 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Frontend/BUILD.gn
@@ -36,6 +36,7 @@
"HeaderIncludeGen.cpp",
"InitHeaderSearch.cpp",
"InitPreprocessor.cpp",
+ "InterfaceStubFunctionsConsumer.cpp",
"LangStandards.cpp",
"LayoutOverrideSource.cpp",
"LogDiagnosticPrinter.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
index 2c472ce..37d4524 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
@@ -43,6 +43,7 @@
"armintr.h",
"arm64intr.h",
"avx2intrin.h",
+ "avx512bf16intrin.h",
"avx512bwintrin.h",
"avx512bitalgintrin.h",
"avx512vlbitalgintrin.h",
@@ -58,10 +59,13 @@
"avx512vbmivlintrin.h",
"avx512vbmi2intrin.h",
"avx512vlvbmi2intrin.h",
+ "avx512vlbf16intrin.h",
"avx512vlbwintrin.h",
"avx512vlcdintrin.h",
"avx512vldqintrin.h",
"avx512vlintrin.h",
+ "avx512vp2intersectintrin.h",
+ "avx512vlvp2intersectintrin.h",
"avx512vpopcntdqvlintrin.h",
"avx512vnniintrin.h",
"avx512vlvnniintrin.h",
@@ -83,6 +87,7 @@
"clflushoptintrin.h",
"clwbintrin.h",
"emmintrin.h",
+ "enqcmdintrin.h",
"f16cintrin.h",
"float.h",
"fma4intrin.h",
@@ -109,6 +114,7 @@
"mwaitxintrin.h",
"nmmintrin.h",
"opencl-c.h",
+ "opencl-c-base.h",
"pconfigintrin.h",
"pkuintrin.h",
"pmmintrin.h",
@@ -154,6 +160,14 @@
"cuda_wrappers/algorithm",
"cuda_wrappers/complex",
"cuda_wrappers/new",
+ "ppc_wrappers/mmintrin.h",
+ "ppc_wrappers/xmmintrin.h",
+ "ppc_wrappers/mm_malloc.h",
+ "ppc_wrappers/emmintrin.h",
+ "openmp_wrappers/math.h",
+ "openmp_wrappers/cmath",
+ "openmp_wrappers/__clang_openmp_math.h",
+ "openmp_wrappers/__clang_openmp_math_declares.h",
]
outputs = [
"$clang_resource_dir/include/{{source_target_relative}}",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
index 8c7190f..f0b4d59 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Index/BUILD.gn
@@ -15,6 +15,7 @@
sources = [
"CodegenNameGenerator.cpp",
"CommentToXML.cpp",
+ "FileIndexRecord.cpp",
"IndexBody.cpp",
"IndexDecl.cpp",
"IndexSymbol.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Lex/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Lex/BUILD.gn
index 2934e9c..e38bfb7 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Lex/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Lex/BUILD.gn
@@ -6,6 +6,7 @@
"//llvm/lib/Support",
]
sources = [
+ "DependencyDirectivesSourceMinimizer.cpp",
"HeaderMap.cpp",
"HeaderSearch.cpp",
"Lexer.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Sema/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Sema/BUILD.gn
index 716f4d5..ab7486d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Sema/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Sema/BUILD.gn
@@ -1,7 +1,14 @@
+import("//clang/utils/TableGen/clang_tablegen.gni")
+
+clang_tablegen("OpenCLBuiltins") {
+ args = [ "-gen-clang-opencl-builtins" ]
+}
+
static_library("Sema") {
output_name = "clangSema"
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
+ ":OpenCLBuiltins",
"//clang/include/clang/Sema:AttrParsedAttrImpl",
"//clang/include/clang/Sema:AttrParsedAttrKinds",
"//clang/include/clang/Sema:AttrParsedAttrList",
@@ -48,6 +55,7 @@
"SemaInit.cpp",
"SemaLambda.cpp",
"SemaLookup.cpp",
+ "SemaModule.cpp",
"SemaObjCProperty.cpp",
"SemaOpenMP.cpp",
"SemaOverload.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn
index 394b1ed..8096e3a 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Serialization/BUILD.gn
@@ -23,6 +23,7 @@
"ASTWriterStmt.cpp",
"GeneratePCH.cpp",
"GlobalModuleIndex.cpp",
+ "InMemoryModuleCache.cpp",
"Module.cpp",
"ModuleFileExtension.cpp",
"ModuleManager.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
index e8e0c71..9cde0e0 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
@@ -26,6 +26,7 @@
"CallAndMessageChecker.cpp",
"CastSizeChecker.cpp",
"CastToStructChecker.cpp",
+ "CastValueChecker.cpp",
"CheckObjCDealloc.cpp",
"CheckObjCInstMethSignature.cpp",
"CheckSecuritySyntaxOnly.cpp",
@@ -54,6 +55,7 @@
"IvarInvalidationChecker.cpp",
"LLVMConventionsChecker.cpp",
"LocalizationChecker.cpp",
+ "MIGChecker.cpp",
"MPI-Checker/MPIBugReporter.cpp",
"MPI-Checker/MPIChecker.cpp",
"MPI-Checker/MPIFunctionClassifier.cpp",
@@ -71,6 +73,7 @@
"NonnullGlobalConstantsChecker.cpp",
"NullabilityChecker.cpp",
"NumberObjectConversionChecker.cpp",
+ "OSObjectCStyleCast.cpp",
"ObjCAtSyncChecker.cpp",
"ObjCAutoreleaseWriteChecker.cpp",
"ObjCContainersASTChecker.cpp",
@@ -82,17 +85,22 @@
"ObjCUnusedIVarsChecker.cpp",
"PaddingChecker.cpp",
"PointerArithChecker.cpp",
+ "PointerIterationChecker.cpp",
+ "PointerSortingChecker.cpp",
"PointerSubChecker.cpp",
"PthreadLockChecker.cpp",
"RetainCountChecker/RetainCountChecker.cpp",
"RetainCountChecker/RetainCountDiagnostics.cpp",
"ReturnPointerRangeChecker.cpp",
"ReturnUndefChecker.cpp",
+ "ReturnValueChecker.cpp",
"RunLoopAutoreleaseLeakChecker.cpp",
"SimpleStreamChecker.cpp",
+ "SmartPtrModeling.cpp",
"StackAddrEscapeChecker.cpp",
"StdLibraryFunctionsChecker.cpp",
"StreamChecker.cpp",
+ "Taint.cpp",
"TaintTesterChecker.cpp",
"TestAfterDivZeroChecker.cpp",
"TraversalChecker.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
index e08a476..21236bf 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
@@ -48,7 +48,7 @@
"RangeConstraintManager.cpp",
"RangedConstraintManager.cpp",
"RegionStore.cpp",
- "RetainSummaryManager.cpp",
+ "SMTConstraintManager.cpp",
"SValBuilder.cpp",
"SVals.cpp",
"SarifDiagnostics.cpp",
@@ -57,11 +57,6 @@
"Store.cpp",
"SubEngine.cpp",
"SymbolManager.cpp",
- "TaintManager.cpp",
"WorkList.cpp",
- "Z3ConstraintManager.cpp",
]
-
- # FIXME: clang/Config/BUILD.gn currently always sets CLANG_ANALYZER_WITH_Z3
- # to false. If that changes we need to link to Z3 libs here.
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/BUILD.gn
index a298d52..8c1d5e1 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/BUILD.gn
@@ -21,6 +21,7 @@
"Execution.cpp",
"FileMatchTrie.cpp",
"FixIt.cpp",
+ "GuessTargetAndModeCompilationDatabase.cpp",
"InterpolatingCompilationDatabase.cpp",
"JSONCompilationDatabase.cpp",
"Refactoring.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/DependencyScanning/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/DependencyScanning/BUILD.gn
new file mode 100644
index 0000000..572d0d6
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/DependencyScanning/BUILD.gn
@@ -0,0 +1,20 @@
+static_library("DependencyScanning") {
+ output_name = "clangToolingDependencyScanning"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Driver",
+ "//clang/lib/Frontend",
+ "//clang/lib/FrontendTool",
+ "//clang/lib/Lex",
+ "//clang/lib/Parse",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//llvm/lib/IR",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "DependencyScanningWorker.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Refactoring/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Refactoring/BUILD.gn
index bf57e3e..ef25bec 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Refactoring/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Refactoring/BUILD.gn
@@ -1,5 +1,5 @@
static_library("Refactoring") {
- output_name = "clangToolingRefactor"
+ output_name = "clangToolingRefactoring"
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
"//clang/lib/AST",
@@ -19,11 +19,15 @@
"AtomicChange.cpp",
"Extract/Extract.cpp",
"Extract/SourceExtraction.cpp",
+ "RangeSelector.cpp",
"RefactoringActions.cpp",
"Rename/RenamingAction.cpp",
"Rename/SymbolOccurrences.cpp",
"Rename/USRFinder.cpp",
"Rename/USRFindingAction.cpp",
"Rename/USRLocFinder.cpp",
+ "SourceCode.cpp",
+ "Stencil.cpp",
+ "Transformer.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/BUILD.gn
new file mode 100644
index 0000000..29eb3c2
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/BUILD.gn
@@ -0,0 +1,16 @@
+static_library("Syntax") {
+ output_name = "clangToolingSyntax"
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "BuildTree.cpp",
+ "Nodes.cpp",
+ "Tokens.cpp",
+ "Tree.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/runtimes.gni b/src/llvm-project/llvm/utils/gn/secondary/clang/runtimes.gni
new file mode 100644
index 0000000..44c291e
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/runtimes.gni
@@ -0,0 +1,13 @@
+import("//clang/resource_dir.gni")
+import("//llvm/triples.gni")
+
+declare_args() {
+ # Use target triple as the name of the runtimes directory.
+ clang_enable_per_target_runtime_dir = false
+}
+
+if (clang_enable_per_target_runtime_dir) {
+ runtimes_dir = "$clang_resource_dir/$llvm_target_triple/lib"
+} else {
+ runtimes_dir = "$root_build_dir/lib"
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/test/BUILD.gn
index 681b07c..7cb9753 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -39,7 +39,7 @@
output = clang_lit_site_cfg_file
extra_values = [
- "CLANG_ANALYZER_WITH_Z3=", # Must be empty, not 0.
+ "LLVM_WITH_Z3=", # Must be empty, not 0.
"CLANG_BUILD_EXAMPLES=0",
"CLANG_DEFAULT_CXX_STDLIB=", # Empty string means "default value" here.
"CLANG_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
@@ -52,6 +52,7 @@
# builds exist, to make sure it's a toolchain var.
"CMAKE_CXX_COMPILER=c++",
"ENABLE_BACKTRACES=1",
+ "ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0",
"LLVM_HOST_TRIPLE=$llvm_current_triple",
"LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
"LLVM_USE_SANITIZER=",
@@ -79,6 +80,8 @@
if (host_cpu == "x64") {
extra_values += [ "HOST_ARCH=x86_64" ]
+ } else if (host_cpu == "ppc64") {
+ extra_values += [ "HOST_ARCH=powerpc64le" ]
} else {
assert(false, "unimplemented host_cpu " + host_cpu)
}
@@ -90,6 +93,13 @@
} else {
extra_values += [ "LLVM_PLUGIN_EXT=.so" ]
}
+
+ if (host_os == "win") {
+ extra_values += [ "LLVM_ENABLE_PLUGINS=0" ]
+ } else {
+ # FIXME: Analysis/plugins need global -fPIC
+ extra_values += [ "LLVM_ENABLE_PLUGINS=0" ]
+ }
}
write_lit_config("lit_unit_site_cfg") {
@@ -114,16 +124,19 @@
"//clang/tools/clang-offload-bundler",
"//clang/tools/clang-refactor",
"//clang/tools/clang-rename",
+ "//clang/tools/clang-scan-deps",
"//clang/tools/diagtool",
"//clang/tools/driver:symlinks",
"//clang/unittests",
"//clang/utils/TableGen:clang-tblgen",
"//clang/utils/hmaptool",
"//llvm/tools/llc",
+ "//llvm/tools/llvm-as",
"//llvm/tools/llvm-bcanalyzer",
"//llvm/tools/llvm-cat",
"//llvm/tools/llvm-config",
"//llvm/tools/llvm-dis",
+ "//llvm/tools/llvm-dwarfdump",
"//llvm/tools/llvm-lto",
"//llvm/tools/llvm-lto2",
"//llvm/tools/llvm-modextract",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/tools/clang-scan-deps/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/tools/clang-scan-deps/BUILD.gn
new file mode 100644
index 0000000..8a151a4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/tools/clang-scan-deps/BUILD.gn
@@ -0,0 +1,21 @@
+executable("clang-scan-deps") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/CodeGen",
+ "//clang/lib/Driver",
+ "//clang/lib/Frontend",
+ "//clang/lib/FrontendTool",
+ "//clang/lib/Lex",
+ "//clang/lib/Parse",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/DependencyScanning",
+ "//llvm/lib/IR",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "ClangScanDeps.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
index c2fad99..eb04b30 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -3,8 +3,6 @@
# This build file is just enough to get check-clang to pass, it's missing
# several things from the CMake build:
-# - linking in clangTidyPlugin and clangIncludeFixerPlugin from
-# clang-tools-extra (which doesn't have any GN build files yet)
# - using libclang.exports
# - a build target copying the Python bindings
# - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF
@@ -12,8 +10,8 @@
# - the GN build doesn't have LIBCLANG_BUILD_STATIC
libclang_target_type = "shared_library"
-if (host_os == "linux") {
- # Linux needs -fPIC to build shared libs but they aren't on by default.
+if (host_os != "win" && host_os != "mac") {
+ # ELF targets need -fPIC to build shared libs but they aren't on by default.
# For now, make libclang a static lib there.
libclang_target_type = "static_library"
}
@@ -39,11 +37,26 @@
deps += [ "//clang/lib/ARCMigrate" ]
}
+ defines = []
+
+ # FIXME: Once the GN build has a way to select which bits to build,
+ # only include this dependency if clang-tools-extra is part of the build.
+ # FIXME: libclang depending on anything in clang-tools-extra seems like
+ # a layering violation.
+ if (true) {
+ defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
+ deps += [
+ "//clang-tools-extra/clang-include-fixer/plugin",
+ "//clang-tools-extra/clang-tidy/plugin",
+ ]
+ }
+
if (host_os == "win") {
- defines = [ "_CINDEX_LIB_" ]
+ defines += [ "_CINDEX_LIB_" ]
}
sources = [
+ "../../include/clang-c/Index.h",
"ARCMigrate.cpp",
"BuildSystem.cpp",
"CIndex.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn
index d5b00af..d52d586 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn
@@ -13,7 +13,11 @@
]
sources = [
"ASTContextParentMapTest.cpp",
+ "ASTImporterFixtures.cpp",
+ "ASTImporterGenericRedeclTest.cpp",
"ASTImporterTest.cpp",
+ "ASTImporterVisibilityTest.cpp",
+ "ASTTraverserTest.cpp",
"ASTTypeTraitsTest.cpp",
"ASTVectorTest.cpp",
"CommentLexer.cpp",
@@ -26,6 +30,7 @@
"ExternalASTSourceTest.cpp",
"Language.cpp",
"NamedDeclPrinterTest.cpp",
+ "OMPStructuredBlockTest.cpp",
"SourceLocationTest.cpp",
"StmtPrinterTest.cpp",
"StructuralEquivalenceTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn
index c6c6fbe..f3d2c54 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn
@@ -12,6 +12,7 @@
"//llvm/lib/Support",
]
sources = [
+ "CFGDominatorTree.cpp",
"CFGTest.cpp",
"CloneDetectionTest.cpp",
"ExprMutationAnalyzerTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
index a8293ba9..befe73b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
@@ -15,7 +15,9 @@
"Rename:ClangRenameTests",
"Rewrite:RewriteTests",
"Sema:SemaTests",
+ "Serialization:SerializationTests",
"Tooling:ToolingTests",
+ "Tooling/Syntax:SyntaxTests",
]
if (clang_enable_static_analyzer) {
deps += [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn
index 31277ae..2f4555d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn
@@ -12,7 +12,6 @@
"DiagnosticTest.cpp",
"FileManagerTest.cpp",
"FixedPointTest.cpp",
- "MemoryBufferCacheTest.cpp",
"SourceManagerTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn
index aaf990b..5125580 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn
@@ -13,6 +13,7 @@
sources = [
"CleanupTest.cpp",
"FormatTest.cpp",
+ "FormatTestCSharp.cpp",
"FormatTestComments.cpp",
"FormatTestJS.cpp",
"FormatTestJava.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn
index 63180cb..3c79748 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn
@@ -11,6 +11,7 @@
"//llvm/lib/Support",
]
sources = [
+ "DependencyDirectivesSourceMinimizerTest.cpp",
"HeaderMapTest.cpp",
"HeaderSearchTest.cpp",
"LexerTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn
index 350f67d..daf2508 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn
@@ -3,10 +3,14 @@
unittest("RewriteTests") {
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
+ "//clang/lib/Frontend",
"//clang/lib/Rewrite",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
"//llvm/lib/Support",
]
sources = [
"RewriteBufferTest.cpp",
+ "RewriterTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn
index b65865d..2c9e894 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn
@@ -10,6 +10,7 @@
"//clang/lib/Sema",
"//clang/lib/Tooling",
"//llvm/lib/Support",
+ "//llvm/lib/Testing/Support",
]
sources = [
"CodeCompleteTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Serialization/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Serialization/BUILD.gn
new file mode 100644
index 0000000..5c25382
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Serialization/BUILD.gn
@@ -0,0 +1,17 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("SerializationTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Lex",
+ "//clang/lib/Sema",
+ "//clang/lib/Serialization",
+ "//llvm/lib/Bitcode/Reader",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "InMemoryModuleCacheTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn
index 4263853..7715614 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn
@@ -12,6 +12,9 @@
]
sources = [
"AnalyzerOptionsTest.cpp",
+ "CallDescriptionTest.cpp",
"RegisterCustomCheckersTest.cpp",
+ "StoreTest.cpp",
+ "SymbolReaperTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
index 5b027dc..d57538d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
@@ -16,6 +16,7 @@
"//clang/lib/Tooling/Refactoring",
"//llvm/lib/Support",
"//llvm/lib/Target:TargetsToBuild",
+ "//llvm/lib/Testing/Support",
]
sources = [
"ASTSelectionTest.cpp",
@@ -29,6 +30,7 @@
"LexicallyOrderedRecursiveASTVisitorTest.cpp",
"LookupTest.cpp",
"QualTypeNamesTest.cpp",
+ "RangeSelectorTest.cpp",
"RecursiveASTVisitorTestDeclVisitor.cpp",
"RecursiveASTVisitorTestPostOrderVisitor.cpp",
"RecursiveASTVisitorTestTypeLocVisitor.cpp",
@@ -47,6 +49,7 @@
"RecursiveASTVisitorTests/IntegerLiteral.cpp",
"RecursiveASTVisitorTests/LambdaDefaultCapture.cpp",
"RecursiveASTVisitorTests/LambdaExpr.cpp",
+ "RecursiveASTVisitorTests/LambdaTemplateParams.cpp",
"RecursiveASTVisitorTests/NestedNameSpecifiers.cpp",
"RecursiveASTVisitorTests/ParenExpr.cpp",
"RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp",
@@ -56,6 +59,9 @@
"RefactoringTest.cpp",
"ReplacementsYamlTest.cpp",
"RewriterTest.cpp",
+ "SourceCodeTest.cpp",
+ "StencilTest.cpp",
"ToolingTest.cpp",
+ "TransformerTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/BUILD.gn
new file mode 100644
index 0000000..0449e6e
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/BUILD.gn
@@ -0,0 +1,21 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("SyntaxTests") {
+ configs += [ "//llvm/utils/gn/build:clang_code" ]
+ deps = [
+ "//clang/lib/AST",
+ "//clang/lib/Basic",
+ "//clang/lib/Frontend",
+ "//clang/lib/Lex",
+ "//clang/lib/Serialization",
+ "//clang/lib/Tooling",
+ "//clang/lib/Tooling/Syntax",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:TargetsToBuild",
+ "//llvm/lib/Testing/Support",
+ ]
+ sources = [
+ "TokensTest.cpp",
+ "TreeTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/clang/utils/TableGen/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/clang/utils/TableGen/BUILD.gn
index acfccca..9a81b79 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/clang/utils/TableGen/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/clang/utils/TableGen/BUILD.gn
@@ -11,6 +11,7 @@
"ClangCommentHTMLTagsEmitter.cpp",
"ClangDataCollectorsEmitter.cpp",
"ClangDiagnosticsEmitter.cpp",
+ "ClangOpenCLBuiltinEmitter.cpp",
"ClangOptionDocEmitter.cpp",
"ClangSACheckersEmitter.cpp",
"NeonEmitter.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
new file mode 100644
index 0000000..d2bfd1c
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
@@ -0,0 +1,5 @@
+group("compiler-rt") {
+ deps = [
+ "//compiler-rt/lib(//llvm/utils/gn/build/toolchain:stage2_unix)",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/include/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/include/BUILD.gn
index 39aac9f..446df71 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/include/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/include/BUILD.gn
@@ -7,7 +7,6 @@
"sanitizer/common_interface_defs.h",
"sanitizer/coverage_interface.h",
"sanitizer/dfsan_interface.h",
- "sanitizer/esan_interface.h",
"sanitizer/hwasan_interface.h",
"sanitizer/linux_syscall_hooks.h",
"sanitizer/lsan_interface.h",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
new file mode 100644
index 0000000..16aa0ec
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
@@ -0,0 +1,5 @@
+group("lib") {
+ deps = [
+ "//compiler-rt/lib/builtins",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
new file mode 100644
index 0000000..53d6386
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -0,0 +1,484 @@
+import("//compiler-rt/target.gni")
+import("//llvm/utils/gn/build/buildflags.gni")
+
+declare_args() {
+ # Skip the atomic builtin (these should normally be provided by a shared library)
+ compiler_rt_exclude_atomic_builtin = true
+
+ # Compile builtins for baremetal.
+ compiler_rt_baremetal_build = false
+}
+
+static_library("builtins") {
+ output_dir = crt_current_out_dir
+ output_name = "clang_rt.builtins$crt_current_target_suffix"
+ complete_static_lib = true
+ cflags = [
+ "-fPIC",
+ "-fno-builtin",
+ ]
+ if (target_os != "android") {
+ cflags += [ "-fvisibility=hidden" ]
+ }
+ if (!is_debug) {
+ cflags += [ "-fomit-frame-pointer" ]
+ }
+ cflags_c = [ "-std=c11" ]
+ configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+
+ sources = [
+ "absvdi2.c",
+ "absvsi2.c",
+ "absvti2.c",
+ "adddf3.c",
+ "addsf3.c",
+ "addtf3.c",
+ "addvdi3.c",
+ "addvsi3.c",
+ "addvti3.c",
+ "apple_versioning.c",
+ "ashldi3.c",
+ "ashlti3.c",
+ "ashrdi3.c",
+ "ashrti3.c",
+ "bswapdi2.c",
+ "bswapsi2.c",
+ "clzdi2.c",
+ "clzsi2.c",
+ "clzti2.c",
+ "cmpdi2.c",
+ "cmpti2.c",
+ "comparedf2.c",
+ "comparesf2.c",
+ "ctzdi2.c",
+ "ctzsi2.c",
+ "ctzti2.c",
+ "divdc3.c",
+ "divdf3.c",
+ "divdi3.c",
+ "divmoddi4.c",
+ "divmodsi4.c",
+ "divsc3.c",
+ "divsf3.c",
+ "divsi3.c",
+ "divtc3.c",
+ "divtf3.c",
+ "divti3.c",
+ "extendhfsf2.c",
+ "extendsfdf2.c",
+ "ffsdi2.c",
+ "ffssi2.c",
+ "ffsti2.c",
+ "fixdfdi.c",
+ "fixdfsi.c",
+ "fixdfti.c",
+ "fixsfdi.c",
+ "fixsfsi.c",
+ "fixsfti.c",
+ "fixunsdfdi.c",
+ "fixunsdfsi.c",
+ "fixunsdfti.c",
+ "fixunssfdi.c",
+ "fixunssfsi.c",
+ "fixunssfti.c",
+ "floatdidf.c",
+ "floatdisf.c",
+ "floatsidf.c",
+ "floatsisf.c",
+ "floattidf.c",
+ "floattisf.c",
+ "floatundidf.c",
+ "floatundisf.c",
+ "floatunsidf.c",
+ "floatunsisf.c",
+ "floatuntidf.c",
+ "floatuntisf.c",
+ "int_util.c",
+ "lshrdi3.c",
+ "lshrti3.c",
+ "moddi3.c",
+ "modsi3.c",
+ "modti3.c",
+ "muldc3.c",
+ "muldf3.c",
+ "muldi3.c",
+ "mulodi4.c",
+ "mulosi4.c",
+ "muloti4.c",
+ "mulsc3.c",
+ "mulsf3.c",
+ "multf3.c",
+ "multi3.c",
+ "mulvdi3.c",
+ "mulvsi3.c",
+ "mulvti3.c",
+ "negdf2.c",
+ "negdi2.c",
+ "negsf2.c",
+ "negti2.c",
+ "negvdi2.c",
+ "negvsi2.c",
+ "negvti2.c",
+ "os_version_check.c",
+ "paritydi2.c",
+ "paritysi2.c",
+ "parityti2.c",
+ "popcountdi2.c",
+ "popcountsi2.c",
+ "popcountti2.c",
+ "powidf2.c",
+ "powisf2.c",
+ "powitf2.c",
+ "subdf3.c",
+ "subsf3.c",
+ "subtf3.c",
+ "subvdi3.c",
+ "subvsi3.c",
+ "subvti3.c",
+ "trampoline_setup.c",
+ "truncdfhf2.c",
+ "truncdfsf2.c",
+ "truncsfhf2.c",
+ "ucmpdi2.c",
+ "ucmpti2.c",
+ "udivdi3.c",
+ "udivmoddi4.c",
+ "udivmodsi4.c",
+ "udivmodti4.c",
+ "udivsi3.c",
+ "udivti3.c",
+ "umoddi3.c",
+ "umodsi3.c",
+ "umodti3.c",
+
+ # This depends on unwind.h which is present in Clang headers. We should
+ # reconsider this if we ever decide to support building builtins with
+ # other compilers.
+ "gcc_personality_v0.c",
+ ]
+
+ if (target_os != "fuchsia") {
+ sources += [
+ "emutls.c",
+ "enable_execute_stack.c",
+ "eprintf.c",
+ ]
+ }
+
+ if (target_os != "fuchsia" && !compiler_rt_baremetal_build) {
+ sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "clear_cache.c",
+ ]
+ }
+
+ if (target_os == "mac") {
+ sources += [
+ "atomic_flag_clear.c",
+ "atomic_flag_clear_explicit.c",
+ "atomic_flag_test_and_set.c",
+ "atomic_flag_test_and_set_explicit.c",
+ "atomic_signal_fence.c",
+ "atomic_thread_fence.c",
+ ]
+ }
+
+ if (target_cpu == "x86" || target_cpu == "x64") {
+ sources += [
+ "cpu_model.c",
+ "divxc3.c",
+ "fixunsxfdi.c",
+ "fixunsxfsi.c",
+ "fixunsxfti.c",
+ "fixxfdi.c",
+ "fixxfti.c",
+ "floatdixf.c",
+ "floattixf.c",
+ "floatundixf.c",
+ "floatuntixf.c",
+ "mulxc3.c",
+ "powixf2.c",
+ ]
+ }
+ if (target_os == "x86") {
+ sources += [
+ "i386/ashldi3.S",
+ "i386/ashrdi3.S",
+ "i386/divdi3.S",
+ "i386/floatdidf.S",
+ "i386/floatdisf.S",
+ "i386/floatdixf.S",
+ "i386/floatundidf.S",
+ "i386/floatundisf.S",
+ "i386/floatundixf.S",
+ "i386/lshrdi3.S",
+ "i386/moddi3.S",
+ "i386/muldi3.S",
+ "i386/udivdi3.S",
+ "i386/umoddi3.S",
+ ]
+ if (target_os == "win") {
+ sources += [
+ "i386/chkstk.S",
+ "i386/chkstk2.S",
+ ]
+ }
+ } else if (target_cpu == "x64") {
+ sources += [
+ "x86_64/floatdidf.c",
+ "x86_64/floatdisf.c",
+ "x86_64/floatdixf.c",
+ "x86_64/floatundidf.S",
+ "x86_64/floatundisf.S",
+ "x86_64/floatundixf.S",
+ ]
+ if (target_os == "win") {
+ sources += [
+ "x86_64/chkstk.S",
+ "x86_64/chkstk2.S",
+ ]
+ }
+ }
+
+ if (target_cpu == "arm") {
+ sources += [
+ "arm/bswapdi2.S",
+ "arm/bswapsi2.S",
+ "arm/clzdi2.S",
+ "arm/clzsi2.S",
+ "arm/comparesf2.S",
+ "arm/divmodsi4.S",
+ "arm/divsi3.S",
+ "arm/modsi3.S",
+ "arm/sync_fetch_and_add_4.S",
+ "arm/sync_fetch_and_add_8.S",
+ "arm/sync_fetch_and_and_4.S",
+ "arm/sync_fetch_and_and_8.S",
+ "arm/sync_fetch_and_max_4.S",
+ "arm/sync_fetch_and_max_8.S",
+ "arm/sync_fetch_and_min_4.S",
+ "arm/sync_fetch_and_min_8.S",
+ "arm/sync_fetch_and_nand_4.S",
+ "arm/sync_fetch_and_nand_8.S",
+ "arm/sync_fetch_and_or_4.S",
+ "arm/sync_fetch_and_or_8.S",
+ "arm/sync_fetch_and_sub_4.S",
+ "arm/sync_fetch_and_sub_8.S",
+ "arm/sync_fetch_and_umax_4.S",
+ "arm/sync_fetch_and_umax_8.S",
+ "arm/sync_fetch_and_umin_4.S",
+ "arm/sync_fetch_and_umin_8.S",
+ "arm/sync_fetch_and_xor_4.S",
+ "arm/sync_fetch_and_xor_8.S",
+ "arm/udivmodsi4.S",
+ "arm/udivsi3.S",
+ "arm/umodsi3.S",
+ ]
+ if (target_os == "mingw") {
+ sources += [
+ "arm/aeabi_idivmod.S",
+ "arm/aeabi_ldivmod.S",
+ "arm/aeabi_uidivmod.S",
+ "arm/aeabi_uldivmod.S",
+ "arm/chkstk.S",
+ "divdi3.c",
+ "divmoddi4.c",
+ "divmodsi4.c",
+ "divsi3.c",
+ "emutls.c",
+ "fixdfdi.c",
+ "fixsfdi.c",
+ "fixunsdfdi.c",
+ "fixunssfdi.c",
+ "floatdidf.c",
+ "floatdisf.c",
+ "floatundidf.c",
+ "floatundisf.c",
+ "mingw_fixfloat.c",
+ "moddi3.c",
+ "udivmoddi4.c",
+ "udivmodsi4.c",
+ "udivsi3.c",
+ "umoddi3.c",
+ ]
+ }
+ }
+
+ if (target_cpu == "arm64") {
+ sources += [
+ "comparetf2.c",
+ "extenddftf2.c",
+ "extendsftf2.c",
+ "fixtfdi.c",
+ "fixtfsi.c",
+ "fixtfti.c",
+ "fixunstfdi.c",
+ "fixunstfsi.c",
+ "fixunstfti.c",
+ "floatditf.c",
+ "floatsitf.c",
+ "floattitf.c",
+ "floatunditf.c",
+ "floatunsitf.c",
+ "floatuntitf.c",
+ "multc3.c",
+ "trunctfdf2.c",
+ "trunctfsf2.c",
+ ]
+ if (target_os == "mingw") {
+ sources += [
+ # This comment prevents `gn format` from putting the file on the same
+ # line as `sources +=`, for sync_source_lists_from_cmake.py.
+ "aarch64/chkstk.S",
+ ]
+ }
+ }
+
+ if (target_cpu == "hexagon") {
+ sources += [
+ "hexagon/common_entry_exit_abi1.S",
+ "hexagon/common_entry_exit_abi2.S",
+ "hexagon/common_entry_exit_legacy.S",
+ "hexagon/dfaddsub.S",
+ "hexagon/dfdiv.S",
+ "hexagon/dffma.S",
+ "hexagon/dfminmax.S",
+ "hexagon/dfmul.S",
+ "hexagon/dfsqrt.S",
+ "hexagon/divdi3.S",
+ "hexagon/divsi3.S",
+ "hexagon/fabs_opt.S",
+ "hexagon/fastmath2_dlib_asm.S",
+ "hexagon/fastmath2_ldlib_asm.S",
+ "hexagon/fastmath_dlib_asm.S",
+ "hexagon/fma_opt.S",
+ "hexagon/fmax_opt.S",
+ "hexagon/fmin_opt.S",
+ "hexagon/memcpy_forward_vp4cp4n2.S",
+ "hexagon/memcpy_likely_aligned.S",
+ "hexagon/moddi3.S",
+ "hexagon/modsi3.S",
+ "hexagon/sfdiv_opt.S",
+ "hexagon/sfsqrt_opt.S",
+ "hexagon/udivdi3.S",
+ "hexagon/udivmoddi4.S",
+ "hexagon/udivmodsi4.S",
+ "hexagon/udivsi3.S",
+ "hexagon/umoddi3.S",
+ "hexagon/umodsi3.S",
+ ]
+ }
+
+ if (target_cpu == "ppc64") {
+ sources += [
+ "ppc/divtc3.c",
+ "ppc/fixtfdi.c",
+ "ppc/fixunstfdi.c",
+ "ppc/fixunstfti.c",
+ "ppc/floatditf.c",
+ "ppc/floattitf.c",
+ "ppc/floatunditf.c",
+ "ppc/gcc_qadd.c",
+ "ppc/gcc_qdiv.c",
+ "ppc/gcc_qmul.c",
+ "ppc/gcc_qsub.c",
+ "ppc/multc3.c",
+ ]
+ }
+
+ if (target_cpu == "riscv") {
+ sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "riscv/mulsi3.S",
+ ]
+ }
+
+ if (!compiler_rt_exclude_atomic_builtin) {
+ sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "atomic.c",
+ ]
+ }
+}
+
+# Currently unused but necessary to make the sync_source_lists_from_cmake.py happy.
+source_set("_unused") {
+ sources = [
+ # Thumb1
+ "arm/addsf3.S",
+ "arm/comparesf2.S",
+ "arm/divsi3.S",
+ "arm/udivsi3.S",
+
+ # EABI
+ "arm/aeabi_cdcmp.S",
+ "arm/aeabi_cdcmpeq_check_nan.c",
+ "arm/aeabi_cfcmp.S",
+ "arm/aeabi_cfcmpeq_check_nan.c",
+ "arm/aeabi_dcmp.S",
+ "arm/aeabi_div0.c",
+ "arm/aeabi_drsub.c",
+ "arm/aeabi_fcmp.S",
+ "arm/aeabi_frsub.c",
+ "arm/aeabi_idivmod.S",
+ "arm/aeabi_ldivmod.S",
+ "arm/aeabi_memcmp.S",
+ "arm/aeabi_memcpy.S",
+ "arm/aeabi_memmove.S",
+ "arm/aeabi_memset.S",
+ "arm/aeabi_uidivmod.S",
+ "arm/aeabi_uldivmod.S",
+
+ # Thumb1 JT
+ "arm/switch16.S",
+ "arm/switch32.S",
+ "arm/switch8.S",
+ "arm/switchu8.S",
+
+ # Thumb1 SjLj
+ "arm/restore_vfp_d8_d15_regs.S",
+ "arm/save_vfp_d8_d15_regs.S",
+
+ # Thumb1 VFPv2
+ "arm/adddf3vfp.S",
+ "arm/addsf3vfp.S",
+ "arm/divdf3vfp.S",
+ "arm/divsf3vfp.S",
+ "arm/eqdf2vfp.S",
+ "arm/eqsf2vfp.S",
+ "arm/extendsfdf2vfp.S",
+ "arm/fixdfsivfp.S",
+ "arm/fixsfsivfp.S",
+ "arm/fixunsdfsivfp.S",
+ "arm/fixunssfsivfp.S",
+ "arm/floatsidfvfp.S",
+ "arm/floatsisfvfp.S",
+ "arm/floatunssidfvfp.S",
+ "arm/floatunssisfvfp.S",
+ "arm/gedf2vfp.S",
+ "arm/gesf2vfp.S",
+ "arm/gtdf2vfp.S",
+ "arm/gtsf2vfp.S",
+ "arm/ledf2vfp.S",
+ "arm/lesf2vfp.S",
+ "arm/ltdf2vfp.S",
+ "arm/ltsf2vfp.S",
+ "arm/muldf3vfp.S",
+ "arm/mulsf3vfp.S",
+ "arm/nedf2vfp.S",
+ "arm/negdf2vfp.S",
+ "arm/negsf2vfp.S",
+ "arm/nesf2vfp.S",
+ "arm/subdf3vfp.S",
+ "arm/subsf3vfp.S",
+ "arm/truncdfsf2vfp.S",
+ "arm/unorddf2vfp.S",
+ "arm/unordsf2vfp.S",
+
+ # Thumb1 icache
+ "arm/sync_synchronize.S",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/cfi/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/cfi/BUILD.gn
index dd24b5b..0db8fca 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/cfi/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/cfi/BUILD.gn
@@ -1,5 +1,13 @@
import("//clang/resource_dir.gni")
+source_set("sources") {
+ configs -= [ "//llvm/utils/gn/build:llvm_code" ]
+ configs += [ "//llvm/utils/gn/build:crt_code" ]
+ sources = [
+ "cfi.cpp",
+ ]
+}
+
copy("blacklist") {
sources = [
"cfi_blacklist.txt",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
index 81b6f60d..f29d245 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
@@ -16,11 +16,14 @@
"--version-list",
"--extra",
rebase_path(sources[0], root_build_dir),
- rebase_path("$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.a",
- root_build_dir),
rebase_path(
- "$crt_current_out_dir/libclang_rt.hwasan_cxx-$crt_current_target.a",
+ "$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.a",
root_build_dir),
+ rebase_path(
+ "$crt_current_out_dir/libclang_rt.hwasan_cxx$crt_current_target_suffix.a",
+ root_build_dir),
+ "--nm-executable",
+ "nm",
"-o",
rebase_path(outputs[0], root_build_dir),
]
@@ -36,16 +39,29 @@
"//compiler-rt/lib/ubsan:sources",
]
sources = [
- "hwasan.cc",
- "hwasan_allocator.cc",
- "hwasan_dynamic_shadow.cc",
- "hwasan_interceptors.cc",
- "hwasan_linux.cc",
- "hwasan_memintrinsics.cc",
- "hwasan_poisoning.cc",
- "hwasan_report.cc",
- "hwasan_thread.cc",
- "hwasan_thread_list.cc",
+ "hwasan.cpp",
+ "hwasan.h",
+ "hwasan_allocator.cpp",
+ "hwasan_allocator.h",
+ "hwasan_dynamic_shadow.cpp",
+ "hwasan_dynamic_shadow.h",
+ "hwasan_flags.h",
+ "hwasan_interceptors.cpp",
+ "hwasan_interceptors_vfork.S",
+ "hwasan_interface_internal.h",
+ "hwasan_linux.cpp",
+ "hwasan_malloc_bisect.h",
+ "hwasan_mapping.h",
+ "hwasan_memintrinsics.cpp",
+ "hwasan_poisoning.cpp",
+ "hwasan_poisoning.h",
+ "hwasan_report.cpp",
+ "hwasan_report.h",
+ "hwasan_tag_mismatch_aarch64.S",
+ "hwasan_thread.cpp",
+ "hwasan_thread.h",
+ "hwasan_thread_list.cpp",
+ "hwasan_thread_list.h",
]
}
@@ -56,15 +72,18 @@
"//compiler-rt/lib/ubsan:cxx_sources",
]
sources = [
- "hwasan_new_delete.cc",
+ "hwasan_new_delete.cpp",
]
}
static_library("hwasan") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan-$crt_current_target"
+ output_name = "clang_rt.hwasan$crt_current_target_suffix"
complete_static_lib = true
- configs -= [ "//llvm/utils/gn/build:llvm_code" ]
+ configs -= [
+ "//llvm/utils/gn/build:llvm_code",
+ "//llvm/utils/gn/build:thin_archive",
+ ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":sources",
@@ -73,9 +92,12 @@
static_library("hwasan_cxx") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan_cxx-$crt_current_target"
+ output_name = "clang_rt.hwasan_cxx$crt_current_target_suffix"
complete_static_lib = true
- configs -= [ "//llvm/utils/gn/build:llvm_code" ]
+ configs -= [
+ "//llvm/utils/gn/build:llvm_code",
+ "//llvm/utils/gn/build:thin_archive",
+ ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
":cxx_sources",
@@ -84,7 +106,7 @@
shared_library("hwasan_shared") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan-$crt_current_target"
+ output_name = "clang_rt.hwasan$crt_current_target_suffix"
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/interception/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/interception/BUILD.gn
index 4276e2e4..77a6c28 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/interception/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/interception/BUILD.gn
@@ -5,9 +5,13 @@
"//compiler-rt/lib/sanitizer_common:sources",
]
sources = [
+ "interception.h",
"interception_linux.cc",
+ "interception_linux.h",
"interception_mac.cc",
+ "interception_mac.h",
"interception_type_test.cc",
"interception_win.cc",
+ "interception_win.h",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
index 7d280bd..0c4c2e2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
@@ -13,71 +13,148 @@
}
sources = [
"sancov_flags.cc",
+ "sancov_flags.h",
+ "sanitizer_addrhashmap.h",
"sanitizer_allocator.cc",
+ "sanitizer_allocator.h",
+ "sanitizer_allocator_bytemap.h",
"sanitizer_allocator_checks.cc",
+ "sanitizer_allocator_checks.h",
+ "sanitizer_allocator_combined.h",
+ "sanitizer_allocator_interface.h",
+ "sanitizer_allocator_internal.h",
+ "sanitizer_allocator_local_cache.h",
+ "sanitizer_allocator_primary32.h",
+ "sanitizer_allocator_primary64.h",
"sanitizer_allocator_report.cc",
+ "sanitizer_allocator_report.h",
+ "sanitizer_allocator_secondary.h",
+ "sanitizer_allocator_size_class_map.h",
+ "sanitizer_allocator_stats.h",
+ "sanitizer_asm.h",
+ "sanitizer_atomic.h",
+ "sanitizer_atomic_clang.h",
+ "sanitizer_atomic_clang_mips.h",
+ "sanitizer_atomic_clang_other.h",
+ "sanitizer_atomic_clang_x86.h",
+ "sanitizer_atomic_msvc.h",
+ "sanitizer_bitvector.h",
+ "sanitizer_bvgraph.h",
"sanitizer_common.cc",
+ "sanitizer_common.h",
"sanitizer_common_libcdep.cc",
"sanitizer_coverage_fuchsia.cc",
"sanitizer_coverage_libcdep_new.cc",
"sanitizer_coverage_win_sections.cc",
+ "sanitizer_dbghelp.h",
+ "sanitizer_deadlock_detector.h",
"sanitizer_deadlock_detector1.cc",
"sanitizer_deadlock_detector2.cc",
+ "sanitizer_deadlock_detector_interface.h",
"sanitizer_errno.cc",
+ "sanitizer_errno.h",
+ "sanitizer_errno_codes.h",
"sanitizer_file.cc",
+ "sanitizer_file.h",
"sanitizer_flag_parser.cc",
+ "sanitizer_flag_parser.h",
"sanitizer_flags.cc",
+ "sanitizer_flags.h",
+ "sanitizer_freebsd.h",
"sanitizer_fuchsia.cc",
+ "sanitizer_fuchsia.h",
+ "sanitizer_getauxval.h",
+ "sanitizer_hash.h",
+ "sanitizer_interface_internal.h",
+ "sanitizer_internal_defs.h",
+ "sanitizer_lfstack.h",
"sanitizer_libc.cc",
+ "sanitizer_libc.h",
"sanitizer_libignore.cc",
+ "sanitizer_libignore.h",
"sanitizer_linux.cc",
+ "sanitizer_linux.h",
"sanitizer_linux_libcdep.cc",
"sanitizer_linux_s390.cc",
+ "sanitizer_list.h",
+ "sanitizer_local_address_space_view.h",
"sanitizer_mac.cc",
+ "sanitizer_mac.h",
"sanitizer_mac_libcdep.cc",
+ "sanitizer_mutex.h",
"sanitizer_netbsd.cc",
"sanitizer_openbsd.cc",
"sanitizer_persistent_allocator.cc",
+ "sanitizer_persistent_allocator.h",
+ "sanitizer_placement_new.h",
+ "sanitizer_platform.h",
+ "sanitizer_platform_interceptors.h",
"sanitizer_platform_limits_freebsd.cc",
"sanitizer_platform_limits_linux.cc",
"sanitizer_platform_limits_netbsd.cc",
+ "sanitizer_platform_limits_netbsd.h",
"sanitizer_platform_limits_openbsd.cc",
+ "sanitizer_platform_limits_openbsd.h",
"sanitizer_platform_limits_posix.cc",
+ "sanitizer_platform_limits_posix.h",
"sanitizer_platform_limits_solaris.cc",
+ "sanitizer_platform_limits_solaris.h",
"sanitizer_posix.cc",
+ "sanitizer_posix.h",
"sanitizer_posix_libcdep.cc",
"sanitizer_printf.cc",
+ "sanitizer_procmaps.h",
"sanitizer_procmaps_bsd.cc",
"sanitizer_procmaps_common.cc",
"sanitizer_procmaps_linux.cc",
"sanitizer_procmaps_mac.cc",
"sanitizer_procmaps_solaris.cc",
+ "sanitizer_quarantine.h",
+ "sanitizer_report_decorator.h",
+ "sanitizer_ring_buffer.h",
"sanitizer_rtems.cc",
+ "sanitizer_rtems.h",
"sanitizer_solaris.cc",
"sanitizer_stackdepot.cc",
+ "sanitizer_stackdepot.h",
+ "sanitizer_stackdepotbase.h",
"sanitizer_stacktrace.cc",
+ "sanitizer_stacktrace.h",
"sanitizer_stacktrace_libcdep.cc",
"sanitizer_stacktrace_printer.cc",
+ "sanitizer_stacktrace_printer.h",
"sanitizer_stacktrace_sparc.cc",
+ "sanitizer_stoptheworld.h",
"sanitizer_stoptheworld_linux_libcdep.cc",
"sanitizer_stoptheworld_mac.cc",
"sanitizer_suppressions.cc",
+ "sanitizer_suppressions.h",
"sanitizer_symbolizer.cc",
+ "sanitizer_symbolizer.h",
+ "sanitizer_symbolizer_fuchsia.h",
+ "sanitizer_symbolizer_internal.h",
"sanitizer_symbolizer_libbacktrace.cc",
+ "sanitizer_symbolizer_libbacktrace.h",
"sanitizer_symbolizer_libcdep.cc",
"sanitizer_symbolizer_mac.cc",
+ "sanitizer_symbolizer_mac.h",
"sanitizer_symbolizer_markup.cc",
"sanitizer_symbolizer_posix_libcdep.cc",
"sanitizer_symbolizer_report.cc",
+ "sanitizer_symbolizer_rtems.h",
"sanitizer_symbolizer_win.cc",
"sanitizer_termination.cc",
"sanitizer_thread_registry.cc",
+ "sanitizer_thread_registry.h",
"sanitizer_tls_get_addr.cc",
+ "sanitizer_tls_get_addr.h",
"sanitizer_unwind_linux_libcdep.cc",
"sanitizer_unwind_win.cc",
+ "sanitizer_vector.h",
"sanitizer_win.cc",
+ "sanitizer_win.h",
+ "sanitizer_win_defs.h",
+ "sanitizer_win_dll_thunk.h",
+ "sanitizer_win_weak_interception.h",
]
- if (current_cpu == "x64") {
- sources += [ "sanitizer_linux_x86_64.S" ]
- }
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
index 7169816..6fa8663 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn
@@ -8,11 +8,20 @@
]
sources = [
"ubsan_diag.cc",
+ "ubsan_diag.h",
"ubsan_flags.cc",
+ "ubsan_flags.h",
"ubsan_handlers.cc",
+ "ubsan_handlers.h",
"ubsan_init.cc",
+ "ubsan_init.h",
"ubsan_monitor.cc",
+ "ubsan_monitor.h",
+ "ubsan_platform.h",
+ "ubsan_signals_standalone.h",
+ "ubsan_type_hash.h",
"ubsan_value.cc",
+ "ubsan_value.h",
]
}
@@ -23,6 +32,7 @@
defines = [ "UBSAN_CAN_USE_CXXABI" ]
sources = [
"ubsan_handlers_cxx.cc",
+ "ubsan_handlers_cxx.h",
"ubsan_type_hash.cc",
"ubsan_type_hash_itanium.cc",
"ubsan_type_hash_win.cc",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/target.gni b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/target.gni
index 7ea73b1..0d55e0d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/target.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/target.gni
@@ -1,20 +1,29 @@
import("//clang/resource_dir.gni")
+import("//clang/runtimes.gni")
-if (current_os == "linux" || current_os == "android") {
- crt_current_out_dir = "$clang_resource_dir/lib/linux"
-} else {
- assert(false, "unimplemented current_os " + current_os)
-}
-
-if (current_cpu == "x64") {
+if (current_cpu == "x86") {
+ crt_current_target_arch = "i386"
+} else if (current_cpu == "x64") {
crt_current_target_arch = "x86_64"
} else if (current_cpu == "arm64") {
crt_current_target_arch = "aarch64"
+} else if (current_cpu == "ppc64") {
+ crt_current_target_arch = "powerpc64le"
} else {
assert(false, "unimplemented current_cpu " + current_cpu)
}
-crt_current_target = crt_current_target_arch
-if (current_os == "android") {
- crt_current_target += "-android"
+if (clang_enable_per_target_runtime_dir) {
+ crt_current_out_dir = runtimes_dir
+
+ crt_current_target_suffix = ""
+} else if (current_os == "linux" || current_os == "android") {
+ crt_current_out_dir = "$clang_resource_dir/lib/linux"
+
+ crt_current_target_suffix = "-$crt_current_target_arch"
+ if (current_os == "android") {
+ crt_current_target_suffix += "-android"
+ }
+} else {
+ assert(false, "unimplemented current_os " + current_os)
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
index 59c0f78..1ee30ee 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
@@ -1,6 +1,7 @@
import("//compiler-rt/target.gni")
import("//compiler-rt/test/test.gni")
import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/libs/zlib/enable.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/version.gni")
@@ -33,19 +34,24 @@
"LLVM_TOOLS_DIR=" + rebase_path("$root_build_dir/bin"),
"LLVM_LIBRARY_OUTPUT_INTDIR=" + rebase_path("$root_build_dir/lib"),
+ "LLVM_LIBCXX_USED=0",
+
"GOLD_EXECUTABLE=ld",
"COMPILER_RT_RESOLVED_TEST_COMPILER=" +
rebase_path("$root_build_dir/bin/clang"),
"COMPILER_RT_TEST_COMPILER_ID=Clang",
"PYTHON_EXECUTABLE=$python_path",
"COMPILER_RT_DEBUG_PYBOOL=False",
+ "COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL=False",
"COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR=" +
rebase_path(crt_current_out_dir),
"COMPILER_RT_EMULATOR=",
"COMPILER_RT_ASAN_SHADOW_SCALE=",
"SANITIZER_CAN_USE_CXXABI_PYBOOL=True",
"COMPILER_RT_HAS_LLD_PYBOOL=True",
+ "COMPILER_RT_HAS_GWP_ASAN_PYBOOL=False",
"HAVE_RPC_XDR_H=0",
+ "ANDROID_NDK_VERSION=19",
"ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
]
@@ -76,4 +82,10 @@
} else {
values += [ "ANDROID_PYBOOL=False" ]
}
+
+ if (llvm_enable_zlib) {
+ values += [ "HAVE_LIBZ=1" ]
+ } else {
+ values += [ "HAVE_LIBZ=0" ]
+ }
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
index ee65838..37ad25f 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
@@ -5,13 +5,13 @@
import("//llvm/version.gni")
write_cmake_config("lit_site_cfg") {
- input = "lit.site.cfg.in"
- output = "$target_gen_dir/lit.site.cfg"
+ input = "lit.site.cfg.py.in"
+ output = "$target_gen_dir/lit.site.cfg.py"
values = [
"LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
- "HWASAN_TEST_CONFIG_SUFFIX=-$crt_current_target",
+ "HWASAN_TEST_CONFIG_SUFFIX=$crt_current_target_suffix",
"HWASAN_TEST_TARGET_CFLAGS=$target_flags_string",
"HWASAN_TEST_TARGET_ARCH=$crt_current_target_arch",
@@ -21,7 +21,7 @@
if (current_os == "android") {
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[\"" + rebase_path(
- "$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.so") + "\", \"" + rebase_path(
+ "$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.so") + "\", \"" + rebase_path(
"$root_out_dir/bin/llvm-symbolizer") + "\"]" ]
} else {
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[]" ]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/test.gni b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/test.gni
index 4144482..e233593 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/test.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/compiler-rt/test/test.gni
@@ -7,8 +7,7 @@
target_flags_string = ""
-foreach(flag,
- target_flags + target_cflags + target_ldflags + [ "-fuse-ld=lld" ]) {
+foreach(flag, target_flags + target_ldflags + [ "-fuse-ld=lld" ]) {
if (target_flags_string != "") {
target_flags_string += " "
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxx/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxx/BUILD.gn
new file mode 100644
index 0000000..aaba4d5
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxx/BUILD.gn
@@ -0,0 +1,6 @@
+group("libcxx") {
+ deps = [
+ "include",
+ "src(//llvm/utils/gn/build/toolchain:stage2_unix)",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxx/config.gni b/src/llvm-project/llvm/utils/gn/secondary/libcxx/config.gni
new file mode 100644
index 0000000..b90263a
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxx/config.gni
@@ -0,0 +1,10 @@
+declare_args() {
+ # ABI version of libc++. Can be either 1 or 2, where 2 is currently not stable. Defaults to 1.
+ libcxx_abi_version = 1
+
+ # The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.
+ libcxx_abi_namespace = ""
+
+ # Unstable ABI of libc++.
+ libcxx_abi_unstable = false
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
new file mode 100644
index 0000000..92ea241
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -0,0 +1,258 @@
+import("//clang/resource_dir.gni")
+import("//libcxx/config.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+
+declare_args() {
+ # Install libc++ support headers.
+ libcxx_install_support_headers = true
+}
+
+libcxx_needs_site_config =
+ libcxx_abi_version != 1 || libcxx_abi_namespace != "" || libcxx_abi_unstable
+
+if (libcxx_needs_site_config) {
+ write_cmake_config("write_config") {
+ input = "__config_site.in"
+ output = "$target_gen_dir/__config_site"
+
+ values = []
+ if (libcxx_abi_version != 1) {
+ values += [ "_LIBCPP_ABI_VERSION=$libcxx_abi_version" ]
+ }
+ if (libcxx_abi_namespace != "") {
+ values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
+ }
+ if (libcxx_abi_unstable) {
+ values += [ "_LIBCPP_ABI_UNSTABLE=" ]
+ }
+ }
+
+ # Generate a custom __config header. The new header is created
+ # by prepending __config_site to the current __config header.
+ action("concat_config") {
+ script = "//libcxx/utils/cat_files.py"
+ inputs = [
+ "$target_gen_dir/__config_site",
+ "__config",
+ ]
+ outputs = [
+ "$target_gen_dir/__config",
+ ]
+ args = [
+ "$target_gen_dir/__config_site",
+ "__config",
+ "-o",
+ "$target_gen_dir/__config",
+ ]
+ deps = [
+ ":write_config",
+ ]
+ }
+
+ copy("copy_config") {
+ sources = [
+ "$target_gen_dir/__config",
+ ]
+ outputs = [
+ "$clang_resource_dir/include/c++/v1/{{source_file_part}}",
+ ]
+ deps = [
+ ":concat_config",
+ ]
+ }
+}
+
+copy("include") {
+ sources = [
+ "__bit_reference",
+ "__bsd_locale_defaults.h",
+ "__bsd_locale_fallbacks.h",
+ "__debug",
+ "__errc",
+ "__functional_03",
+ "__functional_base",
+ "__functional_base_03",
+ "__hash_table",
+ "__libcpp_version",
+ "__locale",
+ "__mutex_base",
+ "__node_handle",
+ "__nullptr",
+ "__split_buffer",
+ "__sso_allocator",
+ "__std_stream",
+ "__string",
+ "__threading_support",
+ "__tree",
+ "__tuple",
+ "__undef_macros",
+ "algorithm",
+ "any",
+ "array",
+ "atomic",
+ "bit",
+ "bitset",
+ "cassert",
+ "ccomplex",
+ "cctype",
+ "cerrno",
+ "cfenv",
+ "cfloat",
+ "charconv",
+ "chrono",
+ "cinttypes",
+ "ciso646",
+ "climits",
+ "clocale",
+ "cmath",
+ "codecvt",
+ "compare",
+ "complex",
+ "complex.h",
+ "condition_variable",
+ "csetjmp",
+ "csignal",
+ "cstdarg",
+ "cstdbool",
+ "cstddef",
+ "cstdint",
+ "cstdio",
+ "cstdlib",
+ "cstring",
+ "ctgmath",
+ "ctime",
+ "ctype.h",
+ "cwchar",
+ "cwctype",
+ "deque",
+ "errno.h",
+ "exception",
+ "experimental/__config",
+ "experimental/__memory",
+ "experimental/algorithm",
+ "experimental/coroutine",
+ "experimental/deque",
+ "experimental/filesystem",
+ "experimental/forward_list",
+ "experimental/functional",
+ "experimental/iterator",
+ "experimental/list",
+ "experimental/map",
+ "experimental/memory_resource",
+ "experimental/propagate_const",
+ "experimental/regex",
+ "experimental/set",
+ "experimental/simd",
+ "experimental/string",
+ "experimental/type_traits",
+ "experimental/unordered_map",
+ "experimental/unordered_set",
+ "experimental/utility",
+ "experimental/vector",
+ "ext/__hash",
+ "ext/hash_map",
+ "ext/hash_set",
+ "fenv.h",
+ "filesystem",
+ "float.h",
+ "forward_list",
+ "fstream",
+ "functional",
+ "future",
+ "initializer_list",
+ "inttypes.h",
+ "iomanip",
+ "ios",
+ "iosfwd",
+ "iostream",
+ "istream",
+ "iterator",
+ "limits",
+ "limits.h",
+ "list",
+ "locale",
+ "locale.h",
+ "map",
+ "math.h",
+ "memory",
+ "module.modulemap",
+ "mutex",
+ "new",
+ "numeric",
+ "optional",
+ "ostream",
+ "queue",
+ "random",
+ "ratio",
+ "regex",
+ "scoped_allocator",
+ "set",
+ "setjmp.h",
+ "shared_mutex",
+ "span",
+ "sstream",
+ "stack",
+ "stdbool.h",
+ "stddef.h",
+ "stdexcept",
+ "stdint.h",
+ "stdio.h",
+ "stdlib.h",
+ "streambuf",
+ "string",
+ "string.h",
+ "string_view",
+ "strstream",
+ "system_error",
+ "tgmath.h",
+ "thread",
+ "tuple",
+ "type_traits",
+ "typeindex",
+ "typeinfo",
+ "unordered_map",
+ "unordered_set",
+ "utility",
+ "valarray",
+ "variant",
+ "vector",
+ "version",
+ "wchar.h",
+ "wctype.h",
+ ]
+ deps = [
+ "//libcxxabi/include",
+ ]
+ if (!libcxx_needs_site_config) {
+ sources += [ "__config" ]
+ } else {
+ deps += [ ":copy_config" ]
+ }
+ if (libcxx_install_support_headers) {
+ sources += [
+ "support/android/locale_bionic.h",
+ "support/fuchsia/xlocale.h",
+ "support/ibm/limits.h",
+ "support/ibm/locale_mgmt_aix.h",
+ "support/ibm/support.h",
+ "support/ibm/xlocale.h",
+ "support/musl/xlocale.h",
+ "support/newlib/xlocale.h",
+ "support/solaris/floatingpoint.h",
+ "support/solaris/wchar.h",
+ "support/solaris/xlocale.h",
+ "support/xlocale/__nop_locale_mgmt.h",
+ "support/xlocale/__posix_l_fallback.h",
+ "support/xlocale/__strtonum_fallback.h",
+ ]
+ if (target_os == "win") {
+ sources += [
+ "support/win32/limits_msvc_win32.h",
+ "support/win32/locale_win32.h",
+ ]
+ }
+ }
+ outputs = [
+ "$root_build_dir/include/c++/v1/{{source_target_relative}}",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxx/src/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
new file mode 100644
index 0000000..8f5c1c3
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
@@ -0,0 +1,310 @@
+import("//clang/runtimes.gni")
+import("//llvm/utils/gn/build/symlink_or_copy.gni")
+
+declare_args() {
+ # Build libc++ with definitions for operator new/delete.
+ libcxx_enable_new_delete_definitions = true
+
+ # Build libc++ as a shared library.
+ libcxx_enable_shared = true
+
+ # Build libc++ as a static library.
+ libcxx_enable_static = true
+
+ # Build filesystem as part of libc++fs.a.
+ libcxx_enable_filesystem = target_os != "win"
+
+ # Build libc++experimental.a.
+ libcxx_enable_experimental = true
+
+ # Use compiler-rt builtins.
+ libcxx_use_compiler_rt = true
+
+ # Use exceptions.
+ libcxx_enable_exceptions = true
+
+ # Use run time type information.
+ libcxx_enable_rtti = true
+
+ # Do not export any symbols from the static library.
+ libcxx_hermetic_static_library = true
+
+ # Use and install a linker script for the given ABI library.
+ libcxx_enable_abi_linker_script = true
+}
+
+config("cxx_config") {
+ include_dirs = [
+ "//libcxxabi/include",
+ "//libcxx/include",
+ ]
+ cflags = [
+ "-Wall",
+ "-Wextra",
+ "-W",
+ "-Wwrite-strings",
+ "-Wno-unused-parameter",
+ "-Wno-long-long",
+ "-Werror=return-type",
+ "-Wextra-semi",
+ "-Wno-user-defined-literals",
+ "-Wno-covered-switch-default",
+ ]
+ cflags_cc = [ "-nostdinc++" ]
+ if (target_os == "win") {
+ cflags_cc += [ "/std:c++11" ]
+ } else {
+ cflags_cc += [ "-std=c++11" ]
+ }
+ defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
+ if (target_os == "win") {
+ cflags += [ "/Zl" ]
+ defines += [
+ # Ignore the -MSC_VER mismatch, as we may build
+ # with a different compatibility version.
+ "_ALLOW_MSC_VER_MISMATCH",
+
+ # Don't check the msvcprt iterator debug levels
+ # as we will define the iterator types; libc++
+ # uses a different macro to identify the debug
+ # level.
+ "_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH",
+
+ # We are building the c++ runtime, don't pull in
+ # msvcprt.
+ "_CRTBLD",
+
+ # Don't warn on the use of "deprecated"
+ # "insecure" functions which are standards
+ # specified.
+ "_CRT_SECURE_NO_WARNINGS",
+
+ # Use the ISO conforming behaviour for conversion
+ # in printf, scanf.
+ "_CRT_STDIO_ISO_WIDE_SPECIFIERS",
+ ]
+ }
+ if (!libcxx_enable_new_delete_definitions) {
+ defines += [ "_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS" ]
+ }
+ if (libcxx_enable_exceptions) {
+ if (current_os == "win") {
+ cflags_cc += [ "/EHsc" ]
+ }
+ } else {
+ if (current_os == "win") {
+ cflags_cc += [
+ "/EHs-",
+ "/EHa-",
+ ]
+ } else {
+ cflags_cc += [ "-fno-exceptions" ]
+ }
+ defines += [ "_LIBCPP_NO_EXCEPTIONS" ]
+ }
+ if (!libcxx_enable_rtti) {
+ if (current_os == "win") {
+ cflags_cc += [ "/GR-" ]
+ } else {
+ cflags_cc += [ "-fno-rtti" ]
+ }
+ defines += [ "_LIBCPP_NO_RTTI" ]
+ }
+}
+
+cxx_sources = [
+ "algorithm.cpp",
+ "any.cpp",
+ "bind.cpp",
+ "charconv.cpp",
+ "chrono.cpp",
+ "condition_variable.cpp",
+ "condition_variable_destructor.cpp",
+ "debug.cpp",
+ "exception.cpp",
+ "functional.cpp",
+ "future.cpp",
+ "hash.cpp",
+ "include/apple_availability.h",
+ "include/atomic_support.h",
+ "include/config_elast.h",
+ "include/refstring.h",
+ "ios.cpp",
+ "iostream.cpp",
+ "locale.cpp",
+ "memory.cpp",
+ "mutex.cpp",
+ "mutex_destructor.cpp",
+ "new.cpp",
+ "optional.cpp",
+ "random.cpp",
+ "regex.cpp",
+ "shared_mutex.cpp",
+ "stdexcept.cpp",
+ "string.cpp",
+ "strstream.cpp",
+ "support/runtime/exception_fallback.ipp",
+ "support/runtime/exception_glibcxx.ipp",
+ "support/runtime/exception_libcxxabi.ipp",
+ "support/runtime/exception_libcxxrt.ipp",
+ "support/runtime/exception_msvc.ipp",
+ "support/runtime/exception_pointer_cxxabi.ipp",
+ "support/runtime/exception_pointer_glibcxx.ipp",
+ "support/runtime/exception_pointer_msvc.ipp",
+ "support/runtime/exception_pointer_unimplemented.ipp",
+ "support/runtime/new_handler_fallback.ipp",
+ "support/runtime/stdexcept_default.ipp",
+ "support/runtime/stdexcept_vcruntime.ipp",
+ "system_error.cpp",
+ "thread.cpp",
+ "typeinfo.cpp",
+ "utility.cpp",
+ "valarray.cpp",
+ "variant.cpp",
+ "vector.cpp",
+]
+if (target_os == "win") {
+ cxx_sources += [
+ "support/win32/locale_win32.cpp",
+ "support/win32/support.cpp",
+ "support/win32/thread_win32.cpp",
+ ]
+}
+if (target_os == "solaris") {
+ cxx_sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "support/solaris/xlocale.cpp",
+ ]
+}
+if (libcxx_enable_filesystem) {
+ cxx_sources += [
+ "filesystem/directory_iterator.cpp",
+ "filesystem/filesystem_common.h",
+ "filesystem/operations.cpp",
+ ]
+ if (libcxx_use_compiler_rt) {
+ cxx_sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "filesystem/int128_builtins.cpp",
+ ]
+ }
+}
+
+if (libcxx_enable_shared) {
+ shared_library("cxx_shared") {
+ output_dir = runtimes_dir
+ output_name = "c++"
+ if (libcxx_enable_abi_linker_script) {
+ output_extension = "so.0"
+ }
+ if (target_os == "linux" || target_os == "mac") {
+ cflags = [ "-fPIC" ]
+ ldflags = [ "-nostdlib++" ]
+ libs = [
+ "dl",
+ "pthread",
+ ]
+ }
+ sources = cxx_sources
+ deps = [
+ "//compiler-rt/lib/builtins",
+ "//libcxxabi/src:cxxabi_shared",
+ "//libunwind/src:unwind_shared",
+ ]
+ configs += [ ":cxx_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+
+ symlink_or_copy("cxx_symlink") {
+ deps = [
+ ":cxx_shared",
+ ]
+ source = "libc++.so.0"
+ output = "$runtimes_dir/libc++.so"
+ }
+
+ if (libcxx_enable_abi_linker_script) {
+ action("cxx_linker_script") {
+ script = "//libcxx/utils/gen_link_script.py"
+ outputs = [
+ "$runtimes_dir/libc++.so",
+ ]
+ args = [
+ "--input",
+ rebase_path("$runtimes_dir/libc++.so.0", root_build_dir),
+ "--output",
+ rebase_path("$runtimes_dir/libc++.so", root_build_dir),
+ "c++abi",
+ "unwind",
+ ]
+ deps = [
+ ":cxx_symlink",
+ ]
+ }
+ }
+}
+
+if (libcxx_enable_static) {
+ static_library("cxx_static") {
+ output_dir = runtimes_dir
+ output_name = "c++"
+ complete_static_lib = true
+ configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+ sources = cxx_sources
+ if (libcxx_hermetic_static_library) {
+ cflags = [ "-fvisibility=hidden" ]
+ if (libcxx_enable_new_delete_definitions) {
+ cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+ }
+ defines = [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
+ }
+ deps = [
+ "//compiler-rt/lib/builtins",
+ "//libcxxabi/src:cxxabi_static",
+ "//libunwind/src:unwind_static",
+ ]
+ configs += [ ":cxx_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+if (libcxx_enable_experimental) {
+ static_library("cxx_experimental") {
+ output_dir = runtimes_dir
+ output_name = "c++experimental"
+ cflags_cc = [ "-std=c++14" ]
+ sources = [
+ "experimental/memory_resource.cpp",
+ ]
+ configs += [ ":cxx_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+group("src") {
+ deps = []
+ if (libcxx_enable_shared) {
+ if (libcxx_enable_abi_linker_script) {
+ deps += [ ":cxx_linker_script" ]
+ } else {
+ deps += [ ":cxx_shared" ]
+ }
+ }
+ if (libcxx_enable_static) {
+ deps += [ ":cxx_static" ]
+ }
+ if (libcxx_enable_experimental) {
+ deps += [ ":cxx_experimental" ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/BUILD.gn
new file mode 100644
index 0000000..7f1e15f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/BUILD.gn
@@ -0,0 +1,5 @@
+group("libcxxabi") {
+ deps = [
+ "//libcxxabi/src(//llvm/utils/gn/build/toolchain:stage2_unix)",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/include/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/include/BUILD.gn
new file mode 100644
index 0000000..46df529
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/include/BUILD.gn
@@ -0,0 +1,11 @@
+import("//clang/resource_dir.gni")
+
+copy("include") {
+ sources = [
+ "__cxxabi_config.h",
+ "cxxabi.h",
+ ]
+ outputs = [
+ "$root_build_dir/include/c++/v1/{{source_target_relative}}",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
new file mode 100644
index 0000000..d84d57d0
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
@@ -0,0 +1,147 @@
+import("//clang/runtimes.gni")
+
+declare_args() {
+ # Use exceptions.
+ libcxxabi_enable_exceptions = true
+
+ # Build libc++abi with definitions for operator new/delete.
+ libcxxabi_enable_new_delete_definitions = true
+
+ # Build libcxxabi as a shared library.
+ libcxxabi_enable_shared = true
+
+ # Build libcxxabi as a static library.
+ libcxxabi_enable_static = true
+
+ # Do not export any symbols from the static library.
+ libcxxabi_hermetic_static_library = true
+}
+
+cxxabi_headers = [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "../include/cxxabi.h",
+]
+
+cxxabi_sources = [
+ # C++ABI files
+ "cxa_aux_runtime.cpp",
+ "cxa_default_handlers.cpp",
+ "cxa_demangle.cpp",
+ "cxa_exception_storage.cpp",
+ "cxa_guard.cpp",
+ "cxa_handlers.cpp",
+ "cxa_unexpected.cpp",
+ "cxa_vector.cpp",
+ "cxa_virtual.cpp",
+
+ # C++ STL files
+ "stdlib_exception.cpp",
+ "stdlib_stdexcept.cpp",
+ "stdlib_typeinfo.cpp",
+
+ # Internal files
+ "abort_message.cpp",
+ "fallback_malloc.cpp",
+ "private_typeinfo.cpp",
+]
+if (libcxxabi_enable_new_delete_definitions) {
+ cxxabi_sources += [ "stdlib_new_delete.cpp" ]
+}
+if (libcxxabi_enable_exceptions) {
+ cxxabi_sources += [
+ "cxa_exception.cpp",
+ "cxa_personality.cpp",
+ ]
+} else {
+ cxxabi_sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "cxa_noexception.cpp",
+ ]
+}
+if (target_os == "linux" || target_os == "fuchsia") {
+ cxxabi_sources += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "cxa_thread_atexit.cpp",
+ ]
+}
+
+config("cxxabi_config") {
+ include_dirs = [
+ "//libcxxabi/include",
+ "//libcxx/include",
+ ]
+ cflags_cc = [ "-nostdinc++" ]
+ defines = [ "_LIBCXXABI_BUILDING_LIBRARY" ]
+ if (target_os == "win") {
+ defines += [ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" ]
+ }
+}
+
+if (libcxxabi_enable_shared) {
+ shared_library("cxxabi_shared") {
+ output_dir = runtimes_dir
+ output_name = "c++abi"
+ if (target_os == "linux" || target_os == "mac") {
+ cflags = [ "-fPIC" ]
+ ldflags = [ "-nostdlib++" ]
+ libs = [
+ "dl",
+ "pthread",
+ ]
+ }
+ sources = cxxabi_sources
+ public = cxxabi_headers
+ deps = [
+ "//compiler-rt/lib/builtins",
+ "//libunwind/src:unwind_shared",
+ ]
+ configs += [ ":cxxabi_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+if (libcxxabi_enable_static) {
+ static_library("cxxabi_static") {
+ output_dir = runtimes_dir
+ output_name = "c++abi"
+ complete_static_lib = true
+ configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+ sources = cxxabi_sources
+ public = cxxabi_headers
+ if (libcxxabi_hermetic_static_library) {
+ cflags = [ "-fvisibility=hidden" ]
+ if (libcxxabi_enable_new_delete_definitions) {
+ cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+ }
+ defines = [
+ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ ]
+ }
+ deps = [
+ "//compiler-rt/lib/builtins",
+ "//libunwind/src:unwind_static",
+ ]
+ configs += [ ":cxxabi_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+group("src") {
+ deps = []
+ if (libcxxabi_enable_shared) {
+ deps += [ ":cxxabi_shared" ]
+ }
+ if (libcxxabi_enable_static) {
+ deps += [ ":cxxabi_static" ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libunwind/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libunwind/BUILD.gn
new file mode 100644
index 0000000..b55d9c7
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libunwind/BUILD.gn
@@ -0,0 +1,5 @@
+group("libunwind") {
+ deps = [
+ "//libunwind/src(//llvm/utils/gn/build/toolchain:stage2_unix)",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/libunwind/src/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/libunwind/src/BUILD.gn
new file mode 100644
index 0000000..1e96b56
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/libunwind/src/BUILD.gn
@@ -0,0 +1,124 @@
+import("//clang/runtimes.gni")
+
+declare_args() {
+ # Build libunwind as a shared library.
+ libunwind_enable_shared = true
+
+ # Build libunwind as a static library.
+ libunwind_enable_static = true
+
+ # Do not export any symbols from the static library.
+ libunwind_hermetic_static_library = true
+}
+
+unwind_headers = [
+ "../include/libunwind.h",
+ "../include/unwind.h",
+]
+if (target_os == "mac") {
+ unwind_headers += [
+ # This comment prevents `gn format` from putting the file on the same line
+ # as `sources +=`, for sync_source_lists_from_cmake.py.
+ "../include/mach-o/compact_unwind_encoding.h",
+ ]
+}
+
+unwind_sources = [
+ "libunwind.cpp",
+ "Unwind-EHABI.cpp",
+ "Unwind-seh.cpp",
+ "UnwindLevel1.c",
+ "UnwindLevel1-gcc-ext.c",
+ "Unwind-sjlj.c",
+ "UnwindRegistersRestore.S",
+ "UnwindRegistersSave.S",
+ "AddressSpace.hpp",
+ "assembly.h",
+ "CompactUnwinder.hpp",
+ "config.h",
+ "dwarf2.h",
+ "DwarfInstructions.hpp",
+ "DwarfParser.hpp",
+ "libunwind_ext.h",
+ "Registers.hpp",
+ "RWMutex.hpp",
+ "UnwindCursor.hpp",
+]
+if (target_os == "mac") {
+ unwind_sources += [ "src/Unwind_AppleExtras.cpp" ]
+}
+
+config("unwind_config") {
+ cflags = []
+ cflags_c = [ "-std=c99" ]
+ cflags_cc = [ "-fno-rtti" ]
+ include_dirs = [ "//libunwind/include" ]
+ if (target_os == "mac") {
+ cflags += [ "-U__STRICT_ANSI__" ]
+ }
+}
+
+if (libunwind_enable_shared) {
+ shared_library("unwind_shared") {
+ output_dir = runtimes_dir
+ output_name = "unwind"
+ if (target_os == "linux" || target_os == "mac") {
+ cflags = [ "-fPIC" ]
+ ldflags = [ "-nostdlib++" ]
+ libs = [
+ "dl",
+ "pthread",
+ ]
+ }
+ if (target_os == "mac") {
+ ldflags += [
+ "-compatibility_version 1",
+ "-install_name /usr/lib/libunwind.1.dylib",
+ ]
+ }
+ sources = unwind_sources
+ public = unwind_headers
+ deps = [
+ "//compiler-rt/lib/builtins",
+ ]
+ configs += [ ":unwind_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+if (libunwind_enable_static) {
+ static_library("unwind_static") {
+ output_dir = runtimes_dir
+ output_name = "unwind"
+ complete_static_lib = true
+ configs -= [ "//llvm/utils/gn/build:thin_archive" ]
+ sources = unwind_sources
+ public = unwind_headers
+ if (libunwind_hermetic_static_library) {
+ cflags = [ "-fvisibility=hidden" ]
+ cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
+ defines = [ "_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS" ]
+ }
+ deps = [
+ "//compiler-rt/lib/builtins",
+ ]
+ configs += [ ":unwind_config" ]
+ configs -= [
+ "//llvm/utils/gn/build:no_exceptions",
+ "//llvm/utils/gn/build:no_rtti",
+ ]
+ }
+}
+
+group("src") {
+ deps = []
+ if (libunwind_enable_shared) {
+ deps += [ ":unwind_shared" ]
+ }
+ if (libunwind_enable_static) {
+ deps += [ ":unwind_static" ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/lld/COFF/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/lld/COFF/BUILD.gn
index 394f07a..c565b0b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/lld/COFF/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/lld/COFF/BUILD.gn
@@ -28,6 +28,7 @@
sources = [
"Chunks.cpp",
"DLL.cpp",
+ "DebugTypes.cpp",
"Driver.cpp",
"DriverUtils.cpp",
"ICF.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/lld/Common/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/lld/Common/BUILD.gn
index b15f092..6f7e50b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/lld/Common/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/lld/Common/BUILD.gn
@@ -17,6 +17,7 @@
sources = [
"Args.cpp",
"ErrorHandler.cpp",
+ "Filesystem.cpp",
"Memory.cpp",
"Reproduce.cpp",
"Strings.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/lld/ELF/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/lld/ELF/BUILD.gn
index 8006ef1..3645595 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/lld/ELF/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/lld/ELF/BUILD.gn
@@ -43,7 +43,6 @@
"Driver.cpp",
"DriverUtils.cpp",
"EhFrame.cpp",
- "Filesystem.cpp",
"ICF.cpp",
"InputFiles.cpp",
"InputSection.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/lld/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/lld/test/BUILD.gn
index 6eb80c9..0f8e2c1 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/lld/test/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/lld/test/BUILD.gn
@@ -45,7 +45,7 @@
if (llvm_enable_libxml2) {
extra_values += [ "LLVM_LIBXML2_ENABLED=1" ]
} else {
- extra_values += [ "LLVM_LIBXML2_ENABLED=" ] # Must be empty.
+ extra_values += [ "LLVM_LIBXML2_ENABLED=0" ] # Must be 0.
}
if (llvm_enable_zlib) {
@@ -53,6 +53,13 @@
} else {
extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
}
+
+ if (current_cpu == "x64" || current_cpu == "arm64" ||
+ current_cpu == "ppc64") {
+ extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
+ } else {
+ extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ]
+ }
}
write_lit_cfg("lit_unit_site_cfg") {
@@ -75,6 +82,7 @@
"//llvm/tools/llvm-ar:symlinks",
"//llvm/tools/llvm-as",
"//llvm/tools/llvm-bcanalyzer",
+ "//llvm/tools/llvm-cvtres",
"//llvm/tools/llvm-dis",
"//llvm/tools/llvm-dwarfdump",
"//llvm/tools/llvm-mc",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/lld/wasm/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/lld/wasm/BUILD.gn
index bec946a..c32205f 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/lld/wasm/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/lld/wasm/BUILD.gn
@@ -24,8 +24,10 @@
"LTO.cpp",
"MarkLive.cpp",
"OutputSections.cpp",
+ "Relocations.cpp",
"SymbolTable.cpp",
"Symbols.cpp",
+ "SyntheticSections.cpp",
"Writer.cpp",
"WriterUtils.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 68ee10c..f09d8a2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -1,4 +1,7 @@
+import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
import("//llvm/lib/Target/targets.gni")
+import("//llvm/lib/Target/targets_with_asm_parsers.gni")
+import("//llvm/lib/Target/targets_with_disassemblers.gni")
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/buildflags.gni")
import("//llvm/utils/gn/build/libs/edit/enable.gni")
@@ -77,7 +80,6 @@
"HAVE_CRASHREPORTERCLIENT_H=",
"HAVE_DECL_FE_ALL_EXCEPT=1",
"HAVE_DECL_FE_INEXACT=1",
- "LLVM_ENABLE_DIA_SDK=",
"LLVM_ENABLE_CRASH_DUMPS=",
"HAVE_ERRNO_H=1",
"HAVE_FCNTL_H=1",
@@ -89,6 +91,7 @@
"HAVE_LIBPSAPI=",
"HAVE_MALLCTL=",
"HAVE_SIGNAL_H=1",
+ "HAVE_STD_IS_TRIVIALLY_COPYABLE=1",
"HAVE_STRERROR=1",
"HAVE_SYS_STAT_H=1",
"HAVE_SYS_TYPES_H=1",
@@ -123,6 +126,10 @@
"RETSIGTYPE=void",
"LLVM_GISEL_COV_ENABLED=",
"LLVM_GISEL_COV_PREFIX=",
+ "LLVM_WITH_Z3=",
+
+ # FIXME: Set to 1 on mac once the 10.14 SDK is in common use.
+ "LLVM_SUPPORT_XCODE_SIGNPOSTS=",
# This is both in llvm-config.h and config.h; llvm-config.h doesn't
# define it if it's not set while config.h defines it to empty in that case.
@@ -158,7 +165,6 @@
"HAVE_CRASHREPORTER_INFO=1",
"HAVE_DECL_ARC4RANDOM=1",
"HAVE_DLADDR=1",
- "HAVE_MALLOC_H=",
"HAVE_MACH_MACH_H=1",
"HAVE_MALLOC_MALLOC_H=1",
"HAVE_MALLOC_ZONE_STATISTICS=1",
@@ -170,7 +176,6 @@
"HAVE_DECL_ARC4RANDOM=",
"HAVE_DLADDR=",
"HAVE_MACH_MACH_H=",
- "HAVE_MALLOC_H=1",
"HAVE_MALLOC_MALLOC_H=",
"HAVE_MALLOC_ZONE_STATISTICS=",
"HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC=",
@@ -209,7 +214,6 @@
"HAVE_PTHREAD_H=",
"HAVE_PTHREAD_MUTEX_LOCK=",
"HAVE_PTHREAD_RWLOCK_INIT=",
- "HAVE_REALPATH=",
"HAVE_SBRK=",
"HAVE_SETENV=",
"HAVE_SETRLIMIT=",
@@ -248,7 +252,6 @@
"HAVE_PTHREAD_H=1",
"HAVE_PTHREAD_MUTEX_LOCK=1",
"HAVE_PTHREAD_RWLOCK_INIT=1",
- "HAVE_REALPATH=1",
"HAVE_SBRK=1",
"HAVE_SETENV=1",
"HAVE_SETRLIMIT=1",
@@ -270,12 +273,12 @@
]
}
- if (current_os == "linux" || current_os == "android") {
- values += [ "LTDL_SHLIB_EXT=.so" ]
- } else if (current_os == "mac") {
+ if (current_os == "mac") {
values += [ "LTDL_SHLIB_EXT=.dylib" ]
} else if (current_os == "win") {
values += [ "LTDL_SHLIB_EXT=.dll" ]
+ } else {
+ values += [ "LTDL_SHLIB_EXT=.so" ]
}
if (llvm_enable_libedit) {
@@ -296,6 +299,12 @@
values += [ "HAVE_TERMINFO=" ]
}
+ if (llvm_enable_dia_sdk) {
+ values += [ "LLVM_ENABLE_DIA_SDK=1" ]
+ } else {
+ values += [ "LLVM_ENABLE_DIA_SDK=" ]
+ }
+
if (llvm_enable_zlib) {
values += [ "LLVM_ENABLE_ZLIB=1" ]
} else {
@@ -360,14 +369,23 @@
input = "$target_name.in"
output = "$target_gen_dir/$target_name"
+ if (defined(invoker.all_targets)) {
+ all_targets = invoker.all_targets
+ } else {
+ all_targets = llvm_targets_to_build
+ }
+
# Build something like
# `LLVM_ENUM_ASM_PARSERS=LLVM_ASM_PARSER(ARM)\nLLVM_ASM_PARSER(X86)\n`. Note
# that \n is a literal '\' followed by a literal 'n', not a newline
# character. (write_cmake_config.py replaces that with a real newline).
value = ""
- foreach(target, llvm_targets_to_build) {
+ foreach(target, all_targets) {
value = "$value${invoker.value}($target)\n"
}
+ if (all_targets == []) {
+ not_needed(invoker, [ "value" ])
+ }
values = [ "${invoker.key}=$value" ]
}
}
@@ -375,6 +393,7 @@
write_target_def_file("AsmParsers.def") {
key = "LLVM_ENUM_ASM_PARSERS"
value = "LLVM_ASM_PARSER"
+ all_targets = targets_with_asm_parsers
}
write_target_def_file("AsmPrinters.def") {
@@ -385,6 +404,7 @@
write_target_def_file("Disassemblers.def") {
key = "LLVM_ENUM_DISASSEMBLERS"
value = "LLVM_DISASSEMBLER"
+ all_targets = targets_with_disassemblers
}
write_target_def_file("Targets.def") {
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
index 5b203d4..3a8382e 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
@@ -41,6 +41,7 @@
"DependenceAnalysis.cpp",
"DivergenceAnalysis.cpp",
"DomPrinter.cpp",
+ "DomTreeUpdater.cpp",
"DominanceFrontier.cpp",
"EHPersonalities.cpp",
"GlobalsModRef.cpp",
@@ -54,7 +55,6 @@
"InstructionSimplify.cpp",
"Interval.cpp",
"IntervalPartition.cpp",
- "IteratedDominanceFrontier.cpp",
"LazyBlockFrequencyInfo.cpp",
"LazyBranchProbabilityInfo.cpp",
"LazyCallGraph.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/BinaryFormat/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/BinaryFormat/BUILD.gn
index 1aa40fc..72847d1 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/BinaryFormat/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/BinaryFormat/BUILD.gn
@@ -7,8 +7,10 @@
"AMDGPUMetadataVerifier.cpp",
"Dwarf.cpp",
"Magic.cpp",
+ "Minidump.cpp",
+ "MsgPackDocument.cpp",
+ "MsgPackDocumentYAML.cpp",
"MsgPackReader.cpp",
- "MsgPackTypes.cpp",
"MsgPackWriter.cpp",
"Wasm.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitcode/Reader/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitcode/Reader/BUILD.gn
index a7ecdf1..6e965a3 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitcode/Reader/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitcode/Reader/BUILD.gn
@@ -2,14 +2,15 @@
output_name = "LLVMBitReader"
deps = [
"//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Bitstream/Reader",
"//llvm/lib/IR",
"//llvm/lib/Support",
]
sources = [
"BitReader.cpp",
+ "BitcodeAnalyzer.cpp",
"BitcodeReader.cpp",
- "BitstreamReader.cpp",
"MetadataLoader.cpp",
"ValueList.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitstream/Reader/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitstream/Reader/BUILD.gn
new file mode 100644
index 0000000..302ae2b
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Bitstream/Reader/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("Reader") {
+ output_name = "LLVMBitstreamReader"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+
+ sources = [
+ "BitstreamReader.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/AsmPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/AsmPrinter/BUILD.gn
index ea42d0d..6815640 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/AsmPrinter/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/AsmPrinter/BUILD.gn
@@ -5,10 +5,12 @@
"//llvm/lib/BinaryFormat",
"//llvm/lib/CodeGen",
"//llvm/lib/DebugInfo/CodeView",
+ "//llvm/lib/DebugInfo/DWARF",
"//llvm/lib/DebugInfo/MSF",
"//llvm/lib/IR",
"//llvm/lib/MC",
"//llvm/lib/MC/MCParser",
+ "//llvm/lib/Remarks",
"//llvm/lib/Support",
"//llvm/lib/Target",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
index 222978c..9a6e19a 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
@@ -39,18 +39,19 @@
"EarlyIfConversion.cpp",
"EdgeBundles.cpp",
"ExecutionDomainFix.cpp",
- "ExpandISelPseudos.cpp",
"ExpandMemCmp.cpp",
"ExpandPostRAPseudos.cpp",
"ExpandReductions.cpp",
"FEntryInserter.cpp",
"FaultMaps.cpp",
+ "FinalizeISel.cpp",
"FuncletLayout.cpp",
"GCMetadata.cpp",
"GCMetadataPrinter.cpp",
"GCRootLowering.cpp",
"GCStrategy.cpp",
"GlobalMerge.cpp",
+ "HardwareLoops.cpp",
"IfConversion.cpp",
"ImplicitNullChecks.cpp",
"IndirectBrExpandPass.cpp",
@@ -161,6 +162,8 @@
"StackMaps.cpp",
"StackProtector.cpp",
"StackSlotColoring.cpp",
+ "SwiftErrorValueTracking.cpp",
+ "SwitchLoweringUtils.cpp",
"TailDuplication.cpp",
"TailDuplicator.cpp",
"TargetFrameLoweringImpl.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/GlobalISel/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/GlobalISel/BUILD.gn
index 83628a8..7e6ecad 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/GlobalISel/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/CodeGen/GlobalISel/BUILD.gn
@@ -12,8 +12,8 @@
"//llvm/lib/Transforms/Utils",
]
sources = [
- "CSEMIRBuilder.cpp",
"CSEInfo.cpp",
+ "CSEMIRBuilder.cpp",
"CallLowering.cpp",
"Combiner.cpp",
"CombinerHelper.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/GSYM/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/GSYM/BUILD.gn
new file mode 100644
index 0000000..48b70bd
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/GSYM/BUILD.gn
@@ -0,0 +1,11 @@
+static_library("GSYM") {
+ output_name = "LLVMDebugInfoGSYM"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "FunctionInfo.cpp",
+ "InlineInfo.cpp",
+ "Range.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/BUILD.gn
index 6305768..d38b2bb 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/BUILD.gn
@@ -24,10 +24,12 @@
"Native/HashTable.cpp",
"Native/InfoStream.cpp",
"Native/InfoStreamBuilder.cpp",
+ "Native/InjectedSourceStream.cpp",
"Native/ModuleDebugStream.cpp",
"Native/NamedStreamMap.cpp",
"Native/NativeCompilandSymbol.cpp",
"Native/NativeEnumGlobals.cpp",
+ "Native/NativeEnumInjectedSources.cpp",
"Native/NativeEnumModules.cpp",
"Native/NativeEnumTypes.cpp",
"Native/NativeExeSymbol.cpp",
@@ -113,6 +115,6 @@
"DIA/DIASourceFile.cpp",
"DIA/DIATable.cpp",
]
- # FIXME: Link against the right diaguids.lib too.
+ libs = [ "diaguids.lib" ]
}
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/enable_dia.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/enable_dia.gni
index 9d397bc..aed3566 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/enable_dia.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/DebugInfo/PDB/enable_dia.gni
@@ -1,4 +1,6 @@
declare_args() {
# Whether to build code that requires the Microsoft DIA SDK.
+ # If this is set, %INCLUDE% must contain ".../DIA SDK/include"
+ # and %LIB% must contain ".../DIA SKD/lib/amd64".
llvm_enable_dia_sdk = false
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Demangle/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Demangle/BUILD.gn
index 8e97dfe..81ddb6c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Demangle/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Demangle/BUILD.gn
@@ -2,6 +2,7 @@
output_name = "LLVMDemangle"
sources = [
+ "Demangle.cpp",
"ItaniumDemangle.cpp",
"MicrosoftDemangle.cpp",
"MicrosoftDemangleNodes.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/JITLink/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/JITLink/BUILD.gn
new file mode 100644
index 0000000..aa9894c
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/JITLink/BUILD.gn
@@ -0,0 +1,17 @@
+static_library("JITLink") {
+ output_name = "LLVMJITLink"
+ deps = [
+ "//llvm/lib/BinaryFormat",
+ "//llvm/lib/Object",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "EHFrameSupport.cpp",
+ "JITLink.cpp",
+ "JITLinkGeneric.cpp",
+ "JITLinkMemoryManager.cpp",
+ "MachO.cpp",
+ "MachOAtomGraphBuilder.cpp",
+ "MachO_x86_64.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
index 19c68f0..d9ea254 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
@@ -10,6 +10,7 @@
]
sources = [
"CompileOnDemandLayer.cpp",
+ "CompileUtils.cpp",
"Core.cpp",
"ExecutionUtils.cpp",
"IRCompileLayer.cpp",
@@ -21,6 +22,7 @@
"LazyReexports.cpp",
"Legacy.cpp",
"NullResolver.cpp",
+ "ObjectLinkingLayer.cpp",
"ObjectTransformLayer.cpp",
"OrcABISupport.cpp",
"OrcCBindings.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
index 6d4945f..a93b714 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
@@ -16,9 +16,11 @@
":AttributesCompatFunc",
"//llvm/include/llvm/IR:IntrinsicImpl",
"//llvm/lib/BinaryFormat",
+ "//llvm/lib/Remarks",
"//llvm/lib/Support",
]
sources = [
+ "AbstractCallSite.cpp",
"AsmWriter.cpp",
"Attributes.cpp",
"AutoUpgrade.cpp",
@@ -36,7 +38,6 @@
"DiagnosticHandler.cpp",
"DiagnosticInfo.cpp",
"DiagnosticPrinter.cpp",
- "DomTreeUpdater.cpp",
"Dominators.cpp",
"Function.cpp",
"GVMaterializer.cpp",
@@ -63,6 +64,7 @@
"PassRegistry.cpp",
"PassTimingInfo.cpp",
"ProfileSummary.cpp",
+ "RemarkStreamer.cpp",
"SafepointIRVerifier.cpp",
"Statepoint.cpp",
"Type.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MC/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MC/BUILD.gn
index 3a5251f..28717f4 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MC/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MC/BUILD.gn
@@ -18,6 +18,7 @@
"MCAsmInfoDarwin.cpp",
"MCAsmInfoELF.cpp",
"MCAsmInfoWasm.cpp",
+ "MCAsmInfoXCOFF.cpp",
"MCAsmMacro.cpp",
"MCAsmStreamer.cpp",
"MCAssembler.cpp",
@@ -49,6 +50,7 @@
"MCSectionELF.cpp",
"MCSectionMachO.cpp",
"MCSectionWasm.cpp",
+ "MCSectionXCOFF.cpp",
"MCStreamer.cpp",
"MCSubtargetInfo.cpp",
"MCSymbol.cpp",
@@ -60,10 +62,13 @@
"MCWin64EH.cpp",
"MCWinCOFFStreamer.cpp",
"MCWinEH.cpp",
+ "MCXCOFFObjectTargetWriter.cpp",
+ "MCXCOFFStreamer.cpp",
"MachObjectWriter.cpp",
"StringTableBuilder.cpp",
"SubtargetFeature.cpp",
"WasmObjectWriter.cpp",
"WinCOFFObjectWriter.cpp",
+ "XCOFFObjectWriter.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MCA/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MCA/BUILD.gn
index 9752ca8..d7a632a 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MCA/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/MCA/BUILD.gn
@@ -22,6 +22,7 @@
"Stages/EntryStage.cpp",
"Stages/ExecuteStage.cpp",
"Stages/InstructionTables.cpp",
+ "Stages/MicroOpQueueStage.cpp",
"Stages/RetireStage.cpp",
"Stages/Stage.cpp",
"Support.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Object/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Object/BUILD.gn
index 4f2dd4e..9f4477a 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Object/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Object/BUILD.gn
@@ -26,13 +26,17 @@
"IRSymtab.cpp",
"MachOObjectFile.cpp",
"MachOUniversal.cpp",
+ "Minidump.cpp",
"ModuleSymbolTable.cpp",
"Object.cpp",
"ObjectFile.cpp",
"RecordStreamer.cpp",
+ "RelocationResolver.cpp",
"SymbolSize.cpp",
"SymbolicFile.cpp",
"WasmObjectFile.cpp",
+ "WindowsMachineFlag.cpp",
"WindowsResource.cpp",
+ "XCOFFObjectFile.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ObjectYAML/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ObjectYAML/BUILD.gn
index 27367ff..84575f2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ObjectYAML/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ObjectYAML/BUILD.gn
@@ -15,8 +15,10 @@
"DWARFYAML.cpp",
"ELFYAML.cpp",
"MachOYAML.cpp",
+ "MinidumpYAML.cpp",
"ObjectYAML.cpp",
"WasmYAML.cpp",
+ "XCOFFYAML.cpp",
"YAML.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/OptRemarks/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/OptRemarks/BUILD.gn
deleted file mode 100644
index cd80b85..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/OptRemarks/BUILD.gn
+++ /dev/null
@@ -1,10 +0,0 @@
-static_library("OptRemarks") {
- output_name = "LLVMOptRemarks"
- deps = [
- "//llvm/lib/Support",
- ]
-
- sources = [
- "OptRemarksParser.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Remarks/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Remarks/BUILD.gn
new file mode 100644
index 0000000..19510c1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Remarks/BUILD.gn
@@ -0,0 +1,15 @@
+static_library("Remarks") {
+ output_name = "LLVMRemarks"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+
+ sources = [
+ "Remark.cpp",
+ "RemarkFormat.cpp",
+ "RemarkParser.cpp",
+ "RemarkStringTable.cpp",
+ "YAMLRemarkParser.cpp",
+ "YAMLRemarkSerializer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
index e17f2a3..b34e2a6 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
@@ -46,6 +46,7 @@
"BranchProbability.cpp",
"BuryPointer.cpp",
"COM.cpp",
+ "CRC.cpp",
"CachePruning.cpp",
"Chrono.cpp",
"CodeGenCoverage.cpp",
@@ -88,6 +89,7 @@
"MathExtras.cpp",
"MemoryBuffer.cpp",
"NativeFormatting.cpp",
+ "Optional.cpp",
"Options.cpp",
"Parallel.cpp",
"PluginLoader.cpp",
@@ -97,6 +99,7 @@
"SHA1.cpp",
"ScaledNumber.cpp",
"ScopedPrinter.cpp",
+ "Signposts.cpp",
"SmallPtrSet.cpp",
"SmallVector.cpp",
"SourceMgr.cpp",
@@ -112,6 +115,7 @@
"TarWriter.cpp",
"TargetParser.cpp",
"ThreadPool.cpp",
+ "TimeProfiler.cpp",
"Timer.cpp",
"ToolOutputFile.cpp",
"TrigramIndex.cpp",
@@ -123,6 +127,7 @@
"WithColor.cpp",
"YAMLParser.cpp",
"YAMLTraits.cpp",
+ "Z3Solver.cpp",
"circular_raw_ostream.cpp",
"raw_os_ostream.cpp",
"raw_ostream.cpp",
@@ -155,7 +160,17 @@
libs = []
+ # FIXME: llvm/Config/BUILD.gn currently always sets LLVM_WITH_Z3
+ # to false. If that changes we need to link to Z3 libs here.
+
if (current_os == "linux" || current_os == "android") {
libs += [ "dl" ]
+ } else if (current_os == "win") {
+ # Delay load shell32.dll if possible to speed up process startup.
+ libs += [ "delayimp.lib" ]
+ ldflags = [
+ "-delayload:ole32.dll",
+ "-delayload:shell32.dll",
+ ]
}
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn
index 4f80358..02e02ee 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn
@@ -1,5 +1,11 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("AArch64GenAsmMatcher") {
+ visibility = [ ":LLVMAArch64CodeGen" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "AArch64.td"
+}
+
tablegen("AArch64GenCallingConv") {
visibility = [ ":LLVMAArch64CodeGen" ]
args = [ "-gen-callingconv" ]
@@ -38,13 +44,13 @@
static_library("LLVMAArch64CodeGen") {
deps = [
+ ":AArch64GenAsmMatcher",
":AArch64GenCallingConv",
":AArch64GenDAGISel",
":AArch64GenFastISel",
":AArch64GenGlobalISel",
":AArch64GenMCPseudoLowering",
":AArch64GenRegisterBank",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
@@ -67,6 +73,7 @@
"AArch64AsmPrinter.cpp",
"AArch64BranchTargets.cpp",
"AArch64CallLowering.cpp",
+ "AArch64CallingConvention.cpp",
"AArch64CleanupLocalDynamicTLSPass.cpp",
"AArch64CollectLOH.cpp",
"AArch64CompressJumpTables.cpp",
@@ -74,6 +81,7 @@
"AArch64ConditionOptimizer.cpp",
"AArch64ConditionalCompares.cpp",
"AArch64DeadRegisterDefinitionsPass.cpp",
+ "AArch64ExpandImm.cpp",
"AArch64ExpandPseudoInsts.cpp",
"AArch64FalkorHWPFFix.cpp",
"AArch64FastISel.cpp",
@@ -95,6 +103,7 @@
"AArch64SIMDInstrOpt.cpp",
"AArch64SelectionDAGInfo.cpp",
"AArch64SpeculationHardening.cpp",
+ "AArch64StackTagging.cpp",
"AArch64StorePairSuppress.cpp",
"AArch64Subtarget.cpp",
"AArch64TargetMachine.cpp",
@@ -114,7 +123,6 @@
":LLVMAArch64CodeGen",
"AsmParser",
"Disassembler",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/InstPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/InstPrinter/BUILD.gn
deleted file mode 100644
index 6c17495..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/InstPrinter/BUILD.gn
+++ /dev/null
@@ -1,35 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-tablegen("AArch64GenAsmWriter") {
- visibility = [ ":InstPrinter" ]
- args = [ "-gen-asm-writer" ]
- td_file = "../AArch64.td"
-}
-
-tablegen("AArch64GenAsmWriter1") {
- visibility = [ ":InstPrinter" ]
- args = [
- "-gen-asm-writer",
- "-asmwriternum=1",
- ]
- td_file = "../AArch64.td"
-}
-
-static_library("InstPrinter") {
- output_name = "LLVMAArch64AsmPrinter"
- deps = [
- ":AArch64GenAsmWriter",
- ":AArch64GenAsmWriter1",
- "//llvm/lib/MC",
- "//llvm/lib/Support",
-
- # MCTargetDesc depends on InstPrinter, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/AArch64/MCTargetDesc:tablegen",
- "//llvm/lib/Target/AArch64/Utils",
- ]
- include_dirs = [ ".." ]
- sources = [
- "AArch64InstPrinter.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/MCTargetDesc/BUILD.gn
index 6303fbe..b2603e8 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/MCTargetDesc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/MCTargetDesc/BUILD.gn
@@ -1,5 +1,20 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("AArch64GenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../AArch64.td"
+}
+
+tablegen("AArch64GenAsmWriter1") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [
+ "-gen-asm-writer",
+ "-asmwriternum=1",
+ ]
+ td_file = "../AArch64.td"
+}
+
tablegen("AArch64GenInstrInfo") {
visibility = [ ":tablegen" ]
args = [ "-gen-instr-info" ]
@@ -7,7 +22,7 @@
}
tablegen("AArch64GenMCCodeEmitter") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-emitter" ]
td_file = "../AArch64.td"
}
@@ -24,16 +39,16 @@
td_file = "../AArch64.td"
}
+# This should contain tablegen targets generating .inc files included
+# by other targets. .inc files only used by .cpp files in this directory
+# should be in deps on the static_library instead.
group("tablegen") {
visibility = [
":MCTargetDesc",
- "../InstPrinter",
- "../TargetInfo",
"../Utils",
]
public_deps = [
":AArch64GenInstrInfo",
- ":AArch64GenMCCodeEmitter",
":AArch64GenRegisterInfo",
":AArch64GenSubtargetInfo",
]
@@ -45,9 +60,11 @@
":tablegen",
]
deps = [
+ ":AArch64GenAsmWriter",
+ ":AArch64GenAsmWriter1",
+ ":AArch64GenMCCodeEmitter",
"//llvm/lib/MC",
"//llvm/lib/Support",
- "//llvm/lib/Target/AArch64/InstPrinter",
"//llvm/lib/Target/AArch64/TargetInfo",
"//llvm/lib/Target/AArch64/Utils",
]
@@ -56,6 +73,7 @@
"AArch64AsmBackend.cpp",
"AArch64ELFObjectWriter.cpp",
"AArch64ELFStreamer.cpp",
+ "AArch64InstPrinter.cpp",
"AArch64MCAsmInfo.cpp",
"AArch64MCCodeEmitter.cpp",
"AArch64MCExpr.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/TargetInfo/BUILD.gn
index 114d93f..25565c2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/TargetInfo/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/TargetInfo/BUILD.gn
@@ -2,10 +2,6 @@
output_name = "LLVMAArch64Info"
deps = [
"//llvm/lib/Support",
-
- # MCTargetDesc depends on TargetInfo, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/AArch64/MCTargetDesc:tablegen",
]
include_dirs = [ ".." ]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/Utils/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/Utils/BUILD.gn
index 144bd5c..aef50a0 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/Utils/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/AArch64/Utils/BUILD.gn
@@ -13,6 +13,9 @@
]
deps = [
"//llvm/lib/Support",
+
+ # MCTargetDesc depends on Utils, so we can't depend on the full
+ # MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/AArch64/MCTargetDesc:tablegen",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn
index b299be5..a7d3bda 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn
@@ -44,7 +44,6 @@
":ARMGenGlobalISel",
":ARMGenMCPseudoLowering",
":ARMGenRegisterBank",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
@@ -65,9 +64,10 @@
"ARMAsmPrinter.cpp",
"ARMBaseInstrInfo.cpp",
"ARMBaseRegisterInfo.cpp",
+ "ARMBasicBlockInfo.cpp",
"ARMCallLowering.cpp",
+ "ARMCallingConv.cpp",
"ARMCodeGenPrepare.cpp",
- "ARMComputeBlockSize.cpp",
"ARMConstantIslandPass.cpp",
"ARMConstantPoolValue.cpp",
"ARMExpandPseudoInsts.cpp",
@@ -80,6 +80,7 @@
"ARMInstructionSelector.cpp",
"ARMLegalizerInfo.cpp",
"ARMLoadStoreOptimizer.cpp",
+ "ARMLowOverheadLoops.cpp",
"ARMMCInstLower.cpp",
"ARMMachineFunctionInfo.cpp",
"ARMMacroFusion.cpp",
@@ -113,7 +114,6 @@
":LLVMARMCodeGen",
"AsmParser",
"Disassembler",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/InstPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/InstPrinter/BUILD.gn
deleted file mode 100644
index 6cac442..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/InstPrinter/BUILD.gn
+++ /dev/null
@@ -1,25 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-tablegen("ARMGenAsmWriter") {
- visibility = [ ":InstPrinter" ]
- args = [ "-gen-asm-writer" ]
- td_file = "../ARM.td"
-}
-
-static_library("InstPrinter") {
- output_name = "LLVMARMAsmPrinter"
- deps = [
- ":ARMGenAsmWriter",
- "//llvm/lib/MC",
- "//llvm/lib/Support",
-
- # MCTargetDesc depends on InstPrinter, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/ARM/MCTargetDesc:tablegen",
- "//llvm/lib/Target/ARM/Utils",
- ]
- include_dirs = [ ".." ]
- sources = [
- "ARMInstPrinter.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/MCTargetDesc/BUILD.gn
index 3ef2f43..5e71904 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/MCTargetDesc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/MCTargetDesc/BUILD.gn
@@ -1,5 +1,11 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("ARMGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../ARM.td"
+}
+
tablegen("ARMGenInstrInfo") {
visibility = [ ":tablegen" ]
args = [ "-gen-instr-info" ]
@@ -7,7 +13,7 @@
}
tablegen("ARMGenMCCodeEmitter") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-emitter" ]
td_file = "../ARM.td"
}
@@ -24,30 +30,32 @@
td_file = "../ARM.td"
}
+# This should contain tablegen targets generating .inc files included
+# by other targets. .inc files only used by .cpp files in this directory
+# should be in deps on the static_library instead.
group("tablegen") {
visibility = [
":MCTargetDesc",
- "../InstPrinter",
- "../TargetInfo",
"../Utils",
]
public_deps = [
":ARMGenInstrInfo",
- ":ARMGenMCCodeEmitter",
":ARMGenRegisterInfo",
":ARMGenSubtargetInfo",
]
}
+
static_library("MCTargetDesc") {
output_name = "LLVMARMDesc"
public_deps = [
":tablegen",
]
deps = [
+ ":ARMGenAsmWriter",
+ ":ARMGenMCCodeEmitter",
"//llvm/lib/MC",
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Support",
- "//llvm/lib/Target/ARM/InstPrinter",
"//llvm/lib/Target/ARM/TargetInfo",
"//llvm/lib/Target/ARM/Utils",
]
@@ -56,6 +64,7 @@
"ARMAsmBackend.cpp",
"ARMELFObjectWriter.cpp",
"ARMELFStreamer.cpp",
+ "ARMInstPrinter.cpp",
"ARMMCAsmInfo.cpp",
"ARMMCCodeEmitter.cpp",
"ARMMCExpr.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/TargetInfo/BUILD.gn
index 521367c..b6c3b65 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/TargetInfo/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/TargetInfo/BUILD.gn
@@ -2,10 +2,6 @@
output_name = "LLVMARMInfo"
deps = [
"//llvm/lib/Support",
-
- # MCTargetDesc depends on TargetInfo, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/ARM/MCTargetDesc:tablegen",
]
include_dirs = [ ".." ]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/Utils/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/Utils/BUILD.gn
index e0ddc22..5303a32 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/Utils/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/ARM/Utils/BUILD.gn
@@ -13,6 +13,9 @@
]
deps = [
"//llvm/lib/Support",
+
+ # MCTargetDesc depends on Utils, so we can't depend on the full
+ # MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/ARM/MCTargetDesc:tablegen",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/AsmParser/BUILD.gn
new file mode 100644
index 0000000..bc6e7ab
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/AsmParser/BUILD.gn
@@ -0,0 +1,23 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("BPFGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../BPF.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMBPFAsmParser"
+ deps = [
+ ":BPFGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/BPF/MCTargetDesc",
+ "//llvm/lib/Target/BPF/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "BPFAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/BUILD.gn
new file mode 100644
index 0000000..31350dc
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/BUILD.gn
@@ -0,0 +1,94 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("BPFGenCallingConv") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "BPF.td"
+}
+
+tablegen("BPFGenDAGISel") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "BPF.td"
+}
+
+tablegen("BPFGenFastISel") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-fast-isel" ]
+ td_file = "BPF.td"
+}
+
+tablegen("BPFGenGlobalISel") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-global-isel" ]
+ td_file = "BPF.td"
+}
+
+tablegen("BPFGenMCPseudoLowering") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-pseudo-lowering" ]
+ td_file = "BPF.td"
+}
+
+tablegen("BPFGenRegisterBank") {
+ visibility = [ ":LLVMBPFCodeGen" ]
+ args = [ "-gen-register-bank" ]
+ td_file = "BPF.td"
+}
+
+static_library("LLVMBPFCodeGen") {
+ deps = [
+ ":BPFGenCallingConv",
+ ":BPFGenDAGISel",
+ ":BPFGenFastISel",
+ ":BPFGenGlobalISel",
+ ":BPFGenMCPseudoLowering",
+ ":BPFGenRegisterBank",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/GlobalISel",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "BPFAbstractMemberAccess.cpp",
+ "BPFAsmPrinter.cpp",
+ "BPFFrameLowering.cpp",
+ "BPFISelDAGToDAG.cpp",
+ "BPFISelLowering.cpp",
+ "BPFInstrInfo.cpp",
+ "BPFMCInstLower.cpp",
+ "BPFMIChecking.cpp",
+ "BPFMIPeephole.cpp",
+ "BPFMISimplifyPatchable.cpp",
+ "BPFRegisterInfo.cpp",
+ "BPFSelectionDAGInfo.cpp",
+ "BPFSubtarget.cpp",
+ "BPFTargetMachine.cpp",
+ "BTFDebug.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/BPF" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("BPF") {
+ deps = [
+ ":LLVMBPFCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/Disassembler/BUILD.gn
new file mode 100644
index 0000000..1ee3bc7
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/Disassembler/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("BPFGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../BPF.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMBPFDisassembler"
+ deps = [
+ ":BPFGenDisassemblerTables",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/BPF/MCTargetDesc",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "BPFDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..445df9f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/MCTargetDesc/BUILD.gn
@@ -0,0 +1,60 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("BPFGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../BPF.td"
+}
+
+tablegen("BPFGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../BPF.td"
+}
+
+tablegen("BPFGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../BPF.td"
+}
+
+tablegen("BPFGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../BPF.td"
+}
+
+tablegen("BPFGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../BPF.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMBPFDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
+ public_deps = [
+ ":BPFGenInstrInfo",
+ ":BPFGenRegisterInfo",
+ ":BPFGenSubtargetInfo",
+ ]
+ deps = [
+ ":BPFGenAsmWriter",
+ ":BPFGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/BPF/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "BPFAsmBackend.cpp",
+ "BPFELFObjectWriter.cpp",
+ "BPFInstPrinter.cpp",
+ "BPFMCCodeEmitter.cpp",
+ "BPFMCTargetDesc.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..bb50963
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BPF/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMBPFInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "BPFTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BUILD.gn
index 54b6082..50f33d4 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/BUILD.gn
@@ -1,4 +1,6 @@
import("//llvm/lib/Target/targets.gni")
+import("//llvm/lib/Target/targets_with_asm_parsers.gni")
+import("//llvm/lib/Target/targets_with_disassemblers.gni")
# This build file has two parts:
# 1. The actual //llvm/lib/Target build target, which is just a static
@@ -56,18 +58,11 @@
group("AllTargetsAsmParsers") {
deps = []
- foreach(target, llvm_targets_to_build) {
+ foreach(target, targets_with_asm_parsers) {
deps += [ "$target/AsmParser" ]
}
}
-group("AllTargetsAsmPrinters") {
- deps = []
- foreach(target, llvm_targets_to_build) {
- deps += [ "$target/InstPrinter" ]
- }
-}
-
group("AllTargetsDescs") {
deps = []
foreach(target, llvm_targets_to_build) {
@@ -77,7 +72,7 @@
group("AllTargetsDisassemblers") {
deps = []
- foreach(target, llvm_targets_to_build) {
+ foreach(target, targets_with_disassemblers) {
deps += [ "$target/Disassembler" ]
}
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/AsmParser/BUILD.gn
new file mode 100644
index 0000000..fa8b624
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/AsmParser/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("HexagonGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../Hexagon.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMHexagonAsmParser"
+ deps = [
+ ":HexagonGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Hexagon/MCTargetDesc",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "HexagonAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/BUILD.gn
new file mode 100644
index 0000000..1cfee43
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/BUILD.gn
@@ -0,0 +1,112 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("HexagonGenCallingConv") {
+ visibility = [ ":LLVMHexagonCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "Hexagon.td"
+}
+
+tablegen("HexagonGenDAGISel") {
+ visibility = [ ":LLVMHexagonCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "Hexagon.td"
+}
+
+tablegen("HexagonGenDFAPacketizer") {
+ visibility = [ ":LLVMHexagonCodeGen" ]
+ args = [ "-gen-dfa-packetizer" ]
+ td_file = "Hexagon.td"
+}
+
+static_library("LLVMHexagonCodeGen") {
+ deps = [
+ ":HexagonGenCallingConv",
+ ":HexagonGenDAGISel",
+ ":HexagonGenDFAPacketizer",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Passes",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ "//llvm/lib/Transforms/Utils",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "BitTracker.cpp",
+ "HexagonAsmPrinter.cpp",
+ "HexagonBitSimplify.cpp",
+ "HexagonBitTracker.cpp",
+ "HexagonBlockRanges.cpp",
+ "HexagonBranchRelaxation.cpp",
+ "HexagonCFGOptimizer.cpp",
+ "HexagonCommonGEP.cpp",
+ "HexagonConstExtenders.cpp",
+ "HexagonConstPropagation.cpp",
+ "HexagonCopyToCombine.cpp",
+ "HexagonEarlyIfConv.cpp",
+ "HexagonExpandCondsets.cpp",
+ "HexagonFixupHwLoops.cpp",
+ "HexagonFrameLowering.cpp",
+ "HexagonGenExtract.cpp",
+ "HexagonGenInsert.cpp",
+ "HexagonGenMux.cpp",
+ "HexagonGenPredicate.cpp",
+ "HexagonHardwareLoops.cpp",
+ "HexagonHazardRecognizer.cpp",
+ "HexagonISelDAGToDAG.cpp",
+ "HexagonISelDAGToDAGHVX.cpp",
+ "HexagonISelLowering.cpp",
+ "HexagonISelLoweringHVX.cpp",
+ "HexagonInstrInfo.cpp",
+ "HexagonLoopIdiomRecognition.cpp",
+ "HexagonMCInstLower.cpp",
+ "HexagonMachineFunctionInfo.cpp",
+ "HexagonMachineScheduler.cpp",
+ "HexagonNewValueJump.cpp",
+ "HexagonOptAddrMode.cpp",
+ "HexagonOptimizeSZextends.cpp",
+ "HexagonPeephole.cpp",
+ "HexagonRDFOpt.cpp",
+ "HexagonRegisterInfo.cpp",
+ "HexagonSelectionDAGInfo.cpp",
+ "HexagonSplitConst32AndConst64.cpp",
+ "HexagonSplitDouble.cpp",
+ "HexagonStoreWidening.cpp",
+ "HexagonSubtarget.cpp",
+ "HexagonTargetMachine.cpp",
+ "HexagonTargetObjectFile.cpp",
+ "HexagonTargetTransformInfo.cpp",
+ "HexagonVExtract.cpp",
+ "HexagonVLIWPacketizer.cpp",
+ "HexagonVectorLoopCarriedReuse.cpp",
+ "HexagonVectorPrint.cpp",
+ "RDFCopy.cpp",
+ "RDFDeadCode.cpp",
+ "RDFGraph.cpp",
+ "RDFLiveness.cpp",
+ "RDFRegisters.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/Hexagon" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("Hexagon") {
+ deps = [
+ ":LLVMHexagonCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/Disassembler/BUILD.gn
new file mode 100644
index 0000000..26ce3d2
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/Disassembler/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("HexagonGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../Hexagon.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMHexagonDisassembler"
+ deps = [
+ ":HexagonGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Hexagon/MCTargetDesc",
+ "//llvm/lib/Target/Hexagon/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "HexagonDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..4b7d2b7
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/MCTargetDesc/BUILD.gn
@@ -0,0 +1,68 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("HexagonGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../Hexagon.td"
+}
+
+tablegen("HexagonGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../Hexagon.td"
+}
+
+tablegen("HexagonGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../Hexagon.td"
+}
+
+tablegen("HexagonGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../Hexagon.td"
+}
+
+tablegen("HexagonGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../Hexagon.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMHexagonDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
+ public_deps = [
+ ":HexagonGenInstrInfo",
+ ":HexagonGenRegisterInfo",
+ ":HexagonGenSubtargetInfo",
+ ]
+ deps = [
+ ":HexagonGenAsmWriter",
+ ":HexagonGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Hexagon/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "HexagonAsmBackend.cpp",
+ "HexagonELFObjectWriter.cpp",
+ "HexagonInstPrinter.cpp",
+ "HexagonMCAsmInfo.cpp",
+ "HexagonMCChecker.cpp",
+ "HexagonMCCodeEmitter.cpp",
+ "HexagonMCCompound.cpp",
+ "HexagonMCDuplexInfo.cpp",
+ "HexagonMCELFStreamer.cpp",
+ "HexagonMCExpr.cpp",
+ "HexagonMCInstrInfo.cpp",
+ "HexagonMCShuffler.cpp",
+ "HexagonMCTargetDesc.cpp",
+ "HexagonShuffler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..d12eeb4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Hexagon/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMHexagonInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "HexagonTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn
new file mode 100644
index 0000000..5ab14fc
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LanaiGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../Lanai.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMLanaiAsmParser"
+ deps = [
+ ":LanaiGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Lanai/MCTargetDesc",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "LanaiAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn
new file mode 100644
index 0000000..85903af
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn
@@ -0,0 +1,64 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LanaiGenCallingConv") {
+ visibility = [ ":LLVMLanaiCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "Lanai.td"
+}
+
+tablegen("LanaiGenDAGISel") {
+ visibility = [ ":LLVMLanaiCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "Lanai.td"
+}
+
+static_library("LLVMLanaiCodeGen") {
+ deps = [
+ ":LanaiGenCallingConv",
+ ":LanaiGenDAGISel",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "LanaiAsmPrinter.cpp",
+ "LanaiDelaySlotFiller.cpp",
+ "LanaiFrameLowering.cpp",
+ "LanaiISelDAGToDAG.cpp",
+ "LanaiISelLowering.cpp",
+ "LanaiInstrInfo.cpp",
+ "LanaiMCInstLower.cpp",
+ "LanaiMachineFunctionInfo.cpp",
+ "LanaiMemAluCombiner.cpp",
+ "LanaiRegisterInfo.cpp",
+ "LanaiSelectionDAGInfo.cpp",
+ "LanaiSubtarget.cpp",
+ "LanaiTargetMachine.cpp",
+ "LanaiTargetObjectFile.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/Lanai" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("Lanai") {
+ deps = [
+ ":LLVMLanaiCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn
new file mode 100644
index 0000000..ce04122
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LanaiGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../Lanai.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMLanaiDisassembler"
+ deps = [
+ ":LanaiGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Lanai/MCTargetDesc",
+ "//llvm/lib/Target/Lanai/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "LanaiDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..3c24029
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn
@@ -0,0 +1,61 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LanaiGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../Lanai.td"
+}
+
+tablegen("LanaiGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../Lanai.td"
+}
+
+tablegen("LanaiGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../Lanai.td"
+}
+
+tablegen("LanaiGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../Lanai.td"
+}
+
+tablegen("LanaiGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../Lanai.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMLanaiDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
+ public_deps = [
+ ":LanaiGenInstrInfo",
+ ":LanaiGenRegisterInfo",
+ ":LanaiGenSubtargetInfo",
+ ]
+ deps = [
+ ":LanaiGenAsmWriter",
+ ":LanaiGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Lanai/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "LanaiAsmBackend.cpp",
+ "LanaiELFObjectWriter.cpp",
+ "LanaiInstPrinter.cpp",
+ "LanaiMCAsmInfo.cpp",
+ "LanaiMCCodeEmitter.cpp",
+ "LanaiMCExpr.cpp",
+ "LanaiMCTargetDesc.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..54f23dc
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMLanaiInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "LanaiTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/AsmParser/BUILD.gn
new file mode 100644
index 0000000..f4ec60d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/AsmParser/BUILD.gn
@@ -0,0 +1,23 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("MipsGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../Mips.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMMipsAsmParser"
+ deps = [
+ ":MipsGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Mips/MCTargetDesc",
+ "//llvm/lib/Target/Mips/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "MipsAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/BUILD.gn
new file mode 100644
index 0000000..6030476
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/BUILD.gn
@@ -0,0 +1,118 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("MipsGenCallingConv") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "Mips.td"
+}
+
+tablegen("MipsGenDAGISel") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "Mips.td"
+}
+
+tablegen("MipsGenFastISel") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-fast-isel" ]
+ td_file = "Mips.td"
+}
+
+tablegen("MipsGenGlobalISel") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-global-isel" ]
+ td_file = "Mips.td"
+}
+
+tablegen("MipsGenMCPseudoLowering") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-pseudo-lowering" ]
+ td_file = "Mips.td"
+}
+
+tablegen("MipsGenRegisterBank") {
+ visibility = [ ":LLVMMipsCodeGen" ]
+ args = [ "-gen-register-bank" ]
+ td_file = "Mips.td"
+}
+
+static_library("LLVMMipsCodeGen") {
+ deps = [
+ ":MipsGenCallingConv",
+ ":MipsGenDAGISel",
+ ":MipsGenFastISel",
+ ":MipsGenGlobalISel",
+ ":MipsGenMCPseudoLowering",
+ ":MipsGenRegisterBank",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/GlobalISel",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "MicroMipsSizeReduction.cpp",
+ "Mips16FrameLowering.cpp",
+ "Mips16HardFloat.cpp",
+ "Mips16HardFloatInfo.cpp",
+ "Mips16ISelDAGToDAG.cpp",
+ "Mips16ISelLowering.cpp",
+ "Mips16InstrInfo.cpp",
+ "Mips16RegisterInfo.cpp",
+ "MipsAnalyzeImmediate.cpp",
+ "MipsAsmPrinter.cpp",
+ "MipsBranchExpansion.cpp",
+ "MipsCCState.cpp",
+ "MipsCallLowering.cpp",
+ "MipsConstantIslandPass.cpp",
+ "MipsDelaySlotFiller.cpp",
+ "MipsExpandPseudo.cpp",
+ "MipsFastISel.cpp",
+ "MipsFrameLowering.cpp",
+ "MipsISelDAGToDAG.cpp",
+ "MipsISelLowering.cpp",
+ "MipsInstrInfo.cpp",
+ "MipsInstructionSelector.cpp",
+ "MipsLegalizerInfo.cpp",
+ "MipsMCInstLower.cpp",
+ "MipsMachineFunction.cpp",
+ "MipsModuleISelDAGToDAG.cpp",
+ "MipsOptimizePICCall.cpp",
+ "MipsOs16.cpp",
+ "MipsPreLegalizerCombiner.cpp",
+ "MipsRegisterBankInfo.cpp",
+ "MipsRegisterInfo.cpp",
+ "MipsSEFrameLowering.cpp",
+ "MipsSEISelDAGToDAG.cpp",
+ "MipsSEISelLowering.cpp",
+ "MipsSEInstrInfo.cpp",
+ "MipsSERegisterInfo.cpp",
+ "MipsSubtarget.cpp",
+ "MipsTargetMachine.cpp",
+ "MipsTargetObjectFile.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/Mips" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("Mips") {
+ deps = [
+ ":LLVMMipsCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/Disassembler/BUILD.gn
new file mode 100644
index 0000000..efc708e
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/Disassembler/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("MipsGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../Mips.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMMipsDisassembler"
+ deps = [
+ ":MipsGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Mips/MCTargetDesc",
+ "//llvm/lib/Target/Mips/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "MipsDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..2f6663d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/MCTargetDesc/BUILD.gn
@@ -0,0 +1,76 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("MipsGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../Mips.td"
+}
+
+tablegen("MipsGenInstrInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../Mips.td"
+}
+
+tablegen("MipsGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../Mips.td"
+}
+
+tablegen("MipsGenRegisterInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../Mips.td"
+}
+
+tablegen("MipsGenSubtargetInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../Mips.td"
+}
+
+# This should contain tablegen targets generating .inc files included
+# by other targets. .inc files only used by .cpp files in this directory
+# should be in deps on the static_library instead.
+group("tablegen") {
+ visibility = [
+ ":MCTargetDesc",
+ "../TargetInfo",
+ ]
+ public_deps = [
+ ":MipsGenInstrInfo",
+ ":MipsGenRegisterInfo",
+ ":MipsGenSubtargetInfo",
+ ]
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMMipsDesc"
+ public_deps = [
+ ":tablegen",
+ ]
+ deps = [
+ ":MipsGenAsmWriter",
+ ":MipsGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Mips/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "MipsABIFlagsSection.cpp",
+ "MipsABIInfo.cpp",
+ "MipsAsmBackend.cpp",
+ "MipsELFObjectWriter.cpp",
+ "MipsELFStreamer.cpp",
+ "MipsInstPrinter.cpp",
+ "MipsMCAsmInfo.cpp",
+ "MipsMCCodeEmitter.cpp",
+ "MipsMCExpr.cpp",
+ "MipsMCTargetDesc.cpp",
+ "MipsNaClELFStreamer.cpp",
+ "MipsOptionRecord.cpp",
+ "MipsTargetStreamer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..6706425
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Mips/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMMipsInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "MipsTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/BUILD.gn
new file mode 100644
index 0000000..e0145fe
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/BUILD.gn
@@ -0,0 +1,69 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("NVPTXGenDAGISel") {
+ visibility = [ ":LLVMNVPTXCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "NVPTX.td"
+}
+
+static_library("LLVMNVPTXCodeGen") {
+ deps = [
+ ":NVPTXGenDAGISel",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ "//llvm/lib/Transforms/IPO",
+ "//llvm/lib/Transforms/Scalar",
+ "//llvm/lib/Transforms/Utils",
+ "//llvm/lib/Transforms/Vectorize",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "NVPTXAllocaHoisting.cpp",
+ "NVPTXAsmPrinter.cpp",
+ "NVPTXAssignValidGlobalNames.cpp",
+ "NVPTXFrameLowering.cpp",
+ "NVPTXGenericToNVVM.cpp",
+ "NVPTXISelDAGToDAG.cpp",
+ "NVPTXISelLowering.cpp",
+ "NVPTXImageOptimizer.cpp",
+ "NVPTXInstrInfo.cpp",
+ "NVPTXLowerAggrCopies.cpp",
+ "NVPTXLowerAlloca.cpp",
+ "NVPTXLowerArgs.cpp",
+ "NVPTXMCExpr.cpp",
+ "NVPTXPeephole.cpp",
+ "NVPTXPrologEpilogPass.cpp",
+ "NVPTXProxyRegErasure.cpp",
+ "NVPTXRegisterInfo.cpp",
+ "NVPTXReplaceImageHandles.cpp",
+ "NVPTXSubtarget.cpp",
+ "NVPTXTargetMachine.cpp",
+ "NVPTXTargetTransformInfo.cpp",
+ "NVPTXUtilities.cpp",
+ "NVVMIntrRange.cpp",
+ "NVVMReflect.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/NVPTX" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("NVPTX") {
+ deps = [
+ ":LLVMNVPTXCodeGen",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..6cec8ea
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/MCTargetDesc/BUILD.gn
@@ -0,0 +1,51 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("NVPTXGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../NVPTX.td"
+}
+
+tablegen("NVPTXGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../NVPTX.td"
+}
+
+tablegen("NVPTXGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../NVPTX.td"
+}
+
+tablegen("NVPTXGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../NVPTX.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMNVPTXDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps on the static_library instead.
+ public_deps = [
+ ":NVPTXGenInstrInfo",
+ ":NVPTXGenRegisterInfo",
+ ":NVPTXGenSubtargetInfo",
+ ]
+ deps = [
+ ":NVPTXGenAsmWriter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/NVPTX/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "NVPTXInstPrinter.cpp",
+ "NVPTXMCAsmInfo.cpp",
+ "NVPTXMCTargetDesc.cpp",
+ "NVPTXTargetStreamer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..ab1053f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/NVPTX/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMNVPTXInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "NVPTXTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn
index 268ea48..2065d0e 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn
@@ -23,7 +23,6 @@
":PPCGenCallingConv",
":PPCGenDAGISel",
":PPCGenFastISel",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"//llvm/include/llvm/Config:llvm-config",
@@ -45,6 +44,7 @@
"PPCBranchSelector.cpp",
"PPCCCState.cpp",
"PPCCTRLoops.cpp",
+ "PPCCallingConv.cpp",
"PPCEarlyReturn.cpp",
"PPCExpandISEL.cpp",
"PPCFastISel.cpp",
@@ -57,6 +57,7 @@
"PPCMCInstLower.cpp",
"PPCMIPeephole.cpp",
"PPCMachineFunctionInfo.cpp",
+ "PPCMachineScheduler.cpp",
"PPCPreEmitPeephole.cpp",
"PPCQPXLoadSplat.cpp",
"PPCReduceCRLogicals.cpp",
@@ -84,7 +85,6 @@
":LLVMPowerPCCodeGen",
"AsmParser",
"Disassembler",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/InstPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/InstPrinter/BUILD.gn
deleted file mode 100644
index 8d885d6..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/InstPrinter/BUILD.gn
+++ /dev/null
@@ -1,24 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-tablegen("PPCGenAsmWriter") {
- visibility = [ ":InstPrinter" ]
- args = [ "-gen-asm-writer" ]
- td_file = "../PPC.td"
-}
-
-static_library("InstPrinter") {
- output_name = "LLVMPowerPCAsmPrinter"
- deps = [
- ":PPCGenAsmWriter",
- "//llvm/lib/MC",
- "//llvm/lib/Support",
-
- # MCTargetDesc depends on InstPrinter, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
- ]
- include_dirs = [ ".." ]
- sources = [
- "PPCInstPrinter.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn
index 4425612..cf960fe 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn
@@ -1,63 +1,64 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("PPCGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../PPC.td"
+}
+
tablegen("PPCGenInstrInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ]
td_file = "../PPC.td"
}
tablegen("PPCGenMCCodeEmitter") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-emitter" ]
td_file = "../PPC.td"
}
tablegen("PPCGenRegisterInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ]
td_file = "../PPC.td"
}
tablegen("PPCGenSubtargetInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ]
td_file = "../PPC.td"
}
-group("tablegen") {
- visibility = [
- ":MCTargetDesc",
- "../InstPrinter",
- "../TargetInfo",
- ]
+static_library("MCTargetDesc") {
+ output_name = "LLVMPowerPCDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
public_deps = [
":PPCGenInstrInfo",
- ":PPCGenMCCodeEmitter",
":PPCGenRegisterInfo",
":PPCGenSubtargetInfo",
]
-}
-
-static_library("MCTargetDesc") {
- output_name = "LLVMPowerPCDesc"
- public_deps = [
- ":tablegen",
- ]
deps = [
+ ":PPCGenAsmWriter",
+ ":PPCGenMCCodeEmitter",
"//llvm/lib/MC",
"//llvm/lib/Support",
- "//llvm/lib/Target/PowerPC/InstPrinter",
"//llvm/lib/Target/PowerPC/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
"PPCAsmBackend.cpp",
"PPCELFObjectWriter.cpp",
+ "PPCInstPrinter.cpp",
"PPCMCAsmInfo.cpp",
"PPCMCCodeEmitter.cpp",
"PPCMCExpr.cpp",
"PPCMCTargetDesc.cpp",
"PPCMachObjectWriter.cpp",
"PPCPredicates.cpp",
+ "PPCXCOFFObjectWriter.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn
index c706924..405e442 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn
@@ -2,10 +2,6 @@
output_name = "LLVMPowerPCInfo"
deps = [
"//llvm/lib/Support",
-
- # MCTargetDesc depends on TargetInfo, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
]
include_dirs = [ ".." ]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
new file mode 100644
index 0000000..ef28b23
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
@@ -0,0 +1,24 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("RISCVGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../RISCV.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMRISCVAsmParser"
+ deps = [
+ ":RISCVGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/RISCV:RISCVGenCompressInstEmitter",
+ "//llvm/lib/Target/RISCV/MCTargetDesc",
+ "//llvm/lib/Target/RISCV/Utils",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "RISCVAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
new file mode 100644
index 0000000..7a0610e
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
@@ -0,0 +1,79 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+# RISCV is the only target that has a "compress instr emitter", and it's
+# a bit strange in that it defines static functions depending on which
+# defines are set. Instead of housing these functions in one library,
+# various libraries include the generated .inc file with different defines set.
+tablegen("RISCVGenCompressInstEmitter") {
+ visibility = [
+ ":LLVMRISCVCodeGen",
+ "AsmParser",
+ "MCTargetDesc",
+ ]
+ args = [ "-gen-compress-inst-emitter" ]
+ td_file = "RISCV.td"
+}
+
+tablegen("RISCVGenDAGISel") {
+ visibility = [ ":LLVMRISCVCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "RISCV.td"
+}
+
+tablegen("RISCVGenMCPseudoLowering") {
+ visibility = [ ":LLVMRISCVCodeGen" ]
+ args = [ "-gen-pseudo-lowering" ]
+ td_file = "RISCV.td"
+}
+
+static_library("LLVMRISCVCodeGen") {
+ deps = [
+ ":RISCVGenCompressInstEmitter",
+ ":RISCVGenDAGISel",
+ ":RISCVGenMCPseudoLowering",
+ "MCTargetDesc",
+ "TargetInfo",
+ "Utils",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "RISCVAsmPrinter.cpp",
+ "RISCVExpandPseudoInsts.cpp",
+ "RISCVFrameLowering.cpp",
+ "RISCVISelDAGToDAG.cpp",
+ "RISCVISelLowering.cpp",
+ "RISCVInstrInfo.cpp",
+ "RISCVMCInstLower.cpp",
+ "RISCVMergeBaseOffset.cpp",
+ "RISCVRegisterInfo.cpp",
+ "RISCVSubtarget.cpp",
+ "RISCVTargetMachine.cpp",
+ "RISCVTargetObjectFile.cpp",
+ "RISCVTargetTransformInfo.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/RISCV" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("RISCV") {
+ deps = [
+ ":LLVMRISCVCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ "Utils",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
new file mode 100644
index 0000000..4425610
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("RISCVGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../RISCV.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMRISCVDisassembler"
+ deps = [
+ ":RISCVGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/RISCV/MCTargetDesc",
+ "//llvm/lib/Target/RISCV/Utils",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "RISCVDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..09ca180
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn
@@ -0,0 +1,73 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("RISCVGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../RISCV.td"
+}
+
+tablegen("RISCVGenInstrInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../RISCV.td"
+}
+
+tablegen("RISCVGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../RISCV.td"
+}
+
+tablegen("RISCVGenRegisterInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../RISCV.td"
+}
+
+tablegen("RISCVGenSubtargetInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../RISCV.td"
+}
+
+# This should contain tablegen targets generating .inc files included
+# by other targets. .inc files only used by .cpp files in this directory
+# should be in deps on the static_library instead.
+group("tablegen") {
+ visibility = [
+ ":MCTargetDesc",
+ "../Utils",
+ ]
+ public_deps = [
+ ":RISCVGenInstrInfo",
+ ":RISCVGenRegisterInfo",
+ ":RISCVGenSubtargetInfo",
+ ]
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMRISCVDesc"
+ public_deps = [
+ ":tablegen",
+ ]
+ deps = [
+ ":RISCVGenAsmWriter",
+ ":RISCVGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/RISCV:RISCVGenCompressInstEmitter",
+ "//llvm/lib/Target/RISCV/Utils",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "RISCVAsmBackend.cpp",
+ "RISCVELFObjectWriter.cpp",
+ "RISCVELFStreamer.cpp",
+ "RISCVInstPrinter.cpp",
+ "RISCVMCAsmInfo.cpp",
+ "RISCVMCCodeEmitter.cpp",
+ "RISCVMCExpr.cpp",
+ "RISCVMCTargetDesc.cpp",
+ "RISCVTargetStreamer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..536053f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMRISCVInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "RISCVTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn
new file mode 100644
index 0000000..66924be
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn
@@ -0,0 +1,28 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("RISCVGenSystemOperands") {
+ visibility = [ ":Utils" ]
+ args = [ "-gen-searchable-tables" ]
+ td_file = "../RISCV.td"
+}
+
+static_library("Utils") {
+ output_name = "LLVMRISCVUtils"
+ public_deps = [
+ ":RISCVGenSystemOperands",
+ ]
+ deps = [
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+
+ # MCTargetDesc depends on Utils, so we can't depend on the full
+ # MCTargetDesc target here: it would form a cycle.
+ "//llvm/lib/Target/RISCV/MCTargetDesc:tablegen",
+ ]
+
+ include_dirs = [ ".." ]
+ sources = [
+ "RISCVBaseInfo.cpp",
+ "RISCVMatInt.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/AsmParser/BUILD.gn
new file mode 100644
index 0000000..aaae105
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/AsmParser/BUILD.gn
@@ -0,0 +1,22 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SparcGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../Sparc.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMSparcAsmParser"
+ deps = [
+ ":SparcGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Sparc/MCTargetDesc",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SparcAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/BUILD.gn
new file mode 100644
index 0000000..89242e0
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/BUILD.gn
@@ -0,0 +1,62 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SparcGenCallingConv") {
+ visibility = [ ":LLVMSparcCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "Sparc.td"
+}
+
+tablegen("SparcGenDAGISel") {
+ visibility = [ ":LLVMSparcCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "Sparc.td"
+}
+
+static_library("LLVMSparcCodeGen") {
+ deps = [
+ ":SparcGenCallingConv",
+ ":SparcGenDAGISel",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "DelaySlotFiller.cpp",
+ "LeonPasses.cpp",
+ "SparcAsmPrinter.cpp",
+ "SparcFrameLowering.cpp",
+ "SparcISelDAGToDAG.cpp",
+ "SparcISelLowering.cpp",
+ "SparcInstrInfo.cpp",
+ "SparcMCInstLower.cpp",
+ "SparcMachineFunctionInfo.cpp",
+ "SparcRegisterInfo.cpp",
+ "SparcSubtarget.cpp",
+ "SparcTargetMachine.cpp",
+ "SparcTargetObjectFile.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/Sparc" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("Sparc") {
+ deps = [
+ ":LLVMSparcCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/Disassembler/BUILD.gn
new file mode 100644
index 0000000..22a712d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/Disassembler/BUILD.gn
@@ -0,0 +1,21 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SparcGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../Sparc.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMSparcDisassembler"
+ deps = [
+ ":SparcGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/Sparc/MCTargetDesc",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SparcDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..f6b5587
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/MCTargetDesc/BUILD.gn
@@ -0,0 +1,61 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SparcGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../Sparc.td"
+}
+
+tablegen("SparcGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../Sparc.td"
+}
+
+tablegen("SparcGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../Sparc.td"
+}
+
+tablegen("SparcGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../Sparc.td"
+}
+
+tablegen("SparcGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../Sparc.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMSparcDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
+ public_deps = [
+ ":SparcGenInstrInfo",
+ ":SparcGenRegisterInfo",
+ ":SparcGenSubtargetInfo",
+ ]
+ deps = [
+ ":SparcGenAsmWriter",
+ ":SparcGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SparcAsmBackend.cpp",
+ "SparcELFObjectWriter.cpp",
+ "SparcInstPrinter.cpp",
+ "SparcMCAsmInfo.cpp",
+ "SparcMCCodeEmitter.cpp",
+ "SparcMCExpr.cpp",
+ "SparcMCTargetDesc.cpp",
+ "SparcTargetStreamer.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..6dbac501
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/Sparc/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMSparcInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SparcTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/AsmParser/BUILD.gn
new file mode 100644
index 0000000..e9ece31
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/AsmParser/BUILD.gn
@@ -0,0 +1,23 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SystemZGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../SystemZ.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMSystemZAsmParser"
+ deps = [
+ ":SystemZGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/SystemZ/MCTargetDesc",
+ "//llvm/lib/Target/SystemZ/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SystemZAsmParser.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/BUILD.gn
new file mode 100644
index 0000000..034645f
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/BUILD.gn
@@ -0,0 +1,74 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SystemZGenCallingConv") {
+ visibility = [ ":LLVMSystemZCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "SystemZ.td"
+}
+
+tablegen("SystemZGenDAGISel") {
+ visibility = [ ":LLVMSystemZCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "SystemZ.td"
+}
+
+static_library("LLVMSystemZCodeGen") {
+ deps = [
+ ":SystemZGenCallingConv",
+ ":SystemZGenDAGISel",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ "//llvm/lib/Transforms/Scalar",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "SystemZAsmPrinter.cpp",
+ "SystemZCallingConv.cpp",
+ "SystemZConstantPoolValue.cpp",
+ "SystemZElimCompare.cpp",
+ "SystemZExpandPseudo.cpp",
+ "SystemZFrameLowering.cpp",
+ "SystemZHazardRecognizer.cpp",
+ "SystemZISelDAGToDAG.cpp",
+ "SystemZISelLowering.cpp",
+ "SystemZInstrInfo.cpp",
+ "SystemZLDCleanup.cpp",
+ "SystemZLongBranch.cpp",
+ "SystemZMCInstLower.cpp",
+ "SystemZMachineFunctionInfo.cpp",
+ "SystemZMachineScheduler.cpp",
+ "SystemZPostRewrite.cpp",
+ "SystemZRegisterInfo.cpp",
+ "SystemZSelectionDAGInfo.cpp",
+ "SystemZShortenInst.cpp",
+ "SystemZSubtarget.cpp",
+ "SystemZTDC.cpp",
+ "SystemZTargetMachine.cpp",
+ "SystemZTargetTransformInfo.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/SystemZ" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("SystemZ") {
+ deps = [
+ ":LLVMSystemZCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/Disassembler/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/Disassembler/BUILD.gn
new file mode 100644
index 0000000..6a06cf9
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/Disassembler/BUILD.gn
@@ -0,0 +1,23 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SystemZGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../SystemZ.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMSystemZDisassembler"
+ deps = [
+ ":SystemZGenDisassemblerTables",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/SystemZ/MCTargetDesc",
+ "//llvm/lib/Target/SystemZ/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SystemZDisassembler.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/MCTargetDesc/BUILD.gn
new file mode 100644
index 0000000..25504b8
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/MCTargetDesc/BUILD.gn
@@ -0,0 +1,60 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("SystemZGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../SystemZ.td"
+}
+
+tablegen("SystemZGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../SystemZ.td"
+}
+
+tablegen("SystemZGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../SystemZ.td"
+}
+
+tablegen("SystemZGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../SystemZ.td"
+}
+
+tablegen("SystemZGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../SystemZ.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMSystemZDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps on the static_library instead.
+ public_deps = [
+ ":SystemZGenInstrInfo",
+ ":SystemZGenRegisterInfo",
+ ":SystemZGenSubtargetInfo",
+ ]
+ deps = [
+ ":SystemZGenAsmWriter",
+ ":SystemZGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/SystemZ/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SystemZInstPrinter.cpp",
+ "SystemZMCAsmBackend.cpp",
+ "SystemZMCAsmInfo.cpp",
+ "SystemZMCCodeEmitter.cpp",
+ "SystemZMCObjectWriter.cpp",
+ "SystemZMCTargetDesc.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/TargetInfo/BUILD.gn
new file mode 100644
index 0000000..35754fce
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/SystemZ/TargetInfo/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("TargetInfo") {
+ output_name = "LLVMSystemZInfo"
+ deps = [
+ "//llvm/lib/Support",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "SystemZTargetInfo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn
index e3bd8f2..988e529 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn
@@ -44,7 +44,6 @@
":WebAssemblyGenGlobalISel",
":WebAssemblyGenMCPseudoLowering",
":WebAssemblyGenRegisterBank",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"//llvm/include/llvm/Config:llvm-config",
@@ -67,7 +66,6 @@
"WebAssemblyCFGStackify.cpp",
"WebAssemblyCallIndirectFixup.cpp",
"WebAssemblyDebugValueManager.cpp",
- "WebAssemblyEHRestoreStackPointer.cpp",
"WebAssemblyExceptionInfo.cpp",
"WebAssemblyExplicitLocals.cpp",
"WebAssemblyFastISel.cpp",
@@ -115,7 +113,6 @@
":LLVMWebAssemblyCodeGen",
"AsmParser",
"Disassembler",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn
deleted file mode 100644
index e63ea79..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn
+++ /dev/null
@@ -1,24 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-tablegen("WebAssemblyGenAsmWriter") {
- visibility = [ ":InstPrinter" ]
- args = [ "-gen-asm-writer" ]
- td_file = "../WebAssembly.td"
-}
-
-static_library("InstPrinter") {
- output_name = "LLVMWebAssemblyAsmPrinter"
- deps = [
- ":WebAssemblyGenAsmWriter",
- "//llvm/lib/MC",
- "//llvm/lib/Support",
-
- # MCTargetDesc depends on InstPrinter, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/WebAssembly/MCTargetDesc:tablegen",
- ]
- include_dirs = [ ".." ]
- sources = [
- "WebAssemblyInstPrinter.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn
index 8d8e6c0..146f10b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn
@@ -1,57 +1,57 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("WebAssemblyGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../WebAssembly.td"
+}
+
tablegen("WebAssemblyGenInstrInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ]
td_file = "../WebAssembly.td"
}
tablegen("WebAssemblyGenMCCodeEmitter") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-emitter" ]
td_file = "../WebAssembly.td"
}
tablegen("WebAssemblyGenRegisterInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ]
td_file = "../WebAssembly.td"
}
tablegen("WebAssemblyGenSubtargetInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ]
td_file = "../WebAssembly.td"
}
-group("tablegen") {
- visibility = [
- ":MCTargetDesc",
- "../InstPrinter",
- "../TargetInfo",
- "../Utils",
- ]
+static_library("MCTargetDesc") {
+ output_name = "LLVMWebAssemblyDesc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
public_deps = [
":WebAssemblyGenInstrInfo",
- ":WebAssemblyGenMCCodeEmitter",
":WebAssemblyGenRegisterInfo",
":WebAssemblyGenSubtargetInfo",
]
-}
-static_library("MCTargetDesc") {
- output_name = "LLVMWebAssemblyDesc"
- public_deps = [
- ":tablegen",
- ]
deps = [
+ ":WebAssemblyGenAsmWriter",
+ ":WebAssemblyGenMCCodeEmitter",
"//llvm/lib/MC",
"//llvm/lib/Support",
- "//llvm/lib/Target/WebAssembly/InstPrinter",
"//llvm/lib/Target/WebAssembly/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
"WebAssemblyAsmBackend.cpp",
+ "WebAssemblyInstPrinter.cpp",
"WebAssemblyMCAsmInfo.cpp",
"WebAssemblyMCCodeEmitter.cpp",
"WebAssemblyMCTargetDesc.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn
index 334183b..63f5ca1 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn
@@ -2,10 +2,6 @@
output_name = "LLVMWebAssemblyInfo"
deps = [
"//llvm/lib/Support",
-
- # MCTargetDesc depends on TargetInfo, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/WebAssembly/MCTargetDesc:tablegen",
]
include_dirs = [ ".." ]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/AsmParser/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/AsmParser/BUILD.gn
index f0dcf4d..16124f6 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/AsmParser/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/AsmParser/BUILD.gn
@@ -13,13 +13,11 @@
"//llvm/lib/MC",
"//llvm/lib/MC/MCParser",
"//llvm/lib/Support",
- "//llvm/lib/Target/X86/InstPrinter",
"//llvm/lib/Target/X86/MCTargetDesc",
"//llvm/lib/Target/X86/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
- "X86AsmInstrumentation.cpp",
"X86AsmParser.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/BUILD.gn
index 36ec6c5..3748189 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/BUILD.gn
@@ -57,7 +57,6 @@
":X86GenFastISel",
":X86GenGlobalISel",
":X86GenRegisterBank",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
@@ -76,7 +75,6 @@
deps += [ ":X86GenFoldTables" ]
}
sources = [
- "ShadowCallStack.cpp",
"X86AsmPrinter.cpp",
"X86AvoidStoreForwardingBlocks.cpp",
"X86CallFrameOptimization.cpp",
@@ -137,7 +135,6 @@
":LLVMX86CodeGen",
"AsmParser",
"Disassembler",
- "InstPrinter",
"MCTargetDesc",
"TargetInfo",
"Utils",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/InstPrinter/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/InstPrinter/BUILD.gn
deleted file mode 100644
index 4ca806d..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/InstPrinter/BUILD.gn
+++ /dev/null
@@ -1,38 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-tablegen("X86GenAsmWriter") {
- visibility = [ ":InstPrinter" ]
- args = [ "-gen-asm-writer" ]
- td_file = "../X86.td"
-}
-
-tablegen("X86GenAsmWriter1") {
- visibility = [ ":InstPrinter" ]
- args = [
- "-gen-asm-writer",
- "-asmwriternum=1",
- ]
- td_file = "../X86.td"
-}
-
-static_library("InstPrinter") {
- output_name = "LLVMX86AsmPrinter"
- deps = [
- ":X86GenAsmWriter",
- ":X86GenAsmWriter1",
- "//llvm/lib/MC",
- "//llvm/lib/Support",
-
- # MCTargetDesc depends on InstPrinter, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/X86/MCTargetDesc:tablegen",
- "//llvm/lib/Target/X86/Utils",
- ]
- include_dirs = [ ".." ]
- sources = [
- "X86ATTInstPrinter.cpp",
- "X86InstComments.cpp",
- "X86InstPrinterCommon.cpp",
- "X86IntelInstPrinter.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/MCTargetDesc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/MCTargetDesc/BUILD.gn
index 426f9a5..735a84d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/MCTargetDesc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/MCTargetDesc/BUILD.gn
@@ -1,53 +1,67 @@
import("//llvm/utils/TableGen/tablegen.gni")
+tablegen("X86GenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../X86.td"
+}
+
+tablegen("X86GenAsmWriter1") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [
+ "-gen-asm-writer",
+ "-asmwriternum=1",
+ ]
+ td_file = "../X86.td"
+}
+
tablegen("X86GenInstrInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ]
td_file = "../X86.td"
}
tablegen("X86GenRegisterInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ]
td_file = "../X86.td"
}
tablegen("X86GenSubtargetInfo") {
- visibility = [ ":tablegen" ]
+ visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ]
td_file = "../X86.td"
}
-group("tablegen") {
- visibility = [
- ":MCTargetDesc",
- "../InstPrinter",
- "../TargetInfo",
- ]
+static_library("MCTargetDesc") {
+ output_name = "LLVMX86Desc"
+
+ # This should contain tablegen targets generating .inc files included
+ # by other targets. .inc files only used by .cpp files in this directory
+ # should be in deps instead.
public_deps = [
":X86GenInstrInfo",
":X86GenRegisterInfo",
":X86GenSubtargetInfo",
]
-}
-
-static_library("MCTargetDesc") {
- output_name = "LLVMX86Desc"
- public_deps = [
- ":tablegen",
- ]
deps = [
+ ":X86GenAsmWriter",
+ ":X86GenAsmWriter1",
"//llvm/lib/MC",
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Object",
"//llvm/lib/Support",
- "//llvm/lib/Target/X86/InstPrinter",
"//llvm/lib/Target/X86/TargetInfo",
+ "//llvm/lib/Target/X86/Utils",
]
include_dirs = [ ".." ]
sources = [
+ "X86ATTInstPrinter.cpp",
"X86AsmBackend.cpp",
"X86ELFObjectWriter.cpp",
+ "X86InstComments.cpp",
+ "X86InstPrinterCommon.cpp",
+ "X86IntelInstPrinter.cpp",
"X86MCAsmInfo.cpp",
"X86MCCodeEmitter.cpp",
"X86MCTargetDesc.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/TargetInfo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/TargetInfo/BUILD.gn
index 6b0ed1d..1658875 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/TargetInfo/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/X86/TargetInfo/BUILD.gn
@@ -2,10 +2,6 @@
output_name = "LLVMX86Info"
deps = [
"//llvm/lib/Support",
-
- # MCTargetDesc depends on TargetInfo, so we can't depend on the full
- # MCTargetDesc target here: it would form a cycle.
- "//llvm/lib/Target/X86/MCTargetDesc:tablegen",
]
include_dirs = [ ".." ]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni
index 85055cf..61001fc 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni
@@ -10,7 +10,7 @@
llvm_targets_to_build = [ "AArch64" ]
} else if (host_cpu == "arm") {
llvm_targets_to_build = [ "ARM" ]
- } else if (host_cpu == "pcc" || host_cpu == "pcc64") {
+ } else if (host_cpu == "ppc" || host_cpu == "ppc64") {
llvm_targets_to_build = [ "PowerPC" ]
} else if (host_cpu == "x86" || host_cpu == "x64") {
llvm_targets_to_build = [ "X86" ]
@@ -22,7 +22,14 @@
llvm_targets_to_build = [
"AArch64",
"ARM",
+ "BPF",
+ "Hexagon",
+ "Lanai",
+ "Mips",
+ "NVPTX",
"PowerPC",
+ "Sparc",
+ "SystemZ",
"WebAssembly",
"X86",
]
@@ -32,6 +39,7 @@
# and remember which targets are built.
llvm_build_AArch64 = false
llvm_build_ARM = false
+llvm_build_BPF = false
llvm_build_PowerPC = false
llvm_build_WebAssembly = false
llvm_build_X86 = false
@@ -40,8 +48,24 @@
llvm_build_AArch64 = true
} else if (target == "ARM") {
llvm_build_ARM = true
+ } else if (target == "BPF") {
+ llvm_build_BPF = true
+ } else if (target == "Hexagon") {
+ # Nothing to do.
+ } else if (target == "Lanai") {
+ # Nothing to do.
+ } else if (target == "Mips") {
+ # Nothing to do.
+ } else if (target == "NVPTX") {
+ # Nothing to do.
} else if (target == "PowerPC") {
llvm_build_PowerPC = true
+ } else if (target == "RISCV") {
+ # Nothing to do.
+ } else if (target == "Sparc") {
+ # Nothing to do.
+ } else if (target == "SystemZ") {
+ # Nothing to do.
} else if (target == "WebAssembly") {
llvm_build_WebAssembly = true
} else if (target == "X86") {
@@ -57,8 +81,8 @@
native_target = "AArch64"
} else if (host_cpu == "arm") {
native_target = "ARM"
-} else if (host_cpu == "pcc" || host_cpu == "pcc64") {
- native_target = [ "PowerPC" ]
+} else if (host_cpu == "ppc" || host_cpu == "ppc64") {
+ native_target = "PowerPC"
} else if (host_cpu == "x86" || host_cpu == "x64") {
native_target = "X86"
} else {
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_asm_parsers.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_asm_parsers.gni
new file mode 100644
index 0000000..1b0bdb4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_asm_parsers.gni
@@ -0,0 +1,9 @@
+import("//llvm/lib/Target/targets.gni")
+
+targets_with_asm_parsers = []
+foreach(target, llvm_targets_to_build) {
+ # These targets don't have AsmParsers.
+ if (target != "ARC" && target != "NVPTX" && target != "XCore") {
+ targets_with_asm_parsers += [ target ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_disassemblers.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_disassemblers.gni
new file mode 100644
index 0000000..30b8c34
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Target/targets_with_disassemblers.gni
@@ -0,0 +1,9 @@
+import("//llvm/lib/Target/targets.gni")
+
+targets_with_disassemblers = []
+foreach(target, llvm_targets_to_build) {
+ # These targets don't have Disassemblers.
+ if (target != "NVPTX") {
+ targets_with_disassemblers += [ target ]
+ }
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn
index 064d5ec..cdc4230 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn
@@ -5,6 +5,7 @@
"//llvm/utils/unittest:gtest",
]
sources = [
+ "Annotations.cpp",
"Error.cpp",
"SupportHelpers.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn
index 0daf58b..509d589 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn
@@ -8,5 +8,12 @@
sources = [
"ELF/ELFStub.cpp",
"ELF/TBEHandler.cpp",
+ "MachO/Architecture.cpp",
+ "MachO/ArchitectureSet.cpp",
+ "MachO/InterfaceFile.cpp",
+ "MachO/PackedVersion.cpp",
+ "MachO/Symbol.cpp",
+ "MachO/TextStub.cpp",
+ "MachO/TextStubCommon.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ToolDrivers/llvm-lib/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ToolDrivers/llvm-lib/BUILD.gn
index 0e8187c..caa73ef 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ToolDrivers/llvm-lib/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/ToolDrivers/llvm-lib/BUILD.gn
@@ -10,6 +10,7 @@
deps = [
":Options",
"//llvm/lib/BinaryFormat",
+ "//llvm/lib/Bitcode/Reader",
"//llvm/lib/Object",
"//llvm/lib/Option",
"//llvm/lib/Support",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn
index 9240193..9e55578 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Hello/BUILD.gn
@@ -11,9 +11,9 @@
"Hello.cpp",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# The GN build currently doesn't globally pass -fPIC, but that's
- # needed for building .so files on Linux. Just pass it manually
+ # needed for building .so files on ELF. Just pass it manually
# for loadable_modules for now.
cflags = [ "-fPIC" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
index 636936b..6095eb0 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
@@ -20,6 +20,7 @@
sources = [
"AlwaysInliner.cpp",
"ArgumentPromotion.cpp",
+ "Attributor.cpp",
"BarrierNoopPass.cpp",
"BlockExtractor.cpp",
"CalledValuePropagation.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/InstCombine/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/InstCombine/BUILD.gn
index 0082528..d68a007 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/InstCombine/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/InstCombine/BUILD.gn
@@ -17,6 +17,7 @@
sources = [
"InstCombineAddSub.cpp",
"InstCombineAndOrXor.cpp",
+ "InstCombineAtomicRMW.cpp",
"InstCombineCalls.cpp",
"InstCombineCasts.cpp",
"InstCombineCompares.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
index 0a74889..d6c256b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
@@ -14,15 +14,16 @@
"CGProfile.cpp",
"ControlHeightReduction.cpp",
"DataFlowSanitizer.cpp",
- "EfficiencySanitizer.cpp",
"GCOVProfiling.cpp",
"HWAddressSanitizer.cpp",
"IndirectCallPromotion.cpp",
+ "InstrOrderFile.cpp",
"InstrProfiling.cpp",
"Instrumentation.cpp",
"MemorySanitizer.cpp",
"PGOInstrumentation.cpp",
"PGOMemOPSizeOpt.cpp",
+ "PoisonChecking.cpp",
"SanitizerCoverage.cpp",
"ThreadSanitizer.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
index 3d000fa..d09bb70 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -38,6 +38,7 @@
"LoopDataPrefetch.cpp",
"LoopDeletion.cpp",
"LoopDistribute.cpp",
+ "LoopFuse.cpp",
"LoopIdiomRecognize.cpp",
"LoopInstSimplify.cpp",
"LoopInterchange.cpp",
@@ -56,6 +57,7 @@
"LowerAtomic.cpp",
"LowerExpectIntrinsic.cpp",
"LowerGuardIntrinsic.cpp",
+ "LowerWidenableCondition.cpp",
"MakeGuardsExplicit.cpp",
"MemCpyOptimizer.cpp",
"MergeICmps.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
index eee9b80..6b28bc8 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
@@ -57,6 +57,7 @@
"SimplifyCFG.cpp",
"SimplifyIndVar.cpp",
"SimplifyLibCalls.cpp",
+ "SizeOpts.cpp",
"SplitModule.cpp",
"StripGCRelocates.cpp",
"StripNonLineTableDebugInfo.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize/BUILD.gn
index 24d52ba..a308fce 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize/BUILD.gn
@@ -14,6 +14,7 @@
"VPlan.cpp",
"VPlanHCFGBuilder.cpp",
"VPlanHCFGTransforms.cpp",
+ "VPlanPredicator.cpp",
"VPlanSLP.cpp",
"VPlanVerifier.cpp",
"Vectorize.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/test/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/test/BUILD.gn
index b6f7574..7c6a316 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -59,13 +59,14 @@
"LLVM_LINK_LLVM_DYLIB=0",
"LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
"LLVM_NATIVE_ARCH=$native_target",
- "LLVM_TOOL_LTO_BUILD=1", # The GN build always builds //llvm/tools/lto.
"LLVM_USE_INTEL_JITEVENTS=0",
"LLVM_USE_SANITIZER=",
"PYTHON_EXECUTABLE=$python_path",
"TARGETS_TO_BUILD=$llvm_targets_to_build_string",
"TARGET_TRIPLE=$llvm_target_triple",
+ "LLVM_LIBCXX_USED=0",
+
# No bindings are implemented in the GN build.
"LLVM_BINDINGS=",
@@ -76,32 +77,45 @@
"HAVE_OCAML_OUNIT=0",
"OCAMLFIND=OCAMLFIND-NOTFOUND",
"OCAMLFLAGS=",
+ "LLVM_BUILD_EXAMPLES=0",
]
if (host_cpu == "x64") {
extra_values += [ "HOST_ARCH=x86_64" ]
+ } else if (host_cpu == "ppc64") {
+ extra_values += [ "HOST_ARCH=powerpc64le" ]
} else {
assert(false, "unimplemented host_cpu " + host_cpu)
}
+ if (host_os == "win") {
+ extra_values += [ "EXEEXT=.exe" ]
+ } else {
+ extra_values += [ "EXEEXT=" ]
+ }
+
+ if (host_os == "win") {
+ extra_values += [ "LLVM_ENABLE_PLUGINS=0" ]
+ } else {
+ extra_values += [ "LLVM_ENABLE_PLUGINS=1" ]
+ }
+
if (host_os == "mac") {
- extra_values += [
- "EXEEXT=",
- "HOST_OS=Darwin",
- "SHLIBEXT=.dylib",
- ]
- } else if (host_os == "linux") {
- extra_values += [
- "EXEEXT=",
- "HOST_OS=Linux",
- "SHLIBEXT=.so",
- ]
+ extra_values += [ "SHLIBEXT=.dylib" ]
} else if (host_os == "win") {
- extra_values += [
- "EXEEXT=.exe",
- "HOST_OS=Windows",
- "SHLIBEXT=.dll",
- ]
+ extra_values += [ "SHLIBEXT=.dll" ]
+ } else {
+ extra_values += [ "SHLIBEXT=.so" ]
+ }
+
+ if (host_os == "freebsd") {
+ extra_values += [ "HOST_OS=FreeBSD" ]
+ } else if (host_os == "mac") {
+ extra_values += [ "HOST_OS=Darwin" ]
+ } else if (host_os == "linux") {
+ extra_values += [ "HOST_OS=Linux" ]
+ } else if (host_os == "win") {
+ extra_values += [ "HOST_OS=Windows" ]
} else {
assert(false, "unsupported host_os " + host_os)
}
@@ -141,7 +155,7 @@
if (llvm_enable_libxml2) {
extra_values += [ "LLVM_LIBXML2_ENABLED=1" ]
} else {
- extra_values += [ "LLVM_LIBXML2_ENABLED=" ] # Must be empty.
+ extra_values += [ "LLVM_LIBXML2_ENABLED=0" ] # Must be 0.
}
if (llvm_enable_threads) {
@@ -202,7 +216,9 @@
"//llvm/tools/llvm-exegesis",
"//llvm/tools/llvm-extract",
"//llvm/tools/llvm-isel-fuzzer",
+ "//llvm/tools/llvm-jitlink",
"//llvm/tools/llvm-link",
+ "//llvm/tools/llvm-lipo",
"//llvm/tools/llvm-lto",
"//llvm/tools/llvm-lto2",
"//llvm/tools/llvm-mc",
@@ -222,7 +238,7 @@
"//llvm/tools/llvm-size",
"//llvm/tools/llvm-split",
"//llvm/tools/llvm-strings",
- "//llvm/tools/llvm-symbolizer",
+ "//llvm/tools/llvm-symbolizer:symlinks",
"//llvm/tools/llvm-undname",
"//llvm/tools/llvm-xray",
"//llvm/tools/lto",
@@ -236,6 +252,7 @@
"//llvm/utils/FileCheck",
"//llvm/utils/TableGen:llvm-tblgen",
"//llvm/utils/count",
+ "//llvm/utils/llvm-lit",
"//llvm/utils/not",
# llvm-config wants libgtest_main.a to exist at runtime when run as in
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn
index 385c469..260c390 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint-passes/BUILD.gn
@@ -11,9 +11,9 @@
"TestPasses.cpp",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# The GN build currently doesn't globally pass -fPIC, but that's
- # needed for building .so files on Linux. Just pass it manually
+ # needed for building .so files on ELF. Just pass it manually
# for loadable_modules for now.
cflags = [ "-fPIC" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
index 84a4908..d14aec2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
@@ -33,7 +33,7 @@
# Support plugins.
# FIXME: Disable dead stripping once other binaries are dead-stripped.
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Make sure bugpoint plugins can access bugpoint's symbols.
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn
index 45cde4a..5f7aff1 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llc/BUILD.gn
@@ -21,7 +21,7 @@
# Support plugins.
# FIXME: Disable dead stripping once other binaries are dead-stripped.
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn
index 0e17358..171e0dd 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lli/BUILD.gn
@@ -22,7 +22,7 @@
sources = [
"lli.cpp",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-cfi-verify/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-cfi-verify/BUILD.gn
index e5779ae..2f0c08c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-cfi-verify/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-cfi-verify/BUILD.gn
@@ -7,7 +7,6 @@
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmParsers",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn
index ef4eea6..5cea22c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn
@@ -27,6 +27,7 @@
"PerfHelper.cpp",
"RegisterAliasing.cpp",
"RegisterValue.cpp",
+ "SchedClassResolution.cpp",
"SnippetGenerator.cpp",
"Target.cpp",
"Uops.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn
new file mode 100644
index 0000000..3df75c2
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-jitlink/BUILD.gn
@@ -0,0 +1,17 @@
+executable("llvm-jitlink") {
+ deps = [
+ "//llvm/lib/BinaryFormat",
+ "//llvm/lib/ExecutionEngine",
+ "//llvm/lib/ExecutionEngine/JITLink",
+ "//llvm/lib/ExecutionEngine/Orc",
+ "//llvm/lib/ExecutionEngine/RuntimeDyld",
+ "//llvm/lib/MC",
+ "//llvm/lib/Object",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:TargetsToBuild",
+ ]
+ sources = [
+ "llvm-jitlink-macho.cpp",
+ "llvm-jitlink.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-lipo/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-lipo/BUILD.gn
new file mode 100644
index 0000000..28f762d
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-lipo/BUILD.gn
@@ -0,0 +1,19 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LipoOpts") {
+ visibility = [ ":llvm-lipo" ]
+ args = [ "-gen-opt-parser-defs" ]
+}
+
+executable("llvm-lipo") {
+ deps = [
+ ":LipoOpts",
+ "//llvm/lib/Object",
+ "//llvm/lib/Option",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:TargetsToBuild",
+ ]
+ sources = [
+ "llvm-lipo.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mc/BUILD.gn
index ddaae80..653c5c0 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mc/BUILD.gn
@@ -4,7 +4,6 @@
"//llvm/lib/MC/MCParser",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmParsers",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mca/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mca/BUILD.gn
index f4b66eb..f703de7 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mca/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-mca/BUILD.gn
@@ -5,7 +5,6 @@
"//llvm/lib/MCA",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmParsers",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
@@ -18,6 +17,7 @@
"CodeRegion.cpp",
"CodeRegionGenerator.cpp",
"PipelinePrinter.cpp",
+ "Views/BottleneckAnalysis.cpp",
"Views/DispatchStatistics.cpp",
"Views/InstructionInfoView.cpp",
"Views/RegisterFileStatistics.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objcopy/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objcopy/BUILD.gn
index a23d1a3..341220c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objcopy/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objcopy/BUILD.gn
@@ -56,6 +56,10 @@
"CopyConfig.cpp",
"ELF/ELFObjcopy.cpp",
"ELF/Object.cpp",
+ "MachO/MachOObjcopy.cpp",
+ "MachO/MachOReader.cpp",
+ "MachO/MachOWriter.cpp",
+ "MachO/Object.cpp",
"llvm-objcopy.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objdump/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objdump/BUILD.gn
index e567a70..3b1670b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objdump/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-objdump/BUILD.gn
@@ -11,7 +11,7 @@
}
}
-# //:llvm-nm depends on this symlink target, see comment in //BUILD.gn.
+# //:llvm-objdump depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
deps = [
":llvm-objdump",
@@ -33,7 +33,6 @@
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Object",
"//llvm/lib/Support",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-opt-report/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-opt-report/BUILD.gn
index 70b2e1b..ea21b5c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-opt-report/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-opt-report/BUILD.gn
@@ -3,7 +3,7 @@
"//llvm/lib/Demangle",
"//llvm/lib/IR",
"//llvm/lib/Object",
- "//llvm/lib/OptRemarks",
+ "//llvm/lib/Remarks",
"//llvm/lib/Support",
]
sources = [
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-pdbutil/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-pdbutil/BUILD.gn
index b72bd00..c931b65 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-pdbutil/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-pdbutil/BUILD.gn
@@ -29,6 +29,7 @@
"PrettyTypedefDumper.cpp",
"PrettyVariableDumper.cpp",
"StreamUtil.cpp",
+ "TypeReferenceTracker.cpp",
"YAMLOutputStyle.cpp",
"llvm-pdbutil.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-readobj/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-readobj/BUILD.gn
index 501d809..dde560d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-readobj/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-readobj/BUILD.gn
@@ -44,6 +44,7 @@
"WasmDumper.cpp",
"Win64EHDumper.cpp",
"WindowsResourceDumper.cpp",
+ "XCOFFDumper.cpp",
"llvm-readobj.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-symbolizer/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-symbolizer/BUILD.gn
index 497d2c8..34e4e41 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-symbolizer/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/llvm-symbolizer/BUILD.gn
@@ -1,23 +1,25 @@
import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")
+symlinks = [ "llvm-addr2line" ]
if (llvm_install_binutils_symlinks) {
- symlink_or_copy("addr2line") {
+ symlinks += [ "addr2line" ]
+}
+foreach(target, symlinks) {
+ symlink_or_copy(target) {
deps = [
":llvm-symbolizer",
]
source = "llvm-symbolizer"
- output = "$root_out_dir/bin/addr2line"
+ output = "$root_out_dir/bin/$target"
}
}
# //:llvm-symbolizer depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
- deps = [
- ":llvm-symbolizer",
- ]
- if (llvm_install_binutils_symlinks) {
- deps += [ ":addr2line" ]
+ deps = []
+ foreach(target, symlinks) {
+ deps += [ ":$target" ]
}
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
index 3cc62d3..135b952 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
@@ -1,8 +1,8 @@
import("//llvm/version.gni")
lto_target_type = "shared_library"
-if (host_os == "linux") {
- # Linux needs -fPIC to build shared libs but they aren't on by default.
+if (host_os != "mac" && host_os != "win") {
+ # ELF targets need -fPIC to build shared libs but they aren't on by default.
# For now, make libclang a static lib there.
lto_target_type = "static_library"
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/obj2yaml/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/obj2yaml/BUILD.gn
index 6ba2022..cba338b 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/obj2yaml/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/obj2yaml/BUILD.gn
@@ -12,7 +12,9 @@
"dwarf2yaml.cpp",
"elf2yaml.cpp",
"macho2yaml.cpp",
+ "minidump2yaml.cpp",
"obj2yaml.cpp",
"wasm2yaml.cpp",
+ "xcoff2yaml.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn
index 7deae1c..2bf062c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn
@@ -32,7 +32,7 @@
# Support plugins.
# FIXME: Disable dead stripping once other binaries are dead-stripped.
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
index c07af7b..9c3f585 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/sancov/BUILD.gn
@@ -7,7 +7,6 @@
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Object",
"//llvm/lib/Support",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/yaml2obj/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/yaml2obj/BUILD.gn
index 56bebc4..a36004d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/yaml2obj/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/tools/yaml2obj/BUILD.gn
@@ -10,6 +10,7 @@
"yaml2coff.cpp",
"yaml2elf.cpp",
"yaml2macho.cpp",
+ "yaml2minidump.cpp",
"yaml2obj.cpp",
"yaml2wasm.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/triples.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/triples.gni
index 1987afa..efe8be2 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/triples.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/triples.gni
@@ -1,5 +1,11 @@
-if (current_cpu == "x64") {
+if (current_cpu == "x86") {
if (current_os == "linux") {
+ llvm_current_triple = "i386-unknown-linux-gnu"
+ }
+} else if (current_cpu == "x64") {
+ if (current_os == "freebsd") {
+ llvm_current_triple = "x86_64-unknown-freebsd"
+ } else if (current_os == "linux") {
llvm_current_triple = "x86_64-unknown-linux-gnu"
} else if (current_os == "mac") {
llvm_current_triple = "x86_64-apple-darwin"
@@ -10,6 +16,10 @@
if (current_os == "android") {
llvm_current_triple = "aarch64-linux-android21"
}
+} else if (current_cpu == "ppc64") {
+ if (current_os == "linux") {
+ llvm_current_triple = "powerpc64le-unknown-linux-gnu"
+ }
}
if (!defined(llvm_current_triple)) {
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ADT/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ADT/BUILD.gn
index 611df36..d444bc3 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ADT/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ADT/BUILD.gn
@@ -7,6 +7,7 @@
# Some tests include files from IR, but there's no library dependency.
"//llvm/include/llvm/IR:public_tablegen",
"//llvm/lib/Support",
+ "//llvm/lib/Testing/Support",
]
sources = [
"APFloatTest.cpp",
@@ -24,6 +25,7 @@
"DenseSetTest.cpp",
"DepthFirstIteratorTest.cpp",
"EquivalenceClassesTest.cpp",
+ "FallibleIteratorTest.cpp",
"FoldingSet.cpp",
"FunctionExtrasTest.cpp",
"FunctionRefTest.cpp",
@@ -70,6 +72,7 @@
"StringExtrasTest.cpp",
"StringMapTest.cpp",
"StringRefTest.cpp",
+ "StringSetTest.cpp",
"StringSwitchTest.cpp",
"TinyPtrVectorTest.cpp",
"TripleTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
index e68ef94..9be8d42 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
@@ -18,7 +18,9 @@
"CallGraphTest.cpp",
"CaptureTrackingTest.cpp",
"DivergenceAnalysisTest.cpp",
+ "DomTreeUpdaterTest.cpp",
"GlobalsModRefTest.cpp",
+ "IVDescriptorsTest.cpp",
"LazyCallGraphTest.cpp",
"LoopInfoTest.cpp",
"MemoryBuiltinsTest.cpp",
@@ -34,5 +36,6 @@
"UnrollAnalyzerTest.cpp",
"ValueLatticeTest.cpp",
"ValueTrackingTest.cpp",
+ "VectorUtilsTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
index b46d402..e2f813d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
@@ -7,14 +7,17 @@
"AsmParser:AsmParserTests",
"BinaryFormat:BinaryFormatTests",
"Bitcode:BitcodeTests",
+ "Bitstream:BitstreamTests",
"CodeGen:CodeGenTests",
"CodeGen/GlobalISel:GlobalISelTests",
"DebugInfo/CodeView:DebugInfoCodeViewTests",
"DebugInfo/DWARF:DebugInfoDWARFTests",
+ "DebugInfo/GSYM:DebugInfoGSYMTests",
"DebugInfo/MSF:DebugInfoMSFTests",
"DebugInfo/PDB:DebugInfoPDBTests",
"Demangle:DemangleTests",
"ExecutionEngine:ExecutionEngineTests",
+ "ExecutionEngine/JITLink:JITLinkTests",
"ExecutionEngine/MCJIT:MCJITTests",
"ExecutionEngine/Orc:OrcJITTests",
"FuzzMutate:FuzzMutateTests",
@@ -25,10 +28,10 @@
"MI:MITests",
"Object:ObjectTests",
"ObjectYAML:ObjectYAMLTests",
- "OptRemarks:OptRemarksTests",
"Option:OptionTests",
"Passes:PluginsTests",
"ProfileData:ProfileDataTests",
+ "Remarks:RemarksTests",
"Support:SupportTests",
"Support/DynamicLibrary:DynamicLibraryTests",
"TextAPI:TextAPITests",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BinaryFormat/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BinaryFormat/BUILD.gn
index 7b2b78e..b6b9dc7 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BinaryFormat/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/BinaryFormat/BUILD.gn
@@ -7,8 +7,8 @@
sources = [
"DwarfTest.cpp",
"MachOTest.cpp",
+ "MsgPackDocumentTest.cpp",
"MsgPackReaderTest.cpp",
- "MsgPackTypesTest.cpp",
"MsgPackWriterTest.cpp",
"TestFileMagic.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitcode/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitcode/BUILD.gn
index 9cb7894..9a3817e 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitcode/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitcode/BUILD.gn
@@ -10,7 +10,5 @@
]
sources = [
"BitReaderTest.cpp",
- "BitstreamReaderTest.cpp",
- "BitstreamWriterTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitstream/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitstream/BUILD.gn
new file mode 100644
index 0000000..373a26b
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Bitstream/BUILD.gn
@@ -0,0 +1,11 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("BitstreamTests") {
+ deps = [
+ "//llvm/lib/Bitstream/Reader",
+ ]
+ sources = [
+ "BitstreamReaderTest.cpp",
+ "BitstreamWriterTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn
index b67631b..9469788 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn
@@ -21,5 +21,8 @@
"MachineInstrTest.cpp",
"MachineOperandTest.cpp",
"ScalableVectorMVTsTest.cpp",
+ "TargetOptionsTest.cpp",
+ "TypeTraitsTest.cpp",
]
+ has_custom_main = true
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn
index 43cf22c..3afd244 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/CodeGen/GlobalISel/BUILD.gn
@@ -13,8 +13,10 @@
]
sources = [
"CSETest.cpp",
+ "GISelMITest.cpp",
"LegalizerHelperTest.cpp",
"LegalizerInfoTest.cpp",
+ "MachineIRBuilderTest.cpp",
"PatternMatchTest.cpp",
]
has_custom_main = true
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/DebugInfo/GSYM/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/DebugInfo/GSYM/BUILD.gn
new file mode 100644
index 0000000..a5e13a4
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/DebugInfo/GSYM/BUILD.gn
@@ -0,0 +1,17 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("DebugInfoGSYMTests") {
+ deps = [
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/DebugInfo/GSYM",
+ "//llvm/lib/MC",
+ "//llvm/lib/Object",
+ "//llvm/lib/ObjectYAML",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target:TargetsToBuild",
+ "//llvm/lib/Testing/Support",
+ ]
+ sources = [
+ "GSYMTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Demangle/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Demangle/BUILD.gn
index c7eedfb..7981d94 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Demangle/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Demangle/BUILD.gn
@@ -5,6 +5,7 @@
"//llvm/lib/Demangle",
]
sources = [
+ "DemangleTest.cpp",
"ItaniumDemangleTest.cpp",
"PartialDemangleTest.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/JITLink/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/JITLink/BUILD.gn
new file mode 100644
index 0000000..75a00a1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/JITLink/BUILD.gn
@@ -0,0 +1,20 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("JITLinkTests") {
+ deps = [
+ "//llvm/lib/ExecutionEngine/JITLink",
+ "//llvm/lib/ExecutionEngine/RuntimeDyld",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Object",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ "//llvm/lib/Target:TargetsToBuild",
+ "//llvm/lib/Testing/Support",
+ ]
+ sources = [
+ "JITLinkTestCommon.cpp",
+ "MachO_x86_64_Tests.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc/BUILD.gn
index 81b66a5..1e4ff4d 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc/BUILD.gn
@@ -9,6 +9,7 @@
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:NativeTarget",
+ "//llvm/lib/Testing/Support",
]
sources = [
"CoreAPIsTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/IR/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/IR/BUILD.gn
index b02a66c..d3342af 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/IR/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/IR/BUILD.gn
@@ -16,9 +16,9 @@
"CFGBuilder.cpp",
"ConstantRangeTest.cpp",
"ConstantsTest.cpp",
+ "DataLayoutTest.cpp",
"DebugInfoTest.cpp",
"DebugTypeODRUniquingTest.cpp",
- "DomTreeUpdaterTest.cpp",
"DominatorTreeBatchUpdatesTest.cpp",
"DominatorTreeTest.cpp",
"FunctionTest.cpp",
@@ -33,12 +33,14 @@
"PassBuilderCallbacksTest.cpp",
"PassManagerTest.cpp",
"PatternMatch.cpp",
+ "TimePassesTest.cpp",
"TypesTest.cpp",
"UseTest.cpp",
"UserTest.cpp",
"ValueHandleTest.cpp",
"ValueMapTest.cpp",
"ValueTest.cpp",
+ "VectorTypesTest.cpp",
"VerifierTest.cpp",
"WaymarkTest.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Object/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Object/BUILD.gn
index 74f3525..204e718 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Object/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Object/BUILD.gn
@@ -2,9 +2,12 @@
unittest("ObjectTests") {
deps = [
+ "//llvm/lib/BinaryFormat",
"//llvm/lib/Object",
+ "//llvm/lib/Testing/Support",
]
sources = [
+ "MinidumpTest.cpp",
"SymbolSizeTest.cpp",
"SymbolicFileTest.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ObjectYAML/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ObjectYAML/BUILD.gn
index 8d8575d..4e7d610 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ObjectYAML/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/ObjectYAML/BUILD.gn
@@ -2,9 +2,12 @@
unittest("ObjectYAMLTests") {
deps = [
+ "//llvm/lib/Object",
"//llvm/lib/ObjectYAML",
+ "//llvm/lib/Testing/Support",
]
sources = [
+ "MinidumpYAMLTest.cpp",
"YAMLTest.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/OptRemarks/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/OptRemarks/BUILD.gn
deleted file mode 100644
index 785e78b..0000000
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/OptRemarks/BUILD.gn
+++ /dev/null
@@ -1,11 +0,0 @@
-import("//llvm/utils/unittest/unittest.gni")
-
-unittest("OptRemarksTests") {
- deps = [
- "//llvm/lib/OptRemarks",
- "//llvm/lib/Support",
- ]
- sources = [
- "OptRemarksParsingTest.cpp",
- ]
-}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn
index 6bf6e70..4ad9317 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn
@@ -17,9 +17,9 @@
"//llvm/include/llvm/IR:public_tablegen",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# The GN build currently doesn't globally pass -fPIC, but that's
- # needed for building .so files on Linux. Just pass it manually
+ # needed for building .so files on ELF. Just pass it manually
# for loadable_modules for now.
cflags = [ "-fPIC" ]
}
@@ -46,7 +46,7 @@
defines = [ "LLVM_ENABLE_PLUGINS" ]
}
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Remarks/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Remarks/BUILD.gn
new file mode 100644
index 0000000..cd1cd56
--- /dev/null
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Remarks/BUILD.gn
@@ -0,0 +1,12 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("RemarksTests") {
+ deps = [
+ "//llvm/lib/Remarks",
+ "//llvm/lib/Support",
+ ]
+ sources = [
+ "RemarksStrTabParsingTest.cpp",
+ "YAMLRemarksParsingTest.cpp",
+ ]
+}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
index f8d8a02..2490293 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/BUILD.gn
@@ -9,10 +9,12 @@
"ARMAttributeParser.cpp",
"AlignOfTest.cpp",
"AllocatorTest.cpp",
+ "AnnotationsTest.cpp",
"ArrayRecyclerTest.cpp",
"BinaryStreamTest.cpp",
"BlockFrequencyTest.cpp",
"BranchProbabilityTest.cpp",
+ "CRCTest.cpp",
"CachePruningTest.cpp",
"Casting.cpp",
"CheckedArithmeticTest.cpp",
@@ -30,17 +32,20 @@
"ErrnoTest.cpp",
"ErrorOrTest.cpp",
"ErrorTest.cpp",
+ "FileCheckTest.cpp",
"FileOutputBufferTest.cpp",
"FormatVariadicTest.cpp",
"GlobPatternTest.cpp",
"Host.cpp",
"ItaniumManglingCanonicalizerTest.cpp",
"JSONTest.cpp",
+ "KnownBitsTest.cpp",
"LEB128Test.cpp",
"LineIteratorTest.cpp",
"LockFileManagerTest.cpp",
"MD5Test.cpp",
"ManagedStatic.cpp",
+ "MatchersTest.cpp",
"MathExtrasTest.cpp",
"MemoryBufferTest.cpp",
"MemoryTest.cpp",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn
index a04559e..aac3da7 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Support/DynamicLibrary/BUILD.gn
@@ -15,9 +15,9 @@
"PipSqueak.cpp",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# The GN build currently doesn't globally pass -fPIC, but that's
- # needed for building .so files on Linux. Just pass it manually
+ # needed for building .so files on ELF. Just pass it manually
# for loadable_modules for now.
cflags = [ "-fPIC" ]
}
@@ -42,7 +42,7 @@
"ExportedFuncs.cpp",
]
- if (host_os == "linux") {
+ if (host_os != "mac" && host_os != "win") {
# Corresponds to export_executable_symbols() in cmake.
ldflags = [ "-rdynamic" ]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/TextAPI/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/TextAPI/BUILD.gn
index 0bfa109..4c207d4 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/TextAPI/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/TextAPI/BUILD.gn
@@ -7,5 +7,7 @@
]
sources = [
"ELFYAMLTest.cpp",
+ "TextStubV1Tests.cpp",
+ "TextStubV2Tests.cpp",
]
}
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Transforms/Vectorize/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Transforms/Vectorize/BUILD.gn
index aec5d0f..33e1efd 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Transforms/Vectorize/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/Transforms/Vectorize/BUILD.gn
@@ -11,6 +11,7 @@
"VPlanDominatorTreeTest.cpp",
"VPlanHCFGTest.cpp",
"VPlanLoopInfoTest.cpp",
+ "VPlanPredicatorTest.cpp",
"VPlanSlpTest.cpp",
"VPlanTest.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn
index e973126..e25d838 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-cfi-verify/BUILD.gn
@@ -8,7 +8,6 @@
"//llvm/lib/Object",
"//llvm/lib/Support",
"//llvm/lib/Target:AllTargetsAsmParsers",
- "//llvm/lib/Target:AllTargetsAsmPrinters",
"//llvm/lib/Target:AllTargetsDescs",
"//llvm/lib/Target:AllTargetsDisassemblers",
"//llvm/lib/Target:AllTargetsInfos",
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/X86/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/X86/BUILD.gn
index 2b59d8b..53c5e4c 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/X86/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/X86/BUILD.gn
@@ -21,10 +21,10 @@
"//llvm/tools/llvm-exegesis/lib",
]
sources = [
- "AnalysisTest.cpp",
"AssemblerTest.cpp",
"BenchmarkResultTest.cpp",
"RegisterAliasingTest.cpp",
+ "SchedClassResolutionTest.cpp",
"SnippetGeneratorTest.cpp",
"TargetTest.cpp",
]
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/TableGen/tablegen.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/TableGen/tablegen.gni
index 5037832..cb588ab 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/TableGen/tablegen.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/TableGen/tablegen.gni
@@ -9,7 +9,7 @@
# Basename of the generated output file.
# Defaults to target name with ".inc" appended.
#
-# td_file (roptional)
+# td_file (optional)
# The .td file to pass to llvm-tblgen.
# Defaults to target name with ".td" appended.
#
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn b/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
index fca5679..c3e4375 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
@@ -1,3 +1,5 @@
+import("//clang-tools-extra/clangd/test/clangd_lit_site_cfg_files.gni")
+import("//clang-tools-extra/test/clang_tools_extra_lit_site_cfg_files.gni")
import("//clang/test/clang_lit_site_cfg_files.gni")
import("//lld/test/lld_lit_site_cfg_files.gni")
import("//llvm/test/llvm_lit_site_cfg_files.gni")
@@ -24,6 +26,8 @@
config_map = ""
deps += [
+ "//clang-tools-extra/test:lit_site_cfg",
+ "//clang-tools-extra/test:lit_unit_site_cfg",
"//clang/test:lit_site_cfg",
"//clang/test:lit_unit_site_cfg",
"//lld/test:lit_site_cfg",
@@ -33,6 +37,18 @@
]
# Note: \n is converted into a newline by write_cmake_config.py, not by gn.
+ config_map +=
+ "map_config('" + rebase_path("//clang-tools-extra/test/lit.cfg.py") +
+ "', '" + rebase_path(clang_tools_extra_lit_site_cfg_file) + "')\n"
+ config_map +=
+ "map_config('" + rebase_path("//clang-tools-extra/test/Unit/lit.cfg.py") +
+ "', '" + rebase_path(clang_tools_extra_lit_unit_site_cfg_file) + "')\n"
+ config_map += "map_config('" +
+ rebase_path("//clang-tools-extra/clangd/test/lit.cfg.py") +
+ "', '" + rebase_path(clangd_lit_site_cfg_file) + "')\n"
+ config_map += "map_config('" +
+ rebase_path("//clang-tools-extra/clang/unittests/lit.cfg.py") +
+ "', '" + rebase_path(clangd_lit_unit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//clang/test/lit.cfg.py") +
"', '" + rebase_path(clang_lit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//clang/test/Unit/lit.cfg.py") +
diff --git a/src/llvm-project/llvm/utils/gn/secondary/llvm/version.gni b/src/llvm-project/llvm/utils/gn/secondary/llvm/version.gni
index b64e3f9..fd448d9 100644
--- a/src/llvm-project/llvm/utils/gn/secondary/llvm/version.gni
+++ b/src/llvm-project/llvm/utils/gn/secondary/llvm/version.gni
@@ -1,4 +1,4 @@
-llvm_version_major = 8
+llvm_version_major = 9
llvm_version_minor = 0
llvm_version_patch = 0
llvm_version = "$llvm_version_major.$llvm_version_minor.$llvm_version_patch"
diff --git a/src/llvm-project/llvm/utils/kate/llvm-tablegen.xml b/src/llvm-project/llvm/utils/kate/llvm-tablegen.xml
index ccca1d3..df9507f 100644
--- a/src/llvm-project/llvm/utils/kate/llvm-tablegen.xml
+++ b/src/llvm-project/llvm/utils/kate/llvm-tablegen.xml
@@ -16,6 +16,7 @@
<item> !tail </item>
<item> !con </item>
<item> !add </item>
+ <item> !mul </item>
<item> !shl </item>
<item> !sra </item>
<item> !srl </item>
@@ -27,6 +28,7 @@
<item> !strconcat </item>
<item> !cast </item>
<item> !listconcat </item>
+ <item> !listsplat </item>
<item> !size </item>
<item> !foldl </item>
<item> !isa </item>
diff --git a/src/llvm-project/llvm/utils/lit/lit/LitConfig.py b/src/llvm-project/llvm/utils/lit/lit/LitConfig.py
index 97c0910..31eeb76 100644
--- a/src/llvm-project/llvm/utils/lit/lit/LitConfig.py
+++ b/src/llvm-project/llvm/utils/lit/lit/LitConfig.py
@@ -21,7 +21,7 @@
def __init__(self, progname, path, quiet,
useValgrind, valgrindLeakCheck, valgrindArgs,
- noExecute, debug, isWindows, singleProcess,
+ noExecute, debug, isWindows,
params, config_prefix = None,
maxIndividualTestTime = 0,
maxFailures = None,
@@ -37,7 +37,6 @@
self.valgrindUserArgs = list(valgrindArgs)
self.noExecute = noExecute
self.debug = debug
- self.singleProcess = singleProcess
self.isWindows = bool(isWindows)
self.params = dict(params)
self.bashPath = None
diff --git a/src/llvm-project/llvm/utils/lit/lit/LitTestCase.py b/src/llvm-project/llvm/utils/lit/lit/LitTestCase.py
deleted file mode 100644
index e04846c..0000000
--- a/src/llvm-project/llvm/utils/lit/lit/LitTestCase.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from __future__ import absolute_import
-import unittest
-
-import lit.Test
-
-"""
-TestCase adaptor for providing a 'unittest' compatible interface to 'lit' tests.
-"""
-
-class UnresolvedError(RuntimeError):
- pass
-
-class LitTestCase(unittest.TestCase):
- def __init__(self, test, run):
- unittest.TestCase.__init__(self)
- self._test = test
- self._run = run
-
- def id(self):
- return self._test.getFullName()
-
- def shortDescription(self):
- return self._test.getFullName()
-
- def runTest(self):
- # Run the test.
- self._run.execute_test(self._test)
-
- # Adapt the result to unittest.
- result = self._test.result
- if result.code is lit.Test.UNRESOLVED:
- raise UnresolvedError(result.output)
- elif result.code.isFailure:
- self.fail(result.output)
diff --git a/src/llvm-project/llvm/utils/lit/lit/TestRunner.py b/src/llvm-project/llvm/utils/lit/lit/TestRunner.py
index 4d903b4..ac627d5 100644
--- a/src/llvm-project/llvm/utils/lit/lit/TestRunner.py
+++ b/src/llvm-project/llvm/utils/lit/lit/TestRunner.py
@@ -23,7 +23,7 @@
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.util
-from lit.util import to_bytes, to_string
+from lit.util import to_bytes, to_string, to_unicode
from lit.BooleanExpression import BooleanExpression
class InternalShellError(Exception):
@@ -49,7 +49,7 @@
# This regex captures ARG. ARG must not contain a right parenthesis, which
# terminates %dbg. ARG must not contain quotes, in which ARG might be enclosed
# during expansion.
-kPdbgRegex = '%dbg\(([^)\'"]*)\)'
+kPdbgRegex = '%dbg\\(([^)\'"]*)\\)'
class ShellEnvironment(object):
@@ -344,13 +344,16 @@
stderr = StringIO()
exitCode = 0
for dir in args:
+ cwd = cmd_shenv.cwd
+ dir = to_unicode(dir) if kIsWindows else to_bytes(dir)
+ cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
if not os.path.isabs(dir):
- dir = os.path.realpath(os.path.join(cmd_shenv.cwd, dir))
+ dir = os.path.realpath(os.path.join(cwd, dir))
if parent:
lit.util.mkdir_p(dir)
else:
try:
- os.mkdir(dir)
+ lit.util.mkdir(dir)
except OSError as err:
stderr.write("Error: 'mkdir' command failed, %s\n" % str(err))
exitCode = 1
@@ -598,8 +601,11 @@
stderr = StringIO()
exitCode = 0
for path in args:
+ cwd = cmd_shenv.cwd
+ path = to_unicode(path) if kIsWindows else to_bytes(path)
+ cwd = to_unicode(cwd) if kIsWindows else to_bytes(cwd)
if not os.path.isabs(path):
- path = os.path.realpath(os.path.join(cmd_shenv.cwd, path))
+ path = os.path.realpath(os.path.join(cwd, path))
if force and not os.path.exists(path):
continue
try:
@@ -607,7 +613,51 @@
if not recursive:
stderr.write("Error: %s is a directory\n" % path)
exitCode = 1
- shutil.rmtree(path, onerror = on_rm_error if force else None)
+ if platform.system() == 'Windows':
+ # NOTE: use ctypes to access `SHFileOperationsW` on Windows to
+ # use the NT style path to get access to long file paths which
+ # cannot be removed otherwise.
+ from ctypes.wintypes import BOOL, HWND, LPCWSTR, UINT, WORD
+ from ctypes import addressof, byref, c_void_p, create_unicode_buffer
+ from ctypes import Structure
+ from ctypes import windll, WinError, POINTER
+
+ class SHFILEOPSTRUCTW(Structure):
+ _fields_ = [
+ ('hWnd', HWND),
+ ('wFunc', UINT),
+ ('pFrom', LPCWSTR),
+ ('pTo', LPCWSTR),
+ ('fFlags', WORD),
+ ('fAnyOperationsAborted', BOOL),
+ ('hNameMappings', c_void_p),
+ ('lpszProgressTitle', LPCWSTR),
+ ]
+
+ FO_MOVE, FO_COPY, FO_DELETE, FO_RENAME = range(1, 5)
+
+ FOF_SILENT = 4
+ FOF_NOCONFIRMATION = 16
+ FOF_NOCONFIRMMKDIR = 512
+ FOF_NOERRORUI = 1024
+
+ FOF_NO_UI = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR
+
+ SHFileOperationW = windll.shell32.SHFileOperationW
+ SHFileOperationW.argtypes = [POINTER(SHFILEOPSTRUCTW)]
+
+ path = os.path.abspath(path)
+
+ pFrom = create_unicode_buffer(path, len(path) + 2)
+ pFrom[len(path)] = pFrom[len(path) + 1] = '\0'
+ operation = SHFILEOPSTRUCTW(wFunc=UINT(FO_DELETE),
+ pFrom=LPCWSTR(addressof(pFrom)),
+ fFlags=FOF_NO_UI)
+ result = SHFileOperationW(byref(operation))
+ if result:
+ raise WinError(result)
+ else:
+ shutil.rmtree(path, onerror = on_rm_error if force else None)
else:
if force and not os.access(path, os.W_OK):
os.chmod(path,
@@ -695,6 +745,8 @@
else:
# Make sure relative paths are relative to the cwd.
redir_filename = os.path.join(cmd_shenv.cwd, name)
+ redir_filename = to_unicode(redir_filename) \
+ if kIsWindows else to_bytes(redir_filename)
fd = open(redir_filename, mode)
# Workaround a Win32 and/or subprocess bug when appending.
#
@@ -939,6 +991,7 @@
for i,f in stderrTempFiles:
f.seek(0, 0)
procData[i] = (procData[i][0], f.read())
+ f.close()
exitCode = None
for i,(out,err) in enumerate(procData):
@@ -1066,7 +1119,7 @@
codeStr = str(result.exitCode)
out += "error: command failed with exit status: %s\n" % (
codeStr,)
- if litConfig.maxIndividualTestTime > 0:
+ if litConfig.maxIndividualTestTime > 0 and result.timeoutReached:
out += 'error: command reached timeout: %s\n' % (
str(result.timeoutReached),)
@@ -1081,9 +1134,12 @@
# Write script file
mode = 'w'
+ open_kwargs = {}
if litConfig.isWindows and not isWin32CMDEXE:
- mode += 'b' # Avoid CRLFs when writing bash scripts.
- f = open(script, mode)
+ mode += 'b' # Avoid CRLFs when writing bash scripts.
+ elif sys.version_info > (3,0):
+ open_kwargs['encoding'] = 'utf-8'
+ f = open(script, mode, **open_kwargs)
if isWin32CMDEXE:
for i, ln in enumerate(commands):
commands[i] = re.sub(kPdbgRegex, "echo '\\1' > nul && ", ln)
@@ -1096,11 +1152,14 @@
for i, ln in enumerate(commands):
commands[i] = re.sub(kPdbgRegex, ": '\\1'; ", ln)
if test.config.pipefail:
- f.write('set -o pipefail;')
+ f.write(b'set -o pipefail;' if mode == 'wb' else 'set -o pipefail;')
if litConfig.echo_all_commands:
- f.write('set -x;')
- f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')
- f.write('\n')
+ f.write(b'set -x;' if mode == 'wb' else 'set -x;')
+ if sys.version_info > (3,0) and mode == 'wb':
+ f.write(bytes('{ ' + '; } &&\n{ '.join(commands) + '; }', 'utf-8'))
+ else:
+ f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')
+ f.write(b'\n' if mode == 'wb' else '\n')
f.close()
if isWin32CMDEXE:
@@ -1365,14 +1424,14 @@
# Trim trailing whitespace.
line = line.rstrip()
# Substitute line number expressions
- line = re.sub('%\(line\)', str(line_number), line)
+ line = re.sub(r'%\(line\)', str(line_number), line)
def replace_line_number(match):
if match.group(1) == '+':
return str(line_number + int(match.group(2)))
if match.group(1) == '-':
return str(line_number - int(match.group(2)))
- line = re.sub('%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
+ line = re.sub(r'%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
# Collapse lines with trailing '\\'.
if output and output[-1][-1] == '\\':
output[-1] = output[-1][:-1] + line
@@ -1401,13 +1460,17 @@
@staticmethod
def _handleBooleanExpr(line_number, line, output):
"""A parser for BOOLEAN_EXPR type keywords"""
+ parts = [s.strip() for s in line.split(',') if s.strip() != '']
+ if output and output[-1][-1] == '\\':
+ output[-1] = output[-1][:-1] + parts[0]
+ del parts[0]
if output is None:
output = []
- output.extend([s.strip() for s in line.split(',')])
+ output.extend(parts)
# Evaluate each expression to verify syntax.
# We don't want any results, just the raised ValueError.
for s in output:
- if s != '*':
+ if s != '*' and not s.endswith('\\'):
BooleanExpression.evaluate(s, [])
return output
@@ -1486,6 +1549,15 @@
return lit.Test.Result(Test.UNRESOLVED,
"Test has unterminated run lines (with '\\')")
+ # Check boolean expressions for unterminated lines.
+ for key in keyword_parsers:
+ kp = keyword_parsers[key]
+ if kp.kind != ParserKind.BOOLEAN_EXPR:
+ continue
+ value = kp.getValue()
+ if value and value[-1][-1] == '\\':
+ raise ValueError("Test has unterminated %s lines (with '\\')" % key)
+
# Enforce REQUIRES:
missing_required_features = test.getMissingRequiredFeatures()
if missing_required_features:
diff --git a/src/llvm-project/llvm/utils/lit/lit/TestingConfig.py b/src/llvm-project/llvm/utils/lit/lit/TestingConfig.py
index 8060688..738aafe 100644
--- a/src/llvm-project/llvm/utils/lit/lit/TestingConfig.py
+++ b/src/llvm-project/llvm/utils/lit/lit/TestingConfig.py
@@ -106,7 +106,7 @@
environment, substitutions, unsupported,
test_exec_root, test_source_root, excludes,
available_features, pipefail, limit_to_features = [],
- is_early = False, parallelism_group = ""):
+ is_early = False, parallelism_group = None):
self.parent = parent
self.name = str(name)
self.suffixes = set(suffixes)
diff --git a/src/llvm-project/llvm/utils/lit/lit/__init__.py b/src/llvm-project/llvm/utils/lit/lit/__init__.py
index 0d849d1..8c4586c 100644
--- a/src/llvm-project/llvm/utils/lit/lit/__init__.py
+++ b/src/llvm-project/llvm/utils/lit/lit/__init__.py
@@ -2,7 +2,7 @@
__author__ = 'Daniel Dunbar'
__email__ = '[email protected]'
-__versioninfo__ = (0, 8, 0)
+__versioninfo__ = (0, 9, 0)
__version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev'
__all__ = []
diff --git a/src/llvm-project/llvm/utils/lit/lit/discovery.py b/src/llvm-project/llvm/utils/lit/lit/discovery.py
index 398b6ce..6867f5c 100644
--- a/src/llvm-project/llvm/utils/lit/lit/discovery.py
+++ b/src/llvm-project/llvm/utils/lit/lit/discovery.py
@@ -249,28 +249,3 @@
sys.exit(2)
return tests
-
-def load_test_suite(inputs):
- import platform
- import unittest
- from lit.LitTestCase import LitTestCase
-
- # Create the global config object.
- litConfig = LitConfig.LitConfig(progname = 'lit',
- path = [],
- quiet = False,
- useValgrind = False,
- valgrindLeakCheck = False,
- valgrindArgs = [],
- singleProcess=False,
- noExecute = False,
- debug = False,
- isWindows = (platform.system()=='Windows'),
- params = {})
-
- # Perform test discovery.
- run = lit.run.Run(litConfig, find_tests_for_inputs(litConfig, inputs))
-
- # Return a unittest test suite which just runs the tests in order.
- return unittest.TestSuite([LitTestCase(test, run)
- for test in run.tests])
diff --git a/src/llvm-project/llvm/utils/lit/lit/llvm/config.py b/src/llvm-project/llvm/utils/lit/lit/llvm/config.py
index c7846bb..6a0bfa1 100644
--- a/src/llvm-project/llvm/utils/lit/lit/llvm/config.py
+++ b/src/llvm-project/llvm/utils/lit/lit/llvm/config.py
@@ -9,10 +9,6 @@
from lit.llvm.subst import ToolSubst
-def binary_feature(on, feature, off_prefix):
- return feature if on else off_prefix + feature
-
-
class LLVMConfig(object):
def __init__(self, lit_config, config):
@@ -58,7 +54,7 @@
elif platform.system() == "Linux":
features.add('system-linux')
elif platform.system() in ['FreeBSD']:
- config.available_features.add('system-freebsd')
+ features.add('system-freebsd')
elif platform.system() == "NetBSD":
features.add('system-netbsd')
@@ -73,13 +69,16 @@
# Sanitizers.
sanitizers = getattr(config, 'llvm_use_sanitizer', '')
sanitizers = frozenset(x.lower() for x in sanitizers.split(';'))
- features.add(binary_feature('address' in sanitizers, 'asan', 'not_'))
- features.add(binary_feature('memory' in sanitizers, 'msan', 'not_'))
- features.add(binary_feature(
- 'undefined' in sanitizers, 'ubsan', 'not_'))
+ if 'address' in sanitizers:
+ features.add('asan')
+ if 'memory' in sanitizers:
+ features.add('msan')
+ if 'undefined' in sanitizers:
+ features.add('ubsan')
have_zlib = getattr(config, 'have_zlib', None)
- features.add(binary_feature(have_zlib, 'zlib', 'no'))
+ if have_zlib:
+ features.add('zlib')
# Check if we should run long running tests.
long_tests = lit_config.params.get('run_long_tests', None)
@@ -96,6 +95,10 @@
features.add('x86_64-linux')
if re.match(r'.*-windows-msvc$', target_triple):
features.add('target-windows')
+ if re.match(r'^i.86.*', target_triple):
+ features.add('target-x86')
+ elif re.match(r'^x86_64.*', target_triple):
+ features.add('target-x86_64')
use_gmalloc = lit_config.params.get('use_gmalloc', None)
if lit.util.pythonize_bool(use_gmalloc):
@@ -229,8 +232,8 @@
major_version_number = int(version_regex.group(1))
minor_version_number = int(version_regex.group(2))
patch_version_number = int(version_regex.group(3))
- if 'Apple LLVM' in version_string:
- # Apple LLVM doesn't yet support LSan
+ if ('Apple LLVM' in version_string) or ('Apple clang' in version_string):
+ # Apple clang doesn't yet support LSan
return False
else:
return major_version_number >= 5
@@ -484,11 +487,11 @@
was_found = ld_lld and lld_link and ld64_lld and wasm_ld
tool_substitutions = []
if ld_lld:
- tool_substitutions.append(ToolSubst('ld.lld', command=ld_lld))
+ tool_substitutions.append(ToolSubst('ld\.lld', command=ld_lld))
if lld_link:
tool_substitutions.append(ToolSubst('lld-link', command=lld_link))
if ld64_lld:
- tool_substitutions.append(ToolSubst('ld64.lld', command=ld64_lld))
+ tool_substitutions.append(ToolSubst('ld64\.lld', command=ld64_lld))
if wasm_ld:
tool_substitutions.append(ToolSubst('wasm-ld', command=wasm_ld))
self.add_tool_substitutions(tool_substitutions)
diff --git a/src/llvm-project/llvm/utils/lit/lit/main.py b/src/llvm-project/llvm/utils/lit/lit/main.py
index 807360a..49aaf63 100755
--- a/src/llvm-project/llvm/utils/lit/lit/main.py
+++ b/src/llvm-project/llvm/utils/lit/lit/main.py
@@ -11,6 +11,7 @@
import platform
import random
import re
+import shlex
import sys
import time
import argparse
@@ -321,12 +322,9 @@
debug_group.add_argument("--show-tests", dest="showTests",
help="Show all discovered tests",
action="store_true", default=False)
- debug_group.add_argument("--single-process", dest="singleProcess",
- help="Don't run tests in parallel. Intended for debugging "
- "single test failures",
- action="store_true", default=False)
- opts = parser.parse_args()
+ opts = parser.parse_args(sys.argv[1:] +
+ shlex.split(os.environ.get("LIT_OPTS", "")))
args = opts.test_paths
if opts.show_version:
@@ -338,9 +336,11 @@
if opts.numThreads is None:
opts.numThreads = lit.util.detectCPUs()
+ elif opts.numThreads <= 0:
+ parser.error("Option '--threads' or '-j' requires positive integer")
- if opts.maxFailures == 0:
- parser.error("Setting --max-failures to 0 does not have any effect.")
+ if opts.maxFailures is not None and opts.maxFailures <= 0:
+ parser.error("Option '--max-failures' requires positive integer")
if opts.echoAllCommands:
opts.showOutput = True
@@ -374,7 +374,6 @@
valgrindLeakCheck = opts.valgrindLeakCheck,
valgrindArgs = opts.valgrindArgs,
noExecute = opts.noExecute,
- singleProcess = opts.singleProcess,
debug = opts.debug,
isWindows = isWindows,
params = userParams,
@@ -506,11 +505,9 @@
except:
pass
- extra = ''
- if len(run.tests) != numTotalTests:
- extra = ' of %d' % numTotalTests
- header = '-- Testing: %d%s tests, %d threads --'%(len(run.tests), extra,
- opts.numThreads)
+ extra = (' of %d' % numTotalTests) if (len(run.tests) != numTotalTests) else ''
+ threads = 'single process' if (opts.numThreads == 1) else ('%d threads' % opts.numThreads)
+ header = '-- Testing: %d%s tests, %s --' % (len(run.tests), extra, threads)
progressBar = None
if not opts.quiet:
if opts.succinct and opts.useProgressBar:
diff --git a/src/llvm-project/llvm/utils/lit/lit/run.py b/src/llvm-project/llvm/utils/lit/lit/run.py
index c4f9eb2..18e754a 100644
--- a/src/llvm-project/llvm/utils/lit/lit/run.py
+++ b/src/llvm-project/llvm/utils/lit/lit/run.py
@@ -1,28 +1,9 @@
-import os
-import sys
-import threading
-import time
-import traceback
-try:
- import Queue as queue
-except ImportError:
- import queue
-
-try:
- import win32api
-except ImportError:
- win32api = None
-
import multiprocessing
-import lit.Test
+import time
-def abort_now():
- """Abort the current process without doing any exception teardown"""
- sys.stdout.flush()
- if win32api:
- win32api.TerminateProcess(win32api.GetCurrentProcess(), 3)
- else:
- os.kill(0, 9)
+import lit.Test
+import lit.util
+import lit.worker
class _Display(object):
def __init__(self, display, provider, maxFailures):
@@ -36,6 +17,12 @@
if self.failedCount == self.maxFailures:
self.provider.cancel()
+# No-operation semaphore for supporting `None` for parallelism_groups.
+# lit_config.parallelism_groups['my_group'] = None
+class NopSemaphore(object):
+ def acquire(self): pass
+ def release(self): pass
+
class Run(object):
"""
This class represents a concrete, configured testing run.
@@ -45,15 +32,10 @@
self.lit_config = lit_config
self.tests = tests
# Set up semaphores to limit parallelism of certain classes of tests.
- # For example, some ASan tests require lots of virtual memory and run
- # faster with less parallelism on OS X.
- self.parallelism_semaphores = \
- {k: multiprocessing.Semaphore(v) for k, v in
- self.lit_config.parallelism_groups.items()}
-
- def execute_test(self, test):
- return _execute_test_impl(test, self.lit_config,
- self.parallelism_semaphores)
+ self.parallelism_semaphores = {
+ k : NopSemaphore() if v is None else
+ multiprocessing.BoundedSemaphore(v)
+ for k, v in lit_config.parallelism_groups.items()}
def execute_tests_in_pool(self, jobs, max_time):
# We need to issue many wait calls, so compute the final deadline and
@@ -67,22 +49,22 @@
# interrupts the workers before we make it into our task callback, they
# will each raise a KeyboardInterrupt exception and print to stderr at
# the same time.
- pool = multiprocessing.Pool(jobs, worker_initializer,
+ pool = multiprocessing.Pool(jobs, lit.worker.initializer,
(self.lit_config,
self.parallelism_semaphores))
# Install a console-control signal handler on Windows.
- if win32api is not None:
+ if lit.util.win32api is not None:
def console_ctrl_handler(type):
print('\nCtrl-C detected, terminating.')
pool.terminate()
pool.join()
- abort_now()
+ lit.util.abort_now()
return True
- win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
+ lit.util.win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
try:
- async_results = [pool.apply_async(worker_run_one_test,
+ async_results = [pool.apply_async(lit.worker.run_one_test,
args=(test_index, test),
callback=self.consume_test_result)
for test_index, test in enumerate(self.tests)]
@@ -133,7 +115,7 @@
be given an UNRESOLVED result.
"""
# Don't do anything if we aren't going to run any tests.
- if not self.tests or jobs == 0:
+ if not self.tests:
return
# Save the display object on the runner so that we can update it from
@@ -142,12 +124,12 @@
self.failure_count = 0
self.hit_max_failures = False
- if self.lit_config.singleProcess:
- global child_lit_config
- child_lit_config = self.lit_config
+ if jobs == 1:
for test_index, test in enumerate(self.tests):
- result = worker_run_one_test(test_index, test)
- self.consume_test_result(result)
+ lit.worker._execute_test(test, self.lit_config)
+ self.consume_test_result((test_index, test))
+ if self.hit_max_failures:
+ break
else:
self.execute_tests_in_pool(jobs, max_time)
@@ -157,7 +139,7 @@
test.setResult(lit.Test.Result(lit.Test.UNRESOLVED, '', 0.0))
def consume_test_result(self, pool_result):
- """Test completion callback for worker_run_one_test
+ """Test completion callback for lit.worker.run_one_test
Updates the test result status in the parent process. Each task in the
pool returns the test index and the result, and we use the index to look
@@ -184,74 +166,3 @@
if self.lit_config.maxFailures and \
self.failure_count == self.lit_config.maxFailures:
self.hit_max_failures = True
-
-def _execute_test_impl(test, lit_config, parallelism_semaphores):
- """Execute one test"""
- pg = test.config.parallelism_group
- if callable(pg):
- pg = pg(test)
-
- result = None
- semaphore = None
- try:
- if pg:
- semaphore = parallelism_semaphores[pg]
- if semaphore:
- semaphore.acquire()
- start_time = time.time()
- result = test.config.test_format.execute(test, lit_config)
- # Support deprecated result from execute() which returned the result
- # code and additional output as a tuple.
- if isinstance(result, tuple):
- code, output = result
- result = lit.Test.Result(code, output)
- elif not isinstance(result, lit.Test.Result):
- raise ValueError("unexpected result from test execution")
- result.elapsed = time.time() - start_time
- except KeyboardInterrupt:
- raise
- except:
- if lit_config.debug:
- raise
- output = 'Exception during script execution:\n'
- output += traceback.format_exc()
- output += '\n'
- result = lit.Test.Result(lit.Test.UNRESOLVED, output)
- finally:
- if semaphore:
- semaphore.release()
-
- test.setResult(result)
-
-child_lit_config = None
-child_parallelism_semaphores = None
-
-def worker_initializer(lit_config, parallelism_semaphores):
- """Copy expensive repeated data into worker processes"""
- global child_lit_config
- child_lit_config = lit_config
- global child_parallelism_semaphores
- child_parallelism_semaphores = parallelism_semaphores
-
-def worker_run_one_test(test_index, test):
- """Run one test in a multiprocessing.Pool
-
- Side effects in this function and functions it calls are not visible in the
- main lit process.
-
- Arguments and results of this function are pickled, so they should be cheap
- to copy. For efficiency, we copy all data needed to execute all tests into
- each worker and store it in the child_* global variables. This reduces the
- cost of each task.
-
- Returns an index and a Result, which the parent process uses to update
- the display.
- """
- try:
- _execute_test_impl(test, child_lit_config, child_parallelism_semaphores)
- return (test_index, test)
- except KeyboardInterrupt as e:
- # If a worker process gets an interrupt, abort it immediately.
- abort_now()
- except:
- traceback.print_exc()
diff --git a/src/llvm-project/llvm/utils/lit/lit/util.py b/src/llvm-project/llvm/utils/lit/lit/util.py
index 4c116b3d..2a61ef7 100644
--- a/src/llvm-project/llvm/utils/lit/lit/util.py
+++ b/src/llvm-project/llvm/utils/lit/lit/util.py
@@ -102,6 +102,20 @@
raise TypeError('not sure how to convert %s to %s' % (type(b), str))
+def to_unicode(s):
+ """Return the parameter as type which supports unicode, possibly decoding
+ it.
+
+ In Python2, this is the unicode type. In Python3 it's the str type.
+
+ """
+ if isinstance(s, bytes):
+ # In Python2, this branch is taken for both 'str' and 'bytes'.
+ # In Python3, this branch is taken only for 'bytes'.
+ return s.decode('utf-8')
+ return s
+
+
def detectCPUs():
"""Detects the number of CPUs on a system.
@@ -128,6 +142,25 @@
return 1 # Default
+def mkdir(path):
+ try:
+ if platform.system() == 'Windows':
+ from ctypes import windll
+ from ctypes import GetLastError, WinError
+
+ path = os.path.abspath(path)
+ NTPath = to_unicode(r'\\?\%s' % path)
+ if not windll.kernel32.CreateDirectoryW(NTPath, None):
+ raise WinError(GetLastError())
+ else:
+ os.mkdir(path)
+ except OSError:
+ e = sys.exc_info()[1]
+ # ignore EEXIST, which may occur during a race condition
+ if e.errno != errno.EEXIST:
+ raise
+
+
def mkdir_p(path):
"""mkdir_p(path) - Make the "path" directory, if it does not exist; this
will also make directories for any missing parent directories."""
@@ -138,13 +171,7 @@
if parent != path:
mkdir_p(parent)
- try:
- os.mkdir(path)
- except OSError:
- e = sys.exc_info()[1]
- # Ignore EEXIST, which may occur during a race condition.
- if e.errno != errno.EEXIST:
- raise
+ mkdir(path)
def listdir_files(dirname, suffixes=None, exclude_filenames=None):
@@ -197,7 +224,7 @@
# Check for absolute match first.
if os.path.isabs(command) and os.path.isfile(command):
- return os.path.normpath(command)
+ return os.path.normcase(os.path.normpath(command))
# Would be nice if Python had a lib function for this.
if not paths:
@@ -215,7 +242,7 @@
for ext in pathext:
p = os.path.join(path, command + ext)
if os.path.exists(p) and not os.path.isdir(p):
- return os.path.normpath(p)
+ return os.path.normcase(os.path.normpath(p))
return None
@@ -377,7 +404,7 @@
except OSError:
res = -1
if res == 0 and out:
- sdk_path = out
+ sdk_path = out.decode()
lit_config.note('using SDKROOT: %r' % sdk_path)
config.environment['SDKROOT'] = sdk_path
@@ -393,7 +420,7 @@
except OSError:
res = -1
if res == 0 and out:
- return out
+ return out.decode()
return None
@@ -424,3 +451,17 @@
psutilProc.kill()
except psutil.NoSuchProcess:
pass
+
+
+try:
+ import win32api
+except ImportError:
+ win32api = None
+
+def abort_now():
+ """Abort the current process without doing any exception teardown"""
+ sys.stdout.flush()
+ if win32api:
+ win32api.TerminateProcess(win32api.GetCurrentProcess(), 3)
+ else:
+ os.kill(0, 9)
diff --git a/src/llvm-project/llvm/utils/lit/lit/worker.py b/src/llvm-project/llvm/utils/lit/lit/worker.py
new file mode 100644
index 0000000..f97b6a0
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/lit/worker.py
@@ -0,0 +1,82 @@
+# The functions in this module are meant to run on a separate worker process.
+# Exception: in single process mode _execute_test is called directly.
+import time
+import traceback
+
+import lit.Test
+import lit.util
+
+_lit_config = None
+_parallelism_semaphores = None
+
+def initializer(lit_config, parallelism_semaphores):
+ """Copy expensive repeated data into worker processes"""
+ global _lit_config
+ global _parallelism_semaphores
+ _lit_config = lit_config
+ _parallelism_semaphores = parallelism_semaphores
+
+def run_one_test(test_index, test):
+ """Run one test in a multiprocessing.Pool
+
+ Side effects in this function and functions it calls are not visible in the
+ main lit process.
+
+ Arguments and results of this function are pickled, so they should be cheap
+ to copy. For efficiency, we copy all data needed to execute all tests into
+ each worker and store it in the worker_* global variables. This reduces the
+ cost of each task.
+
+ Returns an index and a Result, which the parent process uses to update
+ the display.
+ """
+ try:
+ _execute_test_in_parallelism_group(test, _lit_config,
+ _parallelism_semaphores)
+ return (test_index, test)
+ except KeyboardInterrupt:
+ # If a worker process gets an interrupt, abort it immediately.
+ lit.util.abort_now()
+ except:
+ traceback.print_exc()
+
+def _execute_test_in_parallelism_group(test, lit_config, parallelism_semaphores):
+ """Execute one test inside the appropriate parallelism group"""
+ pg = test.config.parallelism_group
+ if callable(pg):
+ pg = pg(test)
+
+ if pg:
+ semaphore = parallelism_semaphores[pg]
+ try:
+ semaphore.acquire()
+ _execute_test(test, lit_config)
+ finally:
+ semaphore.release()
+ else:
+ _execute_test(test, lit_config)
+
+def _execute_test(test, lit_config):
+ """Execute one test"""
+ try:
+ start_time = time.time()
+ result = test.config.test_format.execute(test, lit_config)
+ # Support deprecated result from execute() which returned the result
+ # code and additional output as a tuple.
+ if isinstance(result, tuple):
+ code, output = result
+ result = lit.Test.Result(code, output)
+ elif not isinstance(result, lit.Test.Result):
+ raise ValueError("unexpected result from test execution")
+ result.elapsed = time.time() - start_time
+ except KeyboardInterrupt:
+ raise
+ except:
+ if lit_config.debug:
+ raise
+ output = 'Exception during script execution:\n'
+ output += traceback.format_exc()
+ output += '\n'
+ result = lit.Test.Result(lit.Test.UNRESOLVED, output)
+
+ test.setResult(result)
diff --git a/src/llvm-project/llvm/utils/lit/setup.py b/src/llvm-project/llvm/utils/lit/setup.py
index 10de6bb..9d26b2e 100644
--- a/src/llvm-project/llvm/utils/lit/setup.py
+++ b/src/llvm-project/llvm/utils/lit/setup.py
@@ -16,7 +16,7 @@
author = lit.__author__,
author_email = lit.__email__,
url = 'http://llvm.org',
- license = 'BSD',
+ license = 'Apache-2.0 with LLVM exception',
description = "A Software Testing Tool",
keywords = 'test C++ automatic discovery',
@@ -52,15 +52,15 @@
Source
======
-The *lit* source is available as part of LLVM, in the LLVM SVN repository:
-http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit.
+The *lit* source is available as part of LLVM, in the LLVM source repository:
+https://github.com/llvm/llvm-project/tree/master/llvm/utils/lit
""",
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
- 'License :: OSI Approved :: University of Illinois/NCSA Open Source License',
+ 'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg b/src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/lit.cfg
similarity index 60%
rename from src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg
rename to src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/lit.cfg
index 9e08a86..d8dccdb 100644
--- a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/lit.cfg
@@ -1,6 +1,7 @@
import lit.formats
-config.name = 'unittest-adaptor'
+config.name = 'lit-opts'
config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()
config.test_source_root = None
config.test_exec_root = None
+config.substitutions.append(('%var', lit_config.params.get('var', '')))
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/test.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/test.txt
new file mode 100644
index 0000000..0ddee88
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/lit-opts/test.txt
@@ -0,0 +1 @@
+# RUN: echo %var
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/lit.cfg b/src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/lit.cfg
new file mode 100644
index 0000000..ffc41b1
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/lit.cfg
@@ -0,0 +1,11 @@
+import lit.formats
+config.name = 'parallelism-groups'
+config.suffixes = ['.txt']
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None
+
+# Should not crash
+lit_config.parallelism_groups['my_group'] = None
+
+config.parallelism_group = 'my_group'
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/test1.txt
similarity index 100%
rename from src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt
rename to src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/test1.txt
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/test2.txt
similarity index 100%
copy from src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt
copy to src/llvm-project/llvm/utils/lit/tests/Inputs/parallelism-groups/test2.txt
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/progress-bar/lit.cfg b/src/llvm-project/llvm/utils/lit/tests/Inputs/progress-bar/lit.cfg
index 7f31129..17488a2 100644
--- a/src/llvm-project/llvm/utils/lit/tests/Inputs/progress-bar/lit.cfg
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/progress-bar/lit.cfg
@@ -1,5 +1,5 @@
import lit.formats
-config.name = 'shtest-shell'
+config.name = 'progress-bar'
config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()
config.test_source_root = None
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt
new file mode 100644
index 0000000..cec0b38
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-format/external_shell/utf8_command.txt
@@ -0,0 +1,3 @@
+# Run a command including UTF-8 characters.
+#
+# RUN: echo £
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
index 4899c7e..fb3a3e0 100644
--- a/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
@@ -1,3 +1,3 @@
# RUN: true
# RUN: echo hi
-# RUN: wc missing-file &> %t.out
+# RUN: not not wc missing-file &> %t.out
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-shell/rm-unicode-0.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-shell/rm-unicode-0.txt
new file mode 100644
index 0000000..e34c96c
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/shtest-shell/rm-unicode-0.txt
@@ -0,0 +1,7 @@
+# Check removing unicode
+#
+# RUN: mkdir -p Output/ä¸æ–‡
+# RUN: echo "" > Output/ä¸æ–‡/ä½ å¥½.txt
+# RUN: rm Output/ä¸æ–‡/ä½ å¥½.txt
+# RUN: echo "" > Output/ä¸æ–‡/ä½ å¥½.txt
+# RUN: rm -r Output/ä¸æ–‡
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt
index ed118f3..e280603 100644
--- a/src/llvm-project/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt
+++ b/src/llvm-project/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt
@@ -9,5 +9,11 @@
//
// MY_CUSTOM: a b c
//
+// MY_BOOL: a && (\
+// MY_BOOL: b)
+// MY_BOOL: d
+//
+// MY_BOOL_UNTERMINATED: a \
+//
// END.
// MY_LIST: five
diff --git a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt b/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt
deleted file mode 100644
index 49932c3..0000000
--- a/src/llvm-project/llvm/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt
+++ /dev/null
@@ -1 +0,0 @@
-# RUN: false
diff --git a/src/llvm-project/llvm/utils/lit/tests/discovery.py b/src/llvm-project/llvm/utils/lit/tests/discovery.py
index dbabeb3..9f09470 100644
--- a/src/llvm-project/llvm/utils/lit/tests/discovery.py
+++ b/src/llvm-project/llvm/utils/lit/tests/discovery.py
@@ -29,7 +29,7 @@
# RUN: %{python} %{inputs}/config-map-discovery/driver.py \
# RUN: %{inputs}/config-map-discovery/main-config/lit.cfg \
# RUN: %{inputs}/config-map-discovery/lit.alt.cfg \
-# RUN: --single-process --debug --show-tests --show-suites > %t.out 2> %t.err
+# RUN: --threads=1 --debug --show-tests --show-suites > %t.out 2> %t.err
# RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-OUT < %t.out %s
# RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-ERR < %t.err %s
diff --git a/src/llvm-project/llvm/utils/lit/tests/lit-opts.py b/src/llvm-project/llvm/utils/lit/tests/lit-opts.py
new file mode 100644
index 0000000..4c068dd
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/lit-opts.py
@@ -0,0 +1,33 @@
+# Check cases where LIT_OPTS has no effect.
+#
+# RUN: %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s
+# RUN: env LIT_OPTS= %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s
+# RUN: env LIT_OPTS=-s %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s
+
+# Check that LIT_OPTS can override command-line options.
+#
+# RUN: env LIT_OPTS=-a \
+# RUN: %{lit} -j 1 -s %{inputs}/lit-opts \
+# RUN: | FileCheck -check-prefix=SHOW-ALL -DVAR= %s
+
+# Check that LIT_OPTS understands multiple options with arbitrary spacing.
+#
+# RUN: env LIT_OPTS='-a -v -Dvar=foobar' \
+# RUN: %{lit} -j 1 -s %{inputs}/lit-opts \
+# RUN: | FileCheck -check-prefix=SHOW-ALL -DVAR=foobar %s
+
+# Check that LIT_OPTS parses shell-like quotes and escapes.
+#
+# RUN: env LIT_OPTS='-a -v -Dvar="foo bar"\ baz' \
+# RUN: %{lit} -j 1 -s %{inputs}/lit-opts \
+# RUN: | FileCheck -check-prefix=SHOW-ALL -DVAR="foo bar baz" %s
+
+# CHECK: Testing: 1 tests
+# CHECK-NOT: PASS
+# CHECK: Expected Passes : 1
+
+# SHOW-ALL: Testing: 1 tests
+# SHOW-ALL: PASS: lit-opts :: test.txt (1 of 1)
+# SHOW-ALL: {{^}}[[VAR]]
+# SHOW-ALL-NOT: PASS
+# SHOW-ALL: Expected Passes : 1
diff --git a/src/llvm-project/llvm/utils/lit/tests/lit.cfg b/src/llvm-project/llvm/utils/lit/tests/lit.cfg
index 2af93d6..5667032 100644
--- a/src/llvm-project/llvm/utils/lit/tests/lit.cfg
+++ b/src/llvm-project/llvm/utils/lit/tests/lit.cfg
@@ -4,6 +4,7 @@
import sys
import lit.formats
+from lit.llvm import llvm_config
# Configuration file for the 'lit' test runner.
@@ -25,42 +26,39 @@
config.target_triple = '(unused)'
-src_root = os.path.join(config.test_source_root, '..')
llvm_src_root = getattr(config, 'llvm_src_root', None)
-if llvm_src_root != None:
- # ``src_root`` may be in LLVM's binary build directory which does not contain
+if llvm_src_root:
+ # ``test_source_root`` may be in LLVM's binary build directory which does not contain
# ``lit.py``, so use `llvm_src_root` instead.
lit_path = os.path.join(llvm_src_root, 'utils', 'lit')
else:
- lit_path = src_root
+ lit_path = os.path.join(config.test_source_root, '..')
-pythonpath_list = [lit_path] # Required because some tests import the lit module
+# Required because some tests import the lit module
+if llvm_config:
+ llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
+else:
+ config.environment['PYTHONPATH'] = os.pathsep.join([lit_path])
-# Ensure the user's PYTHONPATH is included.
-if 'PYTHONPATH' in os.environ:
- pythonpath_list.append(os.environ['PYTHONPATH'])
-if 'PYTHONPATH' in config.environment:
- pythonpath_list.append(config.environment['PYTHONPATH'])
-config.environment['PYTHONPATH'] = os.pathsep.join(pythonpath_list)
+# Add llvm and lit tools directories if this config is being loaded indirectly.
+# In this case, we can also expect llvm_config to have been imported correctly.
+for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
+ directory = getattr(config, attribute, None)
+ if directory:
+ llvm_config.with_environment('PATH', directory, append_path=True)
-config.substitutions.append(('%{src_root}', src_root))
config.substitutions.append(('%{inputs}', os.path.join(
- src_root, 'tests', 'Inputs')))
+ config.test_source_root, 'Inputs')))
config.substitutions.append(('%{lit}', "%%{python} %s" % (
- os.path.join(lit_path, 'lit.py'),)))
+ os.path.join(lit_path, 'lit.py'),)))
config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
-
# Enable coverage.py reporting, assuming the coverage module has been installed
# and sitecustomize.py in the virtualenv has been modified appropriately.
if lit_config.params.get('check-coverage', None):
config.environment['COVERAGE_PROCESS_START'] = os.path.join(
os.path.dirname(__file__), ".coveragerc")
-# Add a feature to detect the Python version.
-config.available_features.add("python%d.%d" % (sys.version_info[0],
- sys.version_info[1]))
-
# Add a feature to detect if psutil is available
try:
import psutil
@@ -70,13 +68,9 @@
lit_config.warning('Could not import psutil. Some tests will be skipped and'
' the --timeout command line argument will not work.')
-if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
- config.available_features.add('windows')
-
-# Add llvm and lit tools directories if this config is being loaded indirectly.
-path = config.environment['PATH']
-for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
- directory = getattr(config, attribute, None)
- if directory:
- path = os.path.pathsep.join((directory, path))
-config.environment['PATH'] = path
+# When running the lit tests standalone, we want to define the same features
+# that the llvm_config defines. This means that the 'system-windows' feature
+# (and any others) need to match the names in llvm_config for consistency
+if not llvm_config:
+ if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
+ config.available_features.add('system-windows')
diff --git a/src/llvm-project/llvm/utils/lit/tests/lit.site.cfg.in b/src/llvm-project/llvm/utils/lit/tests/lit.site.cfg.in
index 693364c..43f4e40 100644
--- a/src/llvm-project/llvm/utils/lit/tests/lit.site.cfg.in
+++ b/src/llvm-project/llvm/utils/lit/tests/lit.site.cfg.in
@@ -16,5 +16,8 @@
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+import lit.llvm
+lit.llvm.initialize(lit_config, config)
+
# Let the main config do the real work.
lit_config.load_config(config, "@LLVM_BINARY_DIR@/utils/lit/tests/lit.cfg")
diff --git a/src/llvm-project/llvm/utils/lit/tests/max-failures.py b/src/llvm-project/llvm/utils/lit/tests/max-failures.py
index ca107bc..f37f73d 100644
--- a/src/llvm-project/llvm/utils/lit/tests/max-failures.py
+++ b/src/llvm-project/llvm/utils/lit/tests/max-failures.py
@@ -11,4 +11,4 @@
# CHECK: Failing Tests (27)
# CHECK: Failing Tests (1)
# CHECK: Failing Tests (2)
-# CHECK: error: Setting --max-failures to 0 does not have any effect.
+# CHECK: error: Option '--max-failures' requires positive integer
diff --git a/src/llvm-project/llvm/utils/lit/tests/parallelism-groups.py b/src/llvm-project/llvm/utils/lit/tests/parallelism-groups.py
new file mode 100644
index 0000000..c6427be
--- /dev/null
+++ b/src/llvm-project/llvm/utils/lit/tests/parallelism-groups.py
@@ -0,0 +1,21 @@
+# Check that we do not crash if a parallelism group is set to None. Permits
+# usage of the following pattern.
+#
+# [lit.common.cfg]
+# lit_config.parallelism_groups['my_group'] = None
+# if <condition>:
+# lit_config.parallelism_groups['my_group'] = 3
+#
+# [project/lit.cfg]
+# config.parallelism_group = 'my_group'
+#
+# Note: We need at least 2 tests to prevent lit from using "single process
+# mode", which ignores parallelism groups.
+#
+
+# RUN: %{lit} -j2 %{inputs}/parallelism-groups | FileCheck %s
+
+# CHECK: -- Testing: 2 tests, 2 threads --
+# CHECK-DAG: PASS: parallelism-groups :: test1.txt
+# CHECK-DAG: PASS: parallelism-groups :: test2.txt
+# CHECK: Expected Passes : 2
diff --git a/src/llvm-project/llvm/utils/lit/tests/progress-bar.py b/src/llvm-project/llvm/utils/lit/tests/progress-bar.py
index d046748..e9429d9 100644
--- a/src/llvm-project/llvm/utils/lit/tests/progress-bar.py
+++ b/src/llvm-project/llvm/utils/lit/tests/progress-bar.py
@@ -4,10 +4,10 @@
# RUN: FileCheck < %t.out %s
#
# CHECK: Testing: 0 .. 10.. 20
-# CHECK: FAIL: shtest-shell :: test-1.txt (1 of 4)
+# CHECK: FAIL: progress-bar :: test-1.txt (1 of 4)
# CHECK: Testing: 0 .. 10.. 20.. 30.. 40..
-# CHECK: FAIL: shtest-shell :: test-2.txt (2 of 4)
+# CHECK: FAIL: progress-bar :: test-2.txt (2 of 4)
# CHECK: Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70
-# CHECK: FAIL: shtest-shell :: test-3.txt (3 of 4)
+# CHECK: FAIL: progress-bar :: test-3.txt (3 of 4)
# CHECK: Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
-# CHECK: FAIL: shtest-shell :: test-4.txt (4 of 4)
+# CHECK: FAIL: progress-bar :: test-4.txt (4 of 4)
diff --git a/src/llvm-project/llvm/utils/lit/tests/shtest-format.py b/src/llvm-project/llvm/utils/lit/tests/shtest-format.py
index 8c31869..4f628dc 100644
--- a/src/llvm-project/llvm/utils/lit/tests/shtest-format.py
+++ b/src/llvm-project/llvm/utils/lit/tests/shtest-format.py
@@ -18,7 +18,7 @@
# CHECK-NEXT: line 2: failed test output on stdout
# CHECK: Command Output (stderr):
# CHECK-NEXT: --
-# CHECK-NEXT: cat{{(\.exe)?}}: does-not-exist: No such file or directory
+# CHECK-NEXT: cat{{(\.exe)?}}: {{cannot open does-not-exist|does-not-exist: No such file or directory}}
# CHECK: --
# CHECK: FAIL: shtest-format :: external_shell/fail_with_bad_encoding.txt
@@ -80,7 +80,7 @@
# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
# CHECK: shtest-format :: fail.txt
-# CHECK: Expected Passes : 7
+# CHECK: Expected Passes : 8
# CHECK: Expected Failures : 4
# CHECK: Unsupported Tests : 5
# CHECK: Unresolved Tests : 3
@@ -90,7 +90,7 @@
# XUNIT: <?xml version="1.0" encoding="UTF-8" ?>
# XUNIT-NEXT: <testsuites>
-# XUNIT-NEXT: <testsuite name="shtest-format" tests="23" failures="7" skipped="5">
+# XUNIT-NEXT: <testsuite name="shtest-format" tests="24" failures="7" skipped="5">
# XUNIT: <testcase classname="shtest-format.shtest-format" name="argv0.txt" time="{{[0-9]+\.[0-9]+}}"/>
diff --git a/src/llvm-project/llvm/utils/lit/tests/shtest-output-printing.py b/src/llvm-project/llvm/utils/lit/tests/shtest-output-printing.py
index 2344ef2..8030425 100644
--- a/src/llvm-project/llvm/utils/lit/tests/shtest-output-printing.py
+++ b/src/llvm-project/llvm/utils/lit/tests/shtest-output-printing.py
@@ -24,8 +24,8 @@
# CHECK-NEXT: hi
#
# CHECK: $ ":" "RUN: at line 3"
-# CHECK-NEXT: $ "wc" "missing-file"
+# CHECK-NEXT: $ "not" "not" "wc" "missing-file"
# CHECK-NEXT: # redirected output from '{{.*(/|\\\\)}}basic.txt.tmp.out':
-# CHECK-NEXT: missing-file{{.*}} No such file or directory
+# CHECK-NEXT: {{cannot open missing-file|missing-file.* No such file or directory}}
# CHECK: note: command had no output on stdout or stderr
# CHECK-NEXT: error: command failed with exit status: 1
diff --git a/src/llvm-project/llvm/utils/lit/tests/shtest-shell.py b/src/llvm-project/llvm/utils/lit/tests/shtest-shell.py
index ed0bdf3..f947525 100644
--- a/src/llvm-project/llvm/utils/lit/tests/shtest-shell.py
+++ b/src/llvm-project/llvm/utils/lit/tests/shtest-shell.py
@@ -96,7 +96,7 @@
# CHECK: FAIL: shtest-shell :: diff-r-error-0.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-0.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: Only in {{.*}}dir1: dir1unique
# CHECK: Only in {{.*}}dir2: dir2unique
@@ -104,7 +104,7 @@
# CHECK: FAIL: shtest-shell :: diff-r-error-1.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-1.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: *** {{.*}}dir1{{.*}}subdir{{.*}}f01
# CHECK: --- {{.*}}dir2{{.*}}subdir{{.*}}f01
@@ -114,35 +114,35 @@
# CHECK: FAIL: shtest-shell :: diff-r-error-2.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-2.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: Only in {{.*}}dir2: extrafile
# CHECK: error: command failed with exit status: 1
# CHECK: FAIL: shtest-shell :: diff-r-error-3.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-3.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: Only in {{.*}}dir1: extra_subdir
# CHECK: error: command failed with exit status: 1
# CHECK: FAIL: shtest-shell :: diff-r-error-4.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-4.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: File {{.*}}dir1{{.*}}extra_subdir is a directory while file {{.*}}dir2{{.*}}extra_subdir is a regular file
# CHECK: error: command failed with exit status: 1
# CHECK: FAIL: shtest-shell :: diff-r-error-5.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-5.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: Only in {{.*}}dir1: extra_subdir
# CHECK: error: command failed with exit status: 1
# CHECK: FAIL: shtest-shell :: diff-r-error-6.txt
# CHECK: *** TEST 'shtest-shell :: diff-r-error-6.txt' FAILED ***
-# CEHCK: $ "diff" "-r"
+# CHECK: $ "diff" "-r"
# CHECK: # command output:
# CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
# CHECK: error: command failed with exit status: 1
@@ -224,6 +224,7 @@
# CHECK: Exit Code: 1
# CHECK: ***
+# CHECK: PASS: shtest-shell :: rm-unicode-0.txt
# CHECK: PASS: shtest-shell :: sequencing-0.txt
# CHECK: XFAIL: shtest-shell :: sequencing-1.txt
# CHECK: PASS: shtest-shell :: valid-shell.txt
diff --git a/src/llvm-project/llvm/utils/lit/tests/shtest-timeout.py b/src/llvm-project/llvm/utils/lit/tests/shtest-timeout.py
index 9ed8ebe..1208e73 100644
--- a/src/llvm-project/llvm/utils/lit/tests/shtest-timeout.py
+++ b/src/llvm-project/llvm/utils/lit/tests/shtest-timeout.py
@@ -1,7 +1,7 @@
# REQUIRES: python-psutil
# llvm.org/PR33944
-# REQUIRES: nowindows
+# UNSUPPORTED: system-windows
# FIXME: This test is fragile because it relies on time which can
# be affected by system performance. In particular we are currently
diff --git a/src/llvm-project/llvm/utils/lit/tests/unit/TestRunner.py b/src/llvm-project/llvm/utils/lit/tests/unit/TestRunner.py
index 89209d8..27166cd 100644
--- a/src/llvm-project/llvm/utils/lit/tests/unit/TestRunner.py
+++ b/src/llvm-project/llvm/utils/lit/tests/unit/TestRunner.py
@@ -9,6 +9,7 @@
import tempfile
import lit
+import lit.Test as Test
from lit.TestRunner import ParserKind, IntegratedTestKeywordParser, \
parseIntegratedTestScript
@@ -28,7 +29,6 @@
quiet=False,
useValgrind=False,
valgrindLeakCheck=False,
- singleProcess=False,
valgrindArgs=[],
noExecute=False,
debug=False,
@@ -57,9 +57,11 @@
IntegratedTestKeywordParser("MY_TAG.", ParserKind.TAG),
IntegratedTestKeywordParser("MY_DNE_TAG.", ParserKind.TAG),
IntegratedTestKeywordParser("MY_LIST:", ParserKind.LIST),
+ IntegratedTestKeywordParser("MY_BOOL:", ParserKind.BOOLEAN_EXPR),
IntegratedTestKeywordParser("MY_RUN:", ParserKind.COMMAND),
IntegratedTestKeywordParser("MY_CUSTOM:", ParserKind.CUSTOM,
- custom_parse)
+ custom_parse),
+
]
@staticmethod
@@ -102,6 +104,25 @@
self.assertEqual(value[0].strip(), "%dbg(MY_RUN: at line 4) baz")
self.assertEqual(value[1].strip(), "%dbg(MY_RUN: at line 7) foo bar")
+ def test_boolean(self):
+ parsers = self.make_parsers()
+ self.parse_test(parsers)
+ bool_parser = self.get_parser(parsers, 'MY_BOOL:')
+ value = bool_parser.getValue()
+ self.assertEqual(len(value), 2) # there are only two run lines
+ self.assertEqual(value[0].strip(), "a && (b)")
+ self.assertEqual(value[1].strip(), "d")
+
+ def test_boolean_unterminated(self):
+ parsers = self.make_parsers() + \
+ [IntegratedTestKeywordParser("MY_BOOL_UNTERMINATED:", ParserKind.BOOLEAN_EXPR)]
+ try:
+ self.parse_test(parsers)
+ self.fail('expected exception')
+ except ValueError as e:
+ self.assertIn("Test has unterminated MY_BOOL_UNTERMINATED: lines", str(e))
+
+
def test_custom(self):
parsers = self.make_parsers()
self.parse_test(parsers)
diff --git a/src/llvm-project/llvm/utils/lit/tests/unittest-adaptor.py b/src/llvm-project/llvm/utils/lit/tests/unittest-adaptor.py
deleted file mode 100644
index 0848cd2..0000000
--- a/src/llvm-project/llvm/utils/lit/tests/unittest-adaptor.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Check the lit adaption to run under unittest.
-#
-# RUN: %{python} %s %{inputs}/unittest-adaptor 2> %t.err
-# RUN: FileCheck < %t.err %s
-#
-# CHECK-DAG: unittest-adaptor :: test-two.txt ... FAIL
-# CHECK-DAG: unittest-adaptor :: test-one.txt ... ok
-
-import unittest
-import sys
-
-import lit
-import lit.discovery
-
-input_path = sys.argv[1]
-unittest_suite = lit.discovery.load_test_suite([input_path])
-runner = unittest.TextTestRunner(verbosity=2)
-runner.run(unittest_suite)
diff --git a/src/llvm-project/llvm/utils/lldbDataFormatters.py b/src/llvm-project/llvm/utils/lldbDataFormatters.py
index fcb381cc..de0710a 100644
--- a/src/llvm-project/llvm/utils/lldbDataFormatters.py
+++ b/src/llvm-project/llvm/utils/lldbDataFormatters.py
@@ -18,6 +18,9 @@
debugger.HandleCommand('type summary add -w llvm '
'-F lldbDataFormatters.OptionalSummaryProvider '
'-x "^llvm::Optional<.+>$"')
+ debugger.HandleCommand('type summary add -w llvm '
+ '-F lldbDataFormatters.SmallStringSummaryProvider '
+ '-x "^llvm::SmallString<.+>$"')
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
class SmallVectorSynthProvider:
@@ -104,3 +107,11 @@
underlying_type = storage.GetType().GetTemplateArgumentType(0)
storage = storage.GetChildMemberWithName('storage')
return str(storage.Cast(underlying_type))
+
+def SmallStringSummaryProvider(valobj, internal_dict):
+ num_elements = valobj.GetNumChildren()
+ res = "\""
+ for i in range(0, num_elements):
+ res += valobj.GetChildAtIndex(i).GetValue().strip("'")
+ res += "\""
+ return res
diff --git a/src/llvm-project/llvm/utils/llvm-build/llvmbuild/main.py b/src/llvm-project/llvm/utils/llvm-build/llvmbuild/main.py
index 4533c65..99b82ad 100644
--- a/src/llvm-project/llvm/utils/llvm-build/llvmbuild/main.py
+++ b/src/llvm-project/llvm/utils/llvm-build/llvmbuild/main.py
@@ -275,10 +275,9 @@
f.write("""\
%s
;
-; The LLVM Compiler Infrastructure
-;
-; This file is distributed under the University of Illinois Open Source
-; License. See LICENSE.TXT for details.
+; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+; See https://llvm.org/LICENSE.txt for license information.
+; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
;===------------------------------------------------------------------------===;
;
@@ -360,7 +359,7 @@
root_entries = set(e[0] for e in entries)
for _,_,deps,_ in entries:
root_entries -= set(deps)
- entries.append(('all', None, root_entries, True))
+ entries.append(('all', None, sorted(root_entries), True))
entries.sort()
@@ -545,10 +544,9 @@
f.write("""\
%s
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/llvm-compilers-check b/src/llvm-project/llvm/utils/llvm-compilers-check
index 4db8426..f9bb960 100755
--- a/src/llvm-project/llvm/utils/llvm-compilers-check
+++ b/src/llvm-project/llvm/utils/llvm-compilers-check
@@ -1,10 +1,9 @@
#!/usr/bin/python3
##===- utils/llvmbuild - Build the LLVM project ----------------*-python-*-===##
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
##===----------------------------------------------------------------------===##
#
diff --git a/src/llvm-project/llvm/utils/llvmdo b/src/llvm-project/llvm/utils/llvmdo
index bcfc221..f54c752 100755
--- a/src/llvm-project/llvm/utils/llvmdo
+++ b/src/llvm-project/llvm/utils/llvmdo
@@ -1,10 +1,9 @@
#!/bin/sh
##===- utils/llvmdo - Counts Lines Of Code -------------------*- Script -*-===##
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
##===----------------------------------------------------------------------===##
#
diff --git a/src/llvm-project/llvm/utils/llvmgrep b/src/llvm-project/llvm/utils/llvmgrep
index dc15da4..28b2f95 100755
--- a/src/llvm-project/llvm/utils/llvmgrep
+++ b/src/llvm-project/llvm/utils/llvmgrep
@@ -1,10 +1,9 @@
#!/bin/sh
##===- utils/llvmgrep - Counts Lines Of Code -----------------*- Script -*-===##
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
##===----------------------------------------------------------------------===##
#
diff --git a/src/llvm-project/llvm/utils/not/not.cpp b/src/llvm-project/llvm/utils/not/not.cpp
index e35c884..f00b9c8 100644
--- a/src/llvm-project/llvm/utils/not/not.cpp
+++ b/src/llvm-project/llvm/utils/not/not.cpp
@@ -1,9 +1,8 @@
//===- not.cpp - The 'not' testing tool -----------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Usage:
diff --git a/src/llvm-project/llvm/utils/prepare-code-coverage-artifact.py b/src/llvm-project/llvm/utils/prepare-code-coverage-artifact.py
old mode 100644
new mode 100755
diff --git a/src/llvm-project/llvm/utils/release/build_llvm_package.bat b/src/llvm-project/llvm/utils/release/build_llvm_package.bat
index 6a0b19b..580708e 100755
--- a/src/llvm-project/llvm/utils/release/build_llvm_package.bat
+++ b/src/llvm-project/llvm/utils/release/build_llvm_package.bat
@@ -26,8 +26,8 @@
set revision=%1
set branch=trunk
-set package_version=8.0.0-r%revision%
-set clang_format_vs_version=8.0.0.%revision%
+set package_version=9.0.0-r%revision%
+set clang_format_vs_version=9.0.0.%revision%
set build_dir=llvm_package_%revision%
echo Branch: %branch%
@@ -52,7 +52,17 @@
REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
-set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DCMAKE_INSTALL_UCRT_LIBRARIES=ON -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% -DPACKAGE_VERSION=%package_version% -DLLDB_RELOCATABLE_PYTHON=1 -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: "
+set cmake_flags=^
+ -DCMAKE_BUILD_TYPE=Release ^
+ -DLLVM_ENABLE_ASSERTIONS=ON ^
+ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
+ -DLLVM_BUILD_LLVM_C_DYLIB=ON ^
+ -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
+ -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% ^
+ -DPACKAGE_VERSION=%package_version% ^
+ -DLLDB_RELOCATABLE_PYTHON=1 ^
+ -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe ^
+ -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: "
REM TODO: Run the "check-all" tests.
diff --git a/src/llvm-project/llvm/utils/release/export.sh b/src/llvm-project/llvm/utils/release/export.sh
index d978055..9cd64a3 100755
--- a/src/llvm-project/llvm/utils/release/export.sh
+++ b/src/llvm-project/llvm/utils/release/export.sh
@@ -1,10 +1,9 @@
#!/bin/sh
#===-- tag.sh - Tag the LLVM release candidates ----------------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/release/merge-git.sh b/src/llvm-project/llvm/utils/release/merge-git.sh
index 81d577d..33162f6 100755
--- a/src/llvm-project/llvm/utils/release/merge-git.sh
+++ b/src/llvm-project/llvm/utils/release/merge-git.sh
@@ -1,10 +1,9 @@
#!/bin/bash
#===-- merge-git.sh - Merge commit to the stable branch --------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/release/merge-request.sh b/src/llvm-project/llvm/utils/release/merge-request.sh
index 333b904..0a2bf76 100755
--- a/src/llvm-project/llvm/utils/release/merge-request.sh
+++ b/src/llvm-project/llvm/utils/release/merge-request.sh
@@ -1,10 +1,9 @@
# !/bin/bash
#===-- merge-request.sh ---------------------------------------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
@@ -101,6 +100,9 @@
7.0)
release_metabug="39106"
;;
+ 8.0)
+ release_metabug="41221"
+ ;;
*)
echo "error: invalid stable version"
exit 1
diff --git a/src/llvm-project/llvm/utils/release/merge.sh b/src/llvm-project/llvm/utils/release/merge.sh
index 698353d..ad289b6 100755
--- a/src/llvm-project/llvm/utils/release/merge.sh
+++ b/src/llvm-project/llvm/utils/release/merge.sh
@@ -1,10 +1,9 @@
#!/bin/sh
#===-- merge.sh - Test the LLVM release candidates -------------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/release/tag.sh b/src/llvm-project/llvm/utils/release/tag.sh
index 100831d..01922f4 100755
--- a/src/llvm-project/llvm/utils/release/tag.sh
+++ b/src/llvm-project/llvm/utils/release/tag.sh
@@ -1,10 +1,9 @@
#!/bin/bash
#===-- tag.sh - Tag the LLVM release candidates ----------------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
diff --git a/src/llvm-project/llvm/utils/release/test-release.sh b/src/llvm-project/llvm/utils/release/test-release.sh
index 440dee5..8f691cc 100755
--- a/src/llvm-project/llvm/utils/release/test-release.sh
+++ b/src/llvm-project/llvm/utils/release/test-release.sh
@@ -1,10 +1,9 @@
#!/usr/bin/env bash
#===-- test-release.sh - Test the LLVM release candidates ------------------===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
#
@@ -18,6 +17,7 @@
else
MAKE=make
fi
+generator="Unix Makefiles"
# Base SVN URL for the sources.
Base_url="http://llvm.org/svn/llvm-project"
@@ -58,6 +58,7 @@
echo " -test-asserts Test with asserts on. [default: no]"
echo " -no-compare-files Don't test that phase 2 and 3 files are identical."
echo " -use-gzip Use gzip instead of xz."
+ echo " -use-ninja Use ninja instead of make/gmake."
echo " -configure-flags FLAGS Extra flags to pass to the configure step."
echo " -svn-path DIR Use the specified DIR instead of a release."
echo " For example -svn-path trunk or -svn-path branches/release_37"
@@ -112,6 +113,10 @@
NumJobs="$1"
fi
;;
+ -use-ninja )
+ MAKE=ninja
+ generator=Ninja
+ ;;
-build-dir | --build-dir | -builddir | --builddir )
shift
BuildDir="$1"
@@ -278,6 +283,8 @@
check_program_exists 'objdump'
fi
+check_program_exists ${MAKE}
+
# Make sure that the URLs are valid.
function check_valid_urls() {
for proj in $projects ; do
@@ -366,12 +373,12 @@
echo "# Configuring llvm $Release-$RC $Flavor"
echo "#" env CC="$c_compiler" CXX="$cxx_compiler" \
- cmake -G "Unix Makefiles" \
+ cmake -G "$generator" \
-DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
$ExtraConfigureFlags $BuildDir/llvm.src \
2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
env CC="$c_compiler" CXX="$cxx_compiler" \
- cmake -G "Unix Makefiles" \
+ cmake -G "$generator" \
-DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
$ExtraConfigureFlags $BuildDir/llvm.src \
2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
@@ -385,16 +392,20 @@
ObjDir="$3"
DestDir="$4"
+ Verbose="VERBOSE=1"
+ if [ ${MAKE} = 'ninja' ]; then
+ Verbose="-v"
+ fi
+
cd $ObjDir
echo "# Compiling llvm $Release-$RC $Flavor"
- echo "# ${MAKE} -j $NumJobs VERBOSE=1"
- ${MAKE} -j $NumJobs VERBOSE=1 \
+ echo "# ${MAKE} -j $NumJobs $Verbose"
+ ${MAKE} -j $NumJobs $Verbose \
2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log
echo "# Installing llvm $Release-$RC $Flavor"
echo "# ${MAKE} install"
- ${MAKE} install \
- DESTDIR="${DestDir}" \
+ DESTDIR="${DestDir}" ${MAKE} install \
2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log
cd $BuildDir
}
@@ -404,8 +415,15 @@
Flavor="$2"
ObjDir="$3"
+ KeepGoing="-k"
+ if [ ${MAKE} = 'ninja' ]; then
+ # Ninja doesn't have a documented "keep-going-forever" mode, we need to
+ # set a limit on how many jobs can fail before we give up.
+ KeepGoing="-k 100"
+ fi
+
cd $ObjDir
- if ! ( ${MAKE} -j $NumJobs -k check-all \
+ if ! ( ${MAKE} -j $NumJobs $KeepGoing check-all \
2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
deferred_error $Phase $Flavor "check-all failed"
fi
@@ -413,8 +431,9 @@
if [ $do_test_suite = 'yes' ]; then
cd $TestSuiteBuildDir
env CC="$c_compiler" CXX="$cxx_compiler" \
- cmake $TestSuiteSrcDir -DTEST_SUITE_LIT=$Lit
- if ! ( ${MAKE} -j $NumJobs -k check \
+ cmake $TestSuiteSrcDir -G "$generator" -DTEST_SUITE_LIT=$Lit
+
+ if ! ( ${MAKE} -j $NumJobs $KeepGoing check \
2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
deferred_error $Phase $Flavor "test suite failed"
fi
@@ -572,11 +591,12 @@
for p2 in `find $llvmCore_phase2_objdir -name '*.o'` ; do
p3=`echo $p2 | sed -e 's,Phase2,Phase3,'`
# Substitute 'Phase2' for 'Phase3' in the Phase 2 object file in
- # case there are build paths in the debug info. On some systems,
- # sed adds a newline to the output, so pass $p3 through sed too.
+ # case there are build paths in the debug info. Do the same sub-
+ # stitution on both files in case the string occurrs naturally.
if ! cmp -s \
- <(env LC_CTYPE=C sed -e 's,Phase2,Phase3,g' -e 's,Phase1,Phase2,g' $p2) \
- <(env LC_CTYPE=C sed -e '' $p3) 16 16; then
+ <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p2) \
+ <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p3) \
+ 16 16; then
echo "file `basename $p2` differs between phase 2 and phase 3"
fi
done
diff --git a/src/llvm-project/llvm/utils/unittest/CMakeLists.txt b/src/llvm-project/llvm/utils/unittest/CMakeLists.txt
index 5b5cbf5..0850d49 100644
--- a/src/llvm-project/llvm/utils/unittest/CMakeLists.txt
+++ b/src/llvm-project/llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
add_definitions(-DGTEST_OS_WINDOWS=1)
endif()
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+ remove_definitions("-D_XOPEN_SOURCE=700")
+ add_definitions("-D_ALL_SOURCE")
+endif()
+
if(SUPPORTS_VARIADIC_MACROS_FLAG)
add_definitions("-Wno-variadic-macros")
endif()
diff --git a/src/llvm-project/llvm/utils/unittest/LLVMBuild.txt b/src/llvm-project/llvm/utils/unittest/LLVMBuild.txt
index c276dd6..a91a7f0 100644
--- a/src/llvm-project/llvm/utils/unittest/LLVMBuild.txt
+++ b/src/llvm-project/llvm/utils/unittest/LLVMBuild.txt
@@ -1,9 +1,8 @@
;===- ./utils/unittest/LLVMBuild.txt ---------------------------*- Conf -*--===;
;
-; The LLVM Compiler Infrastructure
-;
-; This file is distributed under the University of Illinois Open Source
-; License. See LICENSE.TXT for details.
+; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+; See https://llvm.org/LICENSE.txt for license information.
+; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
;===------------------------------------------------------------------------===;
;
diff --git a/src/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp b/src/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp
index 5660b44..1be819f 100644
--- a/src/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp
+++ b/src/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp
@@ -1,9 +1,8 @@
//===--- utils/unittest/UnitTestMain/TestMain.cpp - unittest driver -------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/src/llvm-project/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h b/src/llvm-project/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h
index fd993db..a9837c5 100644
--- a/src/llvm-project/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h
+++ b/src/llvm-project/llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h
@@ -1,9 +1,8 @@
//===-- raw-ostream.h - Support for printing using raw_ostream --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// This file is not part of gtest, but extends it to support LLVM libraries.
@@ -42,8 +41,9 @@
// If raw_ostream support is enabled, we specialize for types with operator<<
// that takes a raw_ostream.
#if !GTEST_NO_LLVM_RAW_OSTREAM
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/Support/raw_os_ostream.h"
+#include "llvm/Support/raw_ostream.h"
#include <ostream>
namespace llvm_gtest {
@@ -68,6 +68,18 @@
<< ConvertibleTo<const T &>()))> {
static const RawStreamProxy<T> printable(const T &V) { return {V}; }
};
+
+// llvm::Optional has a template operator<<, which means it will not accept any
+// implicit conversions, so we need to special-case it here.
+template <typename T>
+struct StreamSwitch<llvm::Optional<T>,
+ decltype((void)(std::declval<llvm::raw_ostream &>()
+ << std::declval<llvm::Optional<T>>()))> {
+ static const RawStreamProxy<llvm::Optional<T>>
+ printable(const llvm::Optional<T> &V) {
+ return {V};
+ }
+};
} // namespace llvm_gtest
#endif // !GTEST_NO_LLVM_RAW_OSTREAM
diff --git a/src/llvm-project/llvm/utils/update_analyze_test_checks.py b/src/llvm-project/llvm/utils/update_analyze_test_checks.py
index 64e64e0..df09108 100755
--- a/src/llvm-project/llvm/utils/update_analyze_test_checks.py
+++ b/src/llvm-project/llvm/utils/update_analyze_test_checks.py
@@ -32,6 +32,7 @@
from __future__ import print_function
import argparse
+import glob
import itertools
import os # Used to advertise this file's name ("autogenerated_note").
import string
@@ -48,10 +49,6 @@
IR_FUNCTION_RE = re.compile('^\s*define\s+(?:internal\s+)?[^@]*@([\w-]+)\s*\(')
-
-
-
-
def main():
from argparse import RawTextHelpFormatter
parser = argparse.ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter)
@@ -71,7 +68,8 @@
print('ERROR: Unexpected opt name: ' + opt_basename, file=sys.stderr)
sys.exit(1)
- for test in args.tests:
+ test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+ for test in test_paths:
if args.verbose:
print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
with open(test) as f:
@@ -186,7 +184,7 @@
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':
diff --git a/src/llvm-project/llvm/utils/update_llc_test_checks.py b/src/llvm-project/llvm/utils/update_llc_test_checks.py
index 960fee232..0936a44 100755
--- a/src/llvm-project/llvm/utils/update_llc_test_checks.py
+++ b/src/llvm-project/llvm/utils/update_llc_test_checks.py
@@ -10,6 +10,7 @@
from __future__ import print_function
import argparse
+import glob
import os # Used to advertise this file's name ("autogenerated_note").
import string
import subprocess
@@ -42,7 +43,8 @@
autogenerated_note = (ADVERT + 'utils/' + os.path.basename(__file__))
- for test in args.tests:
+ test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+ for test in test_paths:
if args.verbose:
print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
with open(test) as f:
@@ -79,6 +81,11 @@
if m:
triple_in_cmd = m.groups()[0]
+ march_in_cmd = None
+ m = common.MARCH_ARG_RE.search(llc_cmd)
+ if m:
+ march_in_cmd = m.groups()[0]
+
filecheck_cmd = ''
if len(commands) > 1:
filecheck_cmd = commands[1]
@@ -100,24 +107,25 @@
# FIXME: We should use multiple check prefixes to common check lines. For
# now, we just ignore all but the last.
- run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd))
+ run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd, march_in_cmd))
func_dict = {}
for p in run_list:
prefixes = p[0]
for prefix in prefixes:
func_dict.update({prefix: dict()})
- for prefixes, llc_args, triple_in_cmd in run_list:
+ for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
if args.verbose:
print('Extracted LLC cmd: llc ' + llc_args, file=sys.stderr)
print('Extracted FileCheck prefixes: ' + str(prefixes), file=sys.stderr)
raw_tool_output = common.invoke_tool(args.llc_binary, llc_args, test)
- if not (triple_in_cmd or triple_in_ir):
- print("Cannot find a triple. Assume 'x86'", file=sys.stderr)
+ triple = triple_in_cmd or triple_in_ir
+ if not triple:
+ triple = asm.get_triple_from_march(march_in_cmd)
asm.build_function_body_dictionary_for_triple(args, raw_tool_output,
- triple_in_cmd or triple_in_ir or 'x86', prefixes, func_dict)
+ triple, prefixes, func_dict)
is_in_function = False
is_in_function_start = False
@@ -172,7 +180,7 @@
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':
diff --git a/src/llvm-project/llvm/utils/update_mca_test_checks.py b/src/llvm-project/llvm/utils/update_mca_test_checks.py
index 06fd655..87ac19b 100755
--- a/src/llvm-project/llvm/utils/update_mca_test_checks.py
+++ b/src/llvm-project/llvm/utils/update_mca_test_checks.py
@@ -551,7 +551,7 @@
'Writing {} lines to {}...\n\n'.format(len(output_lines), test_path))
with open(test_path, 'wb') as f:
- f.writelines(['{}\n'.format(l).encode() for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
def main():
args = _parse_args()
diff --git a/src/llvm-project/llvm/utils/update_mir_test_checks.py b/src/llvm-project/llvm/utils/update_mir_test_checks.py
index 56d236d..b42a38b 100755
--- a/src/llvm-project/llvm/utils/update_mir_test_checks.py
+++ b/src/llvm-project/llvm/utils/update_mir_test_checks.py
@@ -21,6 +21,7 @@
import argparse
import collections
+import glob
import os
import re
import subprocess
@@ -62,6 +63,8 @@
with open(ir) as ir_file:
stdout = subprocess.check_output('{} {}'.format(self.bin, args),
shell=True, stdin=ir_file)
+ if sys.version_info[0] > 2:
+ stdout = stdout.decode()
# Fix line endings to unix CR style.
stdout = stdout.replace('\r\n', '\n')
return stdout
@@ -408,7 +411,7 @@
log('Writing {} lines to {}...'.format(len(output_lines), test), verbose)
with open(test, 'wb') as fd:
- fd.writelines([l + '\n' for l in output_lines])
+ fd.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
def main():
@@ -424,7 +427,8 @@
parser.add_argument('tests', nargs='+')
args = parser.parse_args()
- for test in args.tests:
+ test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
+ for test in test_paths:
try:
update_test_file(args.llc, test, args.remove_common_prefixes,
verbose=args.verbose)
diff --git a/src/llvm-project/llvm/utils/update_test_checks.py b/src/llvm-project/llvm/utils/update_test_checks.py
index 6d0bf04..92ce053 100755
--- a/src/llvm-project/llvm/utils/update_test_checks.py
+++ b/src/llvm-project/llvm/utils/update_test_checks.py
@@ -32,6 +32,7 @@
from __future__ import print_function
import argparse
+import glob
import itertools
import os # Used to advertise this file's name ("autogenerated_note").
import string
@@ -67,11 +68,19 @@
autogenerated_note = (ADVERT + 'utils/' + os.path.basename(__file__))
opt_basename = os.path.basename(args.opt_binary)
- if (opt_basename != "opt"):
+ if not re.match(r'^opt(-\d+)?$', opt_basename):
print('ERROR: Unexpected opt name: ' + opt_basename, file=sys.stderr)
sys.exit(1)
+ opt_basename = 'opt'
+ test_paths = []
for test in args.tests:
+ if not glob.glob(test):
+ print('WARNING: Test file \'%s\' was not found. Ignoring it.' % (test,), file=sys.stderr)
+ continue
+ test_paths.append(test)
+
+ for test in test_paths:
if args.verbose:
print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
with open(test) as f:
@@ -183,7 +192,7 @@
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':
diff --git a/src/llvm-project/llvm/utils/vim/README b/src/llvm-project/llvm/utils/vim/README
index 8aea879..5e8cf5b 100644
--- a/src/llvm-project/llvm/utils/vim/README
+++ b/src/llvm-project/llvm/utils/vim/README
@@ -6,7 +6,8 @@
and indentation plugins (indent).
To install copy all subdirectories to your $HOME/.vim or if you prefer create
-symlinks to the files here. Do not copy the vimrc file here it is only meant as an inspiration and starting point for those working on llvm c++ code.
+symlinks to the files here. Do not copy the vimrc file here it is only meant as
+an inspiration and starting point for those working on llvm c++ code.
Note: If you notice missing or incorrect syntax highlighting, please contact
<llvm-bugs [at] lists.llvm.org>; if you wish to provide a patch to improve the
diff --git a/src/llvm-project/llvm/utils/vim/syntax/llvm.vim b/src/llvm-project/llvm/utils/vim/syntax/llvm.vim
index 9345a9c..1a060ab 100644
--- a/src/llvm-project/llvm/utils/vim/syntax/llvm.vim
+++ b/src/llvm-project/llvm/utils/vim/syntax/llvm.vim
@@ -23,7 +23,7 @@
" The true and false tokens can be used for comparison opcodes, but it's
" much more common for these tokens to be used for boolean constants.
syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw
-syn keyword llvmStatement bitcast br catchpad catchswitch catchret call
+syn keyword llvmStatement bitcast br catchpad catchswitch catchret call callbr
syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement
syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext
syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub fneg getelementptr
@@ -148,6 +148,7 @@
\ sspstrong
\ strictfp
\ swiftcc
+ \ swiftself
\ tail
\ target
\ thread_local
diff --git a/src/llvm-project/llvm/utils/yaml-bench/YAMLBench.cpp b/src/llvm-project/llvm/utils/yaml-bench/YAMLBench.cpp
index 3688db6..a9851c0 100644
--- a/src/llvm-project/llvm/utils/yaml-bench/YAMLBench.cpp
+++ b/src/llvm-project/llvm/utils/yaml-bench/YAMLBench.cpp
@@ -1,9 +1,8 @@
//===- YAMLBench - Benchmark the YAMLParser implementation ----------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//