microinstruction: Identity's type depends on the type of its argument

This commit is contained in:
MerryMage 2016-08-23 15:48:30 +01:00
parent 67706c208b
commit e0f9dead5d
2 changed files with 7 additions and 1 deletions

View file

@ -214,6 +214,12 @@ bool Inst::MayHaveSideEffects() const {
} }
Type Inst::GetType() const {
if (op == Opcode::Identity)
return args[0].GetType();
return GetTypeOf(op);
}
Value Inst::GetArg(size_t index) const { Value Inst::GetArg(size_t index) const {
DEBUG_ASSERT(index < GetNumArgsOf(op)); DEBUG_ASSERT(index < GetNumArgsOf(op));
DEBUG_ASSERT(!args[index].IsEmpty()); DEBUG_ASSERT(!args[index].IsEmpty());

View file

@ -78,7 +78,7 @@ public:
/// Get the microop this microinstruction represents. /// Get the microop this microinstruction represents.
Opcode GetOpcode() const { return op; } Opcode GetOpcode() const { return op; }
/// Get the type this instruction returns. /// Get the type this instruction returns.
Type GetType() const { return GetTypeOf(op); } Type GetType() const;
/// Get the number of arguments this instruction has. /// Get the number of arguments this instruction has.
size_t NumArgs() const { return GetNumArgsOf(op); } size_t NumArgs() const { return GetNumArgsOf(op); }