mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Moved Cast from being a Unary instruction to being an "Other" instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -55,12 +55,10 @@ public:
|
||||
// create() - Construct a unary instruction, given the opcode
|
||||
// and its operand.
|
||||
//
|
||||
static UnaryOperator *create(UnaryOps Op, Value *Source,
|
||||
const Type *DestTy = 0);
|
||||
static UnaryOperator *create(UnaryOps Op, Value *Source);
|
||||
|
||||
UnaryOperator(Value *S, UnaryOps iType, const Type *ResultType,
|
||||
const string &Name = "")
|
||||
: Instruction(ResultType, iType, Name) {
|
||||
UnaryOperator(Value *S, UnaryOps iType, const string &Name = "")
|
||||
: Instruction(S->getType(), iType, Name) {
|
||||
Operands.reserve(1);
|
||||
Operands.push_back(Use(S, this));
|
||||
}
|
||||
|
@@ -78,7 +78,6 @@ public:
|
||||
enum UnaryOps {
|
||||
FirstUnaryOp = NumTermOps,
|
||||
Not = NumTermOps, // Binary inverse
|
||||
Cast, // Type cast...
|
||||
|
||||
NumUnaryOps // Must remain at end of enum
|
||||
};
|
||||
@@ -112,6 +111,7 @@ public:
|
||||
enum OtherOps {
|
||||
FirstOtherOp = NumMemoryOps,
|
||||
PHINode = NumMemoryOps, // PHI node instruction
|
||||
Cast, // Type cast...
|
||||
Call, // Call a function
|
||||
|
||||
Shl, Shr, // Shift operations...
|
||||
|
@@ -15,9 +15,8 @@
|
||||
//
|
||||
class GenericUnaryInst : public UnaryOperator {
|
||||
public:
|
||||
GenericUnaryInst(UnaryOps Opcode, Value *S1, const Type *ResultTy = 0,
|
||||
const string &Name = "")
|
||||
: UnaryOperator(S1, Opcode, ResultTy, Name) {
|
||||
GenericUnaryInst(UnaryOps Opcode, Value *S1, const string &Name = "")
|
||||
: UnaryOperator(S1, Opcode, Name) {
|
||||
}
|
||||
|
||||
virtual const char *getOpcodeName() const;
|
||||
|
@@ -12,6 +12,30 @@
|
||||
#include "llvm/Method.h"
|
||||
#include <vector>
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CastInst Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CastInst - This function represents a cast from Operand[0] to the type of
|
||||
// the instruction (i->getType()).
|
||||
//
|
||||
class CastInst : public Instruction {
|
||||
CastInst(const CastInst &CI) : Instruction(CI.getType(), Cast) {
|
||||
Operands.reserve(1);
|
||||
Operands.push_back(Use((Value*)CI.getOperand(0), this));
|
||||
}
|
||||
public:
|
||||
CastInst(Value *S, const Type *Ty, const string &Name = "")
|
||||
: Instruction(Ty, Cast, Name) {
|
||||
Operands.reserve(1);
|
||||
Operands.push_back(Use(S, this));
|
||||
}
|
||||
|
||||
virtual Instruction *clone() const { return new CastInst(*this); }
|
||||
virtual const char *getOpcodeName() const { return "cast"; }
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PHINode Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user