diff options
author | Eric Christopher <echristo@gmail.com> | 2015-01-26 17:33:46 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2015-01-26 17:33:46 +0000 |
commit | a5762816948856ed8a21e2bfd960d5121e8fce4d (patch) | |
tree | fc333bd6e0501612d3c851efec69466353120a72 /llvm/lib/Target/Mips/MipsTargetStreamer.h | |
parent | 6e4ed49d792c1f7ab831351d0e44ee2b31b35bdb (diff) | |
download | bcm5719-llvm-a5762816948856ed8a21e2bfd960d5121e8fce4d.tar.gz bcm5719-llvm-a5762816948856ed8a21e2bfd960d5121e8fce4d.zip |
Move the Mips target to storing the ABI in the TargetMachine rather
than on MipsSubtargetInfo.
This required a bit of massaging in the MC level to handle this since
MC is a) largely a collection of disparate classes with no hierarchy,
and b) there's no overarching equivalent to the TargetMachine, instead
only the subtarget via MCSubtargetInfo (which is the base class of
TargetSubtargetInfo).
We're now storing the ABI in both the TargetMachine level and in the
MC level because the AsmParser and the TargetStreamer both need to
know what ABI we have to parse assembly and emit objects. The target
streamer has a pointer to the one in the asm parser and is updated
when the asm parser is created. This is fragile as the FIXME comment
notes, but shouldn't be a problem in practice since we always
create an asm parser before attempting to emit object code via the
assembler. The TargetMachine now contains the ABI so that the DataLayout
can be constructed dependent upon ABI.
All testcases have been updated to use the -target-abi command line
flag so that we can set the ABI without using a subtarget feature.
Should be no change visible externally here.
llvm-svn: 227102
Diffstat (limited to 'llvm/lib/Target/Mips/MipsTargetStreamer.h')
-rw-r--r-- | llvm/lib/Target/Mips/MipsTargetStreamer.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Target/Mips/MipsTargetStreamer.h b/llvm/lib/Target/Mips/MipsTargetStreamer.h index 6dcd15acef0..19cfec09790 100644 --- a/llvm/lib/Target/Mips/MipsTargetStreamer.h +++ b/llvm/lib/Target/Mips/MipsTargetStreamer.h @@ -11,6 +11,7 @@ #define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H #include "MCTargetDesc/MipsABIFlagsSection.h" +#include "MCTargetDesc/MipsABIInfo.h" #include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" @@ -95,12 +96,18 @@ public: // structure values. template <class PredicateLibrary> void updateABIInfo(const PredicateLibrary &P) { + ABI = &P.getABI(); ABIFlagsSection.setAllFromPredicates(P); } MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; } + const MipsABIInfo &getABI() const { + assert(ABI && "ABI hasn't been set!"); + return *ABI; + } protected: + const MipsABIInfo *ABI; MipsABIFlagsSection ABIFlagsSection; bool GPRInfoSet; @@ -224,11 +231,6 @@ public: // ABI Flags void emitDirectiveModuleOddSPReg(bool Enabled, bool IsO32ABI) override; void emitMipsAbiFlags() override; - -protected: - bool isO32() const { return STI.getFeatureBits() & Mips::FeatureO32; } - bool isN32() const { return STI.getFeatureBits() & Mips::FeatureN32; } - bool isN64() const { return STI.getFeatureBits() & Mips::FeatureN64; } }; } #endif |