#include "llvm/Intrinsics.h"
#include "Support/LeakDetector.h"
#include "SymbolTableListTraitsImpl.h"
+using namespace llvm;
BasicBlock *ilist_traits<BasicBlock>::createNode() {
BasicBlock *Ret = new BasicBlock();
// Explicit instantiations of SymbolTableListTraits since some of the methods
// are not in the public header file...
-template SymbolTableListTraits<Argument, Function, Function>;
-template SymbolTableListTraits<BasicBlock, Function, Function>;
+template class SymbolTableListTraits<Argument, Function, Function>;
+template class SymbolTableListTraits<BasicBlock, Function, Function>;
//===----------------------------------------------------------------------===//
// Argument Implementation
ArgumentList.setParent(this);
SymTab = new SymbolTable();
+ assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)
+ && "LLVM functions cannot return aggregate values!");
+
// Create the arguments vector, all arguments start out unnamed.
for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) {
assert(Ty->getParamType(i) != Type::VoidTy &&
"Invalid symtab argument!");
if ((P = getParent()) && hasName()) P->getSymbolTable().remove(this);
Value::setName(name);
- if (P && getName() != "") P->getSymbolTable().insert(this);
+ if (P && hasName()) P->getSymbolTable().insert(this);
}
void Function::setParent(Module *parent) {
}
/// getIntrinsicID - This method returns the ID number of the specified
-/// function, or LLVMIntrinsic::not_intrinsic if the function is not an
+/// function, or Intrinsic::not_intrinsic if the function is not an
/// intrinsic, or if the pointer is null. This value is always defined to be
/// zero to allow easy checking for whether a function is intrinsic or not. The
/// particular intrinsic functions which correspond to this value are defined in
std::string name; // The name of the intrinsic
unsigned id; // Its ID number
} alpha_intrinsics[] = {
- { "llvm.alpha.ctlz", LLVMIntrinsic::alpha_ctlz },
- { "llvm.alpha.cttz", LLVMIntrinsic::alpha_cttz },
- { "llvm.alpha.ctpop", LLVMIntrinsic::alpha_ctpop },
- { "llvm.alpha.umulh", LLVMIntrinsic::alpha_umulh },
- { "llvm.alpha.vecop", LLVMIntrinsic::alpha_vecop },
- { "llvm.alpha.pup", LLVMIntrinsic::alpha_pup },
- { "llvm.alpha.bytezap", LLVMIntrinsic::alpha_bytezap },
- { "llvm.alpha.bytemanip", LLVMIntrinsic::alpha_bytemanip },
- { "llvm.alpha.dfp_bop", LLVMIntrinsic::alpha_dfpbop },
- { "llvm.alpha.dfp_uop", LLVMIntrinsic::alpha_dfpuop },
- { "llvm.alpha.unordered", LLVMIntrinsic::alpha_unordered },
- { "llvm.alpha.uqtodfp", LLVMIntrinsic::alpha_uqtodfp },
- { "llvm.alpha.uqtosfp", LLVMIntrinsic::alpha_uqtosfp },
- { "llvm.alpha.dfptosq", LLVMIntrinsic::alpha_dfptosq },
- { "llvm.alpha.sfptosq", LLVMIntrinsic::alpha_sfptosq },
+ { "llvm.alpha.ctlz", Intrinsic::alpha_ctlz },
+ { "llvm.alpha.cttz", Intrinsic::alpha_cttz },
+ { "llvm.alpha.ctpop", Intrinsic::alpha_ctpop },
+ { "llvm.alpha.umulh", Intrinsic::alpha_umulh },
+ { "llvm.alpha.vecop", Intrinsic::alpha_vecop },
+ { "llvm.alpha.pup", Intrinsic::alpha_pup },
+ { "llvm.alpha.bytezap", Intrinsic::alpha_bytezap },
+ { "llvm.alpha.bytemanip", Intrinsic::alpha_bytemanip },
+ { "llvm.alpha.dfp_bop", Intrinsic::alpha_dfpbop },
+ { "llvm.alpha.dfp_uop", Intrinsic::alpha_dfpuop },
+ { "llvm.alpha.unordered", Intrinsic::alpha_unordered },
+ { "llvm.alpha.uqtodfp", Intrinsic::alpha_uqtodfp },
+ { "llvm.alpha.uqtosfp", Intrinsic::alpha_uqtosfp },
+ { "llvm.alpha.dfptosq", Intrinsic::alpha_dfptosq },
+ { "llvm.alpha.sfptosq", Intrinsic::alpha_sfptosq },
};
const unsigned num_alpha_intrinsics =
sizeof(alpha_intrinsics) / sizeof(*alpha_intrinsics);
if (getName() == alpha_intrinsics[i].name)
return alpha_intrinsics[i].id;
break;
+ case 'd':
+ if (getName() == "llvm.dbg.stoppoint") return Intrinsic::dbg_stoppoint;
+ if (getName() == "llvm.dbg.region.start")return Intrinsic::dbg_region_start;
+ if (getName() == "llvm.dbg.region.end") return Intrinsic::dbg_region_end;
+ if (getName() == "llvm.dbg.func.start") return Intrinsic::dbg_func_start;
+ if (getName() == "llvm.dbg.declare") return Intrinsic::dbg_declare;
+ break;
+ case 'f':
+ if (getName() == "llvm.frameaddress") return Intrinsic::frameaddress;
+ break;
+ case 'g':
+ if (getName() == "llvm.gcwrite") return Intrinsic::gcwrite;
+ if (getName() == "llvm.gcread") return Intrinsic::gcread;
+ if (getName() == "llvm.gcroot") return Intrinsic::gcroot;
+ break;
case 'l':
- if (getName() == "llvm.longjmp") return LLVMIntrinsic::longjmp;
+ if (getName() == "llvm.longjmp") return Intrinsic::longjmp;
+ break;
+ case 'm':
+ if (getName() == "llvm.memcpy") return Intrinsic::memcpy;
+ if (getName() == "llvm.memmove") return Intrinsic::memmove;
+ if (getName() == "llvm.memset") return Intrinsic::memset;
+ break;
+ case 'r':
+ if (getName() == "llvm.returnaddress") return Intrinsic::returnaddress;
+ if (getName() == "llvm.readport") return Intrinsic::readport;
+ if (getName() == "llvm.readio") return Intrinsic::readio;
break;
case 's':
- if (getName() == "llvm.setjmp") return LLVMIntrinsic::setjmp;
- if (getName() == "llvm.sigsetjmp") return LLVMIntrinsic::sigsetjmp;
- if (getName() == "llvm.siglongjmp") return LLVMIntrinsic::siglongjmp;
+ if (getName() == "llvm.setjmp") return Intrinsic::setjmp;
+ if (getName() == "llvm.sigsetjmp") return Intrinsic::sigsetjmp;
+ if (getName() == "llvm.siglongjmp") return Intrinsic::siglongjmp;
break;
case 'v':
- if (getName() == "llvm.va_copy") return LLVMIntrinsic::va_copy;
- if (getName() == "llvm.va_end") return LLVMIntrinsic::va_end;
- if (getName() == "llvm.va_start") return LLVMIntrinsic::va_start;
+ if (getName() == "llvm.va_copy") return Intrinsic::vacopy;
+ if (getName() == "llvm.va_end") return Intrinsic::vaend;
+ if (getName() == "llvm.va_start") return Intrinsic::vastart;
+ case 'w':
+ if (getName() == "llvm.writeport") return Intrinsic::writeport;
+ if (getName() == "llvm.writeio") return Intrinsic::writeio;
break;
}
// The "llvm." namespace is reserved!
"Invalid symtab argument!");
if ((P = getParent()) && hasName()) P->getSymbolTable().remove(this);
Value::setName(name);
- if (P && getName() != "") P->getSymbolTable().insert(this);
+ if (P && hasName()) P->getSymbolTable().insert(this);
}