[llvm-commits] [hlvm] r38415 - in /hlvm/trunk: Makefile hlvm/AST/AST.cpp hlvm/AST/MemoryOps.cpp hlvm/AST/MemoryOps.h hlvm/AST/Operator.cpp hlvm/AST/Operator.h hlvm/AST/Type.h hlvm/Base/Source.cpp hlvm/CodeGen/LLVMEmitter.cpp hlvm/CodeGen/LLVMEmitter.h hlvm/CodeGen/LLVMGenerator.cpp hlvm/Runtime/hlvm_get_programs.ll tools/hlvm-compiler/SConscript tools/hlvm-config/hlvm-config.cpp
Reid Spencer
reid at x10sys.com
Sat Jul 7 17:03:10 PDT 2007
Author: reid
Date: Sat Jul 7 19:03:10 2007
New Revision: 38415
URL: http://llvm.org/viewvc/llvm-project?rev=38415&view=rev
Log:
Changes necessary to get HLVM compiling with a pre-release of LLVM 2.0
and a few other odds'n'ends. No guarantees as to whether this works or
not. That's the next step.
Modified:
hlvm/trunk/Makefile
hlvm/trunk/hlvm/AST/AST.cpp
hlvm/trunk/hlvm/AST/MemoryOps.cpp
hlvm/trunk/hlvm/AST/MemoryOps.h
hlvm/trunk/hlvm/AST/Operator.cpp
hlvm/trunk/hlvm/AST/Operator.h
hlvm/trunk/hlvm/AST/Type.h
hlvm/trunk/hlvm/Base/Source.cpp
hlvm/trunk/hlvm/CodeGen/LLVMEmitter.cpp
hlvm/trunk/hlvm/CodeGen/LLVMEmitter.h
hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp
hlvm/trunk/hlvm/Runtime/hlvm_get_programs.ll
hlvm/trunk/tools/hlvm-compiler/SConscript
hlvm/trunk/tools/hlvm-config/hlvm-config.cpp
Modified: hlvm/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/Makefile?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/Makefile (original)
+++ hlvm/trunk/Makefile Sat Jul 7 19:03:10 2007
@@ -73,6 +73,9 @@
tools:
cd tools ; scons $(SCONSOPTS) -u mode=$(MYMODE)
+codegen:
+ cd hlvm/CodeGen ; scons $(SCONSOPTS) -u mode=$(MYMODE)
+
dist: exclusions
tar jcf hlvm-0.1-tar.bz2 -C .. --exclude-from exclusions hlvm
Modified: hlvm/trunk/hlvm/AST/AST.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/AST.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/AST.cpp (original)
+++ hlvm/trunk/hlvm/AST/AST.cpp Sat Jul 7 19:03:10 2007
@@ -200,7 +200,7 @@
uint32_t exponent,
const Locator* loc)
{
- RealType* result = new RealType(RealTypeID);
+ RealType* result = new RealType();
result->setMantissa(mantissa);
result->setExponent(exponent);
result->setLocator(loc);
@@ -963,24 +963,40 @@
template PreIncrOp*
AST::new_UnaryOp<PreIncrOp>(
const Type* Ty, Operator* op1, const Locator* loc);
-template PreIncrOp*
-AST::new_UnaryOp<PreIncrOp>(Operator* op1, Bundle* B, const Locator* loc);
+template<> PreIncrOp*
+AST::new_UnaryOp<PreIncrOp>(Operator* op1, Bundle* B, const Locator* loc)
+{
+ const Type* Ty = llvm::cast<GetOp>(op1)->getReferentType();
+ return new_UnaryOp<PreIncrOp>(Ty,op1,loc);
+}
template PreDecrOp*
AST::new_UnaryOp<PreDecrOp>(
const Type* Ty, Operator* op1, const Locator* loc);
-template PreDecrOp*
-AST::new_UnaryOp<PreDecrOp>(Operator* op1, Bundle* B, const Locator* loc);
+template<> PreDecrOp*
+AST::new_UnaryOp<PreDecrOp>(Operator* op1, Bundle* B, const Locator* loc)
+{
+ const Type* Ty = llvm::cast<GetOp>(op1)->getReferentType();
+ return new_UnaryOp<PreDecrOp>(Ty,op1,loc);
+}
template PostIncrOp*
AST::new_UnaryOp<PostIncrOp>(const Type* Ty, Operator* op1, const Locator* loc);
-template PostIncrOp*
-AST::new_UnaryOp<PostIncrOp>(Operator* op1, Bundle* B, const Locator* loc);
+template<> PostIncrOp*
+AST::new_UnaryOp<PostIncrOp>(Operator* op1, Bundle* B, const Locator* loc)
+{
+ const Type* Ty = llvm::cast<GetOp>(op1)->getReferentType();
+ return new_UnaryOp<PostIncrOp>(Ty,op1,loc);
+}
template PostDecrOp*
AST::new_UnaryOp<PostDecrOp>(const Type* Ty, Operator* op1, const Locator* loc);
-template PostDecrOp*
-AST::new_UnaryOp<PostDecrOp>(Operator* op1, Bundle* B, const Locator* loc);
+template<> PostDecrOp*
+AST::new_UnaryOp<PostDecrOp>(Operator* op1, Bundle* B, const Locator* loc)
+{
+ const Type* Ty = llvm::cast<GetOp>(op1)->getReferentType();
+ return new_UnaryOp<PostDecrOp>(Ty,op1,loc);
+}
template SizeOfOp*
AST::new_UnaryOp<SizeOfOp>(const Type* Ty, Operator* op1, const Locator* loc);
@@ -1348,8 +1364,13 @@
template CallOp*
AST::new_MultiOp<CallOp>(const Type*Ty, const std::vector<Operator*>& ops, const Locator*loc);
-template CallOp*
-AST::new_MultiOp<CallOp>(const std::vector<Operator*>& ops, Bundle* B,const Locator* loc);
+template<> CallOp*
+AST::new_MultiOp<CallOp>(const std::vector<Operator*>& ops, Bundle* B,const Locator* loc)
+{
+ GetOp* get = llvm::cast<GetOp>(ops[0]);
+ const Function* F = llvm::cast<Function>(get->getReferent());
+ return new_MultiOp<CallOp>(F->getResultType(),ops,loc);
+}
// Memory Operators
template StoreOp*
@@ -1359,8 +1380,12 @@
template LoadOp*
AST::new_UnaryOp<LoadOp>(const Type* Ty, Operator*op1,const Locator*loc);
-template LoadOp*
-AST::new_UnaryOp<LoadOp>(Operator*op1,Bundle* B, const Locator*loc);
+template<> LoadOp*
+AST::new_UnaryOp<LoadOp>(Operator*op1,Bundle* B, const Locator*loc)
+{
+ const PointerType* PT = llvm::cast<PointerType>(op1->getType());
+ return new_UnaryOp<LoadOp>(PT->getElementType(),op1,loc);
+}
// Input/Output Operators
template OpenOp*
Modified: hlvm/trunk/hlvm/AST/MemoryOps.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/MemoryOps.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/MemoryOps.cpp (original)
+++ hlvm/trunk/hlvm/AST/MemoryOps.cpp Sat Jul 7 19:03:10 2007
@@ -29,6 +29,8 @@
#include <hlvm/AST/MemoryOps.h>
#include <hlvm/AST/ContainerType.h>
+#include <hlvm/AST/Linkables.h>
+#include <hlvm/AST/Constants.h>
#include <llvm/Support/Casting.h>
namespace hlvm {
@@ -36,8 +38,26 @@
LoadOp::~LoadOp() {}
StoreOp::~StoreOp() {}
AutoVarOp::~AutoVarOp() {}
+
GetOp::~GetOp() {}
+
+const Type*
+GetOp::getReferentType() const
+{
+ const Value* ref = getReferent();
+ if (const AutoVarOp* avo = llvm::dyn_cast<AutoVarOp>(ref))
+ return avo->getType();
+ else if (const Variable* var = llvm::dyn_cast<Variable>(ref))
+ return var->getType();
+ else if (const Function* func = llvm::dyn_cast<Function>(ref))
+ return func->getResultType();
+ else if (const Constant* cnst = llvm::dyn_cast<Constant>(ref))
+ return cnst->getType();
+ return ref->getType();
+}
+
GetFieldOp::~GetFieldOp() {}
+
const Type*
GetFieldOp::getFieldType() const
{
@@ -48,6 +68,7 @@
}
GetIndexOp::~GetIndexOp() {}
+
const Type*
GetIndexOp::getIndexedType() const
{
Modified: hlvm/trunk/hlvm/AST/MemoryOps.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/MemoryOps.h?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/MemoryOps.h (original)
+++ hlvm/trunk/hlvm/AST/MemoryOps.h Sat Jul 7 19:03:10 2007
@@ -117,15 +117,6 @@
static inline bool classof(const Node* N) { return N->is(LoadOpID); }
/// @}
- /// @name Mutators
- /// @{
- public:
-
- /// @}
- /// @name Data
- /// @{
- protected:
- /// @}
friend class AST;
};
@@ -150,15 +141,6 @@
static inline bool classof(const Node* N) { return N->is(StoreOpID); }
/// @}
- /// @name Mutators
- /// @{
- public:
-
- /// @}
- /// @name Data
- /// @{
- protected:
- /// @}
friend class AST;
};
@@ -230,6 +212,7 @@
/// @name Accessors
/// @{
public:
+ const Type* getReferentType() const;
const Value* getReferent() const { return referent; }
static inline bool classof(const GetOp*) { return true; }
static inline bool classof(const Node* N) {
Modified: hlvm/trunk/hlvm/AST/Operator.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.cpp (original)
+++ hlvm/trunk/hlvm/AST/Operator.cpp Sat Jul 7 19:03:10 2007
@@ -31,6 +31,7 @@
#include <hlvm/AST/Linkables.h>
#include <hlvm/AST/Bundle.h>
#include <hlvm/AST/ControlFlow.h>
+#include <hlvm/AST/MemoryOps.h>
#include <hlvm/Base/Assert.h>
#include <llvm/Support/Casting.h>
Modified: hlvm/trunk/hlvm/AST/Operator.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.h?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.h (original)
+++ hlvm/trunk/hlvm/AST/Operator.h Sat Jul 7 19:03:10 2007
@@ -66,8 +66,10 @@
/// @name Accessors
/// @{
public:
- /// Get a specific operand of this operator.
+ /// Get the number of operands in this operator
virtual size_t getNumOperands() const = 0;
+
+ /// Get a specific operand of this operator.
virtual Operator* getOperand(unsigned opnum) const = 0;
/// Return the function containing this operator
Modified: hlvm/trunk/hlvm/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Type.h?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Type.h (original)
+++ hlvm/trunk/hlvm/AST/Type.h Sat Jul 7 19:03:10 2007
@@ -66,6 +66,9 @@
virtual const char* getPrimitiveName() const;
bool isPrimitive() const { return getPrimitiveName() != 0; }
+ /// @brief Return the signedness of this type (integers)
+ bool isSigned() const { return flags & SignedTF; }
+
/// @}
/// @name Mutators
/// @{
@@ -267,9 +270,6 @@
/// @brief Return the number of bits in this integer type
uint16_t getBits() const { return bits; }
- /// @brief Return the signedness of this type
- bool isSigned() const { return flags & SignedTF; }
-
/// @brief Methods to support type inquiry via isa, cast, dyn_cast
static inline bool classof(const IntegerType*) { return true; }
static inline bool classof(const Node* T) { return T->is(IntegerTypeID); }
@@ -289,7 +289,7 @@
/// @name Data
/// @{
public:
- uint16_t bits;
+ uint32_t bits;
/// @}
friend class AST;
};
Modified: hlvm/trunk/hlvm/Base/Source.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Base/Source.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Base/Source.cpp (original)
+++ hlvm/trunk/hlvm/Base/Source.cpp Sat Jul 7 19:03:10 2007
@@ -191,7 +191,8 @@
, mf_(0)
, mfs_(0)
{
- mf_ = new llvm::sys::MappedFile(llvm::sys::Path(uri_->resolveToFile()));
+ mf_ = new llvm::sys::MappedFile();
+ mf_->open(llvm::sys::Path(uri_->resolveToFile()));
mfs_ = new MappedFileSource(*mf_);
}
virtual ~URISource() {}
Modified: hlvm/trunk/hlvm/CodeGen/LLVMEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/LLVMEmitter.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/CodeGen/LLVMEmitter.cpp (original)
+++ hlvm/trunk/hlvm/CodeGen/LLVMEmitter.cpp Sat Jul 7 19:03:10 2007
@@ -127,7 +127,7 @@
/// @name Methods
/// @{
public:
- Type* get_hlvm_size() { return Type::ULongTy; }
+ const Type* get_hlvm_size() { return Type::Int64Ty; }
PointerType* get_hlvm_text()
{
@@ -135,8 +135,8 @@
// An hlvm_text is a variable length array of signed bytes preceded by
// an
// Arglist args;
- // args.push_back(Type::UIntTy);
- // args.push_back(ArrayType::Get(Type::SByteTy,0));
+ // args.push_back(Type::Int32Ty);
+ // args.push_back(ArrayType::Get(Type::Int8Ty,0));
OpaqueType* opq = OpaqueType::get();
TheModule->addTypeName("hlvm_text_obj", opq);
hlvm_text = PointerType::get(opq);
@@ -150,7 +150,7 @@
if (! hlvm_text_create) {
Type* result = get_hlvm_text();
std::vector<const Type*> arg_types;
- arg_types.push_back(PointerType::get(Type::SByteTy));
+ arg_types.push_back(PointerType::get(Type::Int8Ty));
FunctionType* FT =
FunctionType::get(result,arg_types,false);
TheModule->addTypeName("hlvm_text_create",FT);
@@ -279,7 +279,7 @@
if (!hlvm_stream_open) {
Type* result = get_hlvm_stream();
std::vector<const Type*> arg_types;
- arg_types.push_back(PointerType::get(Type::SByteTy));
+ arg_types.push_back(PointerType::get(Type::Int8Ty));
FunctionType* FT = FunctionType::get(result,arg_types,false);
TheModule->addTypeName("hlvm_stream_open_signature",FT);
hlvm_stream_open =
@@ -298,7 +298,7 @@
Function* get_hlvm_stream_read()
{
if (!hlvm_stream_read) {
- Type* result = get_hlvm_size();
+ const Type* result = get_hlvm_size();
std::vector<const Type*> arg_types;
arg_types.push_back(get_hlvm_stream());
arg_types.push_back(get_hlvm_buffer());
@@ -321,7 +321,7 @@
Function* get_hlvm_stream_write_buffer()
{
if (!hlvm_stream_write_buffer) {
- Type* result = get_hlvm_size();
+ const Type* result = get_hlvm_size();
std::vector<const Type*> arg_types;
arg_types.push_back(get_hlvm_stream());
arg_types.push_back(get_hlvm_buffer());
@@ -343,10 +343,10 @@
Function* get_hlvm_stream_write_string()
{
if (!hlvm_stream_write_string) {
- Type* result = get_hlvm_size();
+ const Type* result = get_hlvm_size();
std::vector<const Type*> arg_types;
arg_types.push_back(get_hlvm_stream());
- arg_types.push_back(PointerType::get(Type::SByteTy));
+ arg_types.push_back(PointerType::get(Type::Int8Ty));
FunctionType* FT = FunctionType::get(result,arg_types,false);
TheModule->addTypeName("hlvm_stream_write_string_signature",FT);
hlvm_stream_write_string =
@@ -365,7 +365,7 @@
Function* get_hlvm_stream_write_text()
{
if (!hlvm_stream_write_text) {
- Type* result = get_hlvm_size();
+ const Type* result = get_hlvm_size();
std::vector<const Type*> arg_types;
arg_types.push_back(get_hlvm_stream());
arg_types.push_back(get_hlvm_text());
@@ -387,7 +387,7 @@
Function* get_hlvm_stream_close()
{
if (!hlvm_stream_close) {
- Type* result = Type::VoidTy;
+ const Type* result = Type::VoidTy;
std::vector<const Type*> arg_types;
arg_types.push_back(get_hlvm_stream());
FunctionType* FT = FunctionType::get(result,arg_types,false);
@@ -410,11 +410,11 @@
if (!hlvm_program_signature) {
// Get the type of function that all entry points must have
std::vector<const Type*> arg_types;
- arg_types.push_back(Type::IntTy);
+ arg_types.push_back(Type::Int32Ty);
arg_types.push_back(
- PointerType::get(PointerType::get(Type::SByteTy)));
+ PointerType::get(PointerType::get(Type::Int8Ty)));
hlvm_program_signature =
- FunctionType::get(Type::IntTy,arg_types,false);
+ FunctionType::get(Type::Int32Ty,arg_types,false);
TheModule->addTypeName("hlvm_program_signature",hlvm_program_signature);
}
return hlvm_program_signature;
@@ -423,10 +423,10 @@
Function* get_llvm_memcpy()
{
if (!llvm_memcpy) {
- const Type *SBP = PointerType::get(Type::SByteTy);
- llvm_memcpy = TheModule->getOrInsertFunction(
- "llvm.memcpy.i64", Type::VoidTy, SBP, SBP, Type::ULongTy,
- Type::UIntTy, NULL);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
+ llvm_memcpy = cast<Function>(TheModule->getOrInsertFunction(
+ "llvm.memcpy.i64", Type::VoidTy, SBP, SBP, Type::Int64Ty,
+ Type::Int32Ty, NULL));
}
return llvm_memcpy;
}
@@ -434,10 +434,10 @@
Function* get_llvm_memmove()
{
if (!llvm_memmove) {
- const Type *SBP = PointerType::get(Type::SByteTy);
- llvm_memmove = TheModule->getOrInsertFunction(
- "llvm.memmove.i64", Type::VoidTy, SBP, SBP, Type::ULongTy,
- Type::UIntTy, NULL);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
+ llvm_memmove = cast<Function>(TheModule->getOrInsertFunction(
+ "llvm.memmove.i64", Type::VoidTy, SBP, SBP, Type::Int64Ty,
+ Type::Int32Ty, NULL));
}
return llvm_memmove;
}
@@ -445,10 +445,10 @@
Function* get_llvm_memset()
{
if (!llvm_memset) {
- const Type *SBP = PointerType::get(Type::SByteTy);
- llvm_memset = TheModule->getOrInsertFunction(
- "llvm.memset.i64", Type::VoidTy, SBP, Type::UByteTy, Type::ULongTy,
- Type::UIntTy, NULL);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
+ llvm_memset = cast<Function>(TheModule->getOrInsertFunction(
+ "llvm.memset.i64", Type::VoidTy, SBP, Type::Int8Ty, Type::Int64Ty,
+ Type::Int32Ty, NULL));
}
return llvm_memset;
}
@@ -1172,7 +1172,7 @@
// terminate the entry block as usual while still retaining a point for
// insertion in the entry block that retains declaration order.
EntryInsertionPoint =
- new CastInst(Constant::getNullValue(Type::IntTy),Type::IntTy,
+ new BitCastInst(Constant::getNullValue(Type::Int32Ty),Type::Int32Ty,
"entry_point", TheEntryBlock);
// Create a new block for the return node, but don't insert it yet.
@@ -1224,19 +1224,18 @@
LLVMEmitter::ConvertToBoolean(Value* V) const
{
const Type* Ty = V->getType();
- if (Ty == Type::BoolTy)
+ if (Ty == Type::Int1Ty)
return V;
if (Ty->isInteger() || Ty->isFloatingPoint()) {
Constant* CI = Constant::getNullValue(V->getType());
- return new SetCondInst(Instruction::SetNE, V, CI, "i2b",
- TheBlock);
+ return new ICmpInst(ICmpInst::ICMP_NE, V, CI, "i2b", TheBlock);
} else if (isa<GlobalValue>(V)) {
// GlobalValues always have non-zero constant address values, so always true
- return ConstantBool::get(true);
+ return ConstantInt::getTrue();
}
hlvmAssert(!"Don't know how to convert V into bool");
- return ConstantBool::get(true);
+ return ConstantInt::getTrue();
}
Value*
@@ -1245,10 +1244,10 @@
if (!isa<PointerType>(V->getType()))
return V;
- // GetElementPtrInst* GEP = new GetElementPtrIns(V,
- // ConstantInt::get(Type::UIntTy,0),
- // ConstantInt::get(Type::UIntTy,0),
- // "ptr2Value", TheBlock);
+ // GetElementPtrInst* GEP = new GetElementPtrIns(V,
+ // ConstantInt::get(Type::Int32Ty,0),
+ // ConstantInt::get(Type::Int32Ty,0),
+ // "ptr2Value", TheBlock);
return new LoadInst(V,"ptr2Value", TheBlock);
}
@@ -1257,10 +1256,12 @@
{
// check signed to unsigned
const Type *VTy = V->getType();
- if (VTy->isLosslesslyConvertibleTo(Ty)) return true;
+ if (VTy->canLosslesslyBitCastTo(Ty))
+ return true;
// Constant int to anything, to work around stuff like: "xor short X, int 1".
- if (isa<ConstantInt>(V)) return true;
+ if (isa<ConstantInt>(V))
+ return true;
return false;
}
@@ -1268,33 +1269,32 @@
/// CastToType - Cast the specified value to the specified type if it is
/// not already that type.
Value *
-LLVMEmitter::CastToType(Value *V, const Type *Ty)
+LLVMEmitter::CastToType(Value *V, bool srcIsSigned, const Type *Ty,
+ bool destIsSigned, const std::string& newName)
{
// If they are the same type, no cast needed
if (V->getType() == Ty)
return V;
+ // Get the opcode necessary for the cast.
+ Instruction::CastOps Opcode =
+ CastInst::getCastOpcode(V, srcIsSigned, Ty, destIsSigned);
+
// If its a constant then we want a constant cast
if (Constant *C = dyn_cast<Constant>(V))
- return ConstantExpr::getCast(C, Ty);
+ return ConstantExpr::getCast(Opcode, C, Ty);
// If its a cast instruction and we're casting back to the original type,
// which is bool, then just get the operand of the cast instead of emitting
// duplicate cast instructions. This is just an optimization of a frequently
// occurring case.
if (CastInst *CI = dyn_cast<CastInst>(V))
- if (Ty == Type::BoolTy && CI->getOperand(0)->getType() == Type::BoolTy)
+ if (Ty == Type::Int1Ty && CI->getOperand(0)->getType() == Type::Int1Ty)
return CI->getOperand(0);
// Otherwise, just issue the cast
- return new CastInst(V, Ty, V->getName(), TheBlock);
-}
-
-Value *
-LLVMEmitter::NoopCastToType(Value *V, const Type *Ty)
-{
- hlvmAssert(IsNoopCast(V, Ty) && "Invalid Noop Cast!");
- return CastToType(V, Ty);
+ return CastInst::create(Opcode, V, Ty,
+ (newName.empty() ? V->getName() : newName), TheBlock);
}
void
@@ -1400,6 +1400,56 @@
return static_cast<LLVMEmitterImpl*>(this)->get_hlvm_program_signature();
}
+llvm::CmpInst* LLVMEmitter::emitNE(llvm::Value* V1, llvm::Value* V2){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_ONE, V1, V2, "ne",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_NE, V1, V2, "ne",TheBlock);
+}
+
+llvm::CmpInst* LLVMEmitter::emitEQ(llvm::Value* V1, llvm::Value* V2){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_OEQ, V1, V2, "eq",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_EQ, V1, V2, "eq",TheBlock);
+}
+
+llvm::CmpInst* LLVMEmitter::emitLT(llvm::Value* V1, llvm::Value* V2, bool sign){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_OLT, V1, V2,"olt",TheBlock);
+ else if (sign)
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_ULT, V1, V2,"ult",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_SLT, V1, V2,"slt",TheBlock);
+}
+
+llvm::CmpInst* LLVMEmitter::emitGT(llvm::Value* V1, llvm::Value* V2, bool sign){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_OGT, V1, V2,"ogt",TheBlock);
+ else if (sign)
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_SGT, V1, V2,"sgt",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_UGT, V1, V2,"ugt",TheBlock);
+}
+
+llvm::CmpInst* LLVMEmitter::emitLE(llvm::Value* V1, llvm::Value* V2, bool sign){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_OLE, V1, V2,"ole",TheBlock);
+ else if (sign)
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_ULE, V1, V2,"ule",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_SLE, V1, V2,"sle",TheBlock);
+}
+
+llvm::CmpInst* LLVMEmitter::emitGE(llvm::Value* V1, llvm::Value* V2, bool sign){
+ if (V1->getType()->isFloatingPoint())
+ return new llvm::FCmpInst(llvm::FCmpInst::FCMP_OGE, V1, V2,"oge",TheBlock);
+ else if (sign)
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_SGE, V1, V2,"sge",TheBlock);
+ else
+ return new llvm::ICmpInst(llvm::ICmpInst::ICMP_UGE, V1, V2,"uge",TheBlock);
+}
+
void
LLVMEmitter::emitAssign(Value* dest, Value* src)
{
@@ -1433,9 +1483,9 @@
emitStore(GEP,dest);
} else {
// they are both first class types and the source is not a pointer, so
- // just cast them
- CastInst* CI = emitCast(src,destTy,src->getName());
- emitStore(CI,dest);
+ // just cast them. FIXME: signedness
+ Value* V = CastToType(src, false, destTy, false, src->getName());
+ emitStore(V, dest);
}
}
else if (const PointerType* srcPT = dyn_cast<PointerType>(srcTy))
@@ -1470,18 +1520,18 @@
Value *V = new LoadInst(SrcPtr, "tmp", SrcVolatile, BB);
new StoreInst(V, DestPtr, DestVolatile, BB);
} else if (const StructType *STy = dyn_cast<StructType>(ElTy)) {
- Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
+ Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
- Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
+ Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx, "tmp", BB);
Value *SElPtr = new GetElementPtrInst(SrcPtr, Zero, Idx, "tmp", BB);
CopyAggregate(DElPtr, DestVolatile, SElPtr, SrcVolatile, BB);
}
} else {
const ArrayType *ATy = cast<ArrayType>(ElTy);
- Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
+ Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
- Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
+ Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx, "tmp", BB);
Value *SElPtr = new GetElementPtrInst(SrcPtr, Zero, Idx, "tmp", BB);
CopyAggregate(DElPtr, DestVolatile, SElPtr, SrcVolatile, BB);
@@ -1534,7 +1584,9 @@
result = emitLoad(retVal,getBlockName() + "_result");
} else if (resultTy != getReturnType()) {
hlvmAssert(resultTy->isFirstClassType());
- result = emitCast(retVal, getReturnType(), getBlockName()+"_result");
+ // FIXME: signedness
+ result = CastToType(retVal, false, getReturnType(), false,
+ getBlockName()+"_result");
} else {
hlvmAssert(resultTy->isFirstClassType());
result = retVal;
@@ -1622,12 +1674,12 @@
Value *size
)
{
- const Type *SBP = PointerType::get(Type::SByteTy);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
ArgList args;
- args.push_back(CastToType(dest, SBP));
- args.push_back(CastToType(src, SBP));
+ args.push_back(CastToType(dest, false, SBP, false, ""));
+ args.push_back(CastToType(src, false, SBP, false, ""));
args.push_back(size);
- args.push_back(ConstantUInt::get(Type::UIntTy, 0));
+ args.push_back(ConstantInt::get(Type::Int32Ty, 0u));
LLVMEmitterImpl* emimp = static_cast<LLVMEmitterImpl*>(this);
new CallInst(emimp->get_llvm_memcpy(), args, "", TheBlock);
}
@@ -1640,12 +1692,12 @@
Value *size
)
{
- const Type *SBP = PointerType::get(Type::SByteTy);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
ArgList args;
- args.push_back(CastToType(dest, SBP));
- args.push_back(CastToType(src, SBP));
+ args.push_back(CastToType(dest, false, SBP, false, ""));
+ args.push_back(CastToType(src, false, SBP, false, ""));
args.push_back(size);
- args.push_back(ConstantUInt::get(Type::UIntTy, 0));
+ args.push_back(ConstantInt::get(Type::Int32Ty, 0u));
LLVMEmitterImpl* emimp = static_cast<LLVMEmitterImpl*>(this);
new CallInst(emimp->get_llvm_memmove(), args, "", TheBlock);
}
@@ -1658,12 +1710,12 @@
Value *size
)
{
- const Type *SBP = PointerType::get(Type::SByteTy);
+ const Type *SBP = PointerType::get(Type::Int8Ty);
ArgList args;
- args.push_back(CastToType(dest, SBP));
- args.push_back(CastToType(val, Type::UByteTy));
+ args.push_back(CastToType(dest, false, SBP, false, ""));
+ args.push_back(CastToType(val, false, Type::Int8Ty, false, ""));
args.push_back(size);
- args.push_back(ConstantUInt::get(Type::UIntTy, 0));
+ args.push_back(ConstantInt::get(Type::Int32Ty, 0u));
LLVMEmitterImpl* emimp = static_cast<LLVMEmitterImpl*>(this);
new CallInst(emimp->get_llvm_memset(), args, "", TheBlock);
}
@@ -1676,15 +1728,15 @@
llvm::dyn_cast<llvm::PointerType>(strm->getType()))
{
const llvm::Type* Ty = PT->getElementType();
- if (Ty == llvm::Type::SByteTy) {
+ if (Ty == llvm::Type::Int8Ty) {
args.push_back(strm);
} else if (llvm::isa<ArrayType>(Ty) &&
- cast<ArrayType>(Ty)->getElementType() == Type::SByteTy) {
+ cast<ArrayType>(Ty)->getElementType() == Type::Int8Ty) {
ArgList indices;
this->TwoZeroIndices(indices);
args.push_back(this->emitGEP(strm,indices));
} else
- hlvmAssert(!"Array element type is not SByteTy");
+ hlvmAssert(!"Array element type is not Int8Ty");
} else
hlvmAssert(!"OpenOp parameter is not a pointer");
@@ -1722,7 +1774,7 @@
CallInst* result = 0;
if (llvm::isa<llvm::PointerType>(arg2->getType()))
if (llvm::cast<llvm::PointerType>(arg2->getType())->getElementType() ==
- llvm::Type::SByteTy)
+ llvm::Type::Int8Ty)
result = emimp->call_hlvm_stream_write_string(args,"write");
if (arg2->getType() == emimp->get_hlvm_text())
result = emimp->call_hlvm_stream_write_text(args,"write");
Modified: hlvm/trunk/hlvm/CodeGen/LLVMEmitter.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/LLVMEmitter.h?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/CodeGen/LLVMEmitter.h (original)
+++ hlvm/trunk/hlvm/CodeGen/LLVMEmitter.h Sat Jul 7 19:03:10 2007
@@ -202,16 +202,14 @@
static bool IsNoopCast(llvm::Value *V, const llvm::Type *Ty);
/// Cast the \p V to \p Ty if it is not already that type.
- llvm::Value *CastToType(llvm::Value *V, const llvm::Type *Ty);
-
- /// Insert a cast of \p V to \p Ty if needed. This checks that
- /// the cast doesn't change any of the values bits.
- llvm::Value *NoopCastToType(llvm::Value *V, const llvm::Type *Ty);
+ llvm::Value *CastToType(llvm::Value *V, bool isSigned,
+ const llvm::Type *Ty, bool isSigned,
+ const std::string& newName);
static void TwoZeroIndices(ArgList& indices) {
indices.clear();
- indices.push_back(llvm::Constant::getNullValue(llvm::Type::UIntTy));
- indices.push_back(llvm::Constant::getNullValue(llvm::Type::UIntTy));
+ indices.push_back(llvm::ConstantInt::getNullValue(llvm::Type::Int32Ty));
+ indices.push_back(llvm::ConstantInt::getNullValue(llvm::Type::Int32Ty));
}
/// Convert a non-first-class type into a first-class type by constructing
@@ -242,13 +240,10 @@
/// @name Simple Value getters
/// @{
public:
- llvm::Constant* getTrue() const { return llvm::ConstantBool::get(true); }
- llvm::Constant* getFalse() const { return llvm::ConstantBool::get(false); }
- llvm::Constant* getSZero() const {
- return llvm::Constant::getNullValue(llvm::Type::IntTy);
- }
- llvm::Constant* getUZero() const {
- return llvm::Constant::getNullValue(llvm::Type::UIntTy);
+ llvm::Constant* getTrue() const { return llvm::ConstantInt::getTrue(); }
+ llvm::Constant* getFalse() const { return llvm::ConstantInt::getFalse(); }
+ llvm::Constant* getZero() const {
+ return llvm::ConstantInt::getNullValue(llvm::Type::Int32Ty);
}
llvm::Constant* getFOne() const {
return llvm::ConstantFP::get(llvm::Type::FloatTy,1.0);
@@ -259,64 +254,37 @@
llvm::Constant* getFPOne(const llvm::Type* Ty) const {
return llvm::ConstantFP::get(Ty,1.0);
}
- llvm::Constant* getSOne() const {
- return llvm::ConstantSInt::get(llvm::Type::IntTy,1);
- }
- llvm::Constant* getUOne() const {
- return llvm::ConstantUInt::get(llvm::Type::UIntTy,1);
- }
- llvm::Constant* getIOne(const llvm::Type* Ty) const {
+ llvm::Constant* getOne(const llvm::Type* Ty) const {
return llvm::ConstantInt::get(Ty,1);
}
llvm::Constant* getSVal(const llvm::Type* Ty, int64_t val) const {
- return llvm::ConstantSInt::get(Ty,val);
+ return llvm::ConstantInt::get(Ty,val);
}
llvm::Constant* getUVal(const llvm::Type* Ty, uint64_t val) const {
- return llvm::ConstantUInt::get(Ty,val);
+ return llvm::ConstantInt::get(Ty,val);
}
llvm::Constant* getNullValue(const llvm::Type* Ty) const {
return llvm::Constant::getNullValue(Ty);
}
llvm::Constant* getAllOnes(const llvm::Type* Ty) const {
- return llvm::ConstantIntegral::getAllOnesValue(Ty);
+ return llvm::ConstantInt::getAllOnesValue(Ty);
}
/// @}
/// @name Simple emitters
/// @{
public:
- llvm::SetCondInst* emitNE(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetNE,
- V1, V2, "ne", TheBlock);
- }
- llvm::SetCondInst* emitEQ(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetEQ,
- V1,V2,"eq",TheBlock);
- }
- llvm::SetCondInst* emitLT(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetLT,
- V1,V2,"lt",TheBlock);
- }
- llvm::SetCondInst* emitGT(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetGT,
- V1,V2,"gt",TheBlock);
- }
- llvm::SetCondInst* emitLE(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetLE,
- V1,V2,"le",TheBlock);
- }
- llvm::SetCondInst* emitGE(llvm::Value* V1, llvm::Value* V2) {
- return new llvm::SetCondInst(llvm::Instruction::SetGE,
- V1,V2,"ge",TheBlock);
- }
- llvm::CastInst* emitCast(llvm::Value* V1, const llvm::Type* Ty,
- const std::string& name) {
- return new llvm::CastInst(V1,Ty,name,TheBlock);
- }
+ llvm::CmpInst* emitNE(llvm::Value* V1, llvm::Value* V2);
+ llvm::CmpInst* emitEQ(llvm::Value* V1, llvm::Value* V2);
+ llvm::CmpInst* emitLT(llvm::Value* V1, llvm::Value* V2, bool sign = false);
+ llvm::CmpInst* emitGT(llvm::Value* V1, llvm::Value* V2, bool sign = false);
+ llvm::CmpInst* emitLE(llvm::Value* V1, llvm::Value* V2, bool sign = false);
+ llvm::CmpInst* emitGE(llvm::Value* V1, llvm::Value* V2, bool sign = false);
+
llvm::LoadInst* emitLoad(llvm::Value* V, const std::string& name) const {
- return new llvm::LoadInst(V,name,TheBlock);
+ return new llvm::LoadInst(V, name, TheBlock);
}
llvm::StoreInst* emitStore(llvm::Value* from, llvm::Value* to) const {
- return new llvm::StoreInst(from,to,TheBlock);
+ return new llvm::StoreInst(from, to, TheBlock);
}
llvm::BinaryOperator* emitNeg(llvm::Value* V) const {
return llvm::BinaryOperator::createNeg(V,"neg",TheBlock);
@@ -332,45 +300,43 @@
return llvm::ConstantExpr::getSizeOf(Ty);
}
llvm::BinaryOperator* emitAdd(llvm::Value* V1, llvm::Value* V2) {
- return llvm::BinaryOperator::create(llvm::Instruction::Add,
- V1, V2, "add", TheBlock);
+ return llvm::BinaryOperator::createAdd(V1, V2, "add", TheBlock);
}
llvm::BinaryOperator* emitSub(llvm::Value* V1, llvm::Value* V2) {
- return llvm::BinaryOperator::create(llvm::Instruction::Sub,
- V1, V2, "sub", TheBlock);
+ return llvm::BinaryOperator::createSub(V1, V2, "sub", TheBlock);
}
llvm::BinaryOperator* emitMul(llvm::Value* V1, llvm::Value* V2) {
- return llvm::BinaryOperator::create(llvm::Instruction::Mul,
- V1, V2, "mul", TheBlock);
+ return llvm::BinaryOperator::createMul(V1, V2, "mul", TheBlock);
}
- llvm::BinaryOperator* emitDiv(llvm::Value* V1, llvm::Value* V2) const {
- return llvm::BinaryOperator::create(llvm::Instruction::Div,
- V1, V2, "div", TheBlock);
- }
- llvm::BinaryOperator* emitMod(llvm::Value* V1, llvm::Value* V2) const {
- return llvm::BinaryOperator::create(llvm::Instruction::Rem,
- V1, V2, "mod", TheBlock);
+ llvm::BinaryOperator* emitSDiv(llvm::Value* V1, llvm::Value* V2) const {
+ return llvm::BinaryOperator::createSDiv(V1, V2, "div", TheBlock);
+ }
+ llvm::BinaryOperator* emitUDiv(llvm::Value* V1, llvm::Value* V2) const {
+ return llvm::BinaryOperator::createUDiv(V1, V2, "div", TheBlock);
+ }
+ llvm::BinaryOperator* emitSRem(llvm::Value* V1, llvm::Value* V2) const {
+ return llvm::BinaryOperator::createSRem(V1, V2, "mod", TheBlock);
+ }
+ llvm::BinaryOperator* emitURem(llvm::Value* V1, llvm::Value* V2) const {
+ return llvm::BinaryOperator::createURem(V1, V2, "mod", TheBlock);
}
llvm::BinaryOperator* emitBAnd(llvm::Value*V1, llvm::Value* V2) const {
- return llvm::BinaryOperator::create(llvm::Instruction::And,
- V1, V2, "band", TheBlock);
+ return llvm::BinaryOperator::createAnd(V1, V2, "band", TheBlock);
}
llvm::BinaryOperator* emitBOr(llvm::Value*V1, llvm::Value* V2) const {
- return llvm::BinaryOperator::create(llvm::Instruction::Or,
- V1, V2, "bor", TheBlock);
+ return llvm::BinaryOperator::createOr(V1, V2, "bor", TheBlock);
}
llvm::BinaryOperator* emitBXor(llvm::Value*V1, llvm::Value* V2) const {
- return llvm::BinaryOperator::create(llvm::Instruction::Xor,
- V1, V2, "bxor", TheBlock);
+ return llvm::BinaryOperator::createXor(V1, V2, "bxor", TheBlock);
}
llvm::BinaryOperator* emitBNor(llvm::Value* V1, llvm::Value* V2) const {
- llvm::BinaryOperator* bor = llvm::BinaryOperator::create(
- llvm::Instruction::Or, V1, V2, "bnor", TheBlock);
+ llvm::BinaryOperator* bor =
+ llvm::BinaryOperator::createOr(V1, V2, "bnor", TheBlock);
return llvm::BinaryOperator::createNot(bor,"bnor",TheBlock);
}
llvm::BinaryOperator* emitNot(llvm::Value* V1) const {
return llvm::BinaryOperator::createNot(
- ConvertToBoolean(V1),"not",TheBlock);
+ ConvertToBoolean(V1),"not",TheBlock);
}
llvm::BinaryOperator* emitAnd(llvm::Value* V1, llvm::Value* V2) const {
return llvm::BinaryOperator::create(llvm::Instruction::And,
@@ -418,7 +384,7 @@
llvm::GetElementPtrInst* emitGEP(llvm::Value* V, llvm::Value* index) {
ArgList indices;
- indices.push_back(llvm::Constant::getNullValue(llvm::Type::UIntTy));
+ indices.push_back(llvm::Constant::getNullValue(llvm::Type::Int32Ty));
indices.push_back(index);
return new llvm::GetElementPtrInst(V,indices,"",TheBlock);
}
Modified: hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp (original)
+++ hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp Sat Jul 7 19:03:10 2007
@@ -174,29 +174,29 @@
// Okay, we haven't seen this type before so let's construct it
switch (ty->getID()) {
- case BooleanTypeID: result = llvm::Type::BoolTy; break;
- case CharacterTypeID: result = llvm::Type::UIntTy; break;
+ case BooleanTypeID: result = llvm::Type::Int1Ty; break;
+ case CharacterTypeID: result = llvm::Type::Int32Ty; break;
case AnyTypeID:
hlvmNotImplemented("Any Type");
break;
case StringTypeID:
- result = llvm::PointerType::get(llvm::Type::SByteTy);
+ result = llvm::PointerType::get(llvm::Type::Int8Ty);
break;
case EnumerationTypeID:
- result = llvm::Type::UIntTy;
+ result = llvm::Type::Int32Ty;
break;
case IntegerTypeID:
{
const IntegerType* IT = llvm::cast<hlvm::IntegerType>(ty);
uint16_t bits = IT->getBits();
if (bits <= 8)
- result = (IT->isSigned() ? llvm::Type::SByteTy : llvm::Type::UByteTy);
+ result = (IT->isSigned() ? llvm::Type::Int8Ty : llvm::Type::Int8Ty);
else if (bits <= 16)
- result = (IT->isSigned() ? llvm::Type::ShortTy : llvm::Type::UShortTy);
+ result = (IT->isSigned() ? llvm::Type::Int16Ty : llvm::Type::Int16Ty);
else if (bits <= 32)
- result = (IT->isSigned() ? llvm::Type::IntTy : llvm::Type::UIntTy);
+ result = (IT->isSigned() ? llvm::Type::Int32Ty : llvm::Type::Int32Ty);
else if (bits <= 64)
- result = (IT->isSigned() ? llvm::Type::LongTy : llvm::Type::ULongTy);
+ result = (IT->isSigned() ? llvm::Type::Int64Ty : llvm::Type::Int64Ty);
else if (bits <= 128)
hlvmNotImplemented("128-bit integer");
else
@@ -208,18 +208,18 @@
const RangeType* RT = llvm::cast<hlvm::RangeType>(ty);
if (RT->getMin() < 0) {
if (RT->getMin() >= SHRT_MIN && RT->getMax() <= SHRT_MAX)
- return llvm::Type::ShortTy;
+ return llvm::Type::Int16Ty;
else if (RT->getMin() >= INT_MIN && RT->getMax() <= INT_MAX)
- return llvm::Type::IntTy;
+ return llvm::Type::Int32Ty;
else
- return llvm::Type::LongTy;
+ return llvm::Type::Int64Ty;
} else {
if (RT->getMax() <= USHRT_MAX)
- return llvm::Type::UShortTy;
+ return llvm::Type::Int16Ty;
else if (RT->getMax() <= UINT_MAX)
- return llvm::Type::UIntTy;
+ return llvm::Type::Int32Ty;
else
- return llvm::Type::ULongTy;
+ return llvm::Type::Int64Ty;
}
}
case RationalTypeID:
@@ -269,7 +269,7 @@
const hlvm::ArrayType* AT = llvm::cast<hlvm::ArrayType>(ty);
const llvm::Type* elemType = getType(AT->getElementType());
std::vector<const llvm::Type*> Fields;
- Fields.push_back(llvm::Type::UIntTy);
+ Fields.push_back(llvm::Type::Int32Ty);
Fields.push_back(llvm::PointerType::get(elemType));
result = llvm::StructType::get(Fields);
break;
@@ -339,7 +339,7 @@
case ConstantBooleanID:
{
const ConstantBoolean* CI = llvm::cast<const ConstantBoolean>(C);
- result = llvm::ConstantBool::get(CI->getValue());
+ result = llvm::ConstantInt::get(llvm::Type::Int1Ty, CI->getValue());
break;
}
case ConstantCharacterID:
@@ -356,7 +356,7 @@
} else {
val = cVal[0];
}
- result = em->getUVal(llvm::Type::UIntTy,val);
+ result = em->getUVal(llvm::Type::Int32Ty,val);
break;
}
case ConstantEnumeratorID:
@@ -400,8 +400,8 @@
llvm::Constant* CA = llvm::ConstantArray::get(CT->getValue(), true);
llvm::GlobalVariable* GV = em->NewGConst(CA->getType(), CA, C->getName());
std::vector<llvm::Constant*> indices;
- indices.push_back(llvm::Constant::getNullValue(llvm::Type::UIntTy));
- indices.push_back(llvm::Constant::getNullValue(llvm::Type::UIntTy));
+ indices.push_back(llvm::Constant::getNullValue(llvm::Type::Int32Ty));
+ indices.push_back(llvm::Constant::getNullValue(llvm::Type::Int32Ty));
result = llvm::ConstantExpr::getGetElementPtr(GV,indices);
break;
}
@@ -429,7 +429,7 @@
const llvm::StructType* Ty =
llvm::cast<llvm::StructType>(getType(hCA->getType()));
elems.clear();
- elems.push_back(em->getUVal(llvm::Type::UIntTy,hCA->size()));
+ elems.push_back(em->getUVal(llvm::Type::Int32Ty,hCA->size()));
elems.push_back(lCE);
result = llvm::ConstantStruct::get(Ty,elems);
break;
@@ -599,7 +599,7 @@
LLVMGeneratorPass::toBoolean(llvm::Value* V)
{
const llvm::Type* Ty = V->getType();
- if (Ty == llvm::Type::BoolTy)
+ if (Ty == llvm::Type::Int1Ty)
return V;
if (Ty->isInteger() || Ty->isFloatingPoint()) {
@@ -677,7 +677,7 @@
// Its just a value or a constant or something, just cast it to itself
// so we can get its value
result =
- new llvm::CastInst(V,V->getType(),"",entry_block);
+ new llvm::BitCastInst(V, V->getType(), "", entry_block);
}
}
@@ -694,7 +694,7 @@
llvm::Value* result =
popOperandAsBlock(op,name+"_cond",entry_block,exit_block);
hlvmAssert(result);
- hlvmAssert(result->getType() == llvm::Type::BoolTy);
+ hlvmAssert(result->getType() == llvm::Type::Int1Ty);
return result;
}
@@ -799,7 +799,7 @@
llvm::BinaryOperator* add = em->emitAdd(load,one);
pushOperand(em->emitStore(add,operand),op);
} else if (lType->isInteger()) {
- llvm::Constant* one = em->getIOne(lType);
+ llvm::Constant* one = em->getOne(lType);
llvm::BinaryOperator* add = em->emitAdd(load,one);
pushOperand(em->emitStore(add,operand),op);
} else {
@@ -821,7 +821,7 @@
llvm::BinaryOperator* sub = em->emitSub(load,one);
pushOperand(em->emitStore(sub,operand),op);
} else if (lType->isInteger()) {
- llvm::Constant* one = em->getIOne(lType);
+ llvm::Constant* one = em->getOne(lType);
llvm::BinaryOperator* sub = em->emitSub(load, one);
pushOperand(em->emitStore(sub,operand),op);
} else {
@@ -844,7 +844,7 @@
em->emitStore(add,operand);
pushOperand(load,op);
} else if (lType->isInteger()) {
- llvm::Constant* one = em->getIOne(lType);
+ llvm::Constant* one = em->getOne(lType);
llvm::BinaryOperator* add = em->emitAdd(load,one);
em->emitStore(add,operand);
pushOperand(load,op);
@@ -868,7 +868,7 @@
em->emitStore(sub,operand);
pushOperand(load,op);
} else if (lType->isInteger()) {
- llvm::Constant* one = em->getIOne(lType);
+ llvm::Constant* one = em->getOne(lType);
llvm::BinaryOperator* sub = em->emitSub(load, one);
em->emitStore(sub,operand);
pushOperand(load,op);
@@ -904,7 +904,8 @@
// First, deal with the easy case of conversion of first class types. This
// can just be done with the LLVM cast operator
if (lsrcTy->isFirstClassType() && ltgtTy->isFirstClassType()) {
- pushOperand(em->emitCast(v1,ltgtTy,v1->getName() + "_converted"),op);
+ pushOperand(em->CastToType(v1, srcTy->isSigned(), ltgtTy, tgtTy->isSigned(),
+ v1->getName() + "_converted"),op);
return;
}
@@ -951,21 +952,33 @@
template<> void
LLVMGeneratorPass::gen(DivideOp* op)
{
+ bool isSigned =
+ op->getOperand(0)->getType()->isSigned() ||
+ op->getOperand(1)->getType()->isSigned();
llvm::Value* op1 = popOperand(op->getOperand(0));
llvm::Value* op2 = popOperand(op->getOperand(1));
op1 = ptr2Value(op1);
op2 = ptr2Value(op2);
- pushOperand(em->emitDiv(op1,op2),op);
+ if (isSigned)
+ pushOperand(em->emitSDiv(op1,op2),op);
+ else
+ pushOperand(em->emitUDiv(op1,op2),op);
}
template<> void
LLVMGeneratorPass::gen(ModuloOp* op)
{
+ bool isSigned =
+ op->getOperand(0)->getType()->isSigned() ||
+ op->getOperand(1)->getType()->isSigned();
llvm::Value* op1 = popOperand(op->getOperand(0));
llvm::Value* op2 = popOperand(op->getOperand(1));
op1 = ptr2Value(op1);
op2 = ptr2Value(op2);
- pushOperand(em->emitMod(op1,op2),op);
+ if (isSigned)
+ pushOperand(em->emitSRem(op1,op2),op);
+ else
+ pushOperand(em->emitURem(op1,op2),op);
}
template<> void
@@ -1254,7 +1267,7 @@
llvm::Value* op1 = popOperand(op->getOperand(0));
llvm::Value* op2 = popOperand(op->getOperand(1));
llvm::Value* op3 = popOperand(op->getOperand(2));
- hlvmAssert(op1->getType() == llvm::Type::BoolTy);
+ hlvmAssert(op1->getType() == llvm::Type::Int1Ty);
hlvmAssert(op2->getType()->isFirstClassType());
hlvmAssert(op3->getType()->isFirstClassType());
pushOperand(em->emitSelect(op1,op2,op3,"select"),op);
@@ -1624,7 +1637,7 @@
llvm::cast<DisparateContainerType>(loc->getType());
unsigned index = DCT->getFieldIndex(fldName);
hlvmAssert(index != 0 && "Invalid field name");
- llvm::Constant* idx = llvm::ConstantUInt::get(llvm::Type::UIntTy,index);
+ llvm::Constant* idx = llvm::ConstantInt::get(llvm::Type::Int32Ty,index);
llvm::Value* location = popOperand(loc);
pushOperand(em->emitGEP(location,idx),i);
return;
@@ -1685,7 +1698,7 @@
// Define the type of the array elements (a structure with a pointer to
// a string and a pointer to the function).
std::vector<const llvm::Type*> Fields;
- Fields.push_back(llvm::PointerType::get(llvm::Type::SByteTy));
+ Fields.push_back(llvm::PointerType::get(llvm::Type::Int8Ty));
Fields.push_back(llvm::PointerType::get(em->getProgramType()));
llvm::StructType* entry_elem_type = llvm::StructType::get(Fields);
@@ -2011,7 +2024,6 @@
getCleanupPasses(llvm::PassManager& PM)
{
PM.add(llvm::createLowerSetJmpPass()); // Lower llvm.setjmp/.longjmp
- PM.add(llvm::createFunctionResolvingPass()); // Resolve (...) functions
if (NoOptimizations)
return;
@@ -2029,7 +2041,6 @@
PM.add(llvm::createFunctionInliningPass()); // Inline small functions
PM.add(llvm::createSimplifyLibCallsPass()); // Library Call Optimizations
PM.add(llvm::createArgumentPromotionPass()); // Scalarize uninlined fn args
- PM.add(llvm::createRaisePointerReferencesPass());// Recover type information
PM.add(llvm::createTailDuplicationPass()); // Simplify cfg by copying
PM.add(llvm::createCFGSimplificationPass()); // Merge & remove BBs
PM.add(llvm::createScalarReplAggregatesPass()); // Break up aggregate allocas
@@ -2088,8 +2099,10 @@
delete PM;
llvm::Module* mod = genPass.linkModules();
bool result = optimizeModule(mod,ErrMsg);
- if (result)
- llvm::WriteBytecodeToFile(mod, output, /*compress= */ true);
+ if (result) {
+ llvm::OStream strm(output);
+ llvm::WriteBytecodeToFile(mod, strm, /*compress= */ true);
+ }
delete mod;
return result;
}
@@ -2106,7 +2119,8 @@
bool result = optimizeModule(mod,ErrMsg);
if (result) {
llvm::PassManager Passes;
- Passes.add(new llvm::PrintModulePass(&output));
+ llvm::OStream strm(output);
+ Passes.add(new llvm::PrintModulePass(&strm));
Passes.run(*mod);
}
delete mod;
Modified: hlvm/trunk/hlvm/Runtime/hlvm_get_programs.ll
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/hlvm_get_programs.ll?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Runtime/hlvm_get_programs.ll (original)
+++ hlvm/trunk/hlvm/Runtime/hlvm_get_programs.ll Sat Jul 7 19:03:10 2007
@@ -40,18 +40,18 @@
; This is the type for the elements of the hlvm_programs array. Each element
; contains a pointer to a string for the name of the program and a pointer to
; the entry function.
-%hlvm_programs_element = type { sbyte*, int (int, sbyte**)* }
+%hlvm_programs_element = type { i8*, i32 (i32, i8**)* }
; This is the appending constant array with 1 element here that is zero
; initialized. This forms the zero-terminator in the array. This module MUST
; be linked LAST in order for this to work.
-%hlvm_programs = appending constant [1 x %hlvm_programs_element] zeroinitializer
+ at hlvm_programs = appending constant [1 x %hlvm_programs_element] zeroinitializer
; End of declarations, start the implementation
implementation
; This is a very simple function to get the address of %hlvm_programs.
-%hlvm_programs_element* %hlvm_get_programs() {
+define %hlvm_programs_element* @hlvm_get_programs() {
entry:
- ret %hlvm_programs_element* getelementptr([1 x %hlvm_programs_element]* %hlvm_programs, int 0, int 0)
+ ret %hlvm_programs_element* getelementptr([1 x %hlvm_programs_element]* @hlvm_programs, i32 0, i32 0)
}
Modified: hlvm/trunk/tools/hlvm-compiler/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm-compiler/SConscript?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/tools/hlvm-compiler/SConscript (original)
+++ hlvm/trunk/tools/hlvm-compiler/SConscript Sat Jul 7 19:03:10 2007
@@ -35,7 +35,6 @@
'LLVMLinker',
'LLVMBCReader',
'LLVMBCWriter',
- 'LLVMTransforms',
'LLVMipo',
'LLVMipa',
'LLVMScalarOpts',
Modified: hlvm/trunk/tools/hlvm-config/hlvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm-config/hlvm-config.cpp?rev=38415&r1=38414&r2=38415&view=diff
==============================================================================
--- hlvm/trunk/tools/hlvm-config/hlvm-config.cpp (original)
+++ hlvm/trunk/tools/hlvm-config/hlvm-config.cpp Sat Jul 7 19:03:10 2007
@@ -28,9 +28,25 @@
//===----------------------------------------------------------------------===//
#include <hlvm/AST/Node.h>
+#include <hlvm/AST/AST.h>
+#include <hlvm/AST/Arithmetic.h>
+#include <hlvm/AST/Block.h>
+#include <hlvm/AST/BooleanOps.h>
+#include <hlvm/AST/Bundle.h>
+#include <hlvm/AST/Constants.h>
+#include <hlvm/AST/ContainerType.h>
+#include <hlvm/AST/ControlFlow.h>
+#include <hlvm/AST/Documentation.h>
+#include <hlvm/AST/InputOutput.h>
+#include <hlvm/AST/Linkables.h>
+#include <hlvm/AST/MemoryOps.h>
+#include <hlvm/AST/RealMath.h>
+#include <hlvm/AST/RuntimeType.h>
+#include <hlvm/AST/StringOps.h>
#include <hlvm/Base/Configuration.h>
#include <llvm/Support/CommandLine.h>
#include <iostream>
+#include <iomanip>
using namespace llvm;
using namespace hlvm;
@@ -38,155 +54,160 @@
static llvm::cl::opt<bool> ShowNodeIds("node-ids", cl::init(false),
cl::desc("Show the node ids"));
-static const char* NodeIDStrs[] =
+struct ClassInfo {
+ const char* name;
+ size_t size;
+};
+
+static ClassInfo NodeIDStrs[] =
{
- "NoType",
- "TreeTop",
- "Documentation",
- "NamedType",
- "Bundle",
- "Import",
- "AnyType",
- "BooleanType",
- "CharacterType",
- "EnumerationType",
- "IntegerType",
- "OpaqueType",
- "RangeType",
- "RealType",
- "RationalType",
- "StringType",
- "PointerType",
- "ArrayType",
- "VectorType",
- "StructureType",
- "SignatureType",
- "ContinuationType",
- "BufferType",
- "StreamType",
- "TextType",
- "Interface",
- "Class",
- "Method",
- "Implements",
- "Argument",
- "ConstantAny",
- "ConstantBoolean",
- "ConstantCharacter",
- "ConstantEnumerator",
- "ConstantInteger",
- "ConstantReal",
- "ConstantString",
- "ConstantPointer",
- "ConstantArray",
- "ConstantVector",
- "ConstantStructure",
- "ConstantContinuation",
- "ConstantExpression",
- "Variable",
- "Function",
- "Program",
- "Block",
- "BreakOp",
- "ContinueOp",
- "ReturnOp",
- "GetOp",
- "ResultOp",
- "ThrowOp",
- "NotOp",
- "NegateOp",
- "ComplementOp",
- "PreIncrOp",
- "PostIncrOp",
- "PreDecrOp",
- "PostDecrOp",
- "SizeOfOp",
- "ConvertOp",
- "IsPInfOp",
- "IsNInfOp",
- "IsNanOp",
- "TruncOp",
- "RoundOp",
- "FloorOp",
- "CeilingOp",
- "LogEOp",
- "Log2Op",
- "Log10Op",
- "SquareRootOp",
- "CubeRootOp",
- "FactorialOp",
- "LoadOp",
- "AllocateOp",
- "DeallocateOp",
- "AutoVarOp",
- "TellOp",
- "CloseOp",
- "LengthOp",
- "AddOp",
- "SubtractOp",
- "MultiplyOp",
- "DivideOp",
- "ModuloOp",
- "BAndOp",
- "BOrOp",
- "BXorOp",
- "BNorOp",
- "AndOp",
- "OrOp",
- "NorOp",
- "XorOp",
- "LessThanOp",
- "GreaterThanOp",
- "LessEqualOp",
- "GreaterEqualOp",
- "EqualityOp",
- "InequalityOp",
- "PowerOp",
- "RootOp",
- "GCDOp",
- "LCMOp",
- "ReallocateOp",
- "StoreOp",
- "GetIndexOp",
- "GetFieldOp",
- "WhileOp",
- "UnlessOp",
- "UntilOp",
- "OpenOp",
- "ReadOp",
- "WriteOp",
- "CreateContOp",
- "SelectOp",
- "StrInsertOp",
- "StrEraseOp",
- "StrReplaceOp",
- "StrConcatOp",
- "PositionOp",
- "LoopOp",
- "CallOp",
- "InvokeOp",
- "DispatchOp",
- "CallWithContOp",
- "SwitchOp",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
- "**INVALID**",
+ { "NoType", 0 },
+ { "TreeTop", sizeof(AST) },
+ { "Documentation", sizeof(Documentation) },
+ { "NamedType", sizeof(NamedType) },
+ { "Bundle", sizeof(Bundle) },
+ { "Import", sizeof(Import) },
+ { "AnyType", sizeof(AnyType) },
+ { "BooleanType", sizeof(BooleanType) },
+ { "CharacterType", sizeof(CharacterType) },
+ { "EnumerationType", sizeof(EnumerationType) },
+ { "IntegerType", sizeof(IntegerType) },
+ { "OpaqueType", sizeof(OpaqueType) },
+ { "RangeType", sizeof(RangeType) },
+ { "RealType", sizeof(RealType) },
+ { "RationalType", sizeof(RationalType) },
+ { "StringType", sizeof(StringType) },
+ { "PointerType", sizeof(PointerType) },
+ { "ArrayType", sizeof(ArrayType) },
+ { "VectorType", sizeof(VectorType) },
+ { "StructureType", sizeof(StructureType) },
+ { "SignatureType", sizeof(SignatureType) },
+ { "ContinuationType", sizeof(ContinuationType) },
+ { "BufferType", sizeof(BufferType) },
+ { "StreamType", sizeof(StreamType) },
+ { "TextType", sizeof(TextType) },
+ { "Interface", 0 /*sizeof(Interface)*/ },
+ { "Class", 0, /*sizeof(Class)*/ },
+ { "Method", 0 /*sizeof(Method)*/ },
+ { "Implements", 0 /*sizeof(Implements)*/ },
+ { "Argument", sizeof(Argument) },
+ { "ConstantAny", sizeof(ConstantAny) },
+ { "ConstantBoolean", sizeof(ConstantBoolean) },
+ { "ConstantCharacter", sizeof(ConstantCharacter) },
+ { "ConstantEnumerator", sizeof(ConstantEnumerator) },
+ { "ConstantInteger", sizeof(ConstantInteger) },
+ { "ConstantReal", sizeof(ConstantReal) },
+ { "ConstantString", sizeof(ConstantString) },
+ { "ConstantPointer", sizeof(ConstantPointer) },
+ { "ConstantArray", sizeof(ConstantArray) },
+ { "ConstantVector", sizeof(ConstantVector) },
+ { "ConstantStructure", sizeof(ConstantStructure) },
+ { "ConstantContinuation", sizeof(ConstantContinuation) },
+ { "ConstantExpression", sizeof(ConstantExpression) },
+ { "Variable", sizeof(Variable) },
+ { "Function", sizeof(Function) },
+ { "Program", sizeof(Program) },
+ { "Block", sizeof(Block) },
+ { "BreakOp", sizeof(BreakOp) },
+ { "ContinueOp", sizeof(ContinueOp) },
+ { "ReturnOp", sizeof(ReturnOp) },
+ { "GetOp", sizeof(GetOp) },
+ { "ResultOp", sizeof(ResultOp) },
+ { "ThrowOp", 0 /*sizeof(ThrowOp)*/ },
+ { "NotOp", sizeof(NotOp) },
+ { "NegateOp", sizeof(NegateOp) },
+ { "ComplementOp", sizeof(ComplementOp) },
+ { "PreIncrOp", sizeof(PreIncrOp) },
+ { "PostIncrOp", sizeof(PostIncrOp) },
+ { "PreDecrOp", sizeof(PreDecrOp) },
+ { "PostDecrOp", sizeof(PostDecrOp) },
+ { "SizeOfOp", sizeof(SizeOfOp) },
+ { "ConvertOp", sizeof(ConvertOp) },
+ { "IsPInfOp", sizeof(IsPInfOp) },
+ { "IsNInfOp", sizeof(IsNInfOp) },
+ { "IsNanOp", sizeof(IsNanOp) },
+ { "TruncOp", sizeof(TruncOp) },
+ { "RoundOp", sizeof(RoundOp) },
+ { "FloorOp", sizeof(FloorOp) },
+ { "CeilingOp", sizeof(CeilingOp) },
+ { "LogEOp", sizeof(LogEOp) },
+ { "Log2Op", sizeof(Log2Op) },
+ { "Log10Op", sizeof(Log10Op) },
+ { "SquareRootOp", sizeof(SquareRootOp) },
+ { "CubeRootOp", sizeof(CubeRootOp) },
+ { "FactorialOp", sizeof(FactorialOp) },
+ { "LoadOp", sizeof(LoadOp) },
+ { "AllocateOp", sizeof(AllocateOp) },
+ { "DeallocateOp", sizeof(DeallocateOp) },
+ { "AutoVarOp", sizeof(AutoVarOp) },
+ { "TellOp", 0 /*sizeof(TellOp)*/ },
+ { "CloseOp", sizeof(CloseOp) },
+ { "LengthOp", sizeof(LengthOp) },
+ { "AddOp", sizeof(AddOp) },
+ { "SubtractOp", sizeof(SubtractOp) },
+ { "MultiplyOp", sizeof(MultiplyOp) },
+ { "DivideOp", sizeof(DivideOp) },
+ { "ModuloOp", sizeof(ModuloOp) },
+ { "BAndOp", sizeof(BAndOp) },
+ { "BOrOp", sizeof(BOrOp) },
+ { "BXorOp", sizeof(BXorOp) },
+ { "BNorOp", sizeof(BNorOp) },
+ { "AndOp", sizeof(AndOp) },
+ { "OrOp", sizeof(OrOp) },
+ { "NorOp", sizeof(NorOp) },
+ { "XorOp", sizeof(XorOp) },
+ { "LessThanOp", sizeof(LessThanOp) },
+ { "GreaterThanOp", sizeof(GreaterThanOp) },
+ { "LessEqualOp", sizeof(LessEqualOp) },
+ { "GreaterEqualOp", sizeof(GreaterEqualOp) },
+ { "EqualityOp", sizeof(EqualityOp) },
+ { "InequalityOp", sizeof(InequalityOp) },
+ { "PowerOp", sizeof(PowerOp) },
+ { "RootOp", sizeof(RootOp) },
+ { "GCDOp", sizeof(GCDOp) },
+ { "LCMOp", sizeof(LCMOp) },
+ { "ReallocateOp", 0 /*sizeof(ReallocateOp)*/ },
+ { "StoreOp", sizeof(StoreOp) },
+ { "GetIndexOp", sizeof(GetIndexOp) },
+ { "GetFieldOp", sizeof(GetFieldOp) },
+ { "WhileOp", sizeof(WhileOp) },
+ { "UnlessOp", sizeof(UnlessOp) },
+ { "UntilOp", sizeof(UntilOp) },
+ { "OpenOp", sizeof(OpenOp) },
+ { "ReadOp", sizeof(ReadOp) },
+ { "WriteOp", sizeof(WriteOp) },
+ { "CreateContOp", 0 /*sizeof(CreateContOp)*/ },
+ { "SelectOp", sizeof(SelectOp) },
+ { "StrInsertOp", sizeof(StrInsertOp) },
+ { "StrEraseOp", sizeof(StrEraseOp) },
+ { "StrReplaceOp", sizeof(StrReplaceOp) },
+ { "StrConcatOp", sizeof(StrConcatOp) },
+ { "PositionOp", 0 /*sizeof(PositionOp)*/ },
+ { "LoopOp", sizeof(LoopOp) },
+ { "CallOp", sizeof(CallOp) },
+ { "InvokeOp", 0 /*sizeof(InvokeOp)*/ },
+ { "DispatchOp", 0 /*sizeof(DispatchOp)*/ },
+ { "CallWithContOp", 0 /*sizeof(CallWithContOp)*/ },
+ { "SwitchOp", sizeof(SwitchOp) },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
+ { "**INVALID**", 0 },
};
void showNodeIds()
{
unsigned rowcount = 4;
+ std::cout << "NodeID NodeSize Class Name\n";
for (unsigned i = FirstNodeID; i <= LastNodeID; i++) {
- if (rowcount % 4 == 0)
- std::cout << "\n";
- std::cout << " " << i << ":" << NodeIDStrs[i];
+ std::cout << std::setw(6) << i << " " << std::setw(8) << NodeIDStrs[i].size
+ << " " << NodeIDStrs[i].name << "\n";
rowcount++;
}
More information about the llvm-commits
mailing list