forked from OSchip/llvm-project
Add a convenient operation build method for spirv::SelectOp
The SelectOp always has the same result type as its true/false value. Add a builder method that uses the operand type to get the result type. PiperOrigin-RevId: 277217978
This commit is contained in:
parent
ca2538e9a7
commit
61225d678e
|
@ -858,6 +858,10 @@ def SPV_SelectOp : SPV_Op<"Select", [NoSideEffect]> {
|
|||
let results = (outs
|
||||
SPV_SelectType:$result
|
||||
);
|
||||
|
||||
let builders = [OpBuilder<[{Builder *builder, OperationState &state,
|
||||
Value *cond, Value *trueValue,
|
||||
Value *falseValue}]>];
|
||||
}
|
||||
|
||||
// -----
|
||||
|
|
|
@ -1844,6 +1844,11 @@ static LogicalResult verify(spirv::ReturnValueOp retValOp) {
|
|||
// spv.Select
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void spirv::SelectOp::build(Builder *builder, OperationState &state,
|
||||
Value *cond, Value *trueValue, Value *falseValue) {
|
||||
build(builder, state, trueValue->getType(), cond, trueValue, falseValue);
|
||||
}
|
||||
|
||||
static ParseResult parseSelectOp(OpAsmParser &parser, OperationState &state) {
|
||||
OpAsmParser::OperandType condition;
|
||||
SmallVector<OpAsmParser::OperandType, 2> operands;
|
||||
|
|
Loading…
Reference in New Issue