mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-10 17:29:44 +00:00
Reformatting changes to get rid of blank lines, put code on one line, and to
decrease some code indentation. No intended functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143723 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
84a6126937
commit
931d4c2043
@ -61,7 +61,6 @@ bool LTOModule::isBitcodeFileForTarget(const void *mem, size_t length,
|
|||||||
return isTargetMatch(buffer, triplePrefix);
|
return isTargetMatch(buffer, triplePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LTOModule::isBitcodeFileForTarget(const char *path,
|
bool LTOModule::isBitcodeFileForTarget(const char *path,
|
||||||
const char *triplePrefix) {
|
const char *triplePrefix) {
|
||||||
OwningPtr<MemoryBuffer> buffer;
|
OwningPtr<MemoryBuffer> buffer;
|
||||||
@ -74,8 +73,7 @@ bool LTOModule::isBitcodeFileForTarget(const char *path,
|
|||||||
bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
|
bool LTOModule::isTargetMatch(MemoryBuffer *buffer, const char *triplePrefix) {
|
||||||
std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
|
std::string Triple = getBitcodeTargetTriple(buffer, getGlobalContext());
|
||||||
delete buffer;
|
delete buffer;
|
||||||
return (strncmp(Triple.c_str(), triplePrefix,
|
return strncmp(Triple.c_str(), triplePrefix, strlen(triplePrefix)) == 0;
|
||||||
strlen(triplePrefix)) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,8 +95,7 @@ LTOModule *LTOModule::makeLTOModule(const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LTOModule *LTOModule::makeLTOModule(int fd, const char *path,
|
LTOModule *LTOModule::makeLTOModule(int fd, const char *path,
|
||||||
size_t size,
|
size_t size, std::string &errMsg) {
|
||||||
std::string &errMsg) {
|
|
||||||
return makeLTOModule(fd, path, size, size, 0, errMsg);
|
return makeLTOModule(fd, path, size, size, 0, errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +119,6 @@ MemoryBuffer *LTOModule::makeBuffer(const void *mem, size_t length) {
|
|||||||
return MemoryBuffer::getMemBuffer(StringRef(startPtr, length), "", false);
|
return MemoryBuffer::getMemBuffer(StringRef(startPtr, length), "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LTOModule *LTOModule::makeLTOModule(const void *mem, size_t length,
|
LTOModule *LTOModule::makeLTOModule(const void *mem, size_t length,
|
||||||
std::string &errMsg) {
|
std::string &errMsg) {
|
||||||
OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
|
OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
|
||||||
@ -165,15 +161,14 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
|
|||||||
std::string CPU;
|
std::string CPU;
|
||||||
TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr);
|
TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr);
|
||||||
LTOModule *Ret = new LTOModule(m.take(), target);
|
LTOModule *Ret = new LTOModule(m.take(), target);
|
||||||
bool Err = Ret->ParseSymbols(errMsg);
|
if (Ret->ParseSymbols(errMsg)) {
|
||||||
if (Err) {
|
|
||||||
delete Ret;
|
delete Ret;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *LTOModule::getTargetTriple() {
|
const char *LTOModule::getTargetTriple() {
|
||||||
return _module->getTargetTriple().c_str();
|
return _module->getTargetTriple().c_str();
|
||||||
}
|
}
|
||||||
@ -206,7 +201,9 @@ bool LTOModule::objcClassNameFromExpression(Constant *c, std::string &name) {
|
|||||||
|
|
||||||
// Parse i386/ppc ObjC class data structure.
|
// Parse i386/ppc ObjC class data structure.
|
||||||
void LTOModule::addObjCClass(GlobalVariable *clgv) {
|
void LTOModule::addObjCClass(GlobalVariable *clgv) {
|
||||||
if (ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
|
ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer());
|
||||||
|
if (!c) return;
|
||||||
|
|
||||||
// second slot in __OBJC,__class is pointer to superclass name
|
// second slot in __OBJC,__class is pointer to superclass name
|
||||||
std::string superclassName;
|
std::string superclassName;
|
||||||
if (objcClassNameFromExpression(c->getOperand(1), superclassName)) {
|
if (objcClassNameFromExpression(c->getOperand(1), superclassName)) {
|
||||||
@ -220,32 +217,33 @@ void LTOModule::addObjCClass(GlobalVariable *clgv) {
|
|||||||
entry.setValue(info);
|
entry.setValue(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// third slot in __OBJC,__class is pointer to class name
|
// third slot in __OBJC,__class is pointer to class name
|
||||||
std::string className;
|
std::string className;
|
||||||
if (objcClassNameFromExpression(c->getOperand(2), className)) {
|
if (objcClassNameFromExpression(c->getOperand(2), className)) {
|
||||||
StringSet::value_type &entry =
|
StringSet::value_type &entry = _defines.GetOrCreateValue(className);
|
||||||
_defines.GetOrCreateValue(className);
|
|
||||||
entry.setValue(1);
|
entry.setValue(1);
|
||||||
NameAndAttributes info;
|
NameAndAttributes info;
|
||||||
info.name = entry.getKey().data();
|
info.name = entry.getKey().data();
|
||||||
info.attributes = (lto_symbol_attributes)
|
info.attributes = lto_symbol_attributes(LTO_SYMBOL_PERMISSIONS_DATA |
|
||||||
(LTO_SYMBOL_PERMISSIONS_DATA |
|
|
||||||
LTO_SYMBOL_DEFINITION_REGULAR |
|
LTO_SYMBOL_DEFINITION_REGULAR |
|
||||||
LTO_SYMBOL_SCOPE_DEFAULT);
|
LTO_SYMBOL_SCOPE_DEFAULT);
|
||||||
_symbols.push_back(info);
|
_symbols.push_back(info);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse i386/ppc ObjC category data structure.
|
// Parse i386/ppc ObjC category data structure.
|
||||||
void LTOModule::addObjCCategory(GlobalVariable *clgv) {
|
void LTOModule::addObjCCategory(GlobalVariable *clgv) {
|
||||||
if (ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer())) {
|
ConstantStruct *c = dyn_cast<ConstantStruct>(clgv->getInitializer());
|
||||||
|
if (!c) return;
|
||||||
|
|
||||||
// second slot in __OBJC,__category is pointer to target class name
|
// second slot in __OBJC,__category is pointer to target class name
|
||||||
std::string targetclassName;
|
std::string targetclassName;
|
||||||
if (objcClassNameFromExpression(c->getOperand(1), targetclassName)) {
|
if (!objcClassNameFromExpression(c->getOperand(1), targetclassName))
|
||||||
NameAndAttributes info;
|
return;
|
||||||
|
|
||||||
|
NameAndAttributes info;
|
||||||
StringMap<NameAndAttributes>::value_type &entry =
|
StringMap<NameAndAttributes>::value_type &entry =
|
||||||
_undefines.GetOrCreateValue(targetclassName);
|
_undefines.GetOrCreateValue(targetclassName);
|
||||||
|
|
||||||
@ -256,17 +254,16 @@ void LTOModule::addObjCCategory(GlobalVariable *clgv) {
|
|||||||
info.name = symbolName;
|
info.name = symbolName;
|
||||||
info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
|
info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
|
||||||
entry.setValue(info);
|
entry.setValue(info);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse i386/ppc ObjC class list data structure.
|
// Parse i386/ppc ObjC class list data structure.
|
||||||
void LTOModule::addObjCClassRef(GlobalVariable *clgv) {
|
void LTOModule::addObjCClassRef(GlobalVariable *clgv) {
|
||||||
std::string targetclassName;
|
std::string targetclassName;
|
||||||
if (objcClassNameFromExpression(clgv->getInitializer(), targetclassName)) {
|
if (!objcClassNameFromExpression(clgv->getInitializer(), targetclassName))
|
||||||
NameAndAttributes info;
|
return;
|
||||||
|
|
||||||
|
NameAndAttributes info;
|
||||||
StringMap<NameAndAttributes>::value_type &entry =
|
StringMap<NameAndAttributes>::value_type &entry =
|
||||||
_undefines.GetOrCreateValue(targetclassName);
|
_undefines.GetOrCreateValue(targetclassName);
|
||||||
if (entry.getValue().name)
|
if (entry.getValue().name)
|
||||||
@ -276,7 +273,6 @@ void LTOModule::addObjCClassRef(GlobalVariable *clgv) {
|
|||||||
info.name = symbolName;
|
info.name = symbolName;
|
||||||
info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
|
info.attributes = LTO_SYMBOL_DEFINITION_UNDEFINED;
|
||||||
entry.setValue(info);
|
entry.setValue(info);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -327,7 +323,6 @@ void LTOModule::addDefinedDataSymbol(GlobalValue *v) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LTOModule::addDefinedSymbol(GlobalValue *def, bool isFunction) {
|
void LTOModule::addDefinedSymbol(GlobalValue *def, bool isFunction) {
|
||||||
// ignore all llvm.* symbols
|
// ignore all llvm.* symbols
|
||||||
if (def->getName().startswith("llvm."))
|
if (def->getName().startswith("llvm."))
|
||||||
@ -455,7 +450,6 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl) {
|
|||||||
entry.setValue(info);
|
entry.setValue(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class RecordStreamer : public MCStreamer {
|
class RecordStreamer : public MCStreamer {
|
||||||
public:
|
public:
|
||||||
@ -711,12 +705,10 @@ bool LTOModule::ParseSymbols(std::string &errMsg) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t LTOModule::getSymbolCount() {
|
uint32_t LTOModule::getSymbolCount() {
|
||||||
return _symbols.size();
|
return _symbols.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lto_symbol_attributes LTOModule::getSymbolAttributes(uint32_t index) {
|
lto_symbol_attributes LTOModule::getSymbolAttributes(uint32_t index) {
|
||||||
if (index < _symbols.size())
|
if (index < _symbols.size())
|
||||||
return _symbols[index].attributes;
|
return _symbols[index].attributes;
|
||||||
|
Loading…
Reference in New Issue
Block a user