Skip to content

Commit 0139af3

Browse files
committed
Revert r237579, as it broke windows buildbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237583 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1467a41 commit 0139af3

15 files changed

+24
-963
lines changed

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4054,9 +4054,10 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
40544054
case Intrinsic::write_register: {
40554055
Value *Reg = I.getArgOperand(0);
40564056
Value *RegValue = I.getArgOperand(1);
4057+
SDValue Chain = getValue(RegValue).getOperand(0);
40574058
SDValue RegName =
40584059
DAG.getMDNode(cast<MDNode>(cast<MetadataAsValue>(Reg)->getMetadata()));
4059-
DAG.setRoot(DAG.getNode(ISD::WRITE_REGISTER, sdl, MVT::Other, getRoot(),
4060+
DAG.setRoot(DAG.getNode(ISD::WRITE_REGISTER, sdl, MVT::Other, Chain,
40604061
RegName, getValue(RegValue)));
40614062
return nullptr;
40624063
}

lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ class AArch64DAGToDAGISel : public SelectionDAGISel {
156156

157157
SDNode *SelectLIBM(SDNode *N);
158158

159-
SDNode *SelectReadRegister(SDNode *N);
160-
SDNode *SelectWriteRegister(SDNode *N);
161-
162159
// Include the pieces autogenerated from the target description.
163160
#include "AArch64GenDAGISel.inc"
164161

@@ -2117,115 +2114,6 @@ AArch64DAGToDAGISel::SelectCVTFixedPosOperand(SDValue N, SDValue &FixedPos,
21172114
return true;
21182115
}
21192116

2120-
// Inspects a register string of the form o0:op1:CRn:CRm:op2 gets the fields
2121-
// of the string and obtains the integer values from them and combines these
2122-
// into a single value to be used in the MRS/MSR instruction.
2123-
static int getIntOperandFromRegisterString(StringRef RegString) {
2124-
SmallVector<StringRef, 5> Fields;
2125-
RegString.split(Fields, ":");
2126-
2127-
if (Fields.size() == 1)
2128-
return -1;
2129-
2130-
assert(Fields.size() == 5
2131-
&& "Invalid number of fields in read register string");
2132-
2133-
SmallVector<int, 5> Ops;
2134-
bool AllIntFields = true;
2135-
2136-
for (StringRef Field : Fields) {
2137-
unsigned IntField;
2138-
AllIntFields &= !Field.getAsInteger(10, IntField);
2139-
Ops.push_back(IntField);
2140-
}
2141-
2142-
assert(AllIntFields &&
2143-
"Unexpected non-integer value in special register string.");
2144-
2145-
// Need to combine the integer fields of the string into a single value
2146-
// based on the bit encoding of MRS/MSR instruction.
2147-
return (Ops[0] << 14) | (Ops[1] << 11) | (Ops[2] << 7) |
2148-
(Ops[3] << 3) | (Ops[4]);
2149-
}
2150-
2151-
// Lower the read_register intrinsic to an MRS instruction node if the special
2152-
// register string argument is either of the form detailed in the ALCE (the
2153-
// form described in getIntOperandsFromRegsterString) or is a named register
2154-
// known by the MRS SysReg mapper.
2155-
SDNode *AArch64DAGToDAGISel::SelectReadRegister(SDNode *N) {
2156-
const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(N->getOperand(0));
2157-
const MDString *RegString = dyn_cast<MDString>(MD->getMD()->getOperand(0));
2158-
SDLoc DL(N);
2159-
2160-
int Reg = getIntOperandFromRegisterString(RegString->getString());
2161-
if (Reg != -1)
2162-
return CurDAG->getMachineNode(AArch64::MRS, DL, N->getSimpleValueType(0),
2163-
CurDAG->getTargetConstant(Reg, DL, MVT::i32));
2164-
2165-
// Use the sysreg mapper to map the remaining possible strings to the
2166-
// value for the register to be used for the instruction operand.
2167-
AArch64SysReg::MRSMapper mapper;
2168-
bool IsValidSpecialReg;
2169-
Reg = mapper.fromString(RegString->getString(),
2170-
Subtarget->getFeatureBits(),
2171-
IsValidSpecialReg);
2172-
if (IsValidSpecialReg)
2173-
return CurDAG->getMachineNode(AArch64::MRS, DL, N->getSimpleValueType(0),
2174-
CurDAG->getTargetConstant(Reg, DL, MVT::i32));
2175-
return nullptr;
2176-
}
2177-
2178-
// Lower the write_register intrinsic to an MSR instruction node if the special
2179-
// register string argument is either of the form detailed in the ALCE (the
2180-
// form described in getIntOperandsFromRegsterString) or is a named register
2181-
// known by the MSR SysReg mapper.
2182-
SDNode *AArch64DAGToDAGISel::SelectWriteRegister(SDNode *N) {
2183-
const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(N->getOperand(1));
2184-
const MDString *RegString = dyn_cast<MDString>(MD->getMD()->getOperand(0));
2185-
SDLoc DL(N);
2186-
2187-
int Reg = getIntOperandFromRegisterString(RegString->getString());
2188-
if (Reg != -1)
2189-
return CurDAG->getMachineNode(AArch64::MSR, DL, MVT::Other,
2190-
CurDAG->getTargetConstant(Reg, DL, MVT::i32),
2191-
N->getOperand(2), N->getOperand(0));
2192-
2193-
// Check if the register was one of those allowed as the pstatefield value in
2194-
// the MSR (immediate) instruction. To accept the values allowed in the
2195-
// pstatefield for the MSR (immediate) instruction, we also require that an
2196-
// immediate value has been provided as an argument, we know that this is
2197-
// the case as it has been ensured by semantic checking.
2198-
AArch64PState::PStateMapper PMapper;
2199-
bool IsValidSpecialReg;
2200-
Reg = PMapper.fromString(RegString->getString(),
2201-
Subtarget->getFeatureBits(),
2202-
IsValidSpecialReg);
2203-
if (IsValidSpecialReg) {
2204-
assert (isa<ConstantSDNode>(N->getOperand(2))
2205-
&& "Expected a constant integer expression.");
2206-
uint64_t Immed = cast<ConstantSDNode>(N->getOperand(2))->getZExtValue();
2207-
return CurDAG->getMachineNode(AArch64::MSRpstate, DL, MVT::Other,
2208-
CurDAG->getTargetConstant(Reg, DL, MVT::i32),
2209-
CurDAG->getTargetConstant(Immed, DL, MVT::i16),
2210-
N->getOperand(0));
2211-
}
2212-
2213-
// Use the sysreg mapper to attempt to map the remaining possible strings
2214-
// to the value for the register to be used for the MSR (register)
2215-
// instruction operand.
2216-
AArch64SysReg::MSRMapper Mapper;
2217-
Reg = Mapper.fromString(RegString->getString(),
2218-
Subtarget->getFeatureBits(),
2219-
IsValidSpecialReg);
2220-
2221-
if (IsValidSpecialReg)
2222-
return CurDAG->getMachineNode(AArch64::MSR, DL, MVT::Other,
2223-
CurDAG->getTargetConstant(Reg, DL, MVT::i32),
2224-
N->getOperand(2), N->getOperand(0));
2225-
2226-
return nullptr;
2227-
}
2228-
22292117
SDNode *AArch64DAGToDAGISel::Select(SDNode *Node) {
22302118
// Dump information about the Node being selected
22312119
DEBUG(errs() << "Selecting: ");
@@ -2247,16 +2135,6 @@ SDNode *AArch64DAGToDAGISel::Select(SDNode *Node) {
22472135
default:
22482136
break;
22492137

2250-
case ISD::READ_REGISTER:
2251-
if (SDNode *Res = SelectReadRegister(Node))
2252-
return Res;
2253-
break;
2254-
2255-
case ISD::WRITE_REGISTER:
2256-
if (SDNode *Res = SelectWriteRegister(Node))
2257-
return Res;
2258-
break;
2259-
22602138
case ISD::ADD:
22612139
if (SDNode *I = SelectMLAV64LaneV128(Node))
22622140
return I;

lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,8 +4064,7 @@ unsigned AArch64TargetLowering::getRegisterByName(const char* RegName,
40644064
.Default(0);
40654065
if (Reg)
40664066
return Reg;
4067-
report_fatal_error(Twine("Invalid register name \""
4068-
+ StringRef(RegName) + "\"."));
4067+
report_fatal_error("Invalid register name global variable");
40694068
}
40704069

40714070
SDValue AArch64TargetLowering::LowerRETURNADDR(SDValue Op,

0 commit comments

Comments
 (0)