[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Chris Lattner
sabre at nondot.org
Sat May 5 18:58:38 PDT 2007
Changes in directory llvm/lib/Bitcode/Reader:
BitcodeReader.cpp updated: 1.43 -> 1.44
---
Log message:
implement reading/writing of inlineasm objects
---
Diffs of the changes: (+21 -0)
BitcodeReader.cpp | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+)
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.43 llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.44
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.43 Sat May 5 19:53:07 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp Sat May 5 20:58:20 2007
@@ -15,6 +15,7 @@
#include "BitcodeReader.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/ParameterAttributes.h"
@@ -759,6 +760,26 @@
V = ConstantExpr::getICmp(Record[3], Op0, Op1);
break;
}
+ case bitc::CST_CODE_INLINEASM: {
+ if (Record.size() < 2) return Error("Invalid INLINEASM record");
+ std::string AsmStr, ConstrStr;
+ bool HasSideEffects = Record[0];
+ unsigned AsmStrSize = Record[1];
+ if (2+AsmStrSize >= Record.size())
+ return Error("Invalid INLINEASM record");
+ unsigned ConstStrSize = Record[2+AsmStrSize];
+ if (3+AsmStrSize+ConstStrSize > Record.size())
+ return Error("Invalid INLINEASM record");
+
+ for (unsigned i = 0; i != AsmStrSize; ++i)
+ AsmStr += (char)Record[2+i];
+ for (unsigned i = 0; i != ConstStrSize; ++i)
+ ConstrStr += (char)Record[3+AsmStrSize+i];
+ const PointerType *PTy = cast<PointerType>(CurTy);
+ V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()),
+ AsmStr, ConstrStr, HasSideEffects);
+ break;
+ }
}
ValueList.AssignValue(V, NextCstNo);
More information about the llvm-commits
mailing list