+/// Target endian information...
+Module::Endianness Module::getEndianness() const {
+ std::string temp = DataLayout;
+ Module::Endianness ret = AnyEndianness;
+
+ while (!temp.empty()) {
+ std::string token = getToken(temp, "-");
+
+ if (token[0] == 'e') {
+ ret = LittleEndian;
+ } else if (token[0] == 'E') {
+ ret = BigEndian;
+ }
+ }
+
+ return ret;
+}
+
+/// Target Pointer Size information...
+Module::PointerSize Module::getPointerSize() const {
+ std::string temp = DataLayout;
+ Module::PointerSize ret = AnyPointerSize;
+
+ while (!temp.empty()) {
+ std::string token = getToken(temp, "-");
+ char signal = getToken(token, ":")[0];
+
+ if (signal == 'p') {
+ int size = atoi(getToken(token, ":").c_str());
+ if (size == 32)
+ ret = Pointer32;
+ else if (size == 64)
+ ret = Pointer64;
+ }
+ }
+
+ return ret;
+}
+
+/// getNamedValue - Return the first global value in the module with
+/// the specified name, of arbitrary type. This method returns null
+/// if a global with the specified name is not found.
+GlobalValue *Module::getNamedValue(const std::string &Name) const {
+ return cast_or_null<GlobalValue>(getValueSymbolTable().lookup(Name));
+}
+
+GlobalValue *Module::getNamedValue(const char *Name) const {
+ llvm::Value *V = getValueSymbolTable().lookup(Name, Name+strlen(Name));
+ return cast_or_null<GlobalValue>(V);