diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:09:07 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:09:07 +0000 | 
| commit | 571945e6affd20b19264ec22495da418d0fbdbb4 (patch) | |
| tree | 076117cdf3579003f07cad4cdf0593347ce58150 /lib/CodeGen/MachineInstr.cpp | |
| parent | 06f9d4012fb8acea3e9861d5722b5965dbb724d9 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
| -rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 25 | 
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index f73a5a362112..12b974d30be9 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -1058,6 +1058,22 @@ bool MachineInstr::isInvariantLoad(AliasAnalysis *AA) const {    return true;  } +/// isConstantValuePHI - If the specified instruction is a PHI that always +/// merges together the same virtual register, return the register, otherwise +/// return 0. +unsigned MachineInstr::isConstantValuePHI() const { +  if (getOpcode() != TargetInstrInfo::PHI) +    return 0; +  assert(getNumOperands() >= 3 && +         "It's illegal to have a PHI without source operands"); + +  unsigned Reg = getOperand(1).getReg(); +  for (unsigned i = 3, e = getNumOperands(); i < e; i += 2) +    if (getOperand(i).getReg() != Reg) +      return 0; +  return Reg; +} +  void MachineInstr::dump() const {    errs() << "  " << *this;  } @@ -1150,9 +1166,14 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {      DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);      DIScope Scope(DLT.Scope);      OS << " dbg:"; +    // Omit the directory, since it's usually long and uninteresting.      if (!Scope.isNull()) -      OS << Scope.getDirectory() << ':' << Scope.getFilename() << ':'; -    OS << DLT.Line << ":" << DLT.Col; +      OS << Scope.getFilename(); +    else +      OS << "<unknown>"; +    OS << ':' << DLT.Line; +    if (DLT.Col != 0) +      OS << ':' << DLT.Col;    }    OS << "\n";  | 
