gen_gccbuiltins.cpp (ldc-1.32.0) | : | gen_gccbuiltins.cpp (ldc-1.32.1) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#include <algorithm> | #include <algorithm> | |||
#include <assert.h> | #include <assert.h> | |||
#include <map> | #include <map> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <string.h> | #include <string.h> | |||
#include <string> | #include <string> | |||
using namespace std; | using namespace std; | |||
using namespace llvm; | using namespace llvm; | |||
#if LDC_LLVM_VER >= 1500 | ||||
#define BUILTIN_NAME_STRING "ClangBuiltinName" | ||||
#else | ||||
#define BUILTIN_NAME_STRING "GCCBuiltinName" | ||||
#endif | ||||
string dtype(Record* rec, bool readOnlyMem) | string dtype(Record* rec, bool readOnlyMem) | |||
{ | { | |||
Init* typeInit = rec->getValueInit("VT"); | Init* typeInit = rec->getValueInit("VT"); | |||
if(!typeInit) | if(!typeInit) | |||
return ""; | return ""; | |||
string type = typeInit->getAsString(); | string type = typeInit->getAsString(); | |||
if(type == "iPTR") | if(type == "iPTR") | |||
return readOnlyMem ? "const void*" : "void*"; | return readOnlyMem ? "const void*" : "void*"; | |||
skipping to change at line 88 | skipping to change at line 94 | |||
if (prop == "IntrNoMem") | if (prop == "IntrNoMem") | |||
return " pure @safe"; | return " pure @safe"; | |||
if (prop == "IntrReadArgMem" || prop == "IntrReadWriteArgMem") | if (prop == "IntrReadArgMem" || prop == "IntrReadWriteArgMem") | |||
return " pure"; | return " pure"; | |||
return ""; | return ""; | |||
} | } | |||
void processRecord(raw_ostream& os, Record& rec, string arch) | void processRecord(raw_ostream& os, Record& rec, string arch) | |||
{ | { | |||
if(!rec.getValue("GCCBuiltinName")) | if(!rec.getValue(BUILTIN_NAME_STRING)) | |||
return; | return; | |||
const StringRef builtinName = rec.getValueAsString("GCCBuiltinName"); | const StringRef builtinName = rec.getValueAsString(BUILTIN_NAME_STRING); | |||
string name = rec.getName().str(); | string name = rec.getName().str(); | |||
if(name.substr(0, 4) != "int_" || name.find(arch) == string::npos) | if(name.substr(0, 4) != "int_" || name.find(arch) == string::npos) | |||
return; | return; | |||
name = name.substr(4); | name = name.substr(4); | |||
replace(name.begin(), name.end(), '_', '.'); | replace(name.begin(), name.end(), '_', '.'); | |||
name = string("llvm.") + name; | name = string("llvm.") + name; | |||
ListInit* propsList = rec.getValueAsListInit("IntrProperties"); | ListInit* propsList = rec.getValueAsListInit("IntrProperties"); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added |