Skip to content

Commit

Permalink
[DirectX] Revert specialized createOp methods part of #101250
Browse files Browse the repository at this point in the history
In 8cf8565 "[DirectX] Make DXILOpBuilder's API more useable" we introduced
specialized createOp methods for each DirectX op for convenience, but the API
is buggy and untested. It also isn't actually as useful as I imagined it would
be since we don't have argument names or const-ness represented in DXIL.td
currently. Remove these methods for now and we can reintroduce them if we
actually need them later.

Pull Request: #104245
  • Loading branch information
bogner authored Aug 16, 2024
1 parent 1aa8a6f commit 71d54fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Target/DirectX/DXILOpBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Expected<CallInst *> DXILOpBuilder::tryCreateOp(dxil::OpCode OpCode,
return B.CreateCall(DXILFn, OpArgs);
}

CallInst *DXILOpBuilder::createOp(dxil::OpCode OpCode, ArrayRef<Value *> &Args,
CallInst *DXILOpBuilder::createOp(dxil::OpCode OpCode, ArrayRef<Value *> Args,
Type *RetTy) {
Expected<CallInst *> Result = tryCreateOp(OpCode, Args, RetTy);
if (Error E = Result.takeError())
Expand Down
14 changes: 1 addition & 13 deletions llvm/lib/Target/DirectX/DXILOpBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,13 @@ class DXILOpBuilder {

/// Create a call instruction for the given DXIL op. The arguments
/// must be valid for an overload of the operation.
CallInst *createOp(dxil::OpCode Op, ArrayRef<Value *> &Args,
CallInst *createOp(dxil::OpCode Op, ArrayRef<Value *> Args,
Type *RetTy = nullptr);

#define DXIL_OPCODE(Op, Name) \
CallInst *create##Name##Op(ArrayRef<Value *> &Args, Type *RetTy = nullptr) { \
return createOp(dxil::OpCode(Op), Args, RetTy); \
}
#include "DXILOperation.inc"

/// Try to create a call instruction for the given DXIL op. Fails if the
/// overload is invalid.
Expected<CallInst *> tryCreateOp(dxil::OpCode Op, ArrayRef<Value *> Args,
Type *RetTy = nullptr);
#define DXIL_OPCODE(Op, Name) \
Expected<CallInst *> tryCreate##Name##Op(ArrayRef<Value *> &Args, \
Type *RetTy = nullptr) { \
return tryCreateOp(dxil::OpCode(Op), Args, RetTy); \
}
#include "DXILOperation.inc"

/// Return the name of the given opcode.
static const char *getOpCodeName(dxil::OpCode DXILOp);
Expand Down

0 comments on commit 71d54fa

Please sign in to comment.