Commit dddaf9ca by Jim Stichnoth

Subzero: Fix the g++ build (e.g. Windows).

parent 2a7fcbb4
...@@ -55,6 +55,7 @@ void ELFSymbolTableSection::createDefinedSym(const IceString &Name, ...@@ -55,6 +55,7 @@ void ELFSymbolTableSection::createDefinedSym(const IceString &Name,
else else
Unique = GlobalSymbols.insert(std::make_pair(Key, NewSymbol)).second; Unique = GlobalSymbols.insert(std::make_pair(Key, NewSymbol)).second;
assert(Unique); assert(Unique);
(void)Unique;
} }
void ELFSymbolTableSection::noteUndefinedSym(const IceString &Name, void ELFSymbolTableSection::noteUndefinedSym(const IceString &Name,
......
...@@ -26,12 +26,14 @@ ...@@ -26,12 +26,14 @@
#include "IceTimerTree.h" #include "IceTimerTree.h"
#include "IceTypes.h" #include "IceTypes.h"
template <> struct std::hash<Ice::RelocatableTuple> { namespace std {
std::size_t operator()(const Ice::RelocatableTuple &Key) const { template <> struct hash<Ice::RelocatableTuple> {
return std::hash<Ice::IceString>()(Key.Name) + size_t operator()(const Ice::RelocatableTuple &Key) const {
std::hash<Ice::RelocOffsetT>()(Key.Offset); return hash<Ice::IceString>()(Key.Name) +
hash<Ice::RelocOffsetT>()(Key.Offset);
} }
}; };
} // end of namespace std
namespace Ice { namespace Ice {
......
...@@ -128,8 +128,17 @@ public: ...@@ -128,8 +128,17 @@ public:
// result in any native instructions, and a target-specific // result in any native instructions, and a target-specific
// instruction results in a single native instruction. // instruction results in a single native instruction.
virtual uint32_t getEmitInstCount() const { return 0; } virtual uint32_t getEmitInstCount() const { return 0; }
virtual void emit(const Cfg *Func) const = 0; // TODO(stichnot): Change Inst back to abstract once the g++ build
virtual void emitIAS(const Cfg *Func) const = 0; // issue is fixed. llvm::ilist<Ice::Inst> doesn't work under g++
// because the resize(size_t, Ice::Inst) method is incorrectly
// declared and thus doesn't allow the abstract class Ice::Inst.
// The method should be declared resize(size_t, const Ice::Inst &).
// virtual void emit(const Cfg *Func) const = 0;
// virtual void emitIAS(const Cfg *Func) const = 0;
virtual void emit(const Cfg *) const {
llvm_unreachable("emit on abstract class");
}
virtual void emitIAS(const Cfg *Func) const { emit(Func); }
virtual void dump(const Cfg *Func) const; virtual void dump(const Cfg *Func) const;
virtual void dumpExtras(const Cfg *Func) const; virtual void dumpExtras(const Cfg *Func) const;
void dumpDecorated(const Cfg *Func) const; void dumpDecorated(const Cfg *Func) const;
...@@ -835,11 +844,12 @@ protected: ...@@ -835,11 +844,12 @@ protected:
} // end of namespace Ice } // end of namespace Ice
namespace llvm {
// Override the default ilist traits so that Inst's private ctor and // Override the default ilist traits so that Inst's private ctor and
// deleted dtor aren't invoked. // deleted dtor aren't invoked.
template <> template <>
struct llvm::ilist_traits<Ice::Inst> struct ilist_traits<Ice::Inst> : public ilist_default_traits<Ice::Inst> {
: public llvm::ilist_default_traits<Ice::Inst> {
Ice::Inst *createSentinel() const { Ice::Inst *createSentinel() const {
return static_cast<Ice::Inst *>(&Sentinel); return static_cast<Ice::Inst *>(&Sentinel);
} }
...@@ -853,4 +863,6 @@ private: ...@@ -853,4 +863,6 @@ private:
mutable ilist_half_node<Ice::Inst> Sentinel; mutable ilist_half_node<Ice::Inst> Sentinel;
}; };
} // end of namespace llvm
#endif // SUBZERO_SRC_ICEINST_H #endif // SUBZERO_SRC_ICEINST_H
...@@ -253,6 +253,7 @@ const Inst *VariableTracking::getFirstDefinition() const { ...@@ -253,6 +253,7 @@ const Inst *VariableTracking::getFirstDefinition() const {
assert(FirstOrSingleDefinition); assert(FirstOrSingleDefinition);
return FirstOrSingleDefinition; return FirstOrSingleDefinition;
} }
return NULL;
} }
const Inst *VariableTracking::getSingleDefinition() const { const Inst *VariableTracking::getSingleDefinition() const {
...@@ -265,6 +266,7 @@ const Inst *VariableTracking::getSingleDefinition() const { ...@@ -265,6 +266,7 @@ const Inst *VariableTracking::getSingleDefinition() const {
assert(FirstOrSingleDefinition); assert(FirstOrSingleDefinition);
return FirstOrSingleDefinition; return FirstOrSingleDefinition;
} }
return NULL;
} }
void VariablesMetadata::init(MetadataKind TrackingKind) { void VariablesMetadata::init(MetadataKind TrackingKind) {
......
...@@ -1681,6 +1681,8 @@ private: ...@@ -1681,6 +1681,8 @@ private:
Cond = Ice::InstIcmp::Sle; Cond = Ice::InstIcmp::Sle;
return true; return true;
default: default:
// Make sure Cond is always initialized.
Cond = static_cast<Ice::InstIcmp::ICond>(0);
return false; return false;
} }
} }
...@@ -1739,6 +1741,8 @@ private: ...@@ -1739,6 +1741,8 @@ private:
Cond = Ice::InstFcmp::True; Cond = Ice::InstFcmp::True;
return true; return true;
default: default:
// Make sure Cond is always initialized.
Cond = static_cast<Ice::InstFcmp::FCond>(0);
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment