aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-09-13 02:14:32 +0300
committermax99x <max99x@gmail.com>2011-09-13 02:14:32 +0300
commitc5e5c90cd111c08b3d91d1bc89ba7d33a308cbc7 (patch)
tree5c6033729c4a4c5593fcd87bd9ffa6debf21f285 /src/parseTools.js
parent91e29b31f280b879b10debf2194c2b87d94857cf (diff)
parent534cc7f05846daa88f2d3f2d149d9768262033e9 (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: src/intertyper.js tests/runner.py
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 88758454..955353b2 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -74,7 +74,7 @@ function toNiceIdent(ident) {
assert(ident);
if (parseFloat(ident) == ident) return ident;
if (ident == 'null') return '0'; // see parseNumerical
- return ident.replace('%', '$').replace(/["&\\ \.@:<>,\*\[\]-]/g, '_');
+ return ident.replace('%', '$').replace(/["&\\ \.@:<>,\*\[\]\(\)-]/g, '_');
}
// Kind of a hack. In some cases we have strings that we do not want
@@ -143,6 +143,7 @@ function isFunctionDef(token) {
}
function isFunctionType(type) {
+ type = type.replace(/"[^"]+"/g, '".."');
var parts = type.split(' ');
if (pointingLevels(type) !== 1) return false;
var text = removeAllPointing(parts.slice(1).join(' '));
@@ -430,6 +431,9 @@ function parseLLVMFunctionCall(segment) {
if (type === '?') {
if (intertype === 'getelementptr') {
type = '*'; // a pointer, we can easily say, this is
+ } else if (intertype === 'bitcast') {
+ assert(segment[2].item.tokens.slice(-2)[0].text === 'to');
+ type = segment[2].item.tokens.slice(-1)[0].text;
}
}
var ret = {
@@ -486,7 +490,15 @@ function IEEEUnHex(stringy) {
stringy = stringy.substr(2); // leading '0x';
if (stringy.replace(/0/g, '') === '') return 0;
while (stringy.length < 16) stringy = '0' + stringy;
- assert(stringy.length === 16, 'Can only unhex 16-digit double numbers, nothing platform-specific');
+ if (FAKE_X86_FP80 && stringy.length > 16) {
+ stringy = stringy.substr(stringy.length-16, 16);
+ if (!Debugging.shownIEEEUnHexWarning) {
+ dprint('WARNING: .ll contains floating-point values with more than 64 bits. Faking values for them.');
+ dprint(' If they are used, this will almost certainly fail!');
+ Debugging.shownIEEEUnHexWarning = true;
+ }
+ }
+ assert(stringy.length === 16, 'Can only unhex 16-digit double numbers, nothing platform-specific'); // |long double| can cause x86_fp80 which causes this
var top = eval('0x' + stringy[0]);
var neg = !!(top & 8); // sign
if (neg) {