aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-07 10:12:57 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-12-07 10:12:57 -0500
commitacd404b63daf0efa52023f59a3a382b353b41f61 (patch)
tree4ff1cbf30eaa7c83e6a58147a0267f7624d4e83d /lib/Transforms
parent148d38bd8da6f87fbeb5a8f6302a76de220b7d86 (diff)
i64 load
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/NaCl/ExpandI64.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp
index aed5d53150..477db0f3f9 100644
--- a/lib/Transforms/NaCl/ExpandI64.cpp
+++ b/lib/Transforms/NaCl/ExpandI64.cpp
@@ -151,6 +151,23 @@ void ExpandI64::splitInst(Instruction *I, DataLayout& DL) {
Splits[I];
break;
}
+ case Instruction::Load: {
+ LoadInst *LI = dyn_cast<LoadInst>(I);
+
+ Instruction *AI = CopyDebug(new PtrToIntInst(LI->getPointerOperand(), i32, "", I), I);
+ Instruction *P4 = CopyDebug(BinaryOperator::Create(Instruction::Add, AI, ConstantInt::get(i32, 4), "", I), I);
+ Instruction *LP = CopyDebug(new IntToPtrInst(AI, i32P, "", I), I);
+ Instruction *HP = CopyDebug(new IntToPtrInst(P4, i32P, "", I), I);
+ LoadInst *LL = new LoadInst(LP, "", I); CopyDebug(LL, I);
+ LoadInst *LH = new LoadInst(HP, "", I); CopyDebug(LH, I);
+ SplitInfo &Split = Splits[I];
+ Split.LowHigh.Low = LL;
+ Split.LowHigh.High = LH;
+
+ LL->setAlignment(LI->getAlignment());
+ LH->setAlignment(LI->getAlignment());
+ break;
+ }
case Instruction::Store: {
// store i64 A, i64* P => ai = P ; P4 = ai+4 ; lp = P to i32* ; hp = P4 to i32* ; store l, lp ; store h, hp
StoreInst *SI = dyn_cast<StoreInst>(I);
@@ -234,6 +251,7 @@ LowHighPair ExpandI64::getLowHigh(Value *V) {
void ExpandI64::finalizeInst(Instruction *I) {
SplitInfo &Split = Splits[I];
switch (I->getOpcode()) {
+ case Instruction::Load:
case Instruction::SExt:
case Instruction::ZExt: break; // input was legal
case Instruction::Trunc: {