Skip to content

Commit

Permalink
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetD…
Browse files Browse the repository at this point in the history
…esc/* and related. NFC.

Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D10969


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247692 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dsandersllvm committed Sep 15, 2015
1 parent a6aa0c3 commit 9781f90
Show file tree
Hide file tree
Showing 112 changed files with 1,289 additions and 499 deletions.
431 changes: 431 additions & 0 deletions include/llvm/ADT/TargetTuple.h

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions include/llvm/MC/MCELFObjectWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef LLVM_MC_MCELFOBJECTWRITER_H
#define LLVM_MC_MCELFOBJECTWRITER_H

#include "llvm/ADT/Triple.h"
#include "llvm/ADT/TargetTuple.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ELF.h"
#include <vector>
Expand Down Expand Up @@ -50,17 +50,17 @@ class MCELFObjectTargetWriter {
bool IsN64=false);

public:
static uint8_t getOSABI(Triple::OSType OSType) {
static uint8_t getOSABI(TargetTuple::OSType OSType) {
switch (OSType) {
case Triple::CloudABI:
return ELF::ELFOSABI_CLOUDABI;
case Triple::PS4:
case Triple::FreeBSD:
return ELF::ELFOSABI_FREEBSD;
case Triple::Linux:
return ELF::ELFOSABI_LINUX;
default:
return ELF::ELFOSABI_NONE;
case TargetTuple::CloudABI:
return ELF::ELFOSABI_CLOUDABI;
case TargetTuple::PS4:
case TargetTuple::FreeBSD:
return ELF::ELFOSABI_FREEBSD;
case TargetTuple::Linux:
return ELF::ELFOSABI_LINUX;
default:
return ELF::ELFOSABI_NONE;
}
}

Expand Down
13 changes: 7 additions & 6 deletions include/llvm/MC/MCSubtargetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef LLVM_MC_MCSUBTARGETINFO_H
#define LLVM_MC_MCSUBTARGETINFO_H

#include "llvm/ADT/TargetTuple.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/MC/SubtargetFeature.h"
#include <string>
Expand All @@ -27,10 +28,10 @@ class StringRef;
/// MCSubtargetInfo - Generic base class for all target subtargets.
///
class MCSubtargetInfo {
Triple TargetTriple; // Target triple
std::string CPU; // CPU being targeted.
TargetTuple TheTargetTuple; // Target triple
std::string CPU; // CPU being targeted.
ArrayRef<SubtargetFeatureKV> ProcFeatures; // Processor feature list
ArrayRef<SubtargetFeatureKV> ProcDesc; // Processor descriptions
ArrayRef<SubtargetFeatureKV> ProcDesc; // Processor descriptions

// Scheduler machine model
const SubtargetInfoKV *ProcSchedModels;
Expand All @@ -50,16 +51,16 @@ class MCSubtargetInfo {

public:
MCSubtargetInfo(const MCSubtargetInfo &) = default;
MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS,
MCSubtargetInfo(const TargetTuple &TT, StringRef CPU, StringRef FS,
ArrayRef<SubtargetFeatureKV> PF,
ArrayRef<SubtargetFeatureKV> PD,
const SubtargetInfoKV *ProcSched,
const MCWriteProcResEntry *WPR, const MCWriteLatencyEntry *WL,
const MCReadAdvanceEntry *RA, const InstrStage *IS,
const unsigned *OC, const unsigned *FP);

/// getTargetTriple - Return the target triple string.
const Triple &getTargetTriple() const { return TargetTriple; }
/// getTargetTuple - Return the target triple string.
const TargetTuple &getTargetTuple() const { return TheTargetTuple; }

/// getCPU - Return the CPU string.
StringRef getCPU() const {
Expand Down
Loading

0 comments on commit 9781f90

Please sign in to comment.