diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-07 08:26:46 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-07 08:26:46 +0000 |
commit | db068738e806753bc5735434cab9b9f930840c7a (patch) | |
tree | 6badab5755b9428aec30cdbbf587f07271d2e89e /lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | |
parent | 347c50a2933f756097fa5798f2b6c34a19df4162 (diff) |
Sink feature IsThumb into MC layer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp')
-rw-r--r-- | lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp index 402ab4e46b..b709cf5e74 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp @@ -42,8 +42,16 @@ MCRegisterInfo *createARMMCRegisterInfo() { MCSubtargetInfo *createARMMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS) { + std::string ArchFS = ARM_MC::ParseARMTriple(TT); + if (!FS.empty()) { + if (!ArchFS.empty()) + ArchFS = ArchFS + "," + FS.str(); + else + ArchFS = FS; + } + MCSubtargetInfo *X = new MCSubtargetInfo(); - InitARMMCSubtargetInfo(X, CPU, FS); + InitARMMCSubtargetInfo(X, CPU, ArchFS); return X; } @@ -74,16 +82,17 @@ extern "C" void LLVMInitializeARMMCSubtargetInfo() { createARMMCSubtargetInfo); } -std::string ARM_MC::ParseARMTriple(StringRef TT, bool &IsThumb) { +std::string ARM_MC::ParseARMTriple(StringRef TT) { // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. unsigned Len = TT.size(); unsigned Idx = 0; + bool isThumb = false; if (Len >= 5 && TT.substr(0, 4) == "armv") Idx = 4; else if (Len >= 6 && TT.substr(0, 5) == "thumb") { - IsThumb = true; + isThumb = true; if (Len >= 7 && TT[5] == 'v') Idx = 6; } @@ -116,5 +125,12 @@ std::string ARM_MC::ParseARMTriple(StringRef TT, bool &IsThumb) { ARMArchFeature = "+v4t"; } + if (isThumb) { + if (ARMArchFeature.empty()) + ARMArchFeature = "+thumb"; + else + ARMArchFeature += ",+thumb"; + } + return ARMArchFeature; } |