OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "courgette/assembly_program.h" | 5 #include "courgette/assembly_program.h" |
6 | 6 |
7 #include <memory.h> | 7 #include <memory.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 if (!encoded->AddCopy(len, byte_values)) | 399 if (!encoded->AddCopy(len, byte_values)) |
400 return nullptr; | 400 return nullptr; |
401 break; | 401 break; |
402 } | 402 } |
403 case REL32: { | 403 case REL32: { |
404 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); | 404 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); |
405 if (!encoded->AddRel32(label->index_)) | 405 if (!encoded->AddRel32(label->index_)) |
406 return nullptr; | 406 return nullptr; |
407 break; | 407 break; |
408 } | 408 } |
409 case REL32ARM: { | 409 /*case REL32ARM: { |
huangs
2016/05/26 18:34:34
Not sure what this is about?
etiennep
2016/05/26 20:50:09
Whoops, no relation. Took it off.
| |
410 Label* label = | 410 Label* label = |
411 static_cast<InstructionWithLabelARM*>(instruction)->label(); | 411 static_cast<InstructionWithLabelARM*>(instruction)->label(); |
412 uint16_t compressed_op = | 412 uint16_t compressed_op = |
413 static_cast<InstructionWithLabelARM*>(instruction)->compressed_op(); | 413 static_cast<InstructionWithLabelARM*>(instruction)->compressed_op(); |
414 if (!encoded->AddRel32ARM(compressed_op, label->index_)) | 414 if (!encoded->AddRel32ARM(compressed_op, label->index_)) |
415 return nullptr; | 415 return nullptr; |
416 break; | 416 break; |
417 } | 417 }*/ |
418 case ABS32: { | 418 case ABS32: { |
419 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); | 419 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); |
420 if (!encoded->AddAbs32(label->index_)) | 420 if (!encoded->AddAbs32(label->index_)) |
421 return nullptr; | 421 return nullptr; |
422 break; | 422 break; |
423 } | 423 } |
424 case ABS64: { | 424 case ABS64: { |
425 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); | 425 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); |
426 if (!encoded->AddAbs64(label->index_)) | 426 if (!encoded->AddAbs64(label->index_)) |
427 return nullptr; | 427 return nullptr; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 Status Encode(const AssemblyProgram& program, | 480 Status Encode(const AssemblyProgram& program, |
481 std::unique_ptr<EncodedProgram>* output) { | 481 std::unique_ptr<EncodedProgram>* output) { |
482 // Explicitly release any memory associated with the output before encoding. | 482 // Explicitly release any memory associated with the output before encoding. |
483 output->reset(); | 483 output->reset(); |
484 | 484 |
485 *output = program.Encode(); | 485 *output = program.Encode(); |
486 return (*output) ? C_OK : C_GENERAL_ERROR; | 486 return (*output) ? C_OK : C_GENERAL_ERROR; |
487 } | 487 } |
488 | 488 |
489 } // namespace courgette | 489 } // namespace courgette |
OLD | NEW |