Skip to content
This repository has been archived by the owner on Nov 9, 2019. It is now read-only.

Commit

Permalink
Merged with upstream r318998.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 committed Nov 27, 2017
1 parent 0dcad6c commit 6380335
Show file tree
Hide file tree
Showing 93 changed files with 4,994 additions and 17,404 deletions.
18 changes: 16 additions & 2 deletions include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ class Triple {
AMDOpenCL,
CoreCLR,
OpenCL,
LastEnvironmentType = OpenCL
Simulator, // Simulator variants of other systems, e.g., Apple's iOS
LastEnvironmentType = Simulator
};
enum ObjectFormatType {
UnknownObjectFormat,
Expand Down Expand Up @@ -473,6 +474,10 @@ class Triple {
return isMacOSX() || isiOS() || isWatchOS();
}

bool isSimulatorEnvironment() const {
return getEnvironment() == Triple::Simulator;
}

bool isOSNetBSD() const {
return getOS() == Triple::NetBSD;
}
Expand All @@ -499,6 +504,8 @@ class Triple {
return getOS() == Triple::ELFIAMCU;
}

bool isOSUnknown() const { return getOS() == Triple::UnknownOS; }

bool isGNUEnvironment() const {
EnvironmentType Env = getEnvironment();
return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
Expand Down Expand Up @@ -656,8 +663,15 @@ class Triple {
return getArch() == Triple::arm || getArch() == Triple::armeb;
}

/// Tests whether the target is AArch64 (little and big endian).
bool isAArch64() const {
return getArch() == Triple::aarch64 || getArch() == Triple::aarch64_be;
}

/// Tests wether the target supports comdat
bool supportsCOMDAT() const { return !isOSBinFormatMachO(); }
bool supportsCOMDAT() const {
return !isOSBinFormatMachO() && !isOSBinFormatWasm();
}

/// @}
/// @name Mutators
Expand Down
19 changes: 19 additions & 0 deletions include/llvm/BinaryFormat/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,10 @@ enum : unsigned {
SHT_GROUP = 17, // Section group.
SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
// Android packed relocation section types.
// https://android.googlesource.com/platform/bionic/+/6f12bfece5dcc01325e0abba56a46b1bcf991c69/tools/relocation_packer/src/elf_file.cc#37
SHT_ANDROID_REL = 0x60000001,
SHT_ANDROID_RELA = 0x60000002,
SHT_LLVM_ODRTAB = 0x6fff4c00, // LLVM ODR table.
SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes.
SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
Expand Down Expand Up @@ -1170,6 +1174,13 @@ enum {
DT_LOPROC = 0x70000000, // Start of processor specific tags.
DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags.

// Android packed relocation section tags.
// https://android.googlesource.com/platform/bionic/+/6f12bfece5dcc01325e0abba56a46b1bcf991c69/tools/relocation_packer/src/elf_file.cc#31
DT_ANDROID_REL = 0x6000000F,
DT_ANDROID_RELSZ = 0x60000010,
DT_ANDROID_RELA = 0x60000011,
DT_ANDROID_RELASZ = 0x60000012,

DT_GNU_HASH = 0x6FFFFEF5, // Reference to the GNU hash table.
DT_TLSDESC_PLT =
0x6FFFFEF6, // Location of PLT entry for TLS descriptor resolver calls.
Expand Down Expand Up @@ -1391,6 +1402,14 @@ enum {
GNU_ABI_TAG_NACL = 6,
};

// Android packed relocation group flags.
enum {
RELOCATION_GROUPED_BY_INFO_FLAG = 1,
RELOCATION_GROUPED_BY_OFFSET_DELTA_FLAG = 2,
RELOCATION_GROUPED_BY_ADDEND_FLAG = 4,
RELOCATION_GROUP_HAS_ADDEND_FLAG = 8,
};

// Compressed section header for ELF32.
struct Elf32_Chdr {
Elf32_Word ch_type;
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/ISDOpcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ namespace ISD {
/// which do not reference a specific memory location should be less than
/// this value. Those that do must not be less than this value, and can
/// be used with SelectionDAG::getMemIntrinsicNode.
static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+300;
static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+400;

//===--------------------------------------------------------------------===//
/// MemIndexedMode enum - This enum defines the load / store indexed
Expand Down
10 changes: 10 additions & 0 deletions include/llvm/CodeGen/MachineBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class MachineBasicBlock
using const_probability_iterator =
std::vector<BranchProbability>::const_iterator;

Optional<uint64_t> IrrLoopHeaderWeight;

/// Keep track of the physical registers that are livein of the basicblock.
using LiveInVector = std::vector<RegisterMaskPair>;
LiveInVector LiveIns;
Expand Down Expand Up @@ -730,6 +732,14 @@ class MachineBasicBlock
/// Return the MCSymbol for this basic block.
MCSymbol *getSymbol() const;

Optional<uint64_t> getIrrLoopHeaderWeight() const {
return IrrLoopHeaderWeight;
}

void setIrrLoopHeaderWeight(uint64_t Weight) {
IrrLoopHeaderWeight = Weight;
}

private:
/// Return probability iterator corresponding to the I successor iterator.
probability_iterator getProbabilityIterator(succ_iterator I);
Expand Down
26 changes: 20 additions & 6 deletions include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ class SelectionDAG {
.getRawSubclassData();
}

template <typename SDNodeTy>
static uint16_t getSyntheticNodeSubclassData(unsigned Opc, unsigned Order,
SDVTList VTs, EVT MemoryVT,
MachineMemOperand *MMO) {
return SDNodeTy(Opc, Order, DebugLoc(), VTs, MemoryVT, MMO)
.getRawSubclassData();
}

void createOperands(SDNode *Node, ArrayRef<SDValue> Vals) {
assert(!Node->OperandList && "Node already has operands");
SDUse *Ops = OperandRecycler.allocate(
Expand Down Expand Up @@ -1176,16 +1184,22 @@ class SelectionDAG {
unsigned R, bool IsIndirect, const DebugLoc &DL,
unsigned O);

/// Constant
/// Creates a constant SDDbgValue node.
SDDbgValue *getConstantDbgValue(DIVariable *Var, DIExpression *Expr,
const Value *C, const DebugLoc &DL,
unsigned O);

/// FrameIndex
/// Creates a FrameIndex SDDbgValue node.
SDDbgValue *getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr,
unsigned FI, const DebugLoc &DL,
unsigned O);

/// Transfer debug values from one node to another, while optionally
/// generating fragment expressions for split-up values. If \p InvalidateDbg
/// is set, debug values are invalidated after they are transferred.
void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0,
unsigned SizeInBits = 0, bool InvalidateDbg = true);

/// Remove the specified node from the system. If any of its
/// operands then becomes dead, remove them as well. Inform UpdateListener
/// for each node deleted.
Expand Down Expand Up @@ -1266,10 +1280,6 @@ class SelectionDAG {
return DbgInfo->getSDDbgValues(SD);
}

private:
/// Transfer SDDbgValues. Called via ReplaceAllUses{OfValue}?With
void TransferDbgValues(SDValue From, SDValue To);

public:
/// Return true if there are any SDDbgValue nodes associated
/// with this SelectionDAG.
Expand All @@ -1286,6 +1296,10 @@ class SelectionDAG {
return DbgInfo->ByvalParmDbgEnd();
}

/// To be invoked on an SDNode that is slated to be erased. This
/// function mirrors \c llvm::salvageDebugInfo.
void salvageDebugInfo(SDNode &N);

void dump() const;

/// Create a stack temporary, suitable for holding the specified value type.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
#define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H

#include "llvm/CodeGen/TargetLoweringObjectFile.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/Target/TargetLoweringObjectFile.h"

namespace llvm {

Expand Down
16 changes: 8 additions & 8 deletions include/llvm/MC/MCContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,25 +443,25 @@ namespace llvm {
getAssociativeCOFFSection(MCSectionCOFF *Sec, const MCSymbol *KeySym,
unsigned UniqueID = GenericSectionID);

MCSectionWasm *getWasmSection(const Twine &Section, unsigned Type) {
return getWasmSection(Section, Type, nullptr);
MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K) {
return getWasmSection(Section, K, nullptr);
}

MCSectionWasm *getWasmSection(const Twine &Section, unsigned Type,
MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
const char *BeginSymName) {
return getWasmSection(Section, Type, "", ~0, BeginSymName);
return getWasmSection(Section, K, "", ~0, BeginSymName);
}

MCSectionWasm *getWasmSection(const Twine &Section, unsigned Type,
MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
const Twine &Group, unsigned UniqueID) {
return getWasmSection(Section, Type, Group, UniqueID, nullptr);
return getWasmSection(Section, K, Group, UniqueID, nullptr);
}

MCSectionWasm *getWasmSection(const Twine &Section, unsigned Type,
MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
const Twine &Group, unsigned UniqueID,
const char *BeginSymName);

MCSectionWasm *getWasmSection(const Twine &Section, unsigned Type,
MCSectionWasm *getWasmSection(const Twine &Section, SectionKind K,
const MCSymbolWasm *Group, unsigned UniqueID,
const char *BeginSymName);

Expand Down
39 changes: 39 additions & 0 deletions include/llvm/Support/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Chrono.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MD5.h"
Expand Down Expand Up @@ -694,6 +695,44 @@ std::error_code createUniqueFile(const Twine &Model, int &ResultFD,
std::error_code createUniqueFile(const Twine &Model,
SmallVectorImpl<char> &ResultPath);

/// Represents a temporary file.
///
/// The temporary file must be eventually discarded or given a final name and
/// kept.
///
/// The destructor doesn't implicitly discard because there is no way to
/// properly handle errors in a destructor.
class TempFile {
bool Done = false;
TempFile(StringRef Name, int FD);

public:
/// This creates a temporary file with createUniqueFile and schedules it for
/// deletion with sys::RemoveFileOnSignal.
static Expected<TempFile> create(const Twine &Model,
unsigned Mode = all_read | all_write);
TempFile(TempFile &&Other);
TempFile &operator=(TempFile &&Other);

// Name of the temporary file.
std::string TmpName;

// The open file descriptor.
int FD = -1;

// Keep this with the given name.
Error keep(const Twine &Name);

// Keep this with the temporary name.
Error keep();

// Delete the file.
Error discard();

// This checks that keep or delete was called.
~TempFile();
};

/// @brief Create a file in the system temporary directory.
///
/// The filename is of the form prefix-random_chars.suffix. Since the directory
Expand Down
20 changes: 17 additions & 3 deletions include/llvm/Support/TargetRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ class Target {
/// ShortDesc - A short description of the target.
const char *ShortDesc;

/// BackendName - The name of the backend implementation. This must match the
/// name of the 'def X : Target ...' in TableGen.
const char *BackendName;

/// HasJIT - Whether this target supports the JIT.
bool HasJIT;

Expand Down Expand Up @@ -290,6 +294,9 @@ class Target {
/// getShortDescription - Get a short description of the target.
const char *getShortDescription() const { return ShortDesc; }

/// getBackendName - Get the backend name.
const char *getBackendName() const { return BackendName; }

/// @}
/// @name Feature Predicates
/// @{
Expand Down Expand Up @@ -664,10 +671,15 @@ struct TargetRegistry {
/// @param Name - The target name. This should be a static string.
/// @param ShortDesc - A short target description. This should be a static
/// string.
/// @param BackendName - The name of the backend. This should be a static
/// string that is the same for all targets that share a backend
/// implementation and must match the name used in the 'def X : Target ...' in
/// TableGen.
/// @param ArchMatchFn - The arch match checking function for this target.
/// @param HasJIT - Whether the target supports JIT code
/// generation.
static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
const char *BackendName,
Target::ArchMatchFnTy ArchMatchFn,
bool HasJIT = false);

Expand Down Expand Up @@ -897,13 +909,15 @@ struct TargetRegistry {
/// }
/// extern "C" void LLVMInitializeFooTargetInfo() {
/// RegisterTarget<Triple::foo> X(getTheFooTarget(), "foo", "Foo
/// description");
/// description", "Foo" /* Backend Name */);
/// }
template <Triple::ArchType TargetArchType = Triple::UnknownArch,
bool HasJIT = false>
struct RegisterTarget {
RegisterTarget(Target &T, const char *Name, const char *Desc) {
TargetRegistry::RegisterTarget(T, Name, Desc, &getArchMatch, HasJIT);
RegisterTarget(Target &T, const char *Name, const char *Desc,
const char *BackendName) {
TargetRegistry::RegisterTarget(T, Name, Desc, BackendName, &getArchMatch,
HasJIT);
}

static bool getArchMatch(Triple::ArchType Arch) {
Expand Down
Loading

0 comments on commit 6380335

Please sign in to comment.