Index: include/llvm/CodeGen/MachineMemOperand.h =================================================================== --- include/llvm/CodeGen/MachineMemOperand.h +++ include/llvm/CodeGen/MachineMemOperand.h @@ -109,6 +109,9 @@ /// Return a MachinePointerInfo record that refers to a GOT entry. static MachinePointerInfo getGOT(MachineFunction &MF); + /// Return a MachinePointerInfo record that refers to floating-point status. + static MachinePointerInfo getFPStatus(MachineFunction &MF); + /// Stack pointer relative access. static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID = 0); Index: include/llvm/CodeGen/PseudoSourceValue.h =================================================================== --- include/llvm/CodeGen/PseudoSourceValue.h +++ include/llvm/CodeGen/PseudoSourceValue.h @@ -41,6 +41,7 @@ GOT, JumpTable, ConstantPool, + FPStatus, FixedStack, GlobalValueCallEntry, ExternalSymbolCallEntry, @@ -70,6 +71,7 @@ bool isGOT() const { return Kind == GOT; } bool isConstantPool() const { return Kind == ConstantPool; } bool isJumpTable() const { return Kind == JumpTable; } + bool isFPStatus() const { return Kind == FPStatus; } unsigned getAddressSpace() const { return AddressSpace; } @@ -156,7 +158,8 @@ /// Manages creation of pseudo source values. class PseudoSourceValueManager { const TargetInstrInfo &TII; - const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV; + const PseudoSourceValue StackPSV, GOTPSV, JumpTablePSV, ConstantPoolPSV, + FPStatusPSV; std::map> FSValues; StringMap> ExternalCallEntries; @@ -184,6 +187,11 @@ /// are constant, this doesn't need to identify a specific jump table. const PseudoSourceValue *getJumpTable(); + /// Return a pseudo source value referencing target floating-point status + /// (e.g. exception status flags). This is represented as a "memory" object + /// even if a target may actually hold this status in a special register. + const PseudoSourceValue *getFPStatus(); + /// Return a pseudo source value referencing a fixed stack frame entry, /// e.g., a spill slot. const PseudoSourceValue *getFixedStack(int FI); Index: lib/CodeGen/MIRParser/MILexer.h =================================================================== --- lib/CodeGen/MIRParser/MILexer.h +++ lib/CodeGen/MIRParser/MILexer.h @@ -108,6 +108,7 @@ kw_got, kw_jump_table, kw_constant_pool, + kw_fp_status, kw_call_entry, kw_liveout, kw_address_taken, Index: lib/CodeGen/MIRParser/MILexer.cpp =================================================================== --- lib/CodeGen/MIRParser/MILexer.cpp +++ lib/CodeGen/MIRParser/MILexer.cpp @@ -240,6 +240,7 @@ .Case("got", MIToken::kw_got) .Case("jump-table", MIToken::kw_jump_table) .Case("constant-pool", MIToken::kw_constant_pool) + .Case("fp-status", MIToken::kw_fp_status) .Case("call-entry", MIToken::kw_call_entry) .Case("liveout", MIToken::kw_liveout) .Case("address-taken", MIToken::kw_address_taken) Index: lib/CodeGen/MIRParser/MIParser.cpp =================================================================== --- lib/CodeGen/MIRParser/MIParser.cpp +++ lib/CodeGen/MIRParser/MIParser.cpp @@ -2350,6 +2350,9 @@ case MIToken::kw_constant_pool: PSV = MF.getPSVManager().getConstantPool(); break; + case MIToken::kw_fp_status: + PSV = MF.getPSVManager().getFPStatus(); + break; case MIToken::FixedStackObject: { int FI; if (parseFixedStackFrameIndex(FI)) Index: lib/CodeGen/MachineOperand.cpp =================================================================== --- lib/CodeGen/MachineOperand.cpp +++ lib/CodeGen/MachineOperand.cpp @@ -968,6 +968,10 @@ return MachinePointerInfo(MF.getPSVManager().getGOT()); } +MachinePointerInfo MachinePointerInfo::getFPStatus(MachineFunction &MF) { + return MachinePointerInfo(MF.getPSVManager().getFPStatus()); +} + MachinePointerInfo MachinePointerInfo::getStack(MachineFunction &MF, int64_t Offset, uint8_t ID) { return MachinePointerInfo(MF.getPSVManager().getStack(), Offset, ID); @@ -1103,6 +1107,9 @@ case PseudoSourceValue::ConstantPool: OS << "constant-pool"; break; + case PseudoSourceValue::FPStatus: + OS << "fp-status"; + break; case PseudoSourceValue::FixedStack: { int FrameIndex = cast(PVal)->getFrameIndex(); bool IsFixed = true; Index: lib/CodeGen/PseudoSourceValue.cpp =================================================================== --- lib/CodeGen/PseudoSourceValue.cpp +++ lib/CodeGen/PseudoSourceValue.cpp @@ -22,7 +22,7 @@ using namespace llvm; static const char *const PSVNames[] = { - "Stack", "GOT", "JumpTable", "ConstantPool", "FixedStack", + "Stack", "GOT", "JumpTable", "ConstantPool", "FPStatus", "FixedStack", "GlobalValueCallEntry", "ExternalSymbolCallEntry"}; PseudoSourceValue::PseudoSourceValue(unsigned Kind, const TargetInstrInfo &TII) @@ -41,7 +41,7 @@ } bool PseudoSourceValue::isConstant(const MachineFrameInfo *) const { - if (isStack()) + if (isStack() || isFPStatus()) return false; if (isGOT() || isConstantPool() || isJumpTable()) return true; @@ -49,7 +49,7 @@ } bool PseudoSourceValue::isAliased(const MachineFrameInfo *) const { - if (isStack() || isGOT() || isConstantPool() || isJumpTable()) + if (isStack() || isGOT() || isConstantPool() || isJumpTable() || isFPStatus()) return false; llvm_unreachable("Unknown PseudoSourceValue!"); } @@ -110,7 +110,8 @@ StackPSV(PseudoSourceValue::Stack, TII), GOTPSV(PseudoSourceValue::GOT, TII), JumpTablePSV(PseudoSourceValue::JumpTable, TII), - ConstantPoolPSV(PseudoSourceValue::ConstantPool, TII) {} + ConstantPoolPSV(PseudoSourceValue::ConstantPool, TII), + FPStatusPSV(PseudoSourceValue::FPStatus, TII) {} const PseudoSourceValue *PseudoSourceValueManager::getStack() { return &StackPSV; @@ -126,6 +127,10 @@ return &JumpTablePSV; } +const PseudoSourceValue *PseudoSourceValueManager::getFPStatus() { + return &FPStatusPSV; +} + const PseudoSourceValue * PseudoSourceValueManager::getFixedStack(int FI) { std::unique_ptr &V = FSValues[FI]; Index: lib/Target/AMDGPU/R600InstrInfo.cpp =================================================================== --- lib/Target/AMDGPU/R600InstrInfo.cpp +++ lib/Target/AMDGPU/R600InstrInfo.cpp @@ -1508,6 +1508,7 @@ case PseudoSourceValue::ConstantPool: case PseudoSourceValue::GOT: case PseudoSourceValue::JumpTable: + case PseudoSourceValue::FPStatus: case PseudoSourceValue::GlobalValueCallEntry: case PseudoSourceValue::ExternalSymbolCallEntry: case PseudoSourceValue::TargetCustom: Index: lib/Target/AMDGPU/SIInstrInfo.cpp =================================================================== --- lib/Target/AMDGPU/SIInstrInfo.cpp +++ lib/Target/AMDGPU/SIInstrInfo.cpp @@ -1946,6 +1946,7 @@ case PseudoSourceValue::ConstantPool: case PseudoSourceValue::GOT: case PseudoSourceValue::JumpTable: + case PseudoSourceValue::FPStatus: case PseudoSourceValue::GlobalValueCallEntry: case PseudoSourceValue::ExternalSymbolCallEntry: case PseudoSourceValue::TargetCustom: