forked from OSchip/llvm-project
[AVR] Fix reads of uninitialized variables from constructor of AVRSubtarget
The initialization order was not correct. These bugs were discovered by valgrind. They appear to work fine in practice but this patch should unblock switching the AVR backend on by default as now a standard AVR llc invocation runs without memory errors. The AVRISelLowering constructor would run before the subtarget boolean fields were initialized to false. Now, the initialization order is correct.
This commit is contained in:
parent
d5edcb9064
commit
2cf4b4de0c
|
@ -29,8 +29,8 @@ namespace llvm {
|
|||
|
||||
AVRSubtarget::AVRSubtarget(const Triple &TT, const std::string &CPU,
|
||||
const std::string &FS, const AVRTargetMachine &TM)
|
||||
: AVRGenSubtargetInfo(TT, CPU, FS), ELFArch(0), InstrInfo(), FrameLowering(),
|
||||
TLInfo(TM, initializeSubtargetDependencies(CPU, FS, TM)), TSInfo(),
|
||||
: AVRGenSubtargetInfo(TT, CPU, FS),
|
||||
ELFArch(0),
|
||||
|
||||
// Subtarget features
|
||||
m_hasSRAM(false), m_hasJMPCALL(false), m_hasIJMPCALL(false),
|
||||
|
@ -38,7 +38,10 @@ AVRSubtarget::AVRSubtarget(const Triple &TT, const std::string &CPU,
|
|||
m_hasMOVW(false), m_hasLPM(false), m_hasLPMX(false), m_hasELPM(false),
|
||||
m_hasELPMX(false), m_hasSPM(false), m_hasSPMX(false), m_hasDES(false),
|
||||
m_supportsRMW(false), m_supportsMultiplication(false), m_hasBREAK(false),
|
||||
m_hasTinyEncoding(false), m_FeatureSetDummy(false) {
|
||||
m_hasTinyEncoding(false), m_FeatureSetDummy(false),
|
||||
|
||||
InstrInfo(), FrameLowering(),
|
||||
TLInfo(TM, initializeSubtargetDependencies(CPU, FS, TM)), TSInfo() {
|
||||
// Parse features string.
|
||||
ParseSubtargetFeatures(CPU, FS);
|
||||
}
|
||||
|
|
|
@ -85,11 +85,6 @@ private:
|
|||
/// The ELF e_flags architecture.
|
||||
unsigned ELFArch;
|
||||
|
||||
AVRInstrInfo InstrInfo;
|
||||
AVRFrameLowering FrameLowering;
|
||||
AVRTargetLowering TLInfo;
|
||||
AVRSelectionDAGInfo TSInfo;
|
||||
|
||||
// Subtarget feature settings
|
||||
// See AVR.td for details.
|
||||
bool m_hasSRAM;
|
||||
|
@ -114,6 +109,11 @@ private:
|
|||
// Dummy member, used by FeatureSet's. We cannot have a SubtargetFeature with
|
||||
// no variable, so we instead bind pseudo features to this variable.
|
||||
bool m_FeatureSetDummy;
|
||||
|
||||
AVRInstrInfo InstrInfo;
|
||||
AVRFrameLowering FrameLowering;
|
||||
AVRTargetLowering TLInfo;
|
||||
AVRSelectionDAGInfo TSInfo;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
Loading…
Reference in New Issue