Imported Upstream version 5.18.0.205

Former-commit-id: 7f59f7e792705db773f1caecdaa823092f4e2927
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-11-16 08:20:38 +00:00
parent 5cd5df71cc
commit 8e12397d70
28486 changed files with 3867013 additions and 66 deletions

View File

@ -0,0 +1,57 @@
//===- ARCInfo.h - Additional ARC Info --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains small standalone helper functions and enum definitions for
// the ARC target useful for the compiler back-end and the MC libraries.
// As such, it deliberately does not include references to LLVM core
// code gen types, passes, etc..
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCINFO_H
#define LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCINFO_H
namespace llvm {
// Enums corresponding to ARC condition codes
namespace ARCCC {
enum CondCode {
AL = 0x0,
EQ = 0x1,
NE = 0x2,
P = 0x3,
N = 0x4,
LO = 0x5,
HS = 0x6,
GT = 0x9,
GE = 0xa,
LT = 0xb,
LE = 0xc,
HI = 0xd,
LS = 0xe,
PNZ = 0xf,
Z = 0x11, // Low 4-bits = EQ
NZ = 0x12 // Low 4-bits = NE
};
enum BRCondCode {
BREQ = 0x0,
BRNE = 0x1,
BRLT = 0x2,
BRGE = 0x3,
BRLO = 0x4,
BRHS = 0x5
};
} // end namespace ARCCC
} // end namespace llvm
#endif

View File

@ -0,0 +1,32 @@
//===- ARCMCAsmInfo.cpp - ARC asm properties --------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "ARCMCAsmInfo.h"
using namespace llvm;
void ARCMCAsmInfo::anchor() {}
ARCMCAsmInfo::ARCMCAsmInfo(const Triple &TT) {
SupportsDebugInformation = true;
Data16bitsDirective = "\t.short\t";
Data32bitsDirective = "\t.word\t";
Data64bitsDirective = nullptr;
ZeroDirective = "\t.space\t";
CommentString = ";";
UsesELFSectionDirectiveForBSS = true;
AllowAtInName = true;
HiddenVisibilityAttr = MCSA_Invalid;
HiddenDeclarationVisibilityAttr = MCSA_Invalid;
ProtectedVisibilityAttr = MCSA_Invalid;
// Debug
ExceptionsType = ExceptionHandling::DwarfCFI;
DwarfRegNumForCFI = true;
}

View File

@ -0,0 +1,32 @@
//===- ARCMCAsmInfo.h - ARC asm properties ----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains the declaration of the ARCMCAsmInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCASMINFO_H
#define LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCASMINFO_H
#include "llvm/MC/MCAsmInfoELF.h"
namespace llvm {
class Triple;
class ARCMCAsmInfo : public MCAsmInfoELF {
void anchor() override;
public:
explicit ARCMCAsmInfo(const Triple &TT);
};
} // end namespace llvm
#endif // LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCASMINFO_H

View File

@ -0,0 +1,103 @@
//===- ARCMCTargetDesc.cpp - ARC Target Descriptions ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides ARC specific target descriptions.
//
//===----------------------------------------------------------------------===//
#include "ARCMCTargetDesc.h"
#include "ARCMCAsmInfo.h"
#include "ARCTargetStreamer.h"
#include "InstPrinter/ARCInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
#define GET_INSTRINFO_MC_DESC
#include "ARCGenInstrInfo.inc"
#define GET_SUBTARGETINFO_MC_DESC
#include "ARCGenSubtargetInfo.inc"
#define GET_REGINFO_MC_DESC
#include "ARCGenRegisterInfo.inc"
static MCInstrInfo *createARCMCInstrInfo() {
auto *X = new MCInstrInfo();
InitARCMCInstrInfo(X);
return X;
}
static MCRegisterInfo *createARCMCRegisterInfo(const Triple &TT) {
auto *X = new MCRegisterInfo();
InitARCMCRegisterInfo(X, ARC::BLINK);
return X;
}
static MCSubtargetInfo *createARCMCSubtargetInfo(const Triple &TT,
StringRef CPU, StringRef FS) {
return createARCMCSubtargetInfoImpl(TT, CPU, FS);
}
static MCAsmInfo *createARCMCAsmInfo(const MCRegisterInfo &MRI,
const Triple &TT) {
MCAsmInfo *MAI = new ARCMCAsmInfo(TT);
// Initial state of the frame pointer is SP.
MCCFIInstruction Inst = MCCFIInstruction::createDefCfa(nullptr, ARC::SP, 0);
MAI->addInitialFrameState(Inst);
return MAI;
}
static MCInstPrinter *createARCMCInstPrinter(const Triple &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
return new ARCInstPrinter(MAI, MII, MRI);
}
ARCTargetStreamer::ARCTargetStreamer(MCStreamer &S) : MCTargetStreamer(S) {}
ARCTargetStreamer::~ARCTargetStreamer() = default;
static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
formatted_raw_ostream &OS,
MCInstPrinter *InstPrint,
bool isVerboseAsm) {
return new ARCTargetStreamer(S);
}
// Force static initialization.
extern "C" void LLVMInitializeARCTargetMC() {
// Register the MC asm info.
Target &TheARCTarget = getTheARCTarget();
RegisterMCAsmInfoFn X(TheARCTarget, createARCMCAsmInfo);
// Register the MC instruction info.
TargetRegistry::RegisterMCInstrInfo(TheARCTarget, createARCMCInstrInfo);
// Register the MC register info.
TargetRegistry::RegisterMCRegInfo(TheARCTarget, createARCMCRegisterInfo);
// Register the MC subtarget info.
TargetRegistry::RegisterMCSubtargetInfo(TheARCTarget,
createARCMCSubtargetInfo);
// Register the MCInstPrinter
TargetRegistry::RegisterMCInstPrinter(TheARCTarget, createARCMCInstPrinter);
TargetRegistry::RegisterAsmTargetStreamer(TheARCTarget,
createTargetAsmStreamer);
}

View File

@ -0,0 +1,39 @@
//===- ARCMCTargetDesc.h - ARC Target Descriptions --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides ARC specific target descriptions.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCTARGETDESC_H
#define LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCTARGETDESC_H
#include "llvm/Support/DataTypes.h"
namespace llvm {
class Target;
Target &getTheARCTarget();
} // end namespace llvm
// Defines symbolic names for ARC registers. This defines a mapping from
// register name to register number.
#define GET_REGINFO_ENUM
#include "ARCGenRegisterInfo.inc"
// Defines symbolic names for the ARC instructions.
#define GET_INSTRINFO_ENUM
#include "ARCGenInstrInfo.inc"
#define GET_SUBTARGETINFO_ENUM
#include "ARCGenSubtargetInfo.inc"
#endif // LLVM_LIB_TARGET_ARC_MCTARGETDESC_ARCMCTARGETDESC_H

View File

@ -0,0 +1,4 @@
add_llvm_library(LLVMARCDesc
ARCMCTargetDesc.cpp
ARCMCAsmInfo.cpp
)

View File

@ -0,0 +1,23 @@
;===- ./lib/Target/ARC/MCTargetDesc/LLVMBuild.txt ------------*- Conf -*--===;
;
; The LLVM Compiler Infrastructure
;
; This file is distributed under the University of Illinois Open Source
; License. See LICENSE.TXT for details.
;
;===------------------------------------------------------------------------===;
;
; This is an LLVMBuild description file for the components in this subdirectory.
;
; For more information on the LLVMBuild system, please see:
;
; http://llvm.org/docs/LLVMBuild.html
;
;===------------------------------------------------------------------------===;
[component_0]
type = Library
name = ARCDesc
parent = ARC
required_libraries = MC Support ARCAsmPrinter ARCInfo
add_to_library_groups = ARC